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