Package akka.cluster
Class VectorClock
- java.lang.Object
-
- akka.cluster.VectorClock
-
- All Implemented Interfaces:
java.io.Serializable
,scala.Equals
,scala.Product
,scala.Serializable
public final class VectorClock extends java.lang.Object implements scala.Product, scala.Serializable
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
VectorClock.After$
static class
VectorClock.Before$
static class
VectorClock.Concurrent$
static class
VectorClock.Node$
static interface
VectorClock.Ordering
static class
VectorClock.Same$
static class
VectorClock.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)
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 ifthis
is afterthat
else false.boolean
$less(VectorClock that)
Returns true ifthis
is beforethat
else false.boolean
$less$greater(VectorClock that)
Returns true ifthis
andthat
are 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 VectorClock
apply(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()
boolean
canEqual(java.lang.Object x$1)
VectorClock.Ordering
compareTo(VectorClock that)
Compare two vector clocks.VectorClock
copy(scala.collection.immutable.TreeMap<java.lang.String,java.lang.Object> versions)
scala.collection.immutable.TreeMap<java.lang.String,java.lang.Object>
copy$default$1()
boolean
equals(java.lang.Object x$1)
int
hashCode()
VectorClock
merge(VectorClock that)
Merges this VectorClock with another VectorClock.int
productArity()
java.lang.Object
productElement(int x$1)
scala.collection.Iterator<java.lang.Object>
productIterator()
java.lang.String
productPrefix()
VectorClock
prune(java.lang.String removedNode)
java.lang.String
toString()
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-226
Based on code from the 'vlock' VectorClock library by Coda Hale.
- Returns:
- (undocumented)
-
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)
-
$less$greater
public boolean $less$greater(VectorClock that)
Returns true ifthis
andthat
are concurrent else false.- Parameters:
that
- (undocumented)- Returns:
- (undocumented)
-
$less
public boolean $less(VectorClock that)
Returns true ifthis
is beforethat
else false.- Parameters:
that
- (undocumented)- Returns:
- (undocumented)
-
$greater
public boolean $greater(VectorClock that)
Returns true ifthis
is afterthat
else false.- Parameters:
that
- (undocumented)- Returns:
- (undocumented)
-
$eq$eq
public boolean $eq$eq(VectorClock that)
Returns true if this VectorClock has the same history as the 'that' VectorClock else false.- Parameters:
that
- (undocumented)- Returns:
- (undocumented)
-
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.
- Parameters:
that
- (undocumented)- Returns:
- (undocumented)
-
merge
public VectorClock merge(VectorClock that)
Merges this VectorClock with another VectorClock. E.g. merges its versioned history.- Parameters:
that
- (undocumented)- Returns:
- (undocumented)
-
prune
public VectorClock prune(java.lang.String removedNode)
-
toString
public java.lang.String toString()
- Overrides:
toString
in 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:
productPrefix
in interfacescala.Product
-
productArity
public int productArity()
- Specified by:
productArity
in interfacescala.Product
-
productElement
public java.lang.Object productElement(int x$1)
- Specified by:
productElement
in interfacescala.Product
-
productIterator
public scala.collection.Iterator<java.lang.Object> productIterator()
- Specified by:
productIterator
in interfacescala.Product
-
canEqual
public boolean canEqual(java.lang.Object x$1)
- Specified by:
canEqual
in interfacescala.Equals
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object x$1)
- Specified by:
equals
in interfacescala.Equals
- Overrides:
equals
in classjava.lang.Object
-
-