| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
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
- data SourceHealth
- data SourceReporter = SourceReporter {
- reportSource :: SourceHealth -> IO ()
- noteAdmission :: AdmissionIdentity -> IO Bool
- noSourceReporter :: SourceReporter
- data OutageState = Healthy
- data OutageReport
- data AdmissionIdentity = AdmissionIdentity {}
- data OutageStore
- tvarOutageStore :: TVar OutageState -> OutageStore
- sourceReporter :: NominalDiffTime -> IO UTCTime -> OutageStore -> (OutageReport -> IO ()) -> SourceReporter
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. |
Instances
| Show SourceHealth Source # | |
Defined in Ecluse.Core.Rules.Outage.Internal Methods showsPrec :: Int -> SourceHealth -> ShowS # show :: SourceHealth -> String # showList :: [SourceHealth] -> ShowS # | |
| Eq SourceHealth Source # | |
Defined in Ecluse.Core.Rules.Outage.Internal | |
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
| Show OutageState Source # | |
Defined in Ecluse.Core.Rules.Outage.Internal Methods showsPrec :: Int -> OutageState -> ShowS # show :: OutageState -> String # showList :: [OutageState] -> ShowS # | |
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. |
Instances
| Show OutageReport Source # | |
Defined in Ecluse.Core.Rules.Outage.Internal Methods showsPrec :: Int -> OutageReport -> ShowS # show :: OutageReport -> String # showList :: [OutageReport] -> ShowS # | |
| Eq OutageReport Source # | |
Defined in Ecluse.Core.Rules.Outage.Internal | |
data AdmissionIdentity Source #
What identifies one admission's evidence line: the package, the version, and the checks it skipped.
Constructors
| AdmissionIdentity | |
Instances
| Show AdmissionIdentity Source # | |
Defined in Ecluse.Core.Rules.Outage.Internal Methods showsPrec :: Int -> AdmissionIdentity -> ShowS # show :: AdmissionIdentity -> String # showList :: [AdmissionIdentity] -> ShowS # | |
| Eq AdmissionIdentity Source # | |
Defined in Ecluse.Core.Rules.Outage.Internal Methods (==) :: AdmissionIdentity -> AdmissionIdentity -> Bool # (/=) :: AdmissionIdentity -> AdmissionIdentity -> Bool # | |
| Ord AdmissionIdentity Source # | |
Defined in Ecluse.Core.Rules.Outage.Internal Methods compare :: AdmissionIdentity -> AdmissionIdentity -> Ordering # (<) :: AdmissionIdentity -> AdmissionIdentity -> Bool # (<=) :: AdmissionIdentity -> AdmissionIdentity -> Bool # (>) :: AdmissionIdentity -> AdmissionIdentity -> Bool # (>=) :: AdmissionIdentity -> AdmissionIdentity -> Bool # max :: AdmissionIdentity -> AdmissionIdentity -> AdmissionIdentity # min :: AdmissionIdentity -> AdmissionIdentity -> AdmissionIdentity # | |
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.