pub struct ComponentRuntime { /* private fields */ }Expand description
The composed component runtime: scheduler + registry, correctly assembled.
Composition happens once, in ComponentRuntime::compose, with the
built-in-function registry populated before any bytecode can load (see the
module docs for the full composition story). The
scheduler itself stays private: the host’s authority surface is
ComponentRuntime::registry, support modules travel as opaque handles,
and teardown is the residue-checked ComponentRuntime::shutdown.
Implementations§
Source§impl ComponentRuntime
impl ComponentRuntime
Sourcepub fn compose(policy: RuntimePolicy) -> Result<Self, RuntimeError>
pub fn compose(policy: RuntimePolicy) -> Result<Self, RuntimeError>
Composes the runtime with its built-in-function registry populated
before any bytecode can load (the composition
crate::composition::compose_scheduler performs, absorbed).
§Errors
Refuses a zero thread count or zero operation timeout with typed policy errors, and propagates every typed scheduler-composition failure.
Sourcepub fn registry(&self) -> &ComponentRegistry
pub fn registry(&self) -> &ComponentRegistry
Borrows the host’s authority surface (register, grant, start, probe,
stop — the unchanged ComponentRegistry API).
Sourcepub fn registry_handle(&self) -> Arc<ComponentRegistry>
pub fn registry_handle(&self) -> Arc<ComponentRegistry>
A shared handle to the same authority surface, for a management
adapter running on its own thread (the F-7b dev door). The handle
may outlive shutdown; operations against a stopped scheduler
fail typed, never silently.
Sourcepub fn load_support_module(
&self,
bytecode: &[u8],
) -> Result<SupportModuleHandle, RuntimeError>
pub fn load_support_module( &self, bytecode: &[u8], ) -> Result<SupportModuleHandle, RuntimeError>
Loads a support module (e.g. a component’s FFI bytecode) and returns an opaque handle for ordered unload.
The freshly committed module passes the same deferred-erlang:* wall
the registry applies to component bytecode: a module whose import
table still defers a built-in would die at first dispatch, so it is
refused — and removed again — up front.
§Errors
Returns typed failures for loader refusal, a module absent immediately
after load, or deferred erlang:* imports.
Sourcepub fn unload_support_module(
&self,
handle: SupportModuleHandle,
) -> Result<(), RuntimeError>
pub fn unload_support_module( &self, handle: SupportModuleHandle, ) -> Result<(), RuntimeError>
Ordered unload with verification: purge any retained old generation, delete the current one, then verify the module is actually gone.
§Errors
Returns typed failures for an unsafe purge, a failed delete (a stale handle to an already-unloaded module lands here), or post-delete lookup residue.
Sourcepub fn swap_support_module(
&self,
current: &SupportModuleRef,
bytecode: &[u8],
) -> Result<SupportModuleRef, RuntimeError>
pub fn swap_support_module( &self, current: &SupportModuleRef, bytecode: &[u8], ) -> Result<SupportModuleRef, RuntimeError>
Hot-swaps a support module to new bytes of the SAME module name —
see SupportSwapper::swap, which this delegates to.
§Errors
Returns typed failures for an unsafe purge, loader refusal, a
module absent immediately after load, or deferred erlang:*
imports.
Sourcepub fn support_swapper(&self) -> SupportSwapper
pub fn support_swapper(&self) -> SupportSwapper
A thread-shareable handle for support-module swaps, for a management adapter running on its own thread (the F-7b dev door).
Sourcepub fn live_process_count(&self) -> usize
pub fn live_process_count(&self) -> usize
Live process count — the zero-residue check after ordered stop.
Sourcepub fn shutdown(self) -> Result<(), RuntimeError>
pub fn shutdown(self) -> Result<(), RuntimeError>
Final teardown; refuses if the process tree still has residue.
Scheduler::shutdown is never cleanup: every component must have
completed its ordered stop first. A refusal deliberately does NOT stop
the scheduler — live processes are the embedder’s unfinished ordered
stop, and reaping them here would hide it.
§Errors
Returns the live process count as a typed residue refusal.