[][src]Trait cvrdt_exposition::traits::Grow

pub trait Grow: Clone {
    type Payload: Eq;
    type Update;
    type Query;
    type Value;
    fn new(payload: Self::Payload) -> Self;
fn payload(&self) -> Self::Payload;
fn add(&mut self, update: Self::Update);
fn le(&self, other: &Self) -> bool;
fn merge(&self, other: &Self) -> Self;
fn query(&self, query: &Self::Query) -> Self::Value; }

CvRDTs that can only grow, i.e. only add items

Associated Types

type Payload: Eq

The internal state of our CvRDT; sufficient to build a new copy via new. Required to implement Eq for testing and verification.

type Update

Message to update our internal state

type Query

Message to query the Value of our CvRDT

type Value

The response to a Query

Loading content...

Required methods

fn new(payload: Self::Payload) -> Self

Create a new version of our data structure from the given Payload

Parameters

  • payload: a payload which fully specifies all information needed to instantiate our data structure

Returns

A new instance of this CvRDT

fn payload(&self) -> Self::Payload

Retrieve the Payload (internal state) of this CvRDT

Parameters

  • a borrowed reference to self

Returns

The payload of this CvRDT

fn add(&mut self, update: Self::Update)

Add an item to the data structure, mutating this CvRDT in place

Parameters

  • a mutably borrowed reference to self
  • an Update message

Returns

Nothing; this data structure is updated in-place

fn le(&self, other: &Self) -> bool

Is this CvRDT ≤ another in the semilattice's partial order?

Parameters

  • a borrowed reference to self
  • a borrowed reference to teh other structure to compare

Returns

true if and only if this CvRDT is less than or equal to the other (in terms of the semilattice induced by merge)

fn merge(&self, other: &Self) -> Self

Merge this data structure and another into a new CvRDT

Parameters

  • a borrowed reference to self
  • a borrowed reference to the other structure to merge

Returns

A new instance of this CvRDT

Notes

Per the top-level documentation, this function must be commutative, associative, and idempotent

fn query(&self, query: &Self::Query) -> Self::Value

Query the data structure to get some Value

Parameters

  • a borrowed reference to self
  • a borrowed reference to a Query message

Returns

The Value determined by the current internal state

Loading content...

Implementors

impl Grow for GCounter[src]

type Payload = (usize, Vec<u64>)

type Update = ()

type Query = ()

type Value = u64

impl Grow for OneWayBoolean[src]

type Payload = bool

type Update = ()

type Query = ()

type Value = bool

impl Grow for PNCounter[src]

type Payload = (usize, Vec<u64>, Vec<u64>)

type Update = ()

type Query = ()

type Value = u64

impl<X: Clone + Eq + Hash> Grow for GSet<X>[src]

type Payload = HashSet<X>

type Update = X

type Query = X

type Value = bool

impl<X: Clone + Eq + Hash> Grow for TwoPhaseSet<X>[src]

type Payload = (HashSet<X>, HashSet<X>)

type Update = X

type Query = X

type Value = bool

impl<X: Clone + Eq> Grow for LWWRegister<X>[src]

type Payload = (X, Instant)

type Update = X

type Query = ()

type Value = X

Loading content...