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 [
HostHandle] never deadlocks — the command sender is dropped before the dedicated thread is joined. - INV-H2: an eager [
Body::open] failure surfaces as [spawn_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 inside [Body::handle] never 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_complete] fires 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.