Trait fvm::call_manager::CallManager
source · [−]pub trait CallManager: 'static {
type Machine: Machine;
Show 18 methods
fn new(
machine: Self::Machine,
gas_limit: i64,
origin: Address,
nonce: u64
) -> Self;
fn send<K: Kernel<CallManager = Self>>(
&mut self,
from: ActorID,
to: Address,
method: MethodNum,
params: &RawBytes,
value: &TokenAmount
) -> Result<InvocationResult>;
fn with_transaction(
&mut self,
f: impl FnOnce(&mut Self) -> Result<InvocationResult>
) -> Result<InvocationResult>;
fn finish(self) -> (i64, Backtrace, Self::Machine);
fn machine(&self) -> &Self::Machine;
fn machine_mut(&mut self) -> &mut Self::Machine;
fn gas_tracker(&self) -> &GasTracker;
fn gas_tracker_mut(&mut self) -> &mut GasTracker;
fn origin(&self) -> Address;
fn nonce(&self) -> u64;
fn next_actor_idx(&mut self) -> u64;
fn price_list(&self) -> &PriceList { ... }
fn context(&self) -> &MachineContext { ... }
fn blockstore(&self) -> &<Self::Machine as Machine>::Blockstore { ... }
fn externs(&self) -> &<Self::Machine as Machine>::Externs { ... }
fn state_tree(&self) -> &StateTree<<Self::Machine as Machine>::Blockstore> { ... }
fn state_tree_mut(
&mut self
) -> &mut StateTree<<Self::Machine as Machine>::Blockstore> { ... }
fn charge_gas(&mut self, charge: GasCharge<'_>) -> Result<()> { ... }
}
Expand description
The CallManager
manages a single call stack.
When a top-level message is executed:
- The
crate::executor::Executor
creates aCallManager
for that message, giving itself to theCallManager
. - The
crate::executor::Executor
calls the specified actor/method usingCallManager::send()
. - The
CallManager
then constructs aKernel
and executes the actual actor code on that kernel. - If an actor calls another actor, the
Kernel
will:- Detach the
CallManager
from itself. - Call
CallManager::send()
to execute the new message. - Re-attach the
CallManager
. - Return.
- Detach the
Associated Types
The underlying Machine
on top of which this CallManager
executes.
Required methods
Construct a new call manager.
fn send<K: Kernel<CallManager = Self>>(
&mut self,
from: ActorID,
to: Address,
method: MethodNum,
params: &RawBytes,
value: &TokenAmount
) -> Result<InvocationResult>
fn send<K: Kernel<CallManager = Self>>(
&mut self,
from: ActorID,
to: Address,
method: MethodNum,
params: &RawBytes,
value: &TokenAmount
) -> Result<InvocationResult>
Send a message. The type parameter K
specifies the the kernel on top of which the target
actor should execute.
fn with_transaction(
&mut self,
f: impl FnOnce(&mut Self) -> Result<InvocationResult>
) -> Result<InvocationResult>
fn with_transaction(
&mut self,
f: impl FnOnce(&mut Self) -> Result<InvocationResult>
) -> Result<InvocationResult>
Execute some operation (usually a send) within a transaction.
Finishes execution, returning the gas used and the machine.
fn machine_mut(&mut self) -> &mut Self::Machine
fn machine_mut(&mut self) -> &mut Self::Machine
Returns a mutable reference to the machine.
fn gas_tracker(&self) -> &GasTracker
fn gas_tracker(&self) -> &GasTracker
Returns reference to the gas tracker.
fn gas_tracker_mut(&mut self) -> &mut GasTracker
fn gas_tracker_mut(&mut self) -> &mut GasTracker
Returns a mutable reference to the gas tracker.
fn next_actor_idx(&mut self) -> u64
fn next_actor_idx(&mut self) -> u64
Gets and increment the call-stack actor creation index.
Provided methods
fn price_list(&self) -> &PriceList
fn price_list(&self) -> &PriceList
Returns the current price list.
fn context(&self) -> &MachineContext
fn context(&self) -> &MachineContext
Returns the machine context.
fn blockstore(&self) -> &<Self::Machine as Machine>::Blockstore
fn blockstore(&self) -> &<Self::Machine as Machine>::Blockstore
Returns the blockstore.
fn state_tree(&self) -> &StateTree<<Self::Machine as Machine>::Blockstore>
fn state_tree(&self) -> &StateTree<<Self::Machine as Machine>::Blockstore>
Returns the state tree.
fn state_tree_mut(
&mut self
) -> &mut StateTree<<Self::Machine as Machine>::Blockstore>
fn state_tree_mut(
&mut self
) -> &mut StateTree<<Self::Machine as Machine>::Blockstore>
Returns a mutable state-tree.
fn charge_gas(&mut self, charge: GasCharge<'_>) -> Result<()>
fn charge_gas(&mut self, charge: GasCharge<'_>) -> Result<()>
Charge gas.