Struct noosphere_core::data::Orswot

source ·
pub struct Orswot<M, A>where
    M: Hash + Eq,
    A: Ord + Hash,
{ /* private fields */ }
Expand description

Orswot is an add-biased or-set without tombstones ported from the riak_dt CRDT library.

Implementations

Returns a new Orswot instance.

Return a snapshot of the ORSWOT clock

Add a single element.

Add multiple elements.

Remove a member with a witnessing ctx.

Remove members with a witnessing ctx.

Check if the set contains a member

Gets an iterator over the entries of the Map.

Examples
use crdts::{Orswot, CmRDT};

let actor = "actor";

let mut set: Orswot<u8, &'static str> = Default::default();

let add_ctx = set.read_ctx().derive_add_ctx(actor);
set.apply(set.add(100, add_ctx));

let add_ctx = set.read_ctx().derive_add_ctx(actor);
set.apply(set.add(50, add_ctx));

let mut items: Vec<_> = set
    .iter()
    .map(|item_ctx| *item_ctx.val)
    .collect();

items.sort();

assert_eq!(items, &[50, 100]);

Retrieve the current members.

Retrieve the current read context

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Op defines a mutation to the CRDT. As long as Op’s from one actor are replayed in exactly the same order they were generated by that actor, the CRDT will converge. In other words, we must have a total ordering on each actors operations, while requiring only a partial order over all ops. E.g. Read more
The validation error returned by validate_op.
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 op’s before they are applied. Read more
Apply an Op to the CRDT

Merge combines another Orswot with this one.

The validation error returned by validate_merge.
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. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Remove data that is strictly smaller than this clock
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Scrape the references from an impl Read. Read more
Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
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