Struct garage_table::crdt::Map [−][src]
pub struct Map<K, V> { /* fields omitted */ }
Expand description
Simple CRDT Map
This types defines a CRDT for a map from keys to values. Values are CRDT types which can have their own updating logic.
Internally, the map is stored as a vector of keys and values, sorted by ascending key order.
This is why the key type K
must implement Ord
(and also to ensure a unique serialization,
such that two values can be compared for equality based on their hashes). As a consequence,
insertions take O(n)
time. This means that Map should be used for reasonably small maps.
However, note that even if we were using a more efficient data structure such as a BTreeMap
,
the serialization cost O(n)
would still have to be paid at each modification, so we are
actually not losing anything here.
Implementations
Returns a map that contains a single mapping from the specified key to the specified value. This can be used to build a delta-mutator: when merged with another map, the value will be added or CRDT-merged if a previous value already exists.
Gets a reference to all of the items, as a slice. Usefull to iterate on all map values.
Trait Implementations
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Map<K, V>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Map<K, V>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations
impl<K, V> RefUnwindSafe for Map<K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> UnwindSafe for Map<K, V> where
K: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more