Skip to main content

canic_core/api/
ready.rs

1//! Module: api::ready
2//!
3//! Responsibility: public readiness facade for endpoint callers.
4//! Does not own: bootstrap state mutation or readiness barrier internals.
5//! Boundary: exposes read-only readiness and bootstrap status snapshots.
6
7use crate::{
8    dto::state::BootstrapStatusResponse,
9    ops::runtime::{bootstrap::BootstrapStatusOps, ready::ReadyOps},
10};
11
12///
13/// ReadyApi
14///
15/// Thin endpoint-facing facade for readiness checks.
16///
17
18pub struct ReadyApi;
19
20impl ReadyApi {
21    /// Mark a synchronous built-in lifecycle adapter ready after all invariants commit.
22    pub fn mark_ready() {
23        ReadyOps::mark_ready();
24    }
25
26    /// Return whether Canic runtime invariants have completed restoration.
27    #[must_use]
28    pub fn is_ready() -> bool {
29        ReadyOps::is_ready()
30    }
31
32    /// Return the current bootstrap readiness snapshot.
33    #[must_use]
34    pub fn bootstrap_status() -> BootstrapStatusResponse {
35        BootstrapStatusOps::snapshot()
36    }
37}