Skip to main content

systemprompt_api/services/server/
mod.rs

1//! API server assembly, lifecycle, and readiness.
2//!
3//! [`startup`] binds the TCP listener before bootstrap and serves a starting
4//! health probe; [`builder`] composes the full axum router and global
5//! middleware stack; [`runner`] runs the startup reconciliation, swaps the
6//! full router onto the listener, and awaits shutdown. The readiness
7//! signalling surface ([`is_ready`], [`signal_ready`], [`wait_for_ready`]) is
8//! used by external health probes. Discovery, health, metrics, and route
9//! configuration live in the private submodules.
10//!
11//! Copyright (c) systemprompt.io — Business Source License 1.1.
12//! See <https://systemprompt.io> for licensing details.
13
14pub mod builder;
15mod discovery;
16mod health;
17
18#[cfg(feature = "test-api")]
19pub mod test_api {
20    #[cfg(target_os = "linux")]
21    pub use super::health::parse_proc_status_kb;
22    pub use super::health::{audit_log_stats, database_stats, human_bytes, table_stats};
23    pub use super::health_detail::handle_health_detail;
24}
25mod health_detail;
26mod lifecycle;
27pub mod metrics;
28pub mod readiness;
29mod routes;
30pub mod runner;
31pub mod scheduler_health;
32mod shutdown;
33pub mod startup;
34
35#[cfg(feature = "test-api")]
36pub use lifecycle::reconciliation_test_api;
37#[cfg(feature = "test-api")]
38pub use shutdown::test_api as shutdown_test_api;
39
40pub use builder::*;
41pub use readiness::{
42    ReadinessEvent, get_readiness_receiver, init_readiness, is_ready, signal_ready,
43    signal_shutdown, wait_for_ready,
44};
45pub use runner::*;
46pub use startup::{EarlyServer, bind_and_serve, starting_router};