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§
Required Methods§
Sourcefn delta_since(&self, version: &VClock) -> Option<Self::Delta>
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.
Sourcefn apply_delta(&mut self, delta: &Self::Delta)
fn apply_delta(&mut self, delta: &Self::Delta)
Apply an incoming delta to 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.