Package akka.cluster
Class VectorClock
- java.lang.Object
-
- akka.cluster.VectorClock
-
- All Implemented Interfaces:
java.io.Serializable,scala.Equals,scala.Product
public final class VectorClock extends java.lang.Object implements scala.Product, java.io.Serializable- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVectorClock.After$static classVectorClock.Before$static classVectorClock.Concurrent$static classVectorClock.Node$static interfaceVectorClock.Orderingstatic classVectorClock.Same$static classVectorClock.Timestamp$
-
Constructor Summary
Constructors Constructor Description VectorClock(scala.collection.immutable.TreeMap<java.lang.String,java.lang.Object> versions)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description VectorClock$colon$plus(java.lang.String node)Increment the version for the node passed as argument.boolean$eq$eq(VectorClock that)Returns true if this VectorClock has the same history as the 'that' VectorClock else false.boolean$greater(VectorClock that)Returns true ifthisis afterthatelse false.boolean$less(VectorClock that)Returns true ifthisis beforethatelse false.boolean$less$greater(VectorClock that)Returns true ifthisandthatare concurrent else false.static scala.collection.immutable.TreeMap<java.lang.String,java.lang.Object>$lessinit$greater$default$1()Representation of a Vector-based clock (counting clock), inspired by Lamport logical clocks.static VectorClockapply(scala.collection.immutable.TreeMap<java.lang.String,java.lang.Object> versions)static scala.collection.immutable.TreeMap<java.lang.String,java.lang.Object>apply$default$1()booleancanEqual(java.lang.Object x$1)VectorClock.OrderingcompareTo(VectorClock that)Compare two vector clocks.VectorClockcopy(scala.collection.immutable.TreeMap<java.lang.String,java.lang.Object> versions)scala.collection.immutable.TreeMap<java.lang.String,java.lang.Object>copy$default$1()booleanequals(java.lang.Object x$1)inthashCode()VectorClockmerge(VectorClock that)Merges this VectorClock with another VectorClock.intproductArity()java.lang.ObjectproductElement(int x$1)java.lang.StringproductElementName(int x$1)scala.collection.Iterator<java.lang.Object>productIterator()java.lang.StringproductPrefix()VectorClockprune(java.lang.String removedNode)java.lang.StringtoString()static scala.Option<scala.collection.immutable.TreeMap<java.lang.String,java.lang.Object>>unapply(VectorClock x$0)scala.collection.immutable.TreeMap<java.lang.String,java.lang.Object>versions()
-
-
-
Method Detail
-
$lessinit$greater$default$1
public static scala.collection.immutable.TreeMap<java.lang.String,java.lang.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-226Based on code from the 'vlock' VectorClock library by Coda Hale.
-
apply
public static VectorClock apply(scala.collection.immutable.TreeMap<java.lang.String,java.lang.Object> versions)
-
apply$default$1
public static scala.collection.immutable.TreeMap<java.lang.String,java.lang.Object> apply$default$1()
-
unapply
public static scala.Option<scala.collection.immutable.TreeMap<java.lang.String,java.lang.Object>> unapply(VectorClock x$0)
-
versions
public scala.collection.immutable.TreeMap<java.lang.String,java.lang.Object> versions()
-
$colon$plus
public VectorClock $colon$plus(java.lang.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 ifthisandthatare concurrent else false.
-
$less
public boolean $less(VectorClock that)
Returns true ifthisis beforethatelse false.
-
$greater
public boolean $greater(VectorClock that)
Returns true ifthisis afterthatelse 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(java.lang.String removedNode)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
copy
public VectorClock copy(scala.collection.immutable.TreeMap<java.lang.String,java.lang.Object> versions)
-
copy$default$1
public scala.collection.immutable.TreeMap<java.lang.String,java.lang.Object> copy$default$1()
-
productPrefix
public java.lang.String productPrefix()
- Specified by:
productPrefixin interfacescala.Product
-
productArity
public int productArity()
- Specified by:
productArityin interfacescala.Product
-
productElement
public java.lang.Object productElement(int x$1)
- Specified by:
productElementin interfacescala.Product
-
productIterator
public scala.collection.Iterator<java.lang.Object> productIterator()
- Specified by:
productIteratorin interfacescala.Product
-
canEqual
public boolean canEqual(java.lang.Object x$1)
- Specified by:
canEqualin interfacescala.Equals
-
productElementName
public java.lang.String productElementName(int x$1)
- Specified by:
productElementNamein interfacescala.Product
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object x$1)
- Specified by:
equalsin interfacescala.Equals- Overrides:
equalsin classjava.lang.Object
-
-