LogOpMove

Struct LogOpMove 

Source
pub struct LogOpMove<ID: TreeId, TM: TreeMeta, A: Actor> { /* private fields */ }
Expand description

Implements LogOpMove, a log entry used by State

§From the paper[1]:

In order to correctly apply move operations, a replica needs to maintain not only the current state of the tree, but also an operation log. The log is a list of LogMove records in descending timestamp order. LogMove t oldp p m c is similar to Move t p m c; the difference is that LogMove has an additional field oldp of type (’n x ’m) option. This option type means the field can either take the value None or a pair of a node ID and a metadata field.

§When a replica applies a Move operation to its tree it also records a corresponding LogMove operation in its log. The t, p, m, and c fields are taken directly from the Move record while the oldp field is filled in based on the state of the tree before the move. If c did not exist in the tree, oldp is set to None. Else oldp records the previous parent metadata of c: if there exist p’ and m’ such that (p’, m’, c’) E tree, then oldp is set to Some(p', m'). The get_parent() function implements this.

[1] https://martin.kleppmann.com/papers/move-op.pdf

Implementations§

Source§

impl<ID: TreeId, TM: TreeMeta, A: Actor> LogOpMove<ID, TM, A>

Source

pub fn new( op: OpMove<ID, TM, A>, oldp: Option<TreeNode<ID, TM>>, ) -> LogOpMove<ID, TM, A>

create a new instance of LogOpMove

Source

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

returns timestamp reference

Source

pub fn parent_id(&self) -> &ID

returns parent_id reference

Source

pub fn metadata(&self) -> &TM

returns metadata reference

Source

pub fn child_id(&self) -> &ID

returns child_id reference

Source

pub fn oldp(&self) -> &Option<TreeNode<ID, TM>>

returns oldp reference

Source

pub fn op_into(self) -> OpMove<ID, TM, A>

converts LogOpMove into an OpMove

Trait Implementations§

Source§

impl<ID: Clone + TreeId, TM: Clone + TreeMeta, A: Clone + Actor> Clone for LogOpMove<ID, TM, A>

Source§

fn clone(&self) -> LogOpMove<ID, TM, A>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<ID: Debug + TreeId, TM: Debug + TreeMeta, A: Debug + Actor> Debug for LogOpMove<ID, TM, A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, ID, TM, A> Deserialize<'de> for LogOpMove<ID, TM, A>
where ID: Deserialize<'de> + TreeId, TM: Deserialize<'de> + TreeMeta, A: Deserialize<'de> + Actor,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

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

Source§

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

creates OpMove from a LogOpMove

Source§

impl<ID: PartialEq + TreeId, TM: PartialEq + TreeMeta, A: PartialEq + Actor> PartialEq for LogOpMove<ID, TM, A>

Source§

fn eq(&self, other: &LogOpMove<ID, TM, A>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<ID, TM, A> Serialize for LogOpMove<ID, TM, A>
where ID: Serialize + TreeId, TM: Serialize + TreeMeta, A: Serialize + Actor,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<ID: Eq + TreeId, TM: Eq + TreeMeta, A: Eq + Actor> Eq for LogOpMove<ID, TM, A>

Source§

impl<ID: TreeId, TM: TreeMeta, A: Actor> StructuralPartialEq for LogOpMove<ID, TM, A>

Auto Trait Implementations§

§

impl<ID, TM, A> Freeze for LogOpMove<ID, TM, A>
where ID: Freeze, TM: Freeze, A: Freeze,

§

impl<ID, TM, A> RefUnwindSafe for LogOpMove<ID, TM, A>

§

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

§

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

§

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

§

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

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V

Source§

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

Source§

impl<TM> TreeMeta for TM
where TM: Clone,