pub struct WarmState { /* private fields */ }Expand description
Tracks named cache-warm walks and whether they have all finished.
Implementations§
Source§impl WarmState
impl WarmState
Sourcepub fn empty() -> Arc<Self>
pub fn empty() -> Arc<Self>
Shared state with nothing tracked — the create-then-track pattern
(track before spawning each walk). Done from the start, so health
gates only on walks that actually spawn.
Sourcepub fn new(names: impl IntoIterator<Item = impl Into<String>>) -> Arc<Self>
pub fn new(names: impl IntoIterator<Item = impl Into<String>>) -> Arc<Self>
Shared state tracking names (e.g. "axis-s", "registry"), with
the default WARM_MAX_WAIT.
Sourcepub fn with_max_wait(
names: impl IntoIterator<Item = impl Into<String>>,
max_wait: Duration,
) -> Arc<Self>
pub fn with_max_wait( names: impl IntoIterator<Item = impl Into<String>>, max_wait: Duration, ) -> Arc<Self>
Self::new with an explicit stuck threshold (tests, tuning).
Sourcepub fn track(&self, name: impl Into<String>)
pub fn track(&self, name: impl Into<String>)
Register a walk before spawning its thread. Readiness gates on every
tracked name until it completes. The readiness clock starts here — at
the empty → first-pending transition — so time spent opening the DB
before this call does not count against WARM_MAX_WAIT.
Sourcepub fn is_done(&self) -> bool
pub fn is_done(&self) -> bool
All walks finished? (An empty tracker — warm disabled — is done.)
Sourcepub fn elapsed(&self) -> Duration
pub fn elapsed(&self) -> Duration
Time since the first walk was tracked (zero before any track).
Sourcepub fn stuck_warning(&self) -> Option<String>
pub fn stuck_warning(&self) -> Option<String>
The stuck report once elapsed exceeds the max wait and walks are
still pending: prints a stderr warning on the first call and returns
the message (for the health body) on every call while stuck.
None while done or inside the wait window.