[−][src]Trait cvrdt_exposition::traits::Grow
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
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