[][src]Struct crdt_tree::state::State

pub struct State<ID: TreeId, TM: TreeMeta, A: Actor> { /* fields omitted */ }

State. This is the primary interface for working with a Tree CRDT.

Implementations

impl<ID: TreeId, TM: TreeMeta, A: Actor> State<ID, TM, A>[src]

pub fn new() -> Self[src]

create a new State

pub fn tree(&self) -> &Tree<ID, TM>[src]

returns tree reference

pub fn tree_mut(&mut self) -> &mut Tree<ID, TM>[src]

returns mutable tree reference

pub fn log(&self) -> &Vec<LogOpMove<ID, TM, A>>[src]

returns log reference

pub fn add_log_entry(&mut self, entry: LogOpMove<ID, TM, A>)[src]

add_log_entry

pub fn truncate_log_before(&mut self, timestamp: &Clock<A>) -> bool[src]

removes log entries before a given timestamp. not part of crdt-tree algo.

pub fn do_op(&mut self, op: OpMove<ID, TM, A>) -> LogOpMove<ID, TM, A>[src]

The do_op function performs the actual work of applying a move operation.

This function takes as argument a pair consisting of a Move operation and the current tree and it returns a pair consisting of a LogMove operation (which will be added to the log) and an updated tree.

pub fn undo_op(&mut self, log: &LogOpMove<ID, TM, A>)[src]

undo_op

pub fn redo_op(&mut self, log: LogOpMove<ID, TM, A>)[src]

redo_op uses do_op to perform an operation again and recomputes the LogMove record (which might have changed due to the effect of the new operation)

pub fn apply_op(&mut self, op1: OpMove<ID, TM, A>)[src]

See general description of apply/undo/redo above.

The apply_op func takes two arguments: a Move operation to apply and the current replica state; and it returns the new replica state. The constrains t::{linorder} in the type signature indicates that timestamps t are instance if linorder type class, and they can therefore be compared with the < operator during a linear (or total) order.

pub fn apply_ops_into(&mut self, ops: Vec<OpMove<ID, TM, A>>)[src]

applies a list of operations and consume them. (no cloning)

pub fn apply_ops(&mut self, ops: &[OpMove<ID, TM, A>])[src]

applies a list of operations reference, cloning each op.

Trait Implementations

impl<ID: Clone + TreeId, TM: Clone + TreeMeta, A: Clone + Actor> Clone for State<ID, TM, A>[src]

impl<ID: TreeId, TM: TreeMeta, A: Actor> CmRDT for State<ID, TM, A>[src]

type Op = OpMove<ID, TM, A>

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

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

Apply an operation to a State instance.

impl<ID: Debug + TreeId, TM: Debug + TreeMeta, A: Debug + Actor> Debug for State<ID, TM, A>[src]

impl<ID: TreeId, A: Actor, TM: TreeMeta> Default for State<ID, TM, A>[src]

impl<'de, ID: TreeId, TM: TreeMeta, A: Actor> Deserialize<'de> for State<ID, TM, A> where
    ID: Deserialize<'de>,
    TM: Deserialize<'de>,
    A: Deserialize<'de>, 
[src]

impl<ID: Eq + TreeId, TM: Eq + TreeMeta, A: Eq + Actor> Eq for State<ID, TM, A>[src]

impl<ID: TreeId, A: Actor, TM: TreeMeta> From<(Vec<LogOpMove<ID, TM, A>>, Tree<ID, TM>)> for State<ID, TM, A>[src]

fn from(e: (Vec<LogOpMove<ID, TM, A>>, Tree<ID, TM>)) -> Self[src]

creates State from tuple (Vec, Tree)

impl<ID: PartialEq + TreeId, TM: PartialEq + TreeMeta, A: PartialEq + Actor> PartialEq<State<ID, TM, A>> for State<ID, TM, A>[src]

impl<ID: TreeId, TM: TreeMeta, A: Actor> Serialize for State<ID, TM, A> where
    ID: Serialize,
    TM: Serialize,
    A: Serialize
[src]

impl<ID: TreeId, TM: TreeMeta, A: Actor> StructuralEq for State<ID, TM, A>[src]

impl<ID: TreeId, TM: TreeMeta, A: Actor> StructuralPartialEq for State<ID, TM, A>[src]

Auto Trait Implementations

impl<ID, TM, A> RefUnwindSafe for State<ID, TM, A> where
    A: RefUnwindSafe,
    ID: RefUnwindSafe,
    TM: RefUnwindSafe

impl<ID, TM, A> Send for State<ID, TM, A> where
    A: Send,
    ID: Send,
    TM: Send

impl<ID, TM, A> Sync for State<ID, TM, A> where
    A: Sync,
    ID: Sync,
    TM: Sync

impl<ID, TM, A> Unpin for State<ID, TM, A> where
    A: Unpin,
    ID: Unpin,
    TM: Unpin

impl<ID, TM, A> UnwindSafe for State<ID, TM, A> where
    A: UnwindSafe,
    ID: UnwindSafe,
    TM: UnwindSafe

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<TM> TreeMeta for TM where
    TM: Clone
[src]

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>,