pub struct Manager {
pub incidents: BTreeMap<IncidentId, Incident>,
pub(crate) tracks: BTreeMap<UnitId, Track>,
pub(crate) next_id: u64,
pub startup_grace: Millis,
}Fields§
§incidents: BTreeMap<IncidentId, Incident>§tracks: BTreeMap<UnitId, Track>§next_id: u64§startup_grace: MillisHow long after coming up a failing health probe is not yet a fault,
for units that do not set their own (UnitDef::startup_grace).
Implementations§
Source§impl Manager
impl Manager
Sourcepub fn restore(incidents: impl IntoIterator<Item = Incident>) -> Manager
pub fn restore(incidents: impl IntoIterator<Item = Incident>) -> Manager
Rebuild from the incidents the journal holds (open and cooling ones).
Sourcepub fn started(&mut self, unit: &UnitId, now: Timestamp)
pub fn started(&mut self, unit: &UnitId, now: Timestamp)
Planarian (or a user through it) just started or restarted unit:
its startup grace begins again.
pub fn active_for(&self, unit: &UnitId) -> Option<&Incident>
pub(crate) fn active_id(&self, unit: &UnitId) -> Option<IncidentId>
pub(crate) fn close( &mut self, id: IncidentId, now: Timestamp, changed: &mut Vec<Incident>, )
Sourcepub fn tick(
&mut self,
now: Timestamp,
state: &SystemState,
defs: &UnitDefs,
) -> Vec<Incident>
pub fn tick( &mut self, now: Timestamp, state: &SystemState, defs: &UnitDefs, ) -> Vec<Incident>
Observe one tick. Returns every incident that opened, changed or closed.
Sourcepub fn tick_at(
&mut self,
now: Timestamp,
decided: Timestamp,
state: &SystemState,
defs: &UnitDefs,
) -> Vec<Incident>
pub fn tick_at( &mut self, now: Timestamp, decided: Timestamp, state: &SystemState, defs: &UnitDefs, ) -> Vec<Incident>
tick, with the decision’s own time: now is the observation’s
(what the evidence is timed by), decided the clock read after it,
once the probes have run. A hold set here (a third regression’s
escalation) runs from decided, as every cooldown and backoff does
(§13), so a slow observation never shortens it.
pub(crate) fn open( &mut self, target: &UnitId, kind: IncidentKind, divergence: (DesiredStatus, UnitStatus), now: Timestamp, next_attempt: Timestamp, regressions: u8, ) -> Incident
Sourcepub fn actionable(&self, now: Timestamp) -> Vec<&Incident>
pub fn actionable(&self, now: Timestamp) -> Vec<&Incident>
Repair incidents the diagnoser may act on now. An incident whose target currently meets its desired state is stabilizing, not actionable: acting on it would find nothing to do and wrongly exhaust it.
Sourcepub fn diagnostic(&self) -> Vec<&Incident>
pub fn diagnostic(&self) -> Vec<&Incident>
Diagnostic incidents (re-observe through another Readiness probe).
Sourcepub fn record_attempt(
&mut self,
id: IncidentId,
txn: TxnId,
outcome: Outcome,
now: Timestamp,
) -> Option<Incident>
pub fn record_attempt( &mut self, id: IncidentId, txn: TxnId, outcome: Outcome, now: Timestamp, ) -> Option<Incident>
Record an attempt’s transaction. Spends budget, sets the next backoff (longer after regressions), and enters cooldown when the budget is gone.
pub(crate) fn cool(i: &mut Incident, now: Timestamp)
Sourcepub fn exhausted(&mut self, id: IncidentId, now: Timestamp) -> Option<Incident>
pub fn exhausted(&mut self, id: IncidentId, now: Timestamp) -> Option<Incident>
The diagnoser found nothing (A: report to the user). The incident goes quiet with a cooldown rather than retrying forever (§1 step 4).
Sourcepub fn escalate(
&mut self,
id: IncidentId,
reason: EscalationReason,
now: Timestamp,
) -> Option<Incident>
pub fn escalate( &mut self, id: IncidentId, reason: EscalationReason, now: Timestamp, ) -> Option<Incident>
Hand the incident to a person, with why (§13): no autonomous action until the hold ends or someone acts on the target.