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