Expand description
Thunder RPC server — the one listener every family server derives from.
Products integrate by implementing Dispatch (SRV-020) and calling
spawn_listener with their Config;
everything else is Thunder’s:
- lifecycle — accept loop, per-connection writer task, graceful drain, per-connection failure isolation (SRV-001..005);
- the Synap-derived hot path —
BufWriter+ drain-then-flush, exactly one serialization per response,TCP_NODELAY, per-read idle timeout (SRV-006..009); - sessions and profile enforcement — lock-free auth flag, handshake gating, Thunder-built HELLO replies, PUSH_ID policy (SRV-010..014, PRO-030/031);
- plain-atomic metrics recorded after successful writes (SRV-030).
Contract: docs/specs/SPEC-004-server.md. TLS (SRV-040) is pending the
T0 family decision and is intentionally not wired yet.
Structs§
- Listener
Config - Listener configuration. Family posture keeps binds loopback/private by default (SRV-040 guidance).
- Listener
Handle - Handle to a running listener (SRV-001).
- Metrics
Snapshot - One consistent-enough read of the listener’s counters (SRV-030), exporter-agnostic by design.
- Principal
- The identity a successful
Dispatch::authenticateresolves to. Stored on theSessionand fed toDispatch::capabilitiesfor the HELLO reply (SRV-014). - Push
Closed - The connection behind a
PushSenderis gone; the frame was dropped. - Push
Sender - Typed, clonable handle for server-initiated push frames (SRV-013).
- Server
Info - Server identity used by Thunder-built HELLO replies (SRV-014).
- Session
- Session state shared between the read loop and every dispatch task
(SRV-010): the auth flag is a lock-free atomic flipped by
HELLO/AUTHand read by the dispatch path without locks.
Enums§
- Auth
Error - Authentication failure from the product hook (SRV-012). Thunder maps it to the profile’s error convention before it reaches the wire (SRV-021).
- Credentials
- Credentials parsed by Thunder from
HELLO/AUTHpayloads (SRV-012).
Constants§
- NOAUTH
- Family-pinned auth-required error (
Resp3Prefixes, SRV-011). - NOPERM
- Family-pinned insufficient-privilege error (
Resp3Prefixes). - WRONGPASS
- Family-pinned bad-credentials error (
Resp3Prefixes).
Traits§
- Dispatch
- Product integration is exactly this trait (SRV-020).
Functions§
- format_
bracket_ code - Format the machine-readable convention:
"[<code>] <message>"(PRO-014BracketCode). - format_
err - Format the generic-error convention:
"ERR <message>"(PRO-014Resp3Prefixes). - spawn_
listener - Bind
config.addrand run the accept loop: one task per connection, graceful shutdown through the returned handle (SRV-001).