pub trait StateView: Sync {
    // Required methods
    fn get(&self, access_path: &AccessPath) -> Result<Option<Vec<u8>>>;
    fn is_genesis(&self) -> bool;

    // Provided method
    fn id(&self) -> StateViewId { ... }
}
Expand description

StateView is a trait that defines a read-only snapshot of the global state. It is passed to the VM for transaction execution, during which the VM is guaranteed to read anything at the given state.

Required Methods§

source

fn get(&self, access_path: &AccessPath) -> Result<Option<Vec<u8>>>

Gets the state for a single access path.

source

fn is_genesis(&self) -> bool

VM needs this method to know whether the current state view is for genesis state creation. Currently TransactionPayload::WriteSet is only valid for genesis state creation.

Provided Methods§

source

fn id(&self) -> StateViewId

For logging and debugging purpose, identifies what this view is for.

Implementors§