[][src]Trait crdts::CmRDT

pub trait CmRDT {
    type Op;
    fn apply(&mut self, op: Self::Op);
}

Operation based CRDT's replicate by transmitting each operation.

Associated Types

type Op

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.

Actor A produces ops A1, A2 Actor B produces ops B1, B2

the only valid orderings are: A1 < A2 < B1 < B2 A1 < B1 < A2 < B2 B1 < A1 < A2 < B2 A1 < B1 < B2 < A2 B1 < A1 < B2 < A2 B1 < B2 < A1 < A2

Applying ops in any of the valid orders will converge to the same CRDT state

Op's must be idempotent, meaning any Op may be applied more than once.

Loading content...

Required methods

fn apply(&mut self, op: Self::Op)

Apply an Op to the CRDT

Loading content...

Implementors

impl<A: Actor> CmRDT for GCounter<A>[src]

type Op = Dot<A>

impl<A: Actor> CmRDT for PNCounter<A>[src]

type Op = Op<A>

impl<A: Actor> CmRDT for VClock<A>[src]

type Op = Dot<A>

fn apply(&mut self, dot: Self::Op)[src]

Monotonically adds the given actor version to this VClock.

Examples

use crdts::{VClock, Dot, CmRDT};
let mut v = VClock::new();

v.apply(Dot::new("A", 2));

// now all dots applied to `v` from actor `A` where
// the counter is not bigger than 2 are nops.
v.apply(Dot::new("A", 0));
assert_eq!(v.get(&"A"), 2);

impl<K: Ord, V: Val<A> + Default, A: Actor> CmRDT for Map<K, V, A>[src]

type Op = Op<K, V, A>

impl<M: Member, A: Actor> CmRDT for Orswot<M, A>[src]

type Op = Op<M, A>

impl<T: Clone, A: Actor> CmRDT for LSeq<T, A>[src]

type Op = Op<T, A>

fn apply(&mut self, op: Self::Op)[src]

Apply an operation to an LSeq instance.

If the operation is an insert and the identifier is already present in the LSEQ instance the result is a no-op

If the operation is a delete and the identifier is not present in the LSEQ instance the result is a no-op

impl<T: Ord> CmRDT for GSet<T>[src]

type Op = T

impl<V, A: Actor> CmRDT for MVReg<V, A>[src]

type Op = Op<V, A>

Loading content...