akka.cluster
Class VectorClock
java.lang.Object
akka.cluster.VectorClock
- All Implemented Interfaces:
- java.io.Serializable, scala.Equals, scala.Product
public class VectorClock
- extends java.lang.Object
- implements 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.Product |
productArity, productElement, productIterator, productPrefix |
Methods inherited from interface scala.Equals |
canEqual, equals |
VectorClock
public VectorClock(scala.collection.immutable.TreeMap<java.lang.String,VectorClock.Timestamp> versions)
versions
public scala.collection.immutable.TreeMap<java.lang.String,VectorClock.Timestamp> versions()
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.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object