Skip to main content

DeltaCrdt

Trait DeltaCrdt 

Source
pub trait DeltaCrdt: Merge + Sized {
    type Delta: Serialize + DeserializeOwned + Clone + Send + 'static;

    // Required methods
    fn delta_since(&self, version: &VClock) -> Option<Self::Delta>;
    fn apply_delta(&mut self, delta: &Self::Delta);
    fn version(&self) -> VClock;
}
Expand description

A CRDT that supports delta-state synchronization.

Delta-state CRDTs can extract small deltas representing recent changes, rather than broadcasting the entire state. This is more efficient for large data structures.

Required Associated Types§

Source

type Delta: Serialize + DeserializeOwned + Clone + Send + 'static

The type of delta this CRDT produces.

Required Methods§

Source

fn delta_since(&self, version: &VClock) -> Option<Self::Delta>

Extract a delta containing changes since the given version.

Returns None if the delta history doesn’t go back far enough.

Source

fn apply_delta(&mut self, delta: &Self::Delta)

Apply an incoming delta to this CRDT.

Source

fn version(&self) -> VClock

Get the current version (vector clock) of this CRDT.

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 DeltaCrdt for PNCounter

Source§

type Delta = PNCounterDelta

Source§

impl<K: Hash + Eq + Clone + Serialize + DeserializeOwned + Send + 'static, V: Merge + Default + Clone + Serialize + DeserializeOwned + Send + 'static> DeltaCrdt for ORMap<K, V>

Source§

type Delta = ORMapDelta<K, V>

Source§

impl<T: Clone + PartialEq + Serialize + DeserializeOwned + Send + 'static> DeltaCrdt for RGA<T>

Source§

type Delta = RGADelta<T>

Source§

impl<T: Clone + PartialEq + Serialize + DeserializeOwned + Send + 'static> DeltaCrdt for YATA<T>

Source§

type Delta = YATADelta<T>

Source§

impl<T: Clone + PartialEq + Serialize + DeserializeOwned + Send + 'static> DeltaCrdt for MVRegister<T>

Source§

type Delta = MVRegisterDelta<T>

Source§

impl<T: Hash + Eq + Clone + Serialize + DeserializeOwned + Send + 'static, B: SetBias> DeltaCrdt for ORSet<T, B>

Source§

type Delta = ORSetDelta<T>