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