Package voldemort.versioning

Examples of voldemort.versioning.VectorClock.incrementVersion()


        logger.info("\n\n********************  Testing Get All with multiple versions *******************\n\n");
        Map<ByteArray, List<Versioned<byte[]>>> input = new HashMap<ByteArray, List<Versioned<byte[]>>>();
        List<Versioned<byte[]>> valuesList2 = new ArrayList<Versioned<byte[]>>();

        VectorClock vectorClock1 = new VectorClock();
        vectorClock1.incrementVersion(voldemortConfig.getNodeId(), System.currentTimeMillis());
        ByteArray key2 = new ByteArray("key22".getBytes());
        Versioned<byte[]> value1 = new Versioned<byte[]>("value22".getBytes(), vectorClock1);
        store.put(key2, value1, null);
        valuesList2.add(value1);

View Full Code Here


        Versioned<byte[]> value1 = new Versioned<byte[]>("value22".getBytes(), vectorClock1);
        store.put(key2, value1, null);
        valuesList2.add(value1);

        VectorClock vectorClock2 = new VectorClock();
        vectorClock2.incrementVersion(1, System.currentTimeMillis());
        Versioned<byte[]> value2 = new Versioned<byte[]>("value23".getBytes(), vectorClock2);
        store.put(key2, value2, null);
        valuesList2.add(value2);
        input.put(key2, valuesList2);
View Full Code Here

        valuesList2.add(value2);
        input.put(key2, valuesList2);

        List<Versioned<byte[]>> valuesList3 = new ArrayList<Versioned<byte[]>>();
        VectorClock vectorClock3 = new VectorClock();
        vectorClock3.incrementVersion(voldemortConfig.getNodeId(), System.currentTimeMillis());
        ByteArray key3 = new ByteArray("key23".getBytes());
        Versioned<byte[]> value3 = new Versioned<byte[]>("value43".getBytes(), vectorClock3);
        store.put(key3, value3, null);
        valuesList3.add(value3);
        input.put(key3, valuesList3);
View Full Code Here

        store.put(key, value, null);
        List<Versioned<byte[]>> resultList, previousResultList;
        resultList = store.get(key, null);

        VectorClock vectorClock2 = new VectorClock();
        vectorClock2.incrementVersion(voldemortConfig.getNodeId() + 1, System.currentTimeMillis());
        Versioned<byte[]> value2 = new Versioned<byte[]>("value32".getBytes(), vectorClock2);
        store.put(key, value2, null);
        previousResultList = resultList;
        resultList = store.get(key, null);
View Full Code Here

                        VectorClock version;
                        if(vs.size() == 0)
                            version = new VectorClock();
                        else
                            version = (VectorClock) vs.get(0).getVersion();
                        version.incrementVersion(0, 847584375);
                        store.put(key, Versioned.value(value, version), null);
                    } catch(ObsoleteVersionException e) {
                        // do nothing
                    } catch(RuntimeException e) {
                        e.printStackTrace();
View Full Code Here

        Integer[] values1 = { 9, 90, 10, 15, 25, 106 };
        Integer[] filter1 = { 1, 10 };

        Versioned<List<Integer>> values = Versioned.value(Arrays.asList(values1));
        VectorClock clock = (VectorClock) values.getVersion();
        clock.incrementVersion(0, System.currentTimeMillis());
        view.put(1, Versioned.value(values.getValue(), clock), Arrays.asList(filter1));

        assertEquals(10, view.get(1, Arrays.asList(filter1)).get(0).getValue().size());

        Integer[] filter2 = { 5, 10 };
View Full Code Here

        Cluster newCluster = new Cluster(cluster.getName(),
                                         ImmutableList.of(newNode0, newNode1),
                                         Lists.newArrayList(cluster.getZones()));
        for(Node node: cluster.getNodes()) {
            VectorClock clock = (VectorClock) versionedCluster.getVersion();
            clock.incrementVersion(node.getId(), System.currentTimeMillis());

            adminClient.metadataMgmtOps.updateRemoteCluster(node.getId(), newCluster, clock);
        }
    }
View Full Code Here

                Versioned<String> versioned = adminClient.metadataMgmtOps.getRemoteMetadata(nodeId,
                                                                                            MetadataStore.CLUSTER_KEY);
                Version version = versioned.getVersion();

                VectorClock vectorClock = (VectorClock) version;
                vectorClock.incrementVersion(nodeId, System.currentTimeMillis());

                try {
                    adminClient.metadataMgmtOps.updateRemoteMetadata(peerNodeId,
                                                                     MetadataStore.CLUSTER_KEY,
                                                                     versioned);
View Full Code Here

            Store<ByteArray, byte[], byte[]> store = vs.getStoreRepository()
                    .getLocalStore(storeDef.getName());
            Node node = cluster.getNodeById(nodeId);

            VectorClock version1 = new VectorClock();
            version1.incrementVersion(0, System.currentTimeMillis());
            VectorClock version2 = version1.incremented(0, System.currentTimeMillis());

            if(node.getZoneId() == clientZoneId) {
                // local zone
                store.put(new ByteArray(k1_bytes), new Versioned<byte[]>(v1_bytes, version1), null);
View Full Code Here

                            List<Versioned<byte[]>> vals = store.get(new ByteArray(keyBytes), null);
                            if(vals.size() == 0 && j > 1)
                                returnedEmpty.set(true);
                            else {
                                VectorClock v = (VectorClock) vals.get(0).getVersion();
                                v.incrementVersion(0, System.currentTimeMillis());
                                try {
                                    store.put(new ByteArray(keyBytes),
                                              new Versioned<byte[]>(valueBytes, v),
                                              null);
                                } catch(ObsoleteVersionException e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.