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> { ... }
}
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§
sourcefn blockstore(&self) -> &Self::Blockstore
fn blockstore(&self) -> &Self::Blockstore
Returns a reference to the machine’s blockstore.
sourcefn context(&self) -> &MachineContext
fn context(&self) -> &MachineContext
Returns a reference to the machine context: static information about the current execution context.
sourcefn builtin_actors(&self) -> &Manifest
fn builtin_actors(&self) -> &Manifest
Returns the builtin actor index.
sourcefn state_tree(&self) -> &StateTree<Self::Blockstore>
fn state_tree(&self) -> &StateTree<Self::Blockstore>
Returns an immutable reference to the state tree.
sourcefn state_tree_mut(&mut self) -> &mut StateTree<Self::Blockstore>
fn state_tree_mut(&mut self) -> &mut StateTree<Self::Blockstore>
Returns a mutable reference to the state tree.
sourcefn into_store(self) -> Self::Blockstore
fn into_store(self) -> Self::Blockstore
Consumes the machine and returns the owned blockstore.
sourcefn machine_id(&self) -> &str
fn machine_id(&self) -> &str
Returns a generated ID of a machine
sourcefn new_limiter(&self) -> Self::Limiter
fn new_limiter(&self) -> Self::Limiter
Creates a new limiter to track the resources of a message execution.