\Drupal\strata\Health HealthLedgerInterface

Where findings are kept, and where each code currently sits on the ladder.

The ledger is the memory a health system needs and a single sweep cannot have: whether this is the first time a code has fired or the fortieth, and how far up the ladder the response has already climbed. A tripwire answers "is this wrong now"; the ledger answers "how long has it been wrong, and what have we already tried".

Every implementation must be bounded. Scope is the field that grows without limit - a frame hash is a new scope every time - so an implementation caps what it retains per code rather than trusting a purge to run.

A ledger stores and answers. It never repairs, never escalates on its own, and never calls a tripwire; escalation is the caller's decision, made with RepairLadder, and recorded here.

Summary

Methods
Constants
record()
open()
resolve()
rungFor()
setRung()
summary()
purge()
No public constants found

Methods

record()

record(\Drupal\strata\Health\Finding  $finding) : void

Records one finding.

Parameters

\Drupal\strata\Health\Finding $finding

What a tripwire noticed.

Returns

void —

open()

open() : \Drupal\strata\Health\Finding[]

Every finding still held, oldest first.

Returns

\Drupal\strata\Health\Finding[] —

The open findings, empty when nothing is outstanding.

resolve()

resolve(string  $code, string  $scope) : int

Clears the findings for one code and scope.

Scoped rather than code-wide, because one frame being repaired says nothing about the next frame reporting the same code.

Parameters

string $code

The finding code.

string $scope

The exact scope that has been dealt with.

Returns

int —

How many findings were cleared.

rungFor()

rungFor(string  $code) : string

The rung a code currently sits at.

Parameters

string $code

The finding code.

Returns

string —

A rung name from RepairLadder::RUNGS.

setRung()

setRung(string  $code, string  $rung) : void

Moves a code to a rung.

Parameters

string $code

The finding code.

string $rung

A rung name from RepairLadder::RUNGS.

Throws

\InvalidArgumentException

When $rung is not on the ladder.

Returns

void —

summary()

summary() : list<array{code: string, severity: int, rung: string, scopes: int, newest: int}>

Open findings collapsed to one row per code.

What a dashboard and a metrics export both read: a code with four hundred scopes is one line an operator acts on rather than four hundred, and the scopes are only useful once they have decided to look at that code.

Returns

list

One entry per open code, worst severity first.

purge()

purge(int  $olderThan) : int

Drops findings recorded before a point in time.

Parameters

int $olderThan

Unix timestamp; findings recorded strictly before this are dropped.

Returns

int —

How many findings were dropped.