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