Examples of VectorClock


Examples of org.sdnplatform.sync.internal.version.VectorClock

                   !getVersioned(1, 1, 2).equals(getVersioned(2, 1, 1, 2)));

        // Should work for array types too!
        assertEquals("Equal arrays are not equal!",
                     new Versioned<byte[]>(new byte[] { 1 },
                                           new VectorClock(now)),
                     new Versioned<byte[]>(new byte[] { 1 },
                                           new VectorClock(now)));
    }
View Full Code Here

Examples of org.syncany.database.VectorClock

import org.syncany.database.VectorClock.VectorClockComparison;

public class VectorClockTest {
  @Test
  public void testNormalVectorClockUsage() {
    VectorClock vc = new  VectorClock();
   
    vc.setClock("UnitA", 1);
    vc.setClock("UnitB", 2);
    vc.setClock("UnitC", 3);
   
    assertEquals("Expected clock value to be different.", 1L, (long) vc.getClock("UnitA"));
    assertEquals("Expected clock value to be different.", 2L, (long) vc.getClock("UnitB"));
    assertEquals("Expected clock value to be different.", 3L, (long) vc.getClock("UnitC"));
  }
View Full Code Here

Examples of voldemort.versioning.VectorClock

        return count;
    }

    private void populateSlops(List<Versioned<Slop>> slops) {
        for(Versioned<Slop> slop: slops) {
            VectorClock clock = TestUtils.getClock(1);
            NodeValue<ByteArray, byte[]> nodeValue = new NodeValue<ByteArray, byte[]>(PURGE_SERVER_ID,
                                                                                      slop.getValue()
                                                                                          .makeKey(),
                                                                                      new Versioned<byte[]>(slopSerializer.toBytes(slop.getValue()),
                                                                                                            clock));
View Full Code Here

Examples of voldemort.versioning.VectorClock

        }

        Store<ByteArray, byte[], byte[]> store = new InconsistencyResolvingStore<ByteArray, byte[], byte[]>(routedStore,
                                                                                                            new VectorClockInconsistencyResolver<byte[]>());

        VectorClock clock = getClock(1);
        Versioned<byte[]> versioned = new Versioned<byte[]>(aValue, clock);
        routedStore.put(aKey, versioned, aTransform);

        waitForOperationToComplete(customSleepTime);
        assertNOrMoreEqual(routedStore, cluster.getNumberOfNodes() - failures, aKey, versioned);
View Full Code Here

Examples of voldemort.versioning.VectorClock

    private void testBasicOperationFailure(int reads,
                                           int writes,
                                           int failures,
                                           int threads,
                                           RoutedStore customRoutedStore) throws Exception {
        VectorClock clock = getClock(1);
        Versioned<byte[]> versioned = new Versioned<byte[]>(aValue, clock);

        RoutedStore routedStore = null;
        if(customRoutedStore == null) {
            routedStore = getStore(cluster,
View Full Code Here

Examples of voldemort.versioning.VectorClock

    }

    @Test
    public void testPutIncrementsVersion() throws Exception {
        Store<ByteArray, byte[], byte[]> store = getStore();
        VectorClock clock = new VectorClock();
        VectorClock copy = clock.clone();
        store.put(aKey, new Versioned<byte[]>(getValue(), clock), aTransform);
        List<Versioned<byte[]>> found = store.get(aKey, aTransform);
        assertEquals("Invalid number of items found.", 1, found.size());
        assertEquals("Version not incremented properly",
                     Occurred.BEFORE,
                     copy.compare(found.get(0).getVersion()));
    }
View Full Code Here

Examples of voldemort.versioning.VectorClock

    }

    @Test
    public void testPutIncrementsVersionZZZ() throws Exception {
        Store<ByteArray, byte[], byte[]> store = getZonedStore();
        VectorClock clock = new VectorClock();
        VectorClock copy = clock.clone();
        store.put(aKey, new Versioned<byte[]>(getValue(), clock), aTransform);
        List<Versioned<byte[]>> found = store.get(aKey, aTransform);
        assertEquals("Invalid number of items found.", 1, found.size());
        assertEquals("Version not incremented properly",
                     Occurred.BEFORE,
                     copy.compare(found.get(0).getVersion()));
    }
View Full Code Here

Examples of voldemort.versioning.VectorClock

                      9,
                      0,
                      RoutingStrategyType.TO_ALL_STRATEGY,
                      new VoldemortException());
        try {
            s1.delete(aKey, new VectorClock());
            fail("Failure is expected");
        } catch(InsufficientOperationalNodesException e) { /* expected */
        }
        assertOperationalNodes(9);

        cluster = getNineNodeCluster();

        s2 = getStore(cluster,
                      1,
                      9,
                      9,
                      9,
                      0,
                      RoutingStrategyType.TO_ALL_STRATEGY,
                      new UnreachableStoreException("no go"));
        try {
            s2.delete(aKey, new VectorClock());
            fail("Failure is expected");
        } catch(InsufficientOperationalNodesException e) { /* expected */
        }
        assertOperationalNodes(0);
    }
View Full Code Here

Examples of voldemort.versioning.VectorClock

        recordException(failureDetector, secondaryNode);
        recordSuccess(failureDetector, primaryNode);
        // Generate the clock based off secondary so that the resulting clock
        // will be [1:1, 6:1] across the replicas, except for the secondary
        // which will be [6:1]
        VectorClock clock = getClock(6);
        store.put(aKey, new Versioned<byte[]>(anotherValue, clock), null);

        // Enable secondary and disable primary, the following get should cause
        // a read repair on the secondary in the code path that is only executed
        // if there are failures. This should repair the secondary with the
View Full Code Here

Examples of voldemort.versioning.VectorClock

            fail("Store should not getAll null keys!");
        } catch(IllegalArgumentException e) {
            // this is good
        }
        try {
            store.delete(null, new VectorClock());
            fail("Store should not delete null keys!");
        } catch(IllegalArgumentException e) {
            // this is good
        }
    }
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.