//! `GET /health` and `GET /ready`: unauthenticated, for supervisors and load balancers. //! They say whether the node is up and whether it serves the store, nothing more. use axum::{extract::State, http::StatusCode}; use crate::state::AppState; /// The HTTP API is up. pub(crate) async fn health() -> &'static str { "ok\n" } /// The node serves reads and writes: ready, not joining or rejoining. pub(crate) async fn ready(State(state): State) -> (StatusCode, &'static str) { if state.is_ready().await { (StatusCode::OK, "ready\n") } else { (StatusCode::SERVICE_UNAVAILABLE, "not ready\n") } }