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