Class VectorClock

java.lang.Object
org.apache.pekko.cluster.VectorClock
All Implemented Interfaces:
Serializable, scala.Equals, scala.Product

public final class VectorClock extends Object implements scala.Product, Serializable
See Also:
  • Constructor Details

    • VectorClock

      public VectorClock(scala.collection.immutable.TreeMap<String,Object> versions)
  • Method Details

    • $lessinit$greater$default$1

      public static scala.collection.immutable.TreeMap<String,Object> $lessinit$greater$default$1()
      Representation of a Vector-based clock (counting clock), inspired by Lamport logical clocks.
      
       Reference:
          1) Leslie Lamport (1978). "Time, clocks, and the ordering of events in a distributed system". Communications of the ACM 21 (7): 558-565.
          2) Friedemann Mattern (1988). "Virtual Time and Global States of Distributed Systems". Workshop on Parallel and Distributed Algorithms: pp. 215-226
       

      Based on code from the 'vlock' VectorClock library by Coda Hale.

    • apply

      public static VectorClock apply(scala.collection.immutable.TreeMap<String,Object> versions)
    • apply$default$1

      public static scala.collection.immutable.TreeMap<String,Object> apply$default$1()
    • unapply

      public static scala.Option<scala.collection.immutable.TreeMap<String,Object>> unapply(VectorClock x$0)
    • versions

      public scala.collection.immutable.TreeMap<String,Object> versions()
    • $colon$plus

      public VectorClock $colon$plus(String node)
      Increment the version for the node passed as argument. Returns a new VectorClock.
    • $less$greater

      public boolean $less$greater(VectorClock that)
      Returns true if this and that are concurrent else false.
    • $less

      public boolean $less(VectorClock that)
      Returns true if this is before that else false.
    • $greater

      public boolean $greater(VectorClock that)
      Returns true if this is after that else false.
    • $eq$eq

      public boolean $eq$eq(VectorClock that)
      Returns true if this VectorClock has the same history as the 'that' VectorClock else false.
    • compareTo

      public VectorClock.Ordering compareTo(VectorClock that)
      Compare two vector clocks. The outcome will be one of the following:

      
         1. Clock 1 is SAME (==)       as Clock 2 iff for all i c1(i) == c2(i)
         2. Clock 1 is BEFORE (<)      Clock 2 iff for all i c1(i) <= c2(i) and there exist a j such that c1(j) < c2(j)
         3. Clock 1 is AFTER (>)       Clock 2 iff for all i c1(i) >= c2(i) and there exist a j such that c1(j) > c2(j).
         4. Clock 1 is CONCURRENT (<>) to Clock 2 otherwise.
       
    • merge

      public VectorClock merge(VectorClock that)
      Merges this VectorClock with another VectorClock. E.g. merges its versioned history.
    • prune

      public VectorClock prune(String removedNode)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • copy

      public VectorClock copy(scala.collection.immutable.TreeMap<String,Object> versions)
    • copy$default$1

      public scala.collection.immutable.TreeMap<String,Object> copy$default$1()
    • productPrefix

      public String productPrefix()
      Specified by:
      productPrefix in interface scala.Product
    • productArity

      public int productArity()
      Specified by:
      productArity in interface scala.Product
    • productElement

      public Object productElement(int x$1)
      Specified by:
      productElement in interface scala.Product
    • productIterator

      public scala.collection.Iterator<Object> productIterator()
      Specified by:
      productIterator in interface scala.Product
    • canEqual

      public boolean canEqual(Object x$1)
      Specified by:
      canEqual in interface scala.Equals
    • productElementName

      public String productElementName(int x$1)
      Specified by:
      productElementName in interface scala.Product
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object x$1)
      Specified by:
      equals in interface scala.Equals
      Overrides:
      equals in class Object