Trait crdts::CvRDT

source ·
pub trait CvRDT {
    type Validation: Error;

    // Required methods
    fn validate_merge(&self, other: &Self) -> Result<(), Self::Validation>;
    fn merge(&mut self, other: Self);
}
Expand description

State based CRDT’s replicate by transmitting the entire CRDT state.

Required Associated Types§

source

type Validation: Error

The validation error returned by validate_merge.

Required Methods§

source

fn validate_merge(&self, other: &Self) -> Result<(), Self::Validation>

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.

An Ok(()) response signals that the merge is safe to proceed. Otherwise a structured error is returned to help you determine what is wrong with the merge.

source

fn merge(&mut self, other: Self)

Merge the given CRDT into the current CRDT.

Implementors§

source§

impl<A: Ord + Clone + Debug> CvRDT for GCounter<A>

source§

impl<A: Ord + Clone + Debug> CvRDT for PNCounter<A>

source§

impl<A: Ord + Clone + Debug> CvRDT for VClock<A>

source§

impl<K: Ord + Clone + Debug, V: Val<A> + CvRDT + Debug, A: Ord + Hash + Clone + Debug> CvRDT for Map<K, V, A>

source§

impl<M: Hash + Eq + Clone + Debug, A: Ord + Hash + Clone + Debug> CvRDT for Orswot<M, A>

source§

impl<T: Ord> CvRDT for GList<T>

source§

impl<T: Ord> CvRDT for GSet<T>

source§

impl<T: Sha3Hash> CvRDT for MerkleReg<T>

source§

impl<V, A: Ord> CvRDT for MVReg<V, A>

source§

impl<V: PartialEq, M: Ord> CvRDT for LWWReg<V, M>