public abstract class VersionVector extends java.lang.Object implements ReplicatedData, ReplicatedDataSerialization, RemovedNodePruning
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 akka.cluster.VectorClock
.
This class is immutable, i.e. "modifying" methods return a new instance.
Modifier and Type | Class and Description |
---|---|
static class |
VersionVector.After$ |
static class |
VersionVector.Before$ |
static class |
VersionVector.Concurrent$ |
static interface |
VersionVector.Ordering |
static class |
VersionVector.Same$ |
static class |
VersionVector.Timestamp$
INTERNAL API
|
Constructor and Description |
---|
VersionVector() |
Modifier and Type | Method and Description |
---|---|
static VersionVector.After$ |
AfterInstance()
Java API: The
VersionVector.After instance |
static VersionVector |
apply() |
static VersionVector |
apply(scala.collection.immutable.List<scala.Tuple2<UniqueAddress,java.lang.Object>> versions)
INTERNAL API
|
static VersionVector |
apply(scala.collection.immutable.TreeMap<UniqueAddress,java.lang.Object> versions) |
static VersionVector |
apply(UniqueAddress node,
long version) |
static VersionVector.Before$ |
BeforeInstance()
Java API: The
VersionVector.Before instance |
VersionVector.Ordering |
compareTo(VersionVector that)
Compare two version vectors.
|
static VersionVector.Concurrent$ |
ConcurrentInstance()
Java API: The
VersionVector.Concurrent instance |
abstract boolean |
contains(UniqueAddress node)
INTERNAL API
|
static VersionVector |
create()
Java API
|
static VersionVector |
empty() |
VersionVector |
increment(Cluster node)
Increment the version for the node passed as argument.
|
abstract VersionVector |
increment(UniqueAddress node)
INTERNAL API
Increment the version for the node passed as argument.
|
abstract boolean |
isEmpty() |
abstract VersionVector |
merge(VersionVector that)
Merges this VersionVector with another VersionVector.
|
abstract boolean |
needPruningFrom(UniqueAddress removedNode)
Does it have any state changes from a specific node,
which has been removed from the cluster.
|
abstract VersionVector |
prune(UniqueAddress removedNode,
UniqueAddress collapseInto)
When the
removed node has been removed from the cluster the state
changes from that node will be pruned by collapsing the data entries
to another node. |
abstract VersionVector |
pruningCleanup(UniqueAddress removedNode)
Remove data entries from a node that has been removed from the cluster
and already been pruned.
|
static VersionVector.Same$ |
SameInstance()
Java API: The
VersionVector.Same instance |
abstract int |
size()
INTERNAL API
|
abstract long |
versionAt(UniqueAddress node)
INTERNAL API
|
abstract scala.collection.Iterator<scala.Tuple2<UniqueAddress,java.lang.Object>> |
versionsIterator()
INTERNAL API
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
merge
public static VersionVector empty()
public static VersionVector apply()
public static VersionVector apply(scala.collection.immutable.TreeMap<UniqueAddress,java.lang.Object> versions)
public static VersionVector apply(UniqueAddress node, long version)
public static VersionVector apply(scala.collection.immutable.List<scala.Tuple2<UniqueAddress,java.lang.Object>> versions)
public static VersionVector create()
public static VersionVector.After$ AfterInstance()
VersionVector.After
instancepublic static VersionVector.Before$ BeforeInstance()
VersionVector.Before
instancepublic static VersionVector.Same$ SameInstance()
VersionVector.Same
instancepublic static VersionVector.Concurrent$ ConcurrentInstance()
VersionVector.Concurrent
instancepublic VersionVector increment(Cluster node)
node
- (undocumented)public abstract boolean isEmpty()
public abstract int size()
public abstract VersionVector increment(UniqueAddress node)
node
- (undocumented)public abstract long versionAt(UniqueAddress node)
node
- (undocumented)public abstract boolean contains(UniqueAddress node)
node
- (undocumented)public abstract scala.collection.Iterator<scala.Tuple2<UniqueAddress,java.lang.Object>> versionsIterator()
public VersionVector.Ordering compareTo(VersionVector that)
1. Version 1 is SAME (==) as Version 2 iff for all i c1(i) == c2(i)
2. Version 1 is BEFORE (<) Version 2 iff for all i c1(i) <= c2(i) and there exist a j such that c1(j) < c2(j)
3. Version 1 is AFTER (>) Version 2 iff for all i c1(i) >= c2(i) and there exist a j such that c1(j) > c2(j).
4. Version 1 is CONCURRENT (<>) to Version 2 otherwise.
that
- (undocumented)public abstract VersionVector merge(VersionVector that)
that
- (undocumented)public abstract boolean needPruningFrom(UniqueAddress removedNode)
RemovedNodePruning
needPruningFrom
in interface RemovedNodePruning
removedNode
- (undocumented)public abstract VersionVector prune(UniqueAddress removedNode, UniqueAddress collapseInto)
RemovedNodePruning
removed
node has been removed from the cluster the state
changes from that node will be pruned by collapsing the data entries
to another node.prune
in interface RemovedNodePruning
removedNode
- (undocumented)collapseInto
- (undocumented)public abstract VersionVector pruningCleanup(UniqueAddress removedNode)
RemovedNodePruning
pruningCleanup
in interface RemovedNodePruning
removedNode
- (undocumented)