swactor/crates/iroh-driver
Zachery Aaron Shores-Chmielewski 01326b05ed chore(docs): adopt repo-local spec workflow
Specs gain a monotonic Id and relocate by their true status: drafts
(WIP/aspirational) to docs/specs/drafts/, and accurate code-behavior
references stay in their crate dirs. docs/specs/archive/ is reserved for
superseded docs (currently empty).

Dispositions were cross-referenced against code, not the specs' own headers.
IROH_DRIVER claimed "current-state" but ~30% is unbuilt redesign, so it moves
to drafts. DATA_PLANE_ACTOR's central integration claim is unrealized (myelin
bypasses its node actor), and ACTOR_PANEL is not a reference; both are dropped
rather than reviewed or archived. DATASTREAM and MANAGED_PROCESS stay as
references; MYELIN stays in place (stale, flagged for review).

From here, commit titles reference a spec by [N] when one applies. This
bootstrap commit does not carry one.
2026-08-09 15:19:39 +04:00
..
src refactor: more yoke grind 2026-07-30 15:31:23 +04:00
tests refactor: fold driver pumps into iroh-driver and codecs into transport 2026-07-30 12:18:02 +04:00
Cargo.toml feat: proper README, LICENSE, and our first quick example 2026-08-06 00:53:16 +04:00
README.md stash refactor 2026-06-24 00:10:41 +04:00

iroh-driver

iroh-driver is the iroh-backed transport bridge for the actorized distribution stack. It owns the concrete iroh endpoint, QUIC connections, relay configuration, peer authorization, and frame shuttling between iroh and swactor actor mailboxes.

Tokio runtime ownership

The driver needs Tokio because iroh's endpoint, accepts, dials, stream reads/writes, retry timers, and shutdown APIs are async. New call sites should make that engine explicit by constructing the driver with:

let driver = IrohDriver::with_handle(tokio_handle, config)?;

with_handle does not own the Tokio runtime. The caller must keep the runtime alive for as long as the driver exists.

Legacy implicit constructor

IrohDriver::new(config) is still present as a compatibility convenience, but it hides runtime ownership:

  • If called inside an existing Tokio runtime, it uses Handle::try_current() and shares that ambient engine.
  • If called outside Tokio, it silently builds and owns a multi-threaded Tokio runtime with enable_all().

Avoid IrohDriver::new in new production code. Use with_handle or an explicit engine wrapper at the application boundary so every Tokio engine in the process is visible in construction code.

Sync facade caveat

The synchronous facade methods that bridge to async with block_on must run from a non-async thread. Do not call those methods from inside tasks running on the same Tokio runtime; Tokio will panic on nested block_on.