Struct crdts::gcounter::GCounter [−][src]
pub struct GCounter<A: Ord> { /* fields omitted */ }
Expand description
GCounter
is a grow-only witnessed counter.
Examples
use crdts::{GCounter, CmRDT}; let mut a = GCounter::new(); let mut b = GCounter::new(); a.apply(a.inc("A")); b.apply(b.inc("B")); assert_eq!(a.read(), b.read()); a.apply(a.inc("A")); assert!(a.read() > b.read());
Implementations
Generate Op to increment the counter by a number of steps.
Trait Implementations
Op defines a mutation to the CRDT. As long as Op’s from one actor are replayed in exactly the same order they were generated by that actor, the CRDT will converge. In other words, we must have a total ordering on each actors operations, while requiring only a partial order over all ops. E.g. Read more
type Validation = Infallible
type Validation = Infallible
The validation error returned by validate_op
.
Some CRDT’s have stricter requirements on how they must be used. To avoid violating these requirements, CRDT’s provide an interface to optionally validate op’s before they are applied. Read more
type Validation = Infallible
type Validation = Infallible
The validation error returned by validate_merge
.
Some CRDT’s have stricter requirements on how they must be used. To avoid violating these requirements, CRDT’s provide an interface to optionally validate merge compatibility before attempting to merge. Read more
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Remove data that is strictly smaller than this clock
Auto Trait Implementations
impl<A> RefUnwindSafe for GCounter<A> where
A: RefUnwindSafe,
impl<A> UnwindSafe for GCounter<A> where
A: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V