mumble_server_runtime_gateway/mumble_server_runtime_gateway.rs
1//! The front door of the shard runtime: sockets, shards, and the path a voice
2//! packet takes between them.
3//!
4//! [`mumble_server_runtime_shard`] is pure in the way that matters: it renders, plans and
5//! composes, and it never learns what a socket is. This crate is everything it
6//! deliberately does not know.
7//!
8//! ```text
9//! TCP+TLS -> connection task -> router.route() -> Attach(shard)
10//! | |
11//! | control frames | commands, wake
12//! v v
13//! output queue <------------------- the shard's task
14//!
15//! UDP -> voice plane -> bindings -> the shard's routing table
16//! (no shard task is involved, ever)
17//! ```
18//!
19//! # The three things worth knowing before reading further
20//!
21//! **A shard task never waits for IO, and the voice plane never waits for a
22//! shard.** The two planes meet at exactly two places: a routing table published
23//! by [`mumble_server_runtime_shard::Shard`] and read without a shard's help, and a per
24//! connection cursor the shard advances and the voice plane compares against.
25//! Everything else is separate by construction rather than by discipline.
26//!
27//! **Identifiers are runtime-wide, not per shard.** A connection that moves
28//! keeps its session, and two shards never hand the same wire number to two
29//! different things. Both properties are load-bearing for migration, and the
30//! reason is in [`mumble_server_runtime_shard::IdAllocator`].
31//!
32//! **A migration is not a disconnect followed by a connect.** The source hands
33//! the destination the view the client still holds, and the destination plans
34//! one transition onto it. Tearing down first would disconnect the official
35//! client outright: see [`runtime::RuntimeHandle::move_connection`].
36//!
37//! REF: docs/design/guide-implementation.md 8, 9.6, 9.7, 10
38#![forbid(unsafe_code)]
39
40pub mod config;
41pub mod connection;
42pub mod handshake;
43pub mod limits;
44pub mod peer;
45pub mod router;
46pub mod runtime;
47pub mod serve;
48pub mod tls;
49pub mod voice;
50
51pub use config::GatewayConfig;
52pub use peer::{Peer, Peers, ShardPlane};
53pub use router::{ConnectionIdentity, ConnectionRouter, RouteDecision};
54pub use runtime::{Runtime, RuntimeHandle, ShardStatus};
55pub use serve::{Gateway, serve};
56pub use voice::VoicePlane;