final case class VectorClock(versions: TreeMap[Node, Long] = TreeMap.empty[VectorClock.Node, Long]) extends Product with 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.
- Annotations
- @SerialVersionUID()
- Source
- VectorClock.scala
- Alphabetic
- By Inheritance
- VectorClock
- Serializable
- Product
- Equals
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Instance Constructors
Value Members
- def :+(node: Node): VectorClock
Increment the version for the node passed as argument.
Increment the version for the node passed as argument. Returns a new VectorClock.
- def <(that: VectorClock): Boolean
Returns true if
this
is beforethat
else false. - def <>(that: VectorClock): Boolean
Returns true if
this
andthat
are concurrent else false. - def ==(that: VectorClock): Boolean
Returns true if this VectorClock has the same history as the 'that' VectorClock else false.
- def >(that: VectorClock): Boolean
Returns true if
this
is afterthat
else false. - def compareTo(that: VectorClock): Ordering
Compare two vector clocks.
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.
- def merge(that: VectorClock): VectorClock
Merges this VectorClock with another VectorClock.
Merges this VectorClock with another VectorClock. E.g. merges its versioned history.
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def prune(removedNode: Node): VectorClock
- def toString(): String
- Definition Classes
- VectorClock → AnyRef → Any
- val versions: TreeMap[Node, Long]