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