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