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