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