pub struct Cache { /* private fields */ }Expand description
A cache of changes to the state of the blockchain.
A StateDelta is Cache above a StateRead.
Implementations§
Source§impl Cache
 
impl Cache
Sourcepub fn unwritten_changes(&self) -> &BTreeMap<String, Option<Vec<u8>>>
 
pub fn unwritten_changes(&self) -> &BTreeMap<String, Option<Vec<u8>>>
Inspect the cache of unwritten changes to the verifiable state.
Sourcepub fn nonverifiable_changes(&self) -> &BTreeMap<Vec<u8>, Option<Vec<u8>>>
 
pub fn nonverifiable_changes(&self) -> &BTreeMap<Vec<u8>, Option<Vec<u8>>>
Inspect the cache of unwritten changes to the nonverifiable state.
Sourcepub fn merge(&mut self, other: Cache)
 
pub fn merge(&mut self, other: Cache)
Merge the given cache with this one, taking its writes in place of ours.
Sourcepub fn apply_to<S: StateWrite>(self, state: S)
 
pub fn apply_to<S: StateWrite>(self, state: S)
Consume this cache, applying its writes to the given state.
Sourcepub fn is_dirty(&self) -> bool
 
pub fn is_dirty(&self) -> bool
Returns true if there are cached writes on top of the snapshot, and false otherwise.
Sourcepub fn take_events(&mut self) -> Vec<Event>
 
pub fn take_events(&mut self) -> Vec<Event>
Extracts and returns the ABCI events contained in this cache.
Sourcepub fn shard_by_prefix(
    self,
    prefixes: &MultistoreConfig,
) -> BTreeMap<Arc<SubstoreConfig>, Self>
 
pub fn shard_by_prefix( self, prefixes: &MultistoreConfig, ) -> BTreeMap<Arc<SubstoreConfig>, Self>
Consumes a Cache and returns a map of SubstoreConfig to Cache that
corresponds to changes belonging to each substore. The keys in each Cache
are truncated to remove the substore prefix.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cache
impl !RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl !UnwindSafe for Cache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
 
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> IntoRequest<T> for T
 
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
 
fn into_request(self) -> Request<T>
Wrap the input message 
T in a tonic::Request