pub struct MemoryStorage { /* private fields */ }
Expand description

In-memory storage implementation for the interpreter.

It tracks 3 states:

  • memory: the transactions will be applied to this state.
  • transacted: will receive the committed memory state.
  • persisted: will receive the persisted transacted state.

Implementations§

Create a new memory storage.

Iterate over all contract state in storage

Fetch a mapping from the contract state.

Set the transacted state to the memory state.

Revert the memory state to the transacted state.

Revert the memory and transacted changes to the persisted state.

Persist the changes from transacted to memory+persisted state.

Trait Implementations§

Converts this type into a mutable reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
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
Converts to this type from the input type.
Error implementation for reasons unspecified in the protocol.
Provide the current block height in which the transactions should be executed. Read more
Return the timestamp of a given block Read more
Provide the block hash from a given height.
Provide the coinbase address for the VM instructions implementation.
Fetch a range of values from a key-value mapping in a contract storage. Returns the full range requested using optional values in case a requested slot is unset. Read more
Insert a range of key-value mappings into contract storage. Returns None if any of the keys in the range were previously unset. Read more
Remove a range of key-values from contract storage. Returns None if any of the keys in the range were already unset. Read more
Deploy a contract into the storage
Deploy a contract into the storage with contract id
Fetch a previously inserted contract code from the chain state for a given contract. Read more
Append a contract to the chain, provided its identifier. Read more
Check if a provided contract exists in the chain.
Fetch a previously inserted salt+root tuple from the chain state for a given contract. Read more
Append the salt+root of a contract that was appended to the chain.
Fetch the value form a key-value mapping in a contract storage.
Insert a key-value mapping in a contract storage.
Remove a key-value mapping from a contract storage.
Fetch the balance of an asset ID in a contract storage.
Update the balance of an asset ID in a contract storage.
Return the merkle root of the stored Type in the storage. Read more
Return the merkle root of the stored Type in the storage. Read more
Retrieve Cow<Value> such as Key->Value.
Return true if there is a Key mapping to a value in the storage.
Retrieve Cow<Value> such as Key->Value.
Return true if there is a Key mapping to a value in the storage.
Retrieve Cow<Value> such as Key->Value.
Return true if there is a Key mapping to a value in the storage.
Retrieve Cow<Value> such as Key->Value.
Return true if there is a Key mapping to a value in the storage.
Append Key->Value mapping to the storage. Read more
Remove Key->Value mapping from the storage. Read more
Append Key->Value mapping to the storage. Read more
Remove Key->Value mapping from the storage. Read more
Append Key->Value mapping to the storage. Read more
Remove Key->Value mapping from the storage. Read more
Append Key->Value mapping to the storage. Read more
Remove Key->Value mapping from the storage. 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.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
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.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more