causal_length/
lib.rs

1//! CRDT's based on ["A Low-Cost Set CRDT Based on Causal Lengths"](https://dl.acm.org/doi/pdf/10.1145/3380787.3393678)
2//! combined with an optional tag. The tag can be any type that satisfies `Ord + Copy`. A simple
3//! integer, wall clock, lamport timestamp, or even a hybrid logical clock from ["Logical Physical Clocks and Consistent Snapshots
4//! in Globally Distributed Databases"](http://www.cse.buffalo.edu/tech-reports/2014-04.pdf) may
5//! be used.
6
7use num_integer::Integer;
8use num_traits::One;
9use std::hash::Hash;
10
11/// Causal length Map
12pub mod map;
13pub use self::map::*;
14/// Causal length Register
15pub mod register;
16pub use self::register::*;
17
18/// Causal length Set
19pub mod set;
20pub use self::set::*;
21
22/// CausalLength is abstracted to allow any of Rust's integer types to be used.
23pub trait CausalLength: Integer + One + Ord + Copy + Eq {}
24impl<T> CausalLength for T where T: Integer + One + Ord + Copy + Eq {}
25
26/// Key type used in the CRDTs
27pub trait Key: Eq + Hash + Clone {}
28impl<T> Key for T where T: Eq + Hash + Clone {}
29
30/// Value type used in the CRDTs
31pub trait Value: Clone + Eq {}
32impl<T> Value for T where T: Clone + Eq {}
33
34/// Tag type used in the CRDTs
35pub trait TagT: Eq + Ord + Copy + Default {}
36impl<T> TagT for T where T: Eq + Ord + Copy + Default {}