Skip to main content

subc_daemon/
lib.rs

1//! subc daemon core.
2//!
3//! This crate owns the loopback TCP transport and the thin splice-router core:
4//! routing decisions are made from the 21-byte envelope header, while message
5//! bodies are carried as opaque bytes and are never deserialized by the router.
6
7#![forbid(unsafe_code)]
8
9pub mod bootstrap;
10pub(crate) mod capability_requirements;
11mod clock;
12pub mod control;
13pub mod daemon_config;
14#[cfg(test)]
15pub(crate) mod dispatch_spike;
16pub mod fleet_lint;
17pub mod forwarding;
18pub mod identity;
19pub mod observability;
20#[allow(dead_code)]
21mod provenance;
22pub mod registry;
23pub mod router;
24pub mod server;
25pub mod stderr_tail;
26pub mod supervise;
27mod terminal_journal;
28pub mod terminal_ring;
29#[cfg(any(test, feature = "test-support"))]
30pub mod test_support;
31pub mod watchdog;
32
33#[cfg(feature = "bench-harness")]
34pub mod bench_harness;
35
36pub use control::{ControlHandler, MIN_SUPPORTED_VERSION};
37pub use forwarding::{ForwardingError, ForwardingTable, ModuleEndpointId};
38// The frame codec now lives in its natural homes: the `Frame` data type in
39// subc-protocol (pure, with the envelope it accompanies) and the async I/O loop
40// in subc-transport (with the authenticated stream). Re-exported here for
41// callers that use the daemon library to build and exchange frames.
42pub use control::{
43    DEFAULT_ROUTE_BIND_BREAKER_COOLDOWN, DEFAULT_ROUTE_BIND_BREAKER_THRESHOLD,
44    DEFAULT_ROUTE_BIND_RELAY_TIMEOUT,
45};
46pub use identity::{IdentityError, ProjectRootId, RequestIdentity, SessionId};
47pub use observability::{ConnectedClients, DaemonCounters};
48pub use registry::{ChannelState, ConnectionId, ModuleRegistration, Registry, RegistryError};
49pub use router::{
50    Backend, EchoBackend, ForwardBackend, FrameSink, RouteCtx, Router, RouterConnection,
51    RouterError,
52};
53pub use server::{
54    handle_connection, serve_listener, serve_listeners, ConnectionError, ServerAuth, ServerError,
55    DEFAULT_AUTH_DEADLINE, DEFAULT_MAX_UNAUTHENTICATED_CONNECTIONS,
56};
57pub use subc_protocol::{Frame, FrameBuildError};
58pub use subc_transport::{read_frame, write_frame, FrameIoError, ReadStage};
59pub use supervise::{
60    ExitKind, ExitReport, HealthAction, HealthConfig, ModuleHealthStatus, ModuleOverlap,
61    ModuleProcessLiveness, ModuleSpec, ModuleState, ModuleStatus, RestartPolicy, SuperviseError,
62    SupervisedModule, Supervisor, SupervisorHandle, SupervisorProcessLiveness, SwapFailureArm,
63    SwapRefusal, DEFAULT_DRAIN_TIMEOUT, DEFAULT_SWAP_READY_TIMEOUT, SPAWN_ROLE_SWAP_CANDIDATE,
64    SUBC_ARG, SUBC_SPAWN_ROLE_ENV,
65};
66pub use watchdog::{
67    DaemonSelfWatchdog, DaemonSelfWatchdogConfig, WatchdogStage, WatchdogTickError,
68    DEFAULT_SELF_WATCHDOG_DEADLINE, DEFAULT_SELF_WATCHDOG_INTERVAL,
69};