Skip to main content

Crdt

Trait Crdt 

Source
pub trait Crdt {
    // Required method
    fn merge(&mut self, other: &Self);
}
Expand description

Core trait that all CRDTs must implement.

A CRDT (Conflict-free Replicated Data Type) guarantees that concurrent updates on different replicas will converge to the same state after merging, without requiring coordination.

§Properties

All implementations must satisfy:

  • Commutativity: a.merge(b) == b.merge(a)
  • Associativity: a.merge(b.merge(c)) == a.merge(b).merge(c)
  • Idempotency: a.merge(a) == a

Required Methods§

Source

fn merge(&mut self, other: &Self)

Merge another replica’s state into this one.

After merging, self contains the least upper bound of both states. This operation is commutative, associative, and idempotent.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Crdt for GCounter

Source§

impl Crdt for PNCounter

Source§

impl Crdt for TextCrdt

Source§

impl<T: Clone + Ord> Crdt for MVRegister<T>

Source§

impl<T: Clone + Ord> Crdt for Rga<T>

Source§

impl<T: Clone> Crdt for LWWRegister<T>

Source§

impl<T: Ord + Clone> Crdt for GSet<T>

Source§

impl<T: Ord + Clone> Crdt for ORSet<T>

Source§

impl<T: Ord + Clone> Crdt for TwoPSet<T>