Module crdts::vclock [] [src]

vclock contains the vector clock. The vclock crate provides a generic vector clock implementation.


use crdts::VClock;
let (mut a, mut b) = (VClock::new(), VClock::new());
a.witness("A".to_string(), 2);
b.witness("A".to_string(), 1);
assert!(a > b);



A VClock is a standard vector clock. It contains a set of "actors" and associated counters. When a particular actor witnesses a mutation, their associated counter in a VClock is incremented. VClock is typically used as metadata for associated application data, rather than as the container for application data. VClock just tracks causality. It can tell you if something causally descends something else, or if different replicas are "concurrent" (were mutated in isolation, and need to be resolved externally).

Type Definitions


A counter is used to track causality at a particular actor.