[][src]Struct crdt_tree::opmove::OpMove

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

From the paper:

We allow the tree to be updated in three ways: by creating a new child of any parent node, by deleting a node, or by moving a node to be a child of a new parent. However all three types of update can be represented by a move operation. To create a node, we generate a fresh ID for that node, and issue an operation to move this new ID to be created. We also designate as "trash" some node ID that does not exist in the tree; then we can delete a node by moving it to be a child of the trash.

Thus, we define one kind of operation: Move t p m c. A move operation is a 4-tuple consisting of a timestamp t of type 't, a parent node ID p of type 'n, a metadata field m of type 'm, and a child node ID c of type 'n. Here, 't, 'n, and 'm are type variables that can be replaced with arbitrary types; we only require that node identifiers 'n are globally unique (eg UUIDs); timestamps 't need to be globally unique and totally ordered (eg Lamport timestamps [11]).

The meaning of an operation Move t p m c is that at time t, the node with ID c is moved to be a child of the parent node with ID p. The operation does not specify the old location of c; the algorithm simply removes c from wherever it is currently located in the tree, and moves it to p. If c does not currently exist in the tree, it is created as a child of p.

The metadata field m in a move operation allows additional information to be associated with the parent-child relationship of p and c. For example, in a filesystem, the parent and child are the inodes of a directory and a file within it respectively, and the metadata contains the filename of the child. Thus, a file with inode c can be renamed by performing a Move t p m c, where the new parent directory p is the inode of the existing parent (unchanged), but the metadata m contains the new filename.

When users want to make changes to the tree on their local replica they generate new Move t p m c operations for these changes, and apply these operations using the algorithm described...

Implementations

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

pub fn new(
    timestamp: Clock<A>,
    parent_id: ID,
    metadata: TM,
    child_id: ID
) -> Self
[src]

create a new OpMove instance

pub fn timestamp(&self) -> &Clock<A>[src]

returns timestamp reference

pub fn parent_id(&self) -> &ID[src]

returns parent_id reference

pub fn metadata(&self) -> &TM[src]

returns metadata reference

pub fn child_id(&self) -> &ID[src]

returns child_id reference

Trait Implementations

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

fn arbitrary<G: Gen>(g: &mut G) -> Self[src]

generates an arbitrary (random) OpMove

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

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

impl<'de, ID: TreeId, TM: TreeMeta, A: Actor> Deserialize<'de> for OpMove<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 OpMove<ID, TM, A>[src]

impl<ID: TreeId, A: Actor, TM: TreeMeta> From<LogOpMove<ID, TM, A>> for OpMove<ID, TM, A>[src]

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

creates OpMove from a LogOpMove

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

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

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

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

Auto Trait Implementations

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

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

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

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

impl<ID, TM, A> UnwindSafe for OpMove<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>,