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;
10/// `app.open` starts a known operator app from its installed location. See
11/// the module for the ordered decision, the launch table, and the platform
12/// launchers.
13pub mod app_open;
14mod bind_compat;
15pub mod bootstrap;
16pub mod caller_identity;
17pub(crate) mod capability_requirements;
18#[cfg(target_os = "linux")]
19mod cgroup_recovery;
20mod child_output;
21mod child_resources;
22mod child_roster;
23mod clock;
24pub mod config_gate;
25pub mod config_store;
26pub mod control;
27pub mod daemon_config;
28mod disk_monitor;
29#[cfg(test)]
30pub(crate) mod dispatch_spike;
31pub mod fleet_lint;
32pub mod forwarding;
33#[cfg(unix)]
34mod group_recovery;
35mod health_summary;
36pub mod identity;
37mod live_children;
38pub mod local_listener;
39pub mod machine_id;
40pub mod observability;
41pub mod operator_apps;
42pub mod operator_confirm;
43#[cfg(any(target_os = "macos", test))]
44mod peer_identity_lane;
45mod policy_root;
46pub mod privileged_prompt;
47pub(crate) mod program_origin;
48#[allow(dead_code)]
49mod provenance;
50pub mod registry;
51mod resource_history;
52mod resource_totals;
53mod route_outage;
54pub mod router;
55mod run_dir_lock;
56mod scopes;
57pub mod server;
58pub(crate) mod spawn_authority;
59mod stall_witness;
60pub mod stderr_tail;
61mod subtree_resources;
62pub mod supervise;
63mod systemd_kill_mode;
64mod terminal_journal;
65pub mod terminal_ring;
66pub mod watchdog;
67
68#[cfg(feature = "bench-harness")]
69pub mod bench_harness;
70
71pub use control::{ControlHandler, MIN_SUPPORTED_VERSION};
72pub use forwarding::{ForwardingError, ForwardingTable, ModuleEndpointId};
73// The frame codec now lives in its natural homes: the `Frame` data type in
74// subc-protocol (pure, with the envelope it accompanies) and the async I/O loop
75// in subc-transport (with the authenticated stream). Re-exported here for
76// callers that use the daemon library to build and exchange frames.
77pub use control::{
78    DEFAULT_ROUTE_BIND_BREAKER_COOLDOWN, DEFAULT_ROUTE_BIND_BREAKER_THRESHOLD,
79    DEFAULT_ROUTE_BIND_RELAY_TIMEOUT,
80};
81pub use identity::{IdentityError, ProjectRootId, RequestIdentity, SessionId};
82pub use live_children::{
83    read_live_children_roster, ContainerIdentity, ExecutableIdentity, LiveChild,
84    LiveChildrenRoster, RecordReadError, RetainedReason,
85};
86pub use observability::{ConnectedClients, DaemonCounters};
87pub use registry::{ChannelState, ConnectionId, ModuleRegistration, Registry, RegistryError};
88pub use router::{
89    Backend, EchoBackend, ForwardBackend, FrameSink, RouteCtx, Router, RouterConnection,
90    RouterError,
91};
92pub use server::{
93    handle_connection, serve_listener, serve_listeners, serve_local_listener, ConnectionError,
94    ServerAuth, ServerError, DEFAULT_AUTH_DEADLINE, DEFAULT_MAX_UNAUTHENTICATED_CONNECTIONS,
95};
96pub use subc_protocol::{Frame, FrameBuildError};
97pub use subc_transport::{read_frame, write_frame, FrameIoError, ReadStage};
98pub use supervise::{
99    ExitKind, ExitReport, HealthAction, HealthConfig, ModuleHealthStatus, ModuleOverlap,
100    ModuleProcessLiveness, ModuleSpec, ModuleState, ModuleStatus, RestartPolicy, ScriptEntry,
101    ScriptRuntime, SuperviseError, SupervisedModule, Supervisor, SupervisorHandle,
102    SupervisorProcessLiveness, SwapFailureArm, SwapRefusal, DEFAULT_DRAIN_TIMEOUT,
103    DEFAULT_SWAP_READY_TIMEOUT, SPAWN_ROLE_SWAP_CANDIDATE, SUBC_ARG, SUBC_SPAWN_ROLE_ENV,
104};
105pub use watchdog::{
106    DaemonSelfWatchdog, DaemonSelfWatchdogConfig, WatchdogStage, WatchdogTickError,
107    DEFAULT_SELF_WATCHDOG_DEADLINE, DEFAULT_SELF_WATCHDOG_INTERVAL,
108};