pub struct CRDTMap<K: Ord + Clone> { /* private fields */ }Expand description
Map CRDT - composable container for nested CRDTs
Maps keys to values, each value is tagged with a dot. A value is “live” if its dot is in the context. A value is “removed” if its dot is in the context but not in the store.
Implementations§
Source§impl<K: Ord + Clone> CRDTMap<K>
impl<K: Ord + Clone> CRDTMap<K>
Sourcepub fn put(&mut self, replica_id: &str, key: K, value: MapValue) -> Dot
pub fn put(&mut self, replica_id: &str, key: K, value: MapValue) -> Dot
Put a value at a key (from this replica)
Sourcepub fn get(&self, key: &K) -> Option<&MapValue>
pub fn get(&self, key: &K) -> Option<&MapValue>
Get the current value at a key Returns the value if the key exists and has live entries
Sourcepub fn get_all(&self, key: &K) -> Vec<&MapValue>
pub fn get_all(&self, key: &K) -> Vec<&MapValue>
Get all values at a key (for concurrent writes)
Sourcepub fn contains_key(&self, key: &K) -> bool
pub fn contains_key(&self, key: &K) -> bool
Check if a key exists with live values
Sourcepub fn context(&self) -> &CausalContext
pub fn context(&self) -> &CausalContext
Get the causal context
Sourcepub fn put_with_dot(&mut self, key: K, dot: Dot, value: MapValue)
pub fn put_with_dot(&mut self, key: K, dot: Dot, value: MapValue)
Add a value with a specific dot (for merging)
Trait Implementations§
Source§impl<'de, K: Ord + Clone + Deserialize<'de>> Deserialize<'de> for CRDTMap<K>
impl<'de, K: Ord + Clone + Deserialize<'de>> Deserialize<'de> for CRDTMap<K>
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<K: Ord + Clone> Lattice for CRDTMap<K>
impl<K: Ord + Clone> Lattice for CRDTMap<K>
Source§fn join(&self, other: &Self) -> Self
fn join(&self, other: &Self) -> Self
Join operation: merge all entries and contexts For each key, union all the dots and their values
Source§fn partial_cmp_lattice(&self, other: &Self) -> Option<Ordering>
fn partial_cmp_lattice(&self, other: &Self) -> Option<Ordering>
Partial order derived from join: a ≤ b iff a ⊔ b = b
Source§fn join_assign(&mut self, other: &Self)
fn join_assign(&mut self, other: &Self)
Join-assign: self = self ⊔ other
impl<K: Eq + Ord + Clone> Eq for CRDTMap<K>
impl<K: Ord + Clone> StructuralPartialEq for CRDTMap<K>
Auto Trait Implementations§
impl<K> Freeze for CRDTMap<K>
impl<K> RefUnwindSafe for CRDTMap<K>where
K: RefUnwindSafe,
impl<K> Send for CRDTMap<K>where
K: Send,
impl<K> Sync for CRDTMap<K>where
K: Sync,
impl<K> Unpin for CRDTMap<K>
impl<K> UnwindSafe for CRDTMap<K>where
K: RefUnwindSafe,
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