Package krati.retention.clock

Examples of krati.retention.clock.Clock


            GenericArray<GenericRecord> items = (GenericArray<GenericRecord>)response.get("results");
           
            for(GenericRecord item : items) {
                K key = deserializeKey((ByteBuffer)item.get("key"));
                V value = deserializeValue((ByteBuffer)item.get("value"));
                Clock clock = deserializeClock((ByteBuffer)item.get("clock"));
                map.put(key, new SimpleEvent<V>(value, clock));
            }
           
            return getPosition(response.get("position").toString());
        } catch (IOException e) {
View Full Code Here


            @SuppressWarnings("unchecked")
            GenericArray<GenericRecord> items = (GenericArray<GenericRecord>)response.get("results");
           
            for(GenericRecord item : items) {
                K key = deserializeKey((ByteBuffer)item.get("key"));
                Clock clock = deserializeClock((ByteBuffer)item.get("clock"));
                list.add(new SimpleEvent<K>(key, clock));
            }
           
            return getPosition(response.get("position").toString());
        } catch (IOException e) {
View Full Code Here

        StoreBusDirective directive = StoreBusDirective.valueOf(opt);
        if(directive == StoreBusDirective.Position) {
            if(key == null) {
                return getPosition().toString();
            } else {
                Clock clock = Clock.parseClock(key);
                return getPosition(clock).toString();
            }
        }
       
        // no-operation
View Full Code Here

                kvc.put("key", ByteBuffer.wrap(e.getKey()));
               
                byte[] value = e.getValue().getValue();
                kvc.put("value", value == null ? null : ByteBuffer.wrap(value));
               
                Clock clock = clockNotNeeded ? null : e.getValue().getClock();
                kvc.put("clock", clock == null ? null : ByteBuffer.wrap(clock.toByteArray()));
               
                array.add(kvc);
            }
           
            GenericRecord response = new GenericData.Record(schema1);
View Full Code Here

        StoreBusDirective directive = StoreBusDirective.valueOf(opt);
        if(directive == StoreBusDirective.Position) {
            if(key == null) {
                return getPosition().toString();
            } else {
                Clock clock = Clock.parseClock(key);
                return getPosition(clock).toString();
            }
        }
       
        // no-operation
View Full Code Here

                // Deserialize clock
                length = buffer.get();
                byte[] clockBytes = new byte[length];
                buffer.get(clockBytes);
               
                Clock clock = _clockSerializer.deserialize(clockBytes);
               
                Event<T> event = new SimpleEvent<T>(value, clock);
                if(!batch.put(event)) {
                    throw new SerializationException("Invalid clocks:" + " clock=" + clock + " minClock=" + header.getMinClock() + " maxClock=" + header.getMaxClock());
                }
View Full Code Here

           
            Iterator<Event<T>> iter = object.iterator();
            while(iter.hasNext()) {
                Event<T> event = iter.next();
                T value = event.getValue();
                Clock clock = event.getClock();
               
                // Serialize value
                valueBytes = _valueSerializer.serialize(value);
               
                bbInt.clear();
View Full Code Here

       
        // minClock
        int length = bb.get();
        byte[] minClockBytes = new byte[length];
        bb.get(minClockBytes);
        Clock minClock = _clockSerializer.deserialize(minClockBytes);
       
        // maxClock
        length = bb.get();
        byte[] maxClockBytes = new byte[length];
        bb.get(maxClockBytes);
        Clock maxClock = _clockSerializer.deserialize(maxClockBytes);
       
        return new SimpleEventBatchHeader(version, size, origin, creationTime, completionTime, minClock, maxClock);
    }
View Full Code Here

            }
           
            if(iter.hasNext()) {
                return new SimplePosition(_retention.getId(), pos.getOffset(), index, pos.getClock());
            } else {
                Clock newClock;
                newClock = _retention.getClock(pos.getOffset());
                if (newClock == null) newClock = pos.getClock();
                return new SimplePosition(_retention.getId(), pos.getOffset(), newClock);
            }
        } else {
View Full Code Here

   
    public Clock next() {
        for(int i = 0; i < _scnArray.length; i++) {
            _scnArray[i] += _rand.nextInt(10) + 1;
        }
        return new Clock((long[])_scnArray.clone());
    }
View Full Code Here

TOP

Related Classes of krati.retention.clock.Clock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.