pub struct HostBuilder { /* private fields */ }Expand description
Builder that mounts modules and lowers them into a runnable Host.
Implementations§
Source§impl HostBuilder
impl HostBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an empty host builder backed by the production ThreadSpawn.
Sourcepub fn receipt_sink<S>(self, sink: S) -> Selfwhere
S: ReceiptSink + 'static,
pub fn receipt_sink<S>(self, sink: S) -> Selfwhere
S: ReceiptSink + 'static,
Attach the receipt sink the composed runtime records into.
Sourcepub fn status_sink<S>(self, sink: S) -> Self
pub fn status_sink<S>(self, sink: S) -> Self
Wire an operation-status sink through to the composed runtime.
Operations mounted through this host then emit
syncbat::OperationStatusFactV1 lifecycle facts (started / terminal)
exactly as they would through a bare
syncbat::CoreBuilder::status_sink. Without a sink bound, no
lifecycle facts are recorded.
Sourcepub fn grant_capability(self, capability: impl Into<String>) -> Self
pub fn grant_capability(self, capability: impl Into<String>) -> Self
Grant one runtime capability token to the composed runtime (repeatable).
An operation declaring a required capability token (via
OperationEffectRow::requires_capability or the #[operation] macro)
dispatches only when every named token was granted here; otherwise the
runtime fails closed, exactly as with
syncbat::CoreBuilder::grant_capability.
Sourcepub fn grant_capabilities<I, S>(self, capabilities: I) -> Self
pub fn grant_capabilities<I, S>(self, capabilities: I) -> Self
Grant several runtime capability tokens; see Self::grant_capability
for the gate semantics.
Sourcepub fn effect_backend<B>(self, backend: B) -> Selfwhere
B: EffectBackend + 'static,
pub fn effect_backend<B>(self, backend: B) -> Selfwhere
B: EffectBackend + 'static,
Attach the runtime-owned effect backend operations append through.
Operations append events only via Ctx, which performs the append
through this backend; without it bound, an append_event call fails
closed instead of reaching a store the runtime did not mediate.
Sourcepub fn host_control<C>(self, controller: C) -> Selfwhere
C: HostController + 'static,
pub fn host_control<C>(self, controller: C) -> Selfwhere
C: HostController + 'static,
Attach the controller that performs a Control operation’s declared host
controls.
Control operations reach host authority only via Ctx, which performs
the identified control through this controller; without it bound, a
use_host_control call fails closed instead of touching the host. The
composed host-control backend layers OUTER over any effect_backend,
so the store axes still flow through that inner backend.
Sourcepub fn mount(self, module: HostModule) -> Result<Self, HostError>
pub fn mount(self, module: HostModule) -> Result<Self, HostError>
Mount a module, validating it against everything already mounted.
§Errors
A HostError collision variant if the module’s id, any operation,
receipt namespace, or job kind clashes with a mounted module; or
HostError::ModuleHashMismatch if the module’s manifest does not match
its declared parts.
Sourcepub fn build(self) -> Result<Host, HostError>
pub fn build(self) -> Result<Host, HostError>
Lower the mounted modules into a runnable Host.
§Errors
HostError::EmptyHost if nothing is mounted; HostError::ModuleCoherence
if a declared operation has no handler; HostError::Build if the lowered
syncbat runtime does not validate; or HostError::CanonicalEncoding if
the fingerprint cannot be sealed.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for HostBuilder
impl !Send for HostBuilder
impl !Sync for HostBuilder
impl !UnwindSafe for HostBuilder
impl Freeze for HostBuilder
impl Unpin for HostBuilder
impl UnsafeUnpin for HostBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more