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 machine_id;
20pub mod observability;
21#[allow(dead_code)]
22mod provenance;
23pub mod registry;
24pub mod router;
25pub mod server;
26pub mod stderr_tail;
27pub mod supervise;
28mod terminal_journal;
29pub mod terminal_ring;
30#[cfg(any(test, feature = "test-support"))]
31pub mod test_support;
32pub mod watchdog;
33
34#[cfg(feature = "bench-harness")]
35pub mod bench_harness;
36
37pub use control::{ControlHandler, MIN_SUPPORTED_VERSION};
38pub use forwarding::{ForwardingError, ForwardingTable, ModuleEndpointId};
39// The frame codec now lives in its natural homes: the `Frame` data type in
40// subc-protocol (pure, with the envelope it accompanies) and the async I/O loop
41// in subc-transport (with the authenticated stream). Re-exported here for
42// callers that use the daemon library to build and exchange frames.
43pub use control::{
44    DEFAULT_ROUTE_BIND_BREAKER_COOLDOWN, DEFAULT_ROUTE_BIND_BREAKER_THRESHOLD,
45    DEFAULT_ROUTE_BIND_RELAY_TIMEOUT,
46};
47pub use identity::{IdentityError, ProjectRootId, RequestIdentity, SessionId};
48pub use observability::{ConnectedClients, DaemonCounters};
49pub use registry::{ChannelState, ConnectionId, ModuleRegistration, Registry, RegistryError};
50pub use router::{
51    Backend, EchoBackend, ForwardBackend, FrameSink, RouteCtx, Router, RouterConnection,
52    RouterError,
53};
54pub use server::{
55    handle_connection, serve_listener, serve_listeners, ConnectionError, ServerAuth, ServerError,
56    DEFAULT_AUTH_DEADLINE, DEFAULT_MAX_UNAUTHENTICATED_CONNECTIONS,
57};
58pub use subc_protocol::{Frame, FrameBuildError};
59pub use subc_transport::{read_frame, write_frame, FrameIoError, ReadStage};
60pub use supervise::{
61    ExitKind, ExitReport, HealthAction, HealthConfig, ModuleHealthStatus, ModuleOverlap,
62    ModuleProcessLiveness, ModuleSpec, ModuleState, ModuleStatus, RestartPolicy, SuperviseError,
63    SupervisedModule, Supervisor, SupervisorHandle, SupervisorProcessLiveness, SwapFailureArm,
64    SwapRefusal, DEFAULT_DRAIN_TIMEOUT, DEFAULT_SWAP_READY_TIMEOUT, SPAWN_ROLE_SWAP_CANDIDATE,
65    SUBC_ARG, SUBC_SPAWN_ROLE_ENV,
66};
67pub use watchdog::{
68    DaemonSelfWatchdog, DaemonSelfWatchdogConfig, WatchdogStage, WatchdogTickError,
69    DEFAULT_SELF_WATCHDOG_DEADLINE, DEFAULT_SELF_WATCHDOG_INTERVAL,
70};