Expand description
Transport seam: commands, one-shot replies, and persistent watch sinks.
This module is the message-shaped boundary between a daemon’s
transport-agnostic channel logic and its transport backends (the
abstract-socket daemon today, a Binder backend later). The channel logic
sees commands and watchers, never byte streams: each backend’s only job
is to turn its transport’s native events into TransportEvents and push
structured update values into WatcherSink::push.
The seam is generic over the command and reply payload types (C and R);
the channel logic (e.g. FgCtx/FpsCtx) provides the domain types and
never knows which backend delivered them.
§Two shapes, kept distinct
ReplySinkis one-shot: the single reply to a command, consumed exactly once. The socket backend answers in-line (no hop); a Binder backend unblocks a waiting transaction thread.WatcherId/WatcherSinkare persistent: a long-lived push target with its own close / death lifecycle, outliving any single transaction.
Backends may implement both with the same underlying handle (a socket backend uses one fd for both roles over its lifetime); the seam does not assume that in general.
§Single-owner watcher registry
A watch registration is itself a command, so it flows through the same
ingestion path as ping/status. The reactor thread is therefore the only
actor that ever allocates a WatcherId; TransportEvent::WatcherClosed
and TransportEvent::WatcherDied flow back through the same path and are
processed on that same thread.
§What ships here, and what ships with the Binder backend
This module ships the message types only. The bounded per-channel ingestion
queue + eventfd is Binder-backend machinery: only a Binder backend’s
on_transact fires on an arbitrary threadpool thread (a genuine cross-thread
boundary), while the socket backend’s thread already is the owning reactor
thread and answers in-line with zero hop. The queue is added when the Binder
backend lands, not as dead machinery before any consumer exists.
Structs§
- Reply
Sink - One-shot reply target for a command.
- Watcher
Id - An opaque long-lived handle identifying one watch subscriber.
- Watcher
Sink - Persistent push target for watch updates.
Enums§
- Transport
Event - A transport-agnostic command or watcher-lifecycle event.