polyc-eventlog-host 2026.9.4

Durable turn-persistence host: a dedicated-thread Commonware event-log bridge for the tokio control plane (#459).
docs.rs failed to build polyc-eventlog-host-2026.9.4
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

Durable turn persistence host: a Commonware-runtime event log bridged to the tokio control plane.

commonware-runtime cannot be nested inside tokio — commonware_runtime::tokio::Runner::start builds its own multi-threaded tokio runtime and would panic on a nested block_on if called from within a live tokio runtime. So the event log runs on a dedicated OS thread that owns a Commonware tokio runtime; the tokio control plane talks to it over channels. That generic bridge (thread spawn, ready handshake, command loop, post-cancel drain) is [polyc_host] — the same shape polyc_persona::PersonaHost uses. This host is sharded (NUM_SHARDS independent polyc_host::HostHandles, one per shard) rather than a single dedicated thread — see [EventLogHost]'s own doc for why, and its [Drop] impl for the one place this host layers something on top of polyc-host's generic drop-tx-then-join semantics.

On-disk layout

Each shard roots its own Commonware runtime under its own subdirectory, <storage_dir>/shard-<k>/ for k in 0..NUM_SHARDS — never at storage_dir itself. A partition's directories ({name}_data, its _offsets-* siblings, and its __eventcount_checkpoint) live entirely under shard_index(name, NUM_SHARDS)'s directory; [shard_storage_dir] computes it. This is load-bearing, not cosmetic: commonware-runtime's Hold holds an exclusive advisory lock on <root>/.hold for the life of each Runner, so shards sharing one root would serialize behind each other at startup instead of running concurrently. [EventLogHost::spawn] migrates a pre-sharding flat layout into this one on first boot — see migrate_flat_layout and INV-39 in docs/specifications/invariants.md.

Bridge shape

tokio control plane                       dedicated OS thread
───────────────────                       ───────────────────
EventLogHost::append_batch(..) ── Command ──▶ commonware tokio Runner.start(|ctx| {
  (tokio mpsc send)                            EventLog::open(ctx, ..)
        ◀── oneshot ack ──                     loop { rx.recv() -> appends + commit }

On startup [EventLogHost::spawn] launches every shard's thread and blocks (briefly, off the async path) until each has reported readiness. [EventLogHost::append_batch] is async and callable from tokio: it enqueues one Command (a whole turn's events) and awaits a oneshot ack. Dropping the host (or cancelling its [CancellationToken]) cancels every shard, which drains its loop, syncs its logs, lets Runner::start return, and joins its thread — clean shutdown.