Trait forest_filecoin::shim::fvm_latest::machine::Machine

source ·
pub trait Machine: 'static {
    type Blockstore: Blockstore;
    type Externs: Externs;
    type Limiter: MemoryLimiter;

    // Required methods
    fn blockstore(&self) -> &Self::Blockstore;
    fn context(&self) -> &MachineContext;
    fn externs(&self) -> &Self::Externs;
    fn builtin_actors(&self) -> &Manifest;
    fn state_tree(&self) -> &StateTree<Self::Blockstore>;
    fn state_tree_mut(&mut self) -> &mut StateTree<Self::Blockstore>;
    fn into_store(self) -> Self::Blockstore;
    fn machine_id(&self) -> &str;
    fn new_limiter(&self) -> Self::Limiter;

    // Provided method
    fn flush(&mut self) -> Result<Cid<64>, ExecutionError> { ... }
}
Expand description

The Machine is the top-level object of the FVM.

The Machine operates at a concrete network version and epoch, over an initial state root, all of which must be specified at instantiation time.

It is instantiated by the node with concrete Blockstore and Externs implementations.

The Machine is designed to be used in conjunction with the Executor, which is bound to a concrete Machine and is in charge of facilitating message execution.

Required Associated Types§

Required Methods§

source

fn blockstore(&self) -> &Self::Blockstore

Returns a reference to the machine’s blockstore.

source

fn context(&self) -> &MachineContext

Returns a reference to the machine context: static information about the current execution context.

source

fn externs(&self) -> &Self::Externs

Returns a reference to all “node” supplied APIs.

source

fn builtin_actors(&self) -> &Manifest

Returns the builtin actor index.

source

fn state_tree(&self) -> &StateTree<Self::Blockstore>

Returns an immutable reference to the state tree.

source

fn state_tree_mut(&mut self) -> &mut StateTree<Self::Blockstore>

Returns a mutable reference to the state tree.

source

fn into_store(self) -> Self::Blockstore

Consumes the machine and returns the owned blockstore.

source

fn machine_id(&self) -> &str

Returns a generated ID of a machine

source

fn new_limiter(&self) -> Self::Limiter

Creates a new limiter to track the resources of a message execution.

Provided Methods§

source

fn flush(&mut self) -> Result<Cid<64>, ExecutionError>

Flushes the state-tree and returns the new root CID.

Implementations on Foreign Types§

source§

impl<M> Machine for Box<M>
where M: Machine,

Implementors§

source§

impl<B, E> Machine for DefaultMachine<B, E>
where B: Blockstore + 'static, E: Externs + 'static,