VectorClock class

Represents a Vector Clock for tracking causality in a distributed system.

A Vector Clock is a map of replica IDs to their successful operation counts. It allows determining if one event happened before another, or if they are concurrent (conflicting).

Constructors

VectorClock([Map<String, int>? clocks])
const
VectorClock.fromMap(Map<String, dynamic> map)
Creates a VectorClock from a map.
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
props → List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stringify → bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited

Methods

getValue(String replicaId) → int
Returns the count for the given replica ID.
increment(String replicaId) → VectorClock
Increments the clock for the given replica ID.
isConcurrent(VectorClock other) → bool
Returns true if this clock is concurrent with other.
isLessThan(VectorClock other) → bool
Returns true if this clock is strictly less than other.
isLessThanOrEqualTo(VectorClock other) → bool
Returns true if this clock is less than or equal to other.
merge(VectorClock other) → VectorClock
Merges this clock with another clock.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() → Map<String, int>
Converts the VectorClock to a map.
toString() → String
A string representation of this object.

Operators

operator ==(Object other) → bool
The equality operator.
inherited