Expand description
UdsSession — one [web_transport_trait::Session] over a Unix-domain socket.
Epic #131 / moq M1. Same-host processes keep an ipc transport after the ZMQ
removal, but re-platformed off ZMQ framing onto the same generic plane that
quinn and iroh use: a [web_transport_trait::Session]. Because both the RPC
plane (super::rpc_session::SessionRpcTransport /
super::rpc_session::serve_rpc_connection) and the streaming plane
(moq_net::{Client, Server}) are generic over Session, one UdsSession
impl carries both over a single UnixStream — exactly as the QUIC/iroh
sessions do.
§Why a multiplexer
web_transport_trait::Session is a stream-multiplexed abstraction
(open_bi/open_uni/accept_bi/accept_uni). QUIC and iroh provide that
natively; a UnixStream is a single ordered byte-stream. So UdsSession
carries a [yamux] multiplexer — flow-controlled, head-of-line-correct
concurrent substreams over the one socket. moq-lite needs exactly this: one
bidi SETUP control stream plus one uni stream per Group. It never uses
datagrams, so those trait methods are stubbed (max_datagram_size() == 0).
§Two wire conventions (UDS has neither ALPN nor a uni/bidi distinction)
- Plane byte (
PLANE_RPC/PLANE_MOQ) — written once on the rawUnixStreambefore yamux wraps it. Replaces ALPN: the listener reads it to route the connection to the RPC dispatcher vsmoq_net::Server::accept. - Substream tag ([
TAG_BIDI] / [TAG_UNI]) — yamux substreams are all bidirectional, so the opener prefixes each new substream with one tag byte and the acceptor reads it to route the substream toaccept_bivsaccept_uni. A uni opener simply never reads its half.
§Driver
yamux’s Connection is single-owner and poll-driven (not Clone), but
Session: Clone and is called concurrently. So one driver task owns the
Connection and services open_*/inbound-stream work over channels; cloned
UdsSession handles all talk to it. This mirrors libp2p-yamux.
Structs§
- UdsError
- Error type for
UdsSessionand its streams. - UdsRecv
Stream - Inbound half of a UDS substream. Wraps the yamux read half.
- UdsSend
Stream - Outbound half of a UDS substream. Wraps the yamux write half;
finishhalf-closes (sends FIN) so the peer’s read sees EOF. - UdsSession
- A [
web_transport_trait::Session] over a Unix-domain socket, multiplexed by yamux. Clone-cheap (shares one driver viaArc). Carries both the RPC and moq planes — see the module docs.
Constants§
- PLANE_
MOQ - See
PLANE_RPC. Routes the connection tomoq_net::Server::accept. - PLANE_
RPC - Connection-plane selector written as the first byte on the raw socket. The
RPC dispatcher and the moq server are distinct planes (as ALPN distinguishes
them on QUIC); one
UnixStreamserves exactly one.
Functions§
- accept_
uds - Accept side: read the plane byte from a freshly-accepted
UnixStream, then wrap it in a server-mode yamux session. The caller routes byplane(PLANE_RPC→ RPC dispatcher,PLANE_MOQ→moq_net::Server::accept). - connect_
uds - Connect to a UDS endpoint, select
plane, and return a multiplexed session.