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