Package akka.persistence.typed.internal
Class VersionVector
- java.lang.Object
-
- akka.persistence.typed.internal.VersionVector
-
- Direct Known Subclasses:
ManyVersionVector
,OneVersionVector
public abstract class VersionVector extends java.lang.Object
INTERNAL APIRepresentation 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
akka.cluster.ddata.VersionVector
.This class is immutable, i.e. "modifying" methods return a new instance.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class 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 Summary
Constructors Constructor Description VersionVector()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
$eq$eq(VersionVector that)
Returns true if this VersionVector has the same history as the 'that' VersionVector else false.boolean
$greater(VersionVector that)
Returns true ifthis
is afterthat
else false.boolean
$less(VersionVector that)
Returns true ifthis
is beforethat
else false.boolean
$less$greater(VersionVector that)
Returns true ifthis
andthat
are concurrent else false.VersionVector
$plus(java.lang.String key)
Increment the version for the key passed as argument.static VersionVector
apply()
static VersionVector
apply(java.lang.String key, long version)
static VersionVector
apply(scala.collection.immutable.List<scala.Tuple2<java.lang.String,java.lang.Object>> versions)
INTERNAL APIstatic VersionVector
apply(scala.collection.immutable.TreeMap<java.lang.String,java.lang.Object> versions)
VersionVector.Ordering
compareTo(VersionVector that)
Compare two version vectors.abstract boolean
contains(java.lang.String key)
INTERNAL APIstatic VersionVector
empty()
abstract VersionVector
increment(java.lang.String key)
Increment the version for the key passed as argument.abstract boolean
isEmpty()
abstract VersionVector
merge(VersionVector that)
abstract int
size()
INTERNAL APIabstract VersionVector
updated(java.lang.String key, long version)
abstract long
versionAt(java.lang.String key)
abstract scala.collection.Iterator<scala.Tuple2<java.lang.String,java.lang.Object>>
versionsIterator()
INTERNAL API
-
-
-
Method Detail
-
empty
public static VersionVector empty()
-
apply
public static VersionVector apply()
-
apply
public static VersionVector apply(scala.collection.immutable.TreeMap<java.lang.String,java.lang.Object> versions)
-
apply
public static VersionVector apply(java.lang.String key, long version)
-
apply
public static VersionVector apply(scala.collection.immutable.List<scala.Tuple2<java.lang.String,java.lang.Object>> versions)
INTERNAL API
-
$plus
public VersionVector $plus(java.lang.String key)
Increment the version for the key passed as argument. Returns a new VersionVector.
-
increment
public abstract VersionVector increment(java.lang.String key)
Increment the version for the key passed as argument. Returns a new VersionVector.
-
updated
public abstract VersionVector updated(java.lang.String key, long version)
-
isEmpty
public abstract boolean isEmpty()
-
size
public abstract int size()
INTERNAL API
-
versionAt
public abstract long versionAt(java.lang.String key)
-
contains
public abstract boolean contains(java.lang.String key)
INTERNAL API
-
$less$greater
public boolean $less$greater(VersionVector that)
Returns true ifthis
andthat
are concurrent else false.
-
$less
public boolean $less(VersionVector that)
Returns true ifthis
is beforethat
else false.
-
$greater
public boolean $greater(VersionVector that)
Returns true ifthis
is afterthat
else false.
-
$eq$eq
public boolean $eq$eq(VersionVector that)
Returns true if this VersionVector has the same history as the 'that' VersionVector else false.
-
versionsIterator
public abstract scala.collection.Iterator<scala.Tuple2<java.lang.String,java.lang.Object>> versionsIterator()
INTERNAL API
-
compareTo
public VersionVector.Ordering compareTo(VersionVector that)
Compare two version vectors. The outcome will be one of the following: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.
-
merge
public abstract VersionVector merge(VersionVector that)
-
-