pub trait Kernel: SyscallHandler<Self> + 'static {
type CallManager: CallManager;
type Limiter: MemoryLimiter;
// Required methods
fn into_inner(self) -> (Self::CallManager, BlockRegistry)
where Self: Sized;
fn new(
mgr: Self::CallManager,
blocks: BlockRegistry,
caller: u64,
actor_id: u64,
method: u64,
value_received: TokenAmount,
read_only: bool,
) -> Self
where Self: Sized;
fn machine(&self) -> &<Self::CallManager as CallManager>::Machine;
fn limiter_mut(&mut self) -> &mut Self::Limiter;
fn gas_available(&self) -> Gas;
fn charge_gas(
&self,
name: &str,
compute: Gas,
) -> Result<GasTimer, ExecutionError>;
}Expand description
The “kernel” implements the FVM interface as presented to the actors. It:
- Manages the Actor’s state.
- Tracks and charges for IPLD & syscall-specific gas.
Actors may call into the kernel via the syscalls defined in the syscalls
module.
Required Associated Types§
Sourcetype CallManager: CallManager
type CallManager: CallManager
The Kernel’s CallManager is
Sourcetype Limiter: MemoryLimiter
type Limiter: MemoryLimiter
The Kernel’s memory allocation tracker.
Required Methods§
Sourcefn into_inner(self) -> (Self::CallManager, BlockRegistry)where
Self: Sized,
fn into_inner(self) -> (Self::CallManager, BlockRegistry)where
Self: Sized,
Consume the Kernel and return the underlying CallManager and BlockRegistry.
Sourcefn new(
mgr: Self::CallManager,
blocks: BlockRegistry,
caller: u64,
actor_id: u64,
method: u64,
value_received: TokenAmount,
read_only: bool,
) -> Selfwhere
Self: Sized,
fn new(
mgr: Self::CallManager,
blocks: BlockRegistry,
caller: u64,
actor_id: u64,
method: u64,
value_received: TokenAmount,
read_only: bool,
) -> Selfwhere
Self: Sized,
Construct a new Kernel from the given CallManager.
calleris the ID of the immediate caller.actor_idis the ID of this actor.methodis the method that has been invoked.value_receivedis value received due to the current call.blocksis the initial block registry (should already contain the parameters).
Sourcefn machine(&self) -> &<Self::CallManager as CallManager>::Machine
fn machine(&self) -> &<Self::CallManager as CallManager>::Machine
The kernel’s underlying “machine”.
Sourcefn limiter_mut(&mut self) -> &mut Self::Limiter
fn limiter_mut(&mut self) -> &mut Self::Limiter
Give access to the limiter of the underlying call manager.
Sourcefn gas_available(&self) -> Gas
fn gas_available(&self) -> Gas
Returns the remaining gas for the transaction.
Sourcefn charge_gas(
&self,
name: &str,
compute: Gas,
) -> Result<GasTimer, ExecutionError>
fn charge_gas( &self, name: &str, compute: Gas, ) -> Result<GasTimer, ExecutionError>
ChargeGas charges specified amount of gas for execution.
name provides information about gas charging point.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.