Skip to main content

thunder/server/
mod.rs

1//! Thunder RPC server — the one listener every family server derives from.
2//!
3//! Products integrate by implementing [`Dispatch`] (SRV-020) and calling
4//! [`spawn_listener`] with their [`Config`](crate::wire::Config);
5//! everything else is Thunder's:
6//!
7//! - lifecycle — accept loop, per-connection writer task, graceful drain,
8//!   per-connection failure isolation (SRV-001..005);
9//! - the Synap-derived hot path — `BufWriter` + drain-then-flush, exactly
10//!   one serialization per response, `TCP_NODELAY`, per-read idle timeout
11//!   (SRV-006..009);
12//! - sessions and profile enforcement — lock-free auth flag, handshake
13//!   gating, Thunder-built HELLO replies, PUSH_ID policy
14//!   (SRV-010..014, PRO-030/031);
15//! - plain-atomic metrics recorded after successful writes (SRV-030).
16//!
17//! Contract: `docs/specs/SPEC-004-server.md`. TLS (SRV-040) is pending the
18//! T0 family decision and is intentionally not wired yet.
19
20mod dispatch;
21mod errors;
22mod listener;
23mod metrics;
24mod observer;
25mod session;
26
27pub use dispatch::{AuthError, Credentials, Dispatch, Principal};
28pub use errors::{format_bracket_code, format_err, NOAUTH, NOPERM, WRONGPASS};
29pub use listener::{spawn_listener, ListenerConfig, ListenerHandle, MetricsRef, ServerInfo};
30pub use metrics::MetricsSnapshot;
31pub use observer::MetricsObserver;
32pub use session::{PushClosed, PushSender, Session};
33
34#[cfg(test)]
35#[allow(clippy::unwrap_used, clippy::expect_used)]
36mod tests;