Struct crdts::merkle_reg::MerkleReg[][src]

pub struct MerkleReg<T> { /* fields omitted */ }

The MerkleReg is a Register CRDT that uses the Merkle DAG structure to track the current value(s) held by this register. The leaves of the Merkle DAG are the current values.

Implementations

impl<T> MerkleReg<T>[src]

pub fn new() -> Self[src]

Return a new instance of the MerkleReg

pub fn read(&self) -> Content<'_, T>[src]

Read the current values held by the register

pub fn write(&self, value: T, parents: BTreeSet<Hash>) -> Node<T>[src]

Write the given value on top of the given parents.

pub fn node(&self, hash: Hash) -> Option<&Node<T>>[src]

Retrieve a node in the Merkle DAG by it’s hash.

Traverse the history the register by pair this method with the parents of the nodes retrieved in Content::nodes().

pub fn parents(&self, hash: Hash) -> Content<'_, T>[src]

Returns the parents of a node

pub fn children(&self, hash: Hash) -> Content<'_, T>[src]

Returns the children of a node

pub fn num_nodes(&self) -> usize[src]

Returns the number of nodes who are visible, i.e. their parents have been seen.

pub fn num_orphans(&self) -> usize[src]

Returns the number of nodes who are not visible due to missing parents.

Trait Implementations

impl<T: Arbitrary + Sha3Hash> Arbitrary for MerkleReg<T>[src]

impl<T: Clone> Clone for MerkleReg<T>[src]

impl<T: Sha3Hash> CmRDT for MerkleReg<T>[src]

type Op = Node<T>

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

type Validation = ValidationError

The validation error returned by validate_op.

impl<T: Sha3Hash> CvRDT for MerkleReg<T>[src]

type Validation = Infallible

The validation error returned by validate_merge.

impl<T: Debug> Debug for MerkleReg<T>[src]

impl<T> Default for MerkleReg<T>[src]

impl<'de, T> Deserialize<'de> for MerkleReg<T> where
    T: Deserialize<'de>, 
[src]

impl<T: Eq> Eq for MerkleReg<T>[src]

impl<T: Hash> Hash for MerkleReg<T>[src]

impl<T: Ord> Ord for MerkleReg<T>[src]

impl<T: PartialEq> PartialEq<MerkleReg<T>> for MerkleReg<T>[src]

impl<T: PartialOrd> PartialOrd<MerkleReg<T>> for MerkleReg<T>[src]

impl<T> Serialize for MerkleReg<T> where
    T: Serialize
[src]

impl<T> StructuralEq for MerkleReg<T>[src]

impl<T> StructuralPartialEq for MerkleReg<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for MerkleReg<T> where
    T: RefUnwindSafe

impl<T> Send for MerkleReg<T> where
    T: Send

impl<T> Sync for MerkleReg<T> where
    T: Sync

impl<T> Unpin for MerkleReg<T>

impl<T> UnwindSafe for MerkleReg<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,