[][src]Trait crdts::FunkyCvRDT

pub trait FunkyCvRDT {
    type Error;
    pub fn merge(&mut self, other: Self) -> Result<(), Self::Error>;
}

Funky variant of the CvRDT trait.

This trait is for CvRDT's whose state space can't be easily encoded in rusts typesystem so we rely on runtime error checking. E.g. the unicity of timestamp assumption in LWWReg

Associated Types

type Error[src]

User chosen error type

Loading content...

Required methods

pub fn merge(&mut self, other: Self) -> Result<(), Self::Error>[src]

Merge the given CRDT into the current CRDT.

Loading content...

Implementors

impl<V: PartialEq, M: Ord> FunkyCvRDT for LWWReg<V, M>[src]

type Error = Error

pub fn merge(
    &mut self,
    LWWReg { val: val, marker: marker }: Self
) -> Result<(), Error>
[src]

Combines two LWWReg instances according to the marker that tracks causality. Returns an error if the marker is identical but the contained element is different.

use crdts::{LWWReg, FunkyCvRDT};
let mut l1 = LWWReg { val: 1, marker: 2 };
let l2 = LWWReg { val: 3, marker: 2 };
// errors!
assert!(l1.merge(l2).is_err());
Loading content...