pub struct AlertManager<P: AlertPolicy> { /* private fields */ }Expand description
Standing alerts under a policy.
Stores up to MAX_ALERTS alerts inline, ordered by priority then by time
raised, so AlertManager::alerts starts with the most pressing. Several
kilobytes: keep it behind a reference or in a static. Deliberately not
Copy, so the board cannot be duplicated by accident:
fn is_copy<T: Copy>() {}
is_copy::<kinavis_alerts::AlertManager<kinavis_alerts::StandardPolicy>>();Implementations§
Source§impl<P: AlertPolicy> AlertManager<P>
impl<P: AlertPolicy> AlertManager<P>
Sourcepub fn alerts(&self) -> &[Alert]
pub fn alerts(&self) -> &[Alert]
Standing alerts, most pressing first (priority, then time raised).
Sourcepub fn unacknowledged(&self) -> impl Iterator<Item = &Alert> + '_
pub fn unacknowledged(&self) -> impl Iterator<Item = &Alert> + '_
Unacknowledged alerts, most pressing first.
Sourcepub fn ingest<E: Reportable>(
&mut self,
events: &[E],
now: Instant<Utc>,
) -> AlertChanges
pub fn ingest<E: Reportable>( &mut self, events: &[E], now: Instant<Utc>, ) -> AlertChanges
Processes the events of one operation at now.
Each event first ends the conditions it ends, then raises or repeats its
own alert; conditions not reported within rectify_after are then
rectified as in AlertManager::tick. Accepts a slice of any
Reportable type — any
EventList dereferences to one.
Typically one call per source list: estimator, guidance, traffic.
Sourcepub fn tick(&mut self, now: Instant<Utc>) -> AlertChanges
pub fn tick(&mut self, now: Instant<Utc>) -> AlertChanges
Advances time: conditions not reported within rectify_after are
rectified — removed if acknowledged, otherwise left as
AlertState::Rectified.
Sourcepub fn acknowledge(
&mut self,
id: AlertId,
at: Instant<Utc>,
) -> Result<AlertChanges>
pub fn acknowledge( &mut self, id: AlertId, at: Instant<Utc>, ) -> Result<AlertChanges>
Acknowledges an alert: active becomes acknowledged, rectified is removed.
§Errors
KernelError::OutOfRange if no alert has that identifier.
Sourcepub fn acknowledge_all(&mut self, at: Instant<Utc>) -> AlertChanges
pub fn acknowledge_all(&mut self, at: Instant<Utc>) -> AlertChanges
Acknowledges every standing alert.