Search in sources :

Example 36 with Slop

use of voldemort.store.slop.Slop in project voldemort by voldemort.

the class SlopSerializer method toObject.

public Slop toObject(byte[] bytes) {
    DataInputStream input = new DataInputStream(new ByteArrayInputStream(bytes));
    try {
        VSlopProto.Slop proto = ProtoUtils.readToBuilder(input, VSlopProto.Slop.newBuilder()).build();
        String storeName = proto.getStore();
        Slop.Operation op = Slop.Operation.valueOf(proto.getOperation());
        byte[] key = ProtoUtils.decodeBytes(proto.getKey()).get();
        byte[] value = null;
        if (proto.hasValue())
            value = ProtoUtils.decodeBytes(proto.getValue()).get();
        int nodeId = proto.getNodeId();
        Date arrived = new Date(proto.getArrived());
        return new Slop(storeName, op, key, value, nodeId, arrived);
    } catch (IOException e) {
        throw new SerializationException(e);
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) IOException(java.io.IOException) DataInputStream(java.io.DataInputStream) Slop(voldemort.store.slop.Slop) Date(java.util.Date)

Aggregations

Slop (voldemort.store.slop.Slop)36 ByteArray (voldemort.utils.ByteArray)29 Versioned (voldemort.versioning.Versioned)22 Test (org.junit.Test)15 Date (java.util.Date)11 Node (voldemort.cluster.Node)11 UnreachableStoreException (voldemort.store.UnreachableStoreException)11 VoldemortException (voldemort.VoldemortException)9 SlopStorageEngine (voldemort.store.slop.SlopStorageEngine)9 FailureDetectorConfig (voldemort.cluster.failuredetector.FailureDetectorConfig)7 StreamingSlopPusherJob (voldemort.server.scheduler.slop.StreamingSlopPusherJob)6 ScanPermitWrapper (voldemort.server.storage.ScanPermitWrapper)6 ArrayList (java.util.ArrayList)5 BannagePeriodFailureDetector (voldemort.cluster.failuredetector.BannagePeriodFailureDetector)5 ServerStoreConnectionVerifier (voldemort.cluster.failuredetector.ServerStoreConnectionVerifier)5 VectorClock (voldemort.versioning.VectorClock)5 IOException (java.io.IOException)4 Map (java.util.Map)4 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)4 SlopSerializer (voldemort.serialization.SlopSerializer)4