Skip to main content

Manager

Struct Manager 

Source
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: Millis

How 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

Source

pub fn restore(incidents: impl IntoIterator<Item = Incident>) -> Manager

Rebuild from the incidents the journal holds (open and cooling ones).

Source

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.

Source

pub fn active_for(&self, unit: &UnitId) -> Option<&Incident>

Source

pub(crate) fn active_id(&self, unit: &UnitId) -> Option<IncidentId>

Source

pub(crate) fn close( &mut self, id: IncidentId, now: Timestamp, changed: &mut Vec<Incident>, )

Source

pub fn tick( &mut self, now: Timestamp, state: &SystemState, defs: &UnitDefs, ) -> Vec<Incident>

Observe one tick. Returns every incident that opened, changed or closed.

Source

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.

Source

pub(crate) fn open( &mut self, target: &UnitId, kind: IncidentKind, divergence: (DesiredStatus, UnitStatus), now: Timestamp, next_attempt: Timestamp, regressions: u8, ) -> Incident

Source

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.

Source

pub fn diagnostic(&self) -> Vec<&Incident>

Diagnostic incidents (re-observe through another Readiness probe).

Source

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.

Source

pub(crate) fn cool(i: &mut Incident, now: Timestamp)

Source

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).

Source

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.

Source

pub fn human_acted( &mut self, target: &UnitId, now: Timestamp, ) -> Option<Incident>

A human acted on the target (release, explicit request): lift any hold.

Trait Implementations§

Source§

impl Clone for Manager

Source§

fn clone(&self) -> Manager

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Manager

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Manager

Source§

fn default() -> Manager

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.