Expand description
Generic dedicated-thread bridge between the tokio control plane and a Commonware-runtime-backed durable store.
Built slice by slice against the invariants every host migration
(PersonaHost, EventLogHost) depends on:
- INV-H1: dropping a
HostHandlenever deadlocks — the command sender is dropped before the dedicated thread is joined. - INV-H2: an eager
Body::openfailure surfaces asspawn_host’sErr, before any command can be sent — never as a silently-empty host. - INV-H3: a lazy
Body::open(returnsOk(())immediately) followed by a command that fails insideBody::handlenever crashes the command loop. - INV-H4: a command already queued on the channel when
shutdown.cancel()fires is still processed by the post-cancellation drain, not lost. - INV-H5:
Body::on_drain_completefires strictly after the drain has run every command it queued. - INV-H6: a caller-supplied
(Sender, Receiver)pair (spawn_host_with_channel) drives the exact same ready handshake/loop/drain/on_drain_complete/Dropmachinery as an internally-created one (spawn_host) — the only difference is who constructs the channel.EventLogHost’s 4 shards need this: every shard’sSendermust exist and be handed to every OTHER shard’sBodybefore any shard’s thread starts (a chicken-and-egg an internally-built channel can’t resolve), so the caller builds all its channels up front and hands each shard its own(Sender, Receiver)pair.
Structs§
- Closed
- The dedicated host has shut down; a
callcould not be served. - Host
Handle - Handle to a durable host running on its dedicated Commonware-runtime thread.
- Host
Options - Configuration for one dedicated host thread.
Enums§
- Spawn
Error - Error starting a dedicated host thread.
Traits§
- Body
- Per-host behavior plugged into the generic dedicated-thread bridge.
Functions§
- call
- Send one command carrying a fresh
oneshotack, and await the reply. - spawn_
host - Spawn a dedicated Commonware-runtime thread hosting
body, rooted atopts.storage_dir, and returns once the thread has reported readiness. - spawn_
host_ with_ channel - Spawn a dedicated Commonware-runtime thread hosting
body, using a caller-supplied(Sender, Receiver)pair instead of onespawn_hostcreates internally (INV-H6).