Skip to main content

Module session

Module session 

Source
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§

ClientConfig
Client engine knobs. Durations are in milliseconds so the engine stays no_std-clean; plain milliseconds turned into core::time::Duration for the clock.
ClientHandle
A cheap-clone handle to a running run_client engine — the caller-facing RPC surface. Every method funnels a command to the engine, which owns the pending-call map and the wire.
FramedConnection
A framed Connection over any ByteStream and Framer.
FramingDialer
Lifts a StreamDialer and a FramerFactory into a Dialer, so run_client drives an adapter transport unchanged.
FramingListener
Lifts a StreamListener and a FramerFactory into a Listener, so serve drives an adapter transport unchanged.
OneShot
A cell holding a resource until something takes it, once.
OneShotDialer
Hands out one pre-built connection, then refuses.
OneShotListener
Hands out one pre-built connection, then parks forever.
PeerInfo
Remote-peer metadata carried by a Connection.
SessionClientConnector
Mirrors records to/from a peer reached via the dialer D, speaking codec C, under a logical scheme. A transport crate wraps it in a one-line sugar constructor (e.g. UdsClient).
SessionConfig
Per-session engine knobs.
SessionCtx
The authenticated session context produced by Dispatch::authenticate and threaded into Dispatch::open.
SessionLimits
Per-session resource bounds consumed by the engines.
SessionServerConnector
Accepts connections from a Listener L and serves them with a dispatch, speaking codec C, under a logical scheme.
SubUpdate
One update delivered on a subscription stream (server Session::subscribe and client ClientHandle::subscribe alike).

Enums§

AuthError
Authentication failure raised by Dispatch::authenticate.
CodecError
Envelope-codec failure — a frame could not be decoded/encoded.
EndpointError
Why an endpoint is not a host:port.
FrameFault
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.
TransportError
Transport-layer failure (Layer 1).

Traits§

ByteRead
The read half of a split stream.
ByteStream
An unframed, bidirectional byte stream — one TCP connection, one UART, one TLS session. The adapter owns it; the connector never names its type.
ByteWrite
The write half of a split stream.
Connection
A framed, bidirectional pipe — role-neutral (yielded by either Listener::accept or Dialer::connect).
Datagram
Connectionless I/O.
DatagramBinder
Binds Datagram sockets on demand.
Delay
A non-allocating sleep.
Dialer
The initiating (client) side — the dual of Listener; dials out and produces the same Connection.
Dispatch
The shared application dispatch: authenticate a connection, then open a per-connection Session. One Arc<dyn Dispatch> is shared across every accepted connection, so it stays Send + Sync and behind &self.
EnvelopeCodec
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/encode keep the record value as an opaque Payload sliced from / spliced into the frame.
Framer
Frames a byte stream: COBS, length-prefix, NDJSON.
FramerFactory
Builds a fresh Framer per 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 the Box<dyn Session> and threads &mut self into each method, so it can hold per-connection state without a lock; the shared, immutable role stays on Dispatch.
Source
External → AimDB data-plane: a stream of inbound frames, drained by pump_source.
StreamDialer
Produces streams: the client side.
StreamListener
Produces streams: the server side, and the dual of StreamDialer.

Functions§

is_wildcard
Returns true if pattern contains a wildcard segment — i.e. subscribing to it means “match against the registry” rather than “resolve one key”.
pattern_contains
Returns true if every topic matched by requested is also matched by grant — i.e. grant’s match set ⊇ requested’s match set (grant contains requested).
pump_client
Mirror records between a local AimDb and a remote peer over a running run_client engine — 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 ClientHandle for issuing RPC and the engine future to drive on the runner (spawn-free). The future runs until all ClientHandle clones are dropped (graceful stop) — or, with ClientConfig::reconnect off, until the first disconnect.
run_session
Drive one accepted Connection until it closes.
serve
Accept connections from listener and serve each with run_session, bounded by SessionLimits::max_connections. The accept loop and all per-connection futures share one FuturesUnordered — spawn-free.
split_host_port
As split_host_port_opt, substituting default_port when the endpoint names only a host.
split_host_port_opt
Split a host:port endpoint, leaving the port None when none was written.
topic_matches
Returns true if topic matches pattern.

Type Aliases§

BoxFut
Boxed, Send future — the object-safe async return shape used throughout.
BoxStream
Boxed, Send stream — 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.
TransportResult
Result of a transport-layer operation.