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