pub struct OverlayedChanges { /* private fields */ }
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.

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.

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 the next (in lexicographic order) storage key in the overlayed alongside its value. If no value is next then None is returned.

Returns the next (in lexicographic order) child storage key in the overlayed alongside its value. If no value is next then None is returned.

Read only access ot offchain overlay.

Write a key value pair to the offchain storage overlay.

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

Returns the argument unchanged.

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

Calls U::from(self).

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

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)

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.