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§
sourcetype Validation: Error
type Validation: Error
The validation error returned by validate_merge
.
Required Methods§
sourcefn validate_merge(&self, other: &Self) -> Result<(), Self::Validation>
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.