Expand description
Production embedding: shutdown, remote I/O, untrusted modules.
§Production embedding checklist
Byteflow is an in-process flow runtime. Production means the host owns I/O, policy, and shutdown — not a separate cluster daemon.
Use this page with audit-checklist.md when hardening
a deployment.
§Untrusted bytecode
- Always construct the runtime through
Runtime::with_natives_and_config(orRuntime::with_attested) soverify_withruns before workers start. - Keep
TrustLevel::Untrustedunless you control every constant in the chunk. - Prefer
QuotaConfig::sandboxand explicitRuntimeConfig::max_flows,RuntimeConfig::max_ask_waits, and relation caps (max_links,max_monitors,max_registry_names). - Do not expose
Runtime::sendto untrusted plugins; use Caps and confined spawns. - For replayed remote frames, set
RuntimeConfig::remote_dedup_windowto a non-zero window (for example4096).RemoteFrameDedupis wired automatically; duplicates are acknowledged withOk(())and are not delivered twice.
§Shutdown (liveness)
Order for a clean exit:
- Stop accepting new host work (HTTP, sockets, etc.).
- Let flows finish or call
Runtime::shutdown— parked receives wake withFlowOutcome::Failed("runtime shutdown"), not a hungFlowHandle::join. - If using
DistributionBridge:wait_bridge_drained, then [TcpOutboundHandle::wait_wire_drained], then [TcpOutboundHandle::stop]. - Drop inbound
TcpInboundHandleafter sessions finish (stopwaits up to 5s).
§Remote hops (host-owned socket)
Byteflow does not authenticate TCP peers.
| Responsibility | Owner |
|---|---|
| TLS, mTLS, firewall | Host |
Map OutboundHop::node → socket | NodeRouter / your code |
| Drain bridge → wire | spawn_tcp_outbound or custom pump |
| Wire → inbox | spawn_tcp_inbound → Runtime::deliver_frame |
| Replay / at-least-once | Host (RemoteFrameDedup optional) |
Minimum viable remote path: see remote-transport.md and
examples/remote_hop_tcp.rs (channel deliver on the runtime thread — no mutex
around the whole Runtime).
§Observability
- Counters:
Runtime::metrics. - Point-in-time:
Runtime::snapshot(flows, bridge depth, memory ceiling). - Diagnostics:
BYTEFLOW_LOG=infoorRuntimeConfig::log.
§What this runtime is not
- Not Tokio — use
HostAwaitBridgefor async host I/O. - Not BEAM distribution — no transparent
CaporPidacross nodes. - Not a global ETS — tables are per owning flow unless you build a registry service.