Skip to main content

ops_router

Function ops_router 

Source
pub(crate) fn ops_router(data_dir: Arc<PathBuf>) -> Router
Expand description

The three endpoints that answer for the process rather than for the data: liveness, readiness, and everything this node counts about itself.

Here rather than in api.rs because /health and /readyz must not touch the block directory — no query engine, nothing that can be slow, nothing that can fail for a reason that is not the process’s fault. /api/v1/stats does open the directory, which is why it is a query-namespace URL and not a probe.

/health and /readyz used to be the same handler, on the argument that Mira has no warm-up and no cluster to join, so there is no state in which it is alive and not ready. A node whose disk is full is exactly that state: the process is fine, answers every request, and cannot store a byte. That is the state readiness exists for — it is what takes the node out of the Service’s endpoints so the exporters retry somewhere that can — so the two are now different answers. Liveness stays a constant 200: a flusher that stops takes the process with it (serve_with), so answering at all is the liveness answer, and restarting a node whose volume is full fixes nothing.