Examples of incremented()


Examples of org.sdnplatform.sync.internal.version.VectorClock.incremented()

    @Override
    public IVersion put(K key, Versioned<V> versioned)
            throws SyncException {
        VectorClock vc = (VectorClock)versioned.getVersion();

        vc = vc.incremented(syncManager.getLocalNodeId(),
                            System.currentTimeMillis());
        versioned = Versioned.value(versioned.getValue(), vc);

        delegate.put(key, versioned);
        return versioned.getVersion();
View Full Code Here

Examples of org.sdnplatform.sync.internal.version.VectorClock.incremented()

                List<IVersion> versions = store.getVersions(key);
                VectorClock newclock = new VectorClock();
                for (IVersion v : versions) {
                    newclock = newclock.merge((VectorClock)v);
                }
                newclock = newclock.incremented(syncManager.getLocalNodeId(),
                                                System.currentTimeMillis());
                value = Versioned.value(rvalue, newclock);
            } else {
                throw new SyncException("No value specified for put");
            }
View Full Code Here

Examples of org.sdnplatform.sync.internal.version.VectorClock.incremented()

                for (IVersion v : versions) {
                    newclock = newclock.merge((VectorClock)v);
                }
            }
            newclock =
                    newclock.incremented(rpcService.syncManager.getLocalNodeId(),
                                         System.currentTimeMillis());
            Versioned<byte[]> value = Versioned.value(null, newclock);
            store.put(key, value);

            DeleteResponseMessage m = new DeleteResponseMessage();
View Full Code Here

Examples of voldemort.versioning.VectorClock.incremented()

        List<byte[]> values = getValues(putCount);
        assertEquals(putCount, values.size());
        VectorClock clock = new VectorClock();
        for(int i = 0; i < putCount; i++) {
            store.put(keys.get(i), new Versioned<byte[]>(values.get(i), clock), null);
            clock = clock.incremented(0, System.currentTimeMillis());
        }

        int countForGet = putCount / 2;
        List<ByteArray> keysForGet = keys.subList(0, countForGet);
        List<byte[]> valuesForGet = values.subList(0, countForGet);
View Full Code Here

Examples of voldemort.versioning.VectorClock.incremented()

                   new Versioned<String>("v2",
                                         new VectorClock().incremented(nodeId + 1,
                                                                       time.getMilliseconds())));
        assertEquals("GET should return the new value set by PUT.", "v2", client.getValue("k"));
        assertEquals("GET should return the new version set by PUT.",
                     expected.incremented(nodeId + 1, time.getMilliseconds()),
                     client.get("k").getVersion());
    }

    @Test
    public void testPutUnversioned() {
View Full Code Here

Examples of voldemort.versioning.VectorClock.incremented()

        assertEquals("Only one file of name key should be present.", 1, store.get(keyName, null)
                                                                             .size());

        // do a new put
        VectorClock clock = (VectorClock) store.get(keyName, null).get(0).getVersion();
        store.put(keyName, new Versioned<String>("testValue1", clock.incremented(0, 1)), null);
        assertEquals("Only one file of name key should be present.", 1, store.get(keyName, null)
                                                                             .size());
        assertEquals("Value should match.", "testValue1", store.get(keyName, null)
                                                               .get(0)
                                                               .getValue());
View Full Code Here

Examples of voldemort.versioning.VectorClock.incremented()

                   new Versioned<String>("v2",
                                         new VectorClock().incremented(nodeId + 1,
                                                                       time.getMilliseconds())));
        assertEquals("GET should return the new value set by PUT.", "v2", client.getValue("k"));
        assertEquals("GET should return the new version set by PUT.",
                     expected.incremented(nodeId + 1, time.getMilliseconds()),
                     client.get("k").getVersion());
    }

    @Override
    @Test
View Full Code Here

Examples of voldemort.versioning.VectorClock.incremented()

        assertFalse("Delete of non-existant key should be false.", client.delete("k", vc));
        client.put("k", new Versioned<String>("v", vc));
        assertFalse("Delete of a lesser version should be false.", client.delete("k", initialVC));
        assertNotNull("After failed delete, value should still be there.", client.get("k"));
        assertTrue("Delete of k, with the current version should succeed.",
                   client.delete("k", initialVC.incremented(this.nodeId, time.getMilliseconds())));
        assertNull("After a successful delete(k), get(k) should return null.", client.get("k"));
    }
}
View Full Code Here

Examples of voldemort.versioning.VectorClock.incremented()

            List<Versioned<byte[]>> found = engine.get(new ByteArray(item.getBytes()), null);
            if(found.size() == 0) {
                clock = new VectorClock(time.getMilliseconds());
            } else if(found.size() == 1) {
                VectorClock oldClock = (VectorClock) found.get(0).getVersion();
                clock = oldClock.incremented(0, time.getMilliseconds());
            } else {
                fail("Found multiple versions.");
            }
            engine.put(new ByteArray(item.getBytes()),
                       new Versioned<byte[]>(item.getBytes(), clock),
View Full Code Here

Examples of voldemort.versioning.VectorClock.incremented()

                                                  value2,
                                                  null,
                                                  1,
                                                  new Date()), vectorClock1));

            vectorClock2 = vectorClock2.incremented(0, System.currentTimeMillis());
            entrySet.add(Versioned.value(new Slop(storeName,
                                                  Slop.Operation.PUT,
                                                  key2,
                                                  value2,
                                                  null,
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.