ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Rules.Outage

Description

Bounded reporting of an advisory source the rules cannot consult. Each advisory-reading evaluation reports what it saw, and the state machine turns that stream into three reports: the outage began, it continues (at most once per period), and it recovered. The outage also records which admissions the gate has logged evidence for, once per identity, so traffic volume cannot multiply the lines. Ecluse.Core.Rules.Outage.Internal holds the fold itself.

Synopsis

What one evaluation saw

data SourceHealth Source #

What one rule's evaluation established about the source it reads.

Constructors

SourceAnswered Text

The named rule consulted its source, whatever it decided.

SourceUnavailable Text Reason

The named rule could not consult its source, for the given cause.

data SourceReporter Source #

The observer every advisory-reading evaluation reports to. The composition root installs the live one.

Constructors

SourceReporter 

Fields

noSourceReporter :: SourceReporter Source #

The inert reporter, for an ecosystem with no advisory source to observe. It logs every admission.

What the fold produces

data OutageState Source #

One source's outage state. It carries no Eq: comparing two states walks the logged record, so a change is decided by the fold that made it, never by comparison.

Constructors

Healthy 

Instances

Instances details
Show OutageState Source # 
Instance details

Defined in Ecluse.Core.Rules.Outage.Internal

data OutageReport Source #

The three reports an outage produces, each carrying what an operator line needs.

Constructors

OutageBegan Text Reason

The first rule unable to consult the source, with its cause.

OutageContinues UTCTime (Map Text Reason)

The reminder: when the outage began, and every rule still unable, with its latest cause.

OutageRecovered UTCTime

Every rule consults the source again. Carries when the outage began.

data AdmissionIdentity Source #

What identifies one admission's evidence line: the package, the version, and the checks it skipped.

Constructors

AdmissionIdentity 

Fields

A reporter over shared state

data OutageStore Source #

Where one source's outage state lives: a plain read, and a fold committed as one unit.

tvarOutageStore :: TVar OutageState -> OutageStore Source #

The live store: one TVar shared by every mount of an ecosystem.

sourceReporter :: NominalDiffTime -> IO UTCTime -> OutageStore -> (OutageReport -> IO ()) -> SourceReporter Source #

A reporter folding into one source's store. Only a transition or a due reminder commits, so a healthy source costs one read and an unchanged outage one read and one clock reading.