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_roster;
12mod clock;
13pub mod control;
14pub mod daemon_config;
15#[cfg(test)]
16pub(crate) mod dispatch_spike;
17pub mod fleet_lint;
18pub mod forwarding;
19pub mod identity;
20pub mod machine_id;
21pub mod observability;
22#[allow(dead_code)]
23mod provenance;
24pub mod registry;
25pub mod router;
26pub mod server;
27pub mod stderr_tail;
28pub mod supervise;
29mod systemd_kill_mode;
30mod terminal_journal;
31pub mod terminal_ring;
32#[cfg(any(test, feature = "test-support"))]
33pub mod test_support;
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};