Skip to main content

ComponentRuntime

Struct ComponentRuntime 

Source
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

Source

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.

Source

pub fn registry(&self) -> &ComponentRegistry

Borrows the host’s authority surface (register, grant, start, probe, stop — the unchanged ComponentRegistry API).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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).

Source

pub fn live_process_count(&self) -> usize

Live process count — the zero-residue check after ordered stop.

Source

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.

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more