akka.cluster
Class VectorClock
java.lang.Object
akka.cluster.VectorClock
- All Implemented Interfaces:
- java.io.Serializable, scala.Equals, scala.math.PartiallyOrdered<VectorClock>, scala.Product
public class VectorClock
- extends java.lang.Object
- implements scala.math.PartiallyOrdered<VectorClock>, scala.Product, scala.Serializable
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.
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface scala.math.PartiallyOrdered |
$greater, $greater$eq, $less, $less$eq |
Methods inherited from interface scala.Product |
productArity, productElement, productIterator, productPrefix |
Methods inherited from interface scala.Equals |
canEqual, equals |
VectorClock
public VectorClock(VectorClock.Timestamp timestamp,
scala.collection.immutable.Map<VectorClock.Node,VectorClock.Timestamp> versions)
timestamp
public VectorClock.Timestamp timestamp()
versions
public scala.collection.immutable.Map<VectorClock.Node,VectorClock.Timestamp> versions()
tryCompareTo
public <V> scala.Option<java.lang.Object> tryCompareTo(V vclock,
scala.Function1<V,scala.math.PartiallyOrdered<V>> evidence$1)
- For the 'PartiallyOrdered' trait, to allow natural comparisons using <, > and ==.
Compare two vector clocks. The outcomes will be one of the following:
1. Clock 1 is BEFORE (>) Clock 2 if there exists an i such that c1(i) <= c2(i) and there does not exist a j such that c1(j) > c2(j).
2. Clock 1 is CONCURRENT (<>) to Clock 2 if there exists an i, j such that c1(i) < c2(i) and c1(j) > c2(j).
3. Clock 1 is AFTER (<) Clock 2 otherwise.
- Specified by:
tryCompareTo
in interface scala.math.PartiallyOrdered<VectorClock>
merge
public VectorClock merge(VectorClock that)
- Merges this VectorClock with another VectorClock. E.g. merges its versioned history.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object