Struct sp_state_machine::ChangesTrieBuildCache[][src]

pub struct ChangesTrieBuildCache<H, N> { /* fields omitted */ }

Changes trie build cache.

Helps to avoid read of changes tries from the database when digest trie is built. It holds changed keys for every block (indexed by changes trie root) that could be referenced by future digest items. For digest entries it also holds keys covered by this digest. Entries for top level digests are never created, because they'll never be used to build other digests.

Entries are pruned from the cache once digest block that is using this entry is inserted (because digest block will includes all keys from this entry). When there's a fork, entries are pruned when first changes trie is inserted.

Implementations

impl<H, N> BuildCache<H, N> where
    N: Eq + Hash,
    H: Eq + Hash + Clone
[src]

pub fn new() -> Self[src]

Create new changes trie build cache.

pub fn get(
    &self,
    root: &H
) -> Option<&HashMap<Option<PrefixedStorageKey>, HashSet<StorageKey>>>
[src]

Get cached changed keys for changes trie with given root.

pub fn with_changed_keys(
    &self,
    root: &H,
    functor: &mut dyn FnMut(&HashMap<Option<PrefixedStorageKey>, HashSet<StorageKey>>)
) -> bool
[src]

Execute given functor with cached entry for given block. Returns true if the functor has been called and false otherwise.

pub fn perform(&mut self, action: CacheAction<H, N>)[src]

Insert data into cache.

Auto Trait Implementations

impl<H, N> RefUnwindSafe for BuildCache<H, N> where
    H: RefUnwindSafe,
    N: RefUnwindSafe
[src]

impl<H, N> Send for BuildCache<H, N> where
    H: Send,
    N: Send
[src]

impl<H, N> Sync for BuildCache<H, N> where
    H: Sync,
    N: Sync
[src]

impl<H, N> Unpin for BuildCache<H, N> where
    H: Unpin,
    N: Unpin
[src]

impl<H, N> UnwindSafe for BuildCache<H, N> where
    H: UnwindSafe,
    N: UnwindSafe
[src]

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> From<T> for T[src]

impl<T> Instrument for T[src]

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

impl<T, Outer> IsWrappedBy<Outer> for T where
    T: From<Outer>,
    Outer: AsRef<T> + AsMut<T> + From<T>, 
[src]

pub fn from_ref(outer: &Outer) -> &T[src]

Get a reference to the inner from the outer.

pub fn from_mut(outer: &mut Outer) -> &mut T[src]

Get a mutable reference to the inner from the outer.

impl<T> MaybeRefUnwindSafe for T where
    T: RefUnwindSafe

impl<T> Same<T> for T

type Output = T

Should always be Self

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<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

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