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: ActorID,
actor_id: ActorID,
method: MethodNum,
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>;
}
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: ActorID,
actor_id: ActorID,
method: MethodNum,
value_received: TokenAmount,
read_only: bool,
) -> Selfwhere
Self: Sized,
fn new(
mgr: Self::CallManager,
blocks: BlockRegistry,
caller: ActorID,
actor_id: ActorID,
method: MethodNum,
value_received: TokenAmount,
read_only: bool,
) -> Selfwhere
Self: Sized,
Construct a new Kernel
from the given CallManager
.
caller
is the ID of the immediate caller.actor_id
is the ID of this actor.method
is the method that has been invoked.value_received
is value received due to the current call.blocks
is 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.
Object Safety§
This trait is not object safe.