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