VClock64

Type Alias VClock64 

Source
pub type VClock64<K> = VClock<K, u64>;
Expand description

Vector clock using u64 counters. In doubt, use this.

About capacity: considering a computer which would increase the clock for a given key, at a constant rate of 1 billion updates/sec (current benchmarks tend to show this is very optimistic on 2023 hardware) then it would take about 500 years to reach the maximum capacity, updating the same key only, constantly. This is, really, a worse-case scenario. Napkin math: pow(2,64)/(1e9*24*3600*365) -> 585

TL;DR this is big enough.

§Examples

use vclock::VClock64;

// key type can be inferred
let mut c = VClock64::default();
c.incr(&"a");
c.incr(&"a");
c.incr(&"b");
assert_eq!(Some(1), c.get(&"a"));
assert_eq!(Some(0), c.get(&"b"));
assert_eq!(None, c.get(&"c"));

Aliased Type§

pub struct VClock64<K> { /* private fields */ }