pub struct RuntimeService { /* private fields */ }Expand description
Service-layer wrapper around arkhe_kernel::Kernel. Builds a
kernel with WAL configured and exposes a forge-shaped dispatch API.
Implementations§
Source§impl RuntimeService
impl RuntimeService
Sourcepub fn new(world_id: [u8; 32], manifest_digest: [u8; 32]) -> Self
pub fn new(world_id: [u8; 32], manifest_digest: [u8; 32]) -> Self
Construct a service backed by a chain-only WAL writer (L0
SignatureClass::None). world_id and manifest_digest are
pinned into the WAL header.
Sourcepub fn register_action<A: Action>(&mut self)
pub fn register_action<A: Action>(&mut self)
Register a forge ArkheAction so the kernel will execute it
when scheduled. Any forge action whose type bears
#[derive(ArkheAction)] automatically satisfies the kernel
Action bound through the derive’s emitted kernel-side
stack.
Sourcepub fn create_instance(&mut self, config: InstanceConfig) -> InstanceId
pub fn create_instance(&mut self, config: InstanceConfig) -> InstanceId
Create a fresh kernel instance and return its InstanceId.
Sourcepub fn dispatch<A>(
&mut self,
instance: InstanceId,
principal: Principal,
action: &A,
at: Tick,
caps: CapabilityMask,
) -> Result<StepReport, ArkheError>where
A: Action,
pub fn dispatch<A>(
&mut self,
instance: InstanceId,
principal: Principal,
action: &A,
at: Tick,
caps: CapabilityMask,
) -> Result<StepReport, ArkheError>where
A: Action,
Dispatch a forge action — postcard-encode its canonical bytes,
submit at tick at, then step the kernel once with caps.
Returns the kernel’s StepReport so the caller can inspect
actions_executed / effects_applied / effects_denied.
§Errors
Returns the kernel’s ArkheError surface verbatim. The
most common case is InstanceNotFound if instance is not
live; capability denial happens inside step and is reflected
in the returned report’s effects_denied count rather than as
an Err from this function.
Sourcepub fn export_wal(self) -> Option<Wal>
pub fn export_wal(self) -> Option<Wal>
Drain the kernel’s internal WAL (consumes the service so the kernel cannot continue stepping after export).