Struct sp_state_machine::OverlayedChanges[][src]

pub struct OverlayedChanges { /* fields omitted */ }
Expand description

The set of changes that are overlaid onto the backend.

It allows changes to be modified using nestable transactions.

Implementations

Whether no changes are contained in the top nor in any of the child changes.

Ask to collect/not to collect extrinsics indices where key(s) has been changed.

Returns a double-Option: None if the key is unknown (i.e. and the query should be referred to the backend); Some(None) if the key has been deleted. Some(Some(…)) for a key whose value has been set.

Returns mutable reference to current value. If there is no value in the overlay, the given callback is used to initiate the value. Warning this function registers a change, so the mutable reference MUST be modified.

Can be rolled back or committed when called inside a transaction.

Returns a double-Option: None if the key is unknown (i.e. and the query should be referred to the backend); Some(None) if the key has been deleted. Some(Some(…)) for a key whose value has been set.

Set a new value for the specified key.

Can be rolled back or committed when called inside a transaction.

Returns the current nesting depth of the transaction stack.

A value of zero means that no transaction is open and changes are committed on write.

Start a new nested transaction.

This allows to either commit or roll back all changes that where made while this transaction was open. Any transaction must be closed by either rollback_transaction or commit_transaction before this overlay can be converted into storage changes.

Changes made without any open transaction are committed immediately.

Rollback the last transaction started by start_transaction.

Any changes made during that transaction are discarded. Returns an error if there is no open transaction that can be rolled back.

Commit the last transaction started by start_transaction.

Any changes made during that transaction are committed. Returns an error if there is no open transaction that can be committed.

Call this before transfering control to the runtime.

This protects all existing transactions from being removed by the runtime. Calling this while already inside the runtime will return an error.

Call this when control returns from the runtime.

This commits all dangling transaction left open by the runtime. Calling this while outside the runtime will return an error.

Consume all changes (top + children) and return them.

After calling this function no more changes are contained in this changeset.

Panics: Panics if transaction_depth() > 0

Get an iterator over all child changes as seen by the current transaction.

Get an iterator over all top changes as been by the current transaction.

Get an optional iterator over all child changes stored under the supplied key.

Get an list of all index operations.

Convert this instance with all changes into a StorageChanges instance.

Drain all changes into a StorageChanges instance. Leave empty overlay in place.

Generate the storage root using backend and all changes as seen by the current transaction.

Returns the storage root and caches storage transaction in the given cache.

Generate the changes trie root.

Returns the changes trie root and caches the storage transaction into the given cache.

Panics

Panics on storage error, when panic_on_storage_error is set.

Returns an iterator over the keys (in lexicographic order) following key (excluding key) alongside its value.

Returns an iterator over the keys (in lexicographic order) following key (excluding key) alongside its value for the given storage_key child.

Read only access ot offchain overlay.

Write a key value pair to the offchain storage overlay.

Add transaction index operation.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Get a reference to the inner from the outer.

Get a mutable reference to the inner from the outer.

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The counterpart to unchecked_from.