Skip to main content

RuntimeService

Struct RuntimeService 

Source
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

Source

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.

Source

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.

Source

pub fn create_instance(&mut self, config: InstanceConfig) -> InstanceId

Create a fresh kernel instance and return its InstanceId.

Source

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.

Source

pub fn export_wal(self) -> Option<Wal>

Drain the kernel’s internal WAL (consumes the service so the kernel cannot continue stepping after export).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.