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