pub struct CrdtMetadata {
pub clock: HashMap<String, u64>,
pub origin: String,
pub seq: u64,
}Expand description
CRDT metadata for a content block.
Each content block can carry CRDT metadata for tracking distributed state. This enables conflict-free merging of concurrent edits.
Fields§
§clock: HashMap<String, u64>Vector clock mapping site IDs to logical timestamps.
origin: StringSite ID where this version originated.
seq: u64Sequence number within the origin site.
Implementations§
Source§impl CrdtMetadata
impl CrdtMetadata
Sourcepub fn merge(&mut self, other: &Self)
pub fn merge(&mut self, other: &Self)
Merge with another CRDT metadata (takes maximum of each clock entry).
Sourcepub fn happened_before(&self, other: &Self) -> bool
pub fn happened_before(&self, other: &Self) -> bool
Check if this metadata happened before another (causally).
Trait Implementations§
Source§impl Clone for CrdtMetadata
impl Clone for CrdtMetadata
Source§fn clone(&self) -> CrdtMetadata
fn clone(&self) -> CrdtMetadata
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CrdtMetadata
impl Debug for CrdtMetadata
Source§impl<'de> Deserialize<'de> for CrdtMetadata
impl<'de> Deserialize<'de> for CrdtMetadata
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for CrdtMetadata
impl PartialEq for CrdtMetadata
Source§impl Serialize for CrdtMetadata
impl Serialize for CrdtMetadata
impl Eq for CrdtMetadata
impl StructuralPartialEq for CrdtMetadata
Auto Trait Implementations§
impl Freeze for CrdtMetadata
impl RefUnwindSafe for CrdtMetadata
impl Send for CrdtMetadata
impl Sync for CrdtMetadata
impl Unpin for CrdtMetadata
impl UnsafeUnpin for CrdtMetadata
impl UnwindSafe for CrdtMetadata
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.