New model for buckets #172
3 changed files with 3 additions and 1 deletions
|
@ -63,6 +63,7 @@ where
|
||||||
///
|
///
|
||||||
/// However extracting the mutator on its own and only sending that on the network is very
|
/// However extracting the mutator on its own and only sending that on the network is very
|
||||||
/// interesting as it is much smaller than the whole map.
|
/// interesting as it is much smaller than the whole map.
|
||||||
|
#[must_use = "CRDT mutators are meant to be merged into a CRDT and not ignored."]
|
||||||
pub fn update_mutator(&self, k: K, new_v: V) -> Self {
|
pub fn update_mutator(&self, k: K, new_v: V) -> Self {
|
||||||
let new_vals = match self.vals.binary_search_by(|(k2, _, _)| k2.cmp(&k)) {
|
let new_vals = match self.vals.binary_search_by(|(k2, _, _)| k2.cmp(&k)) {
|
||||||
Ok(i) => {
|
Ok(i) => {
|
||||||
|
|
|
@ -33,6 +33,7 @@ where
|
||||||
/// This can be used to build a delta-mutator:
|
/// 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
|
/// when merged with another map, the value will be added or CRDT-merged if a previous
|
||||||
/// value already exists.
|
/// value already exists.
|
||||||
|
#[must_use = "CRDT mutators are meant to be merged into a CRDT and not ignored."]
|
||||||
pub fn put_mutator(k: K, v: V) -> Self {
|
pub fn put_mutator(k: K, v: V) -> Self {
|
||||||
Self { vals: vec![(k, v)] }
|
Self { vals: vec![(k, v)] }
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
//! counter. Alice does +1 on her copy, she reads 1. Bob does +3 on his copy, he reads 3. Now,
|
//! counter. Alice does +1 on her copy, she reads 1. Bob does +3 on his copy, he reads 3. Now,
|
||||||
//! it is easy to merge their counters, order does not count: we always get 4.
|
//! it is easy to merge their counters, order does not count: we always get 4.
|
||||||
//!
|
//!
|
||||||
//! Learn more about CRDT [on Wikipedia](https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type)
|
//! Learn more about CRDTs [on Wikipedia](https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type)
|
||||||
|
|
||||||
mod bool;
|
mod bool;
|
||||||
#[allow(clippy::module_inception)]
|
#[allow(clippy::module_inception)]
|
||||||
|
|
Loading…
Reference in a new issue