Expand description
Connector-session substrate — the shared machinery for transport-based remote access.
Three layers: transport (Connection/Listener/Dialer), codec
(EnvelopeCodec), and dispatch (Dispatch/Session), over a
role-neutral Inbound/Outbound message set shared by the reactive
server engine (serve/run_session) and the proactive client engine
(run_client/pump_client). Data-plane connectors use pump_sink/
pump_source over the Source / Connector
capabilities.
All contracts are dyn-safe and compile on std and no_std + alloc.
Modules§
- aimx
- AimX codec + dispatch — the concrete protocol substrate the session engines ride for AimX remote access.
Structs§
- Client
Config - Client engine knobs. Durations are in milliseconds so the engine stays
no_std-clean; plain milliseconds turned intocore::time::Durationfor the clock. - Client
Handle - A cheap-clone handle to a running
run_clientengine — the caller-facing RPC surface. Every method funnels a command to the engine, which owns the pending-call map and the wire. - Framed
Connection - A framed
Connectionover anyByteStreamandFramer. - Framing
Dialer - Lifts a
StreamDialerand aFramerFactoryinto aDialer, sorun_clientdrives an adapter transport unchanged. - Framing
Listener - Lifts a
StreamListenerand aFramerFactoryinto aListener, soservedrives an adapter transport unchanged. - OneShot
- A cell holding a resource until something takes it, once.
- OneShot
Dialer - Hands out one pre-built connection, then refuses.
- OneShot
Listener - Hands out one pre-built connection, then parks forever.
- Peer
Info - Remote-peer metadata carried by a
Connection. - Session
Client Connector - Mirrors records to/from a peer reached via the dialer
D, speaking codecC, under a logicalscheme. A transport crate wraps it in a one-line sugar constructor (e.g.UdsClient). - Session
Config - Per-session engine knobs.
- Session
Ctx - The authenticated session context produced by
Dispatch::authenticateand threaded intoDispatch::open. - Session
Limits - Per-session resource bounds consumed by the engines.
- Session
Server Connector - Accepts connections from a
ListenerLand serves them with a dispatch, speaking codecC, under a logicalscheme. - SubUpdate
- One update delivered on a subscription stream (server
Session::subscribeand clientClientHandle::subscribealike).
Enums§
- Auth
Error - Authentication failure raised by
Dispatch::authenticate. - Codec
Error - Envelope-codec failure — a frame could not be decoded/encoded.
- Endpoint
Error - Why an endpoint is not a
host:port. - Frame
Fault - How badly a framing step failed.
- Inbound
- A logical request arriving over a
Connection(what the server receives). - Outbound
- A logical message sent back over a
Connection(what the server emits). - RpcError
- Dispatch-layer (application) failure for
call/subscribe/write. - Transport
Error - Transport-layer failure (Layer 1).
Traits§
- Byte
Read - The read half of a
splitstream. - Byte
Stream - An unframed, bidirectional byte stream — one TCP connection, one UART, one TLS session. The adapter owns it; the connector never names its type.
- Byte
Write - The write half of a
splitstream. - Connection
- A framed, bidirectional pipe — role-neutral (yielded by either
Listener::acceptorDialer::connect). - Datagram
- Connectionless I/O.
- Datagram
Binder - Binds
Datagramsockets on demand. - Delay
- A non-allocating sleep.
- Dialer
- The initiating (client) side — the dual of
Listener; dials out and produces the sameConnection. - Dispatch
- The shared application dispatch: authenticate a connection, then open a
per-connection
Session. OneArc<dyn Dispatch>is shared across every accepted connection, so it staysSend + Syncand behind&self. - Envelope
Codec - The protocol-envelope codec: frame bytes ↔ the logical message set. Layered
above (and nesting) the record-value
JsonCodec, so the wire format stays pluggable;decode/encodekeep the record value as an opaquePayloadsliced from / spliced into the frame. - Framer
- Frames a byte stream: COBS, length-prefix, NDJSON.
- Framer
Factory - Builds a fresh
Framerper connection. - Listener
- The accepting (server) side — produces
Connections we did not initiate. - Session
- The per-connection session: serves calls, subscriptions, and writes for one
accepted
Connection. The engine owns theBox<dyn Session>and threads&mut selfinto each method, so it can hold per-connection state without a lock; the shared, immutable role stays onDispatch. - Source
- External → AimDB data-plane: a stream of inbound frames, drained by
pump_source. - Stream
Dialer - Produces streams: the client side.
- Stream
Listener - Produces streams: the server side, and the dual of
StreamDialer.
Functions§
- is_
wildcard - Returns
trueifpatterncontains a wildcard segment — i.e. subscribing to it means “match against the registry” rather than “resolve one key”. - pattern_
contains - Returns
trueif every topic matched byrequestedis also matched bygrant— i.e.grant’s match set ⊇requested’s match set (grantcontainsrequested). - pump_
client - Mirror records between a local
AimDband a remote peer over a runningrun_clientengine — the connector-link half of the client capability. - pump_
sink - Outbound pump: one publisher future per outbound route on
scheme. - pump_
source - Inbound pump: a single multiplexed reader future for
scheme. - run_
client - Build the client engine: returns a
ClientHandlefor issuing RPC and the engine future to drive on the runner (spawn-free). The future runs until allClientHandleclones are dropped (graceful stop) — or, withClientConfig::reconnectoff, until the first disconnect. - run_
session - Drive one accepted
Connectionuntil it closes. - serve
- Accept connections from
listenerand serve each withrun_session, bounded bySessionLimits::max_connections. The accept loop and all per-connection futures share oneFuturesUnordered— spawn-free. - split_
host_ port - As
split_host_port_opt, substitutingdefault_portwhen the endpoint names only a host. - split_
host_ port_ opt - Split a
host:portendpoint, leaving the portNonewhen none was written. - topic_
matches - Returns
trueiftopicmatchespattern.
Type Aliases§
- BoxFut
- Boxed,
Sendfuture — the object-safe async return shape used throughout. - BoxStream
- Boxed,
Sendstream — the reply shape of a subscription (Session::subscribe). - IoError
- Failure of a byte-level I/O operation.
- Payload
- A serialized record value, carried opaquely through the codec.
- Transport
Result - Result of a transport-layer operation.