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