Package org.syncany.database.VectorClock

Examples of org.syncany.database.VectorClock.VectorClockComparison


      DatabaseBranch remoteBranch = remoteDatabaseVersionHeaders.getBranch(currentRemoteClient);
      boolean foundInCurrentClient = false;

      for (DatabaseVersionHeader remoteDatabaseVersionHeader : remoteBranch.getAll()) {
        VectorClock remoteVectorClock = remoteDatabaseVersionHeader.getVectorClock();
        VectorClockComparison remoteVsLocalVectorClockComparison = VectorClock.compare(remoteVectorClock, localVectorClock);

        if (remoteVsLocalVectorClockComparison == VectorClockComparison.GREATER
            || remoteVsLocalVectorClockComparison == VectorClockComparison.EQUAL) {

          foundInCurrentClient = true;
View Full Code Here


        }       
        else {
          // Compare the two machines 'firstMachine*' and 'secondMachine*'
          // Keep the winner, eliminate the loser
         
          VectorClockComparison comparison = VectorClock.compare(firstMachineDatabaseVersionHeader.getVectorClock(),
              secondMachineDatabaseVersionHeader.getVectorClock());

          if (comparison != VectorClockComparison.EQUAL) {
            Boolean eliminateFirstMachine = determineEliminateMachine(firstMachineName, firstMachineDatabaseVersionHeader,
                secondMachineName, secondMachineDatabaseVersionHeader);
View Full Code Here

  }

  private class DatabaseVersionHeaderComparator implements Comparator<DatabaseVersionHeader> {
    @Override
    public int compare(DatabaseVersionHeader o1, DatabaseVersionHeader o2) {
      VectorClockComparison vectorClockComparison = VectorClock.compare(o1.getVectorClock(), o2.getVectorClock());

      if (vectorClockComparison == VectorClockComparison.SIMULTANEOUS) {
        throw new RuntimeException("There must not be a conflict within a branch. VC1: " + o1.getVectorClock() + " - VC2: "
            + o2.getVectorClock());
      }
View Full Code Here

    if (vectorClockRangeFrom == null) {
      greaterOrEqualToVersionFrom = true;
    }
    else {
      VectorClockComparison comparison = VectorClock.compare(vectorClockRangeFrom, vectorClock);

      if (comparison == VectorClockComparison.EQUAL || comparison == VectorClockComparison.SMALLER) {
        greaterOrEqualToVersionFrom = true;
      }
    }

    // Determine if: databaseVersion < versionTo
    boolean lowerOrEqualToVersionTo = false;

    if (vectorClockRangeTo == null) {
      lowerOrEqualToVersionTo = true;
    }
    else {
      VectorClockComparison comparison = VectorClock.compare(vectorClock, vectorClockRangeTo);

      if (comparison == VectorClockComparison.EQUAL || comparison == VectorClockComparison.SMALLER) {
        lowerOrEqualToVersionTo = true;
      }
    }
View Full Code Here

TOP

Related Classes of org.syncany.database.VectorClock.VectorClockComparison

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.