Struct near_store::TrieChanges[][src]

pub struct TrieChanges {
    pub old_root: StateRoot,
    pub new_root: StateRoot,
    // some fields omitted
}

TrieChanges stores delta for refcount. Multiple versions of the state work the following way: __changes1___state1 state0 / __changes2___state2

To store state0, state1 and state2, apply insertions from changes1 and changes2

Then, to discard state2, apply insertions from changes2 as deletions

Then, to discard state0, apply deletions from changes1. deleting state0 while both state1 and state2 exist is not possible. Applying deletions from changes1 while state2 exists makes accessing state2 invalid.

create a fork -> apply insertions resolve a fork -> apply opposite of insertions discard old parent which has no forks from it -> apply deletions

Having old_root and values in deletions allows to apply TrieChanges in reverse

StoreUpdate are the changes from current state refcount to refcount + delta.

Fields

old_root: StateRootnew_root: StateRoot

Implementations

impl TrieChanges[src]

pub fn empty(old_root: StateRoot) -> Self[src]

Trait Implementations

impl BorshDeserialize for TrieChanges where
    StateRoot: BorshDeserialize,
    StateRoot: BorshDeserialize,
    Vec<(CryptoHash, Vec<u8>, u32)>: BorshDeserialize,
    Vec<(CryptoHash, Vec<u8>, u32)>: BorshDeserialize
[src]

impl BorshSerialize for TrieChanges where
    StateRoot: BorshSerialize,
    StateRoot: BorshSerialize,
    Vec<(CryptoHash, Vec<u8>, u32)>: BorshSerialize,
    Vec<(CryptoHash, Vec<u8>, u32)>: BorshSerialize
[src]

impl Clone for TrieChanges[src]

impl Debug for TrieChanges[src]

impl Eq for TrieChanges[src]

impl PartialEq<TrieChanges> for TrieChanges[src]

impl StructuralEq for TrieChanges[src]

impl StructuralPartialEq for TrieChanges[src]

Auto Trait Implementations

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<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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