The one place tripwires are enumerated, and the sweep that runs them.
Registration is keyed by the tripwire's own code, so the registry cannot end up holding two
checks that report under the same identifier - the ledger, the ladder and the circuit breaker
all key on that code, and two sources feeding one key makes every count downstream wrong.
The sweep is the part that has to be hard to break. A tripwire that throws is caught and turned
into a finding of its own, because the alternative is that one broken check hides every check
registered after it, and the checks that stop reporting are exactly the ones nobody notices have
gone quiet.
Code reported when a tripwire throws instead of answering.
The failing tripwire's own code goes in the finding's scope, so one broken check is
attributable without needing a code per tripwire for the same failure mode.
Properties
$wires
$wires : array
The registered tripwires, keyed by code, in registration order.
Type
array<string|int, mixed>
—
Methods
withStorageTripwires()
withStorageTripwires() : self
A registry holding every check over what is in the object store.
The set a verify pass sweeps with. Ordered cheapest-first only incidentally; every one of them
reads the observation it is handed and nothing else, so the order does not change the result.
Returns
self
—
A populated registry.
withCaptureTripwires()
withCaptureTripwires() : self
A registry holding the checks over whether capture saw everything.
Separate from the storage set because it answers a different question. The storage checks ask
whether what was stored is intact; this one asks whether anything was missed, which is the only
failure a backup system cannot see from inside its own capture path.
Returns
self
—
A populated registry.
withFileTripwires()
withFileTripwires() : self
A registry holding the checks over the file realm.
Its own set because the file realm's failure is neither corruption nor a gap: the content is
stored and restores exactly, and it simply costs far more than it should because fixed blocks
cannot follow a shift.
When the code is empty, or something is already registered under it. Both are refused
loudly rather than resolved by last-write-wins, which would silently drop a check.
Returns
self
—
This registry, so a set can be built in one expression.
has()
has(string $code) : bool
Whether a code is registered.
Parameters
string
$code
The tripwire code.
Returns
bool
—
TRUE when a tripwire is registered under this code.
Runs every tripwire over one observation and collects what fired.
The sweep never aborts. A tripwire that throws becomes a FAILED finding scoped to that
tripwire's code and the sweep continues, so a bug in one check costs one check.
Parameters
array
$observation
Scalars the caller already had; passed to every tripwire unchanged.
Returns
\Drupal\strata\Health\Finding[]
—
Findings in registration order, empty when everything is satisfied.