Skip to main content

Module choose

Module choose 

Source
Expand description

Stage 4 of backend benchmarking, kind-agnostic: “best backend for X”, as a ranked list with its evidence. The kinds (persistant_kv::choose, persistant_blob::choose) supply their contract leaf ids, their workload ids and a table of what their backends declare about durability; the logic is here, once.

The consumer states what it needs; nothing is chosen for it:

choose returns a Choice: the eligible backends fastest first, each with the measurement it was ranked on (date, re-run command, image digest), the eligible ones that were not measured in that environment, and every backend that was excluded, with the reason. If nothing is eligible it is an error (NoneEligible) that carries the exclusions: no silent fallback, no “closest match”. Every decision is written as lines (Choice::log_lines) the caller logs.

Durability is declared; Process and Machine are verified only where a test ran (the kind’s process-kill test; the guest power-cut harness in scripts/machine-durability). A backend with no declaration is excluded as unknown once the need asks for more than Volatile. Machine is marked verified only for what that harness exercised, and never for host power loss or NTFS.

Structs§

Candidate
One backend, with the evidence gathered about it. eligibility comes from the kind’s contract check on the needed leaves.
Choice
The answer: ranked, with evidence, and everything left out with its reason.
Declared
A durability class, where it comes from, and how much of it a test has checked.
Entry
A backend in the ranking, with what it was ranked on.
Excluded
A backend left out, with the reason.
LeafFailure
A required leaf the backend did not pass.
Need
What the consumer needs. Every field is the consumer’s to state.
NoneEligible
Nothing satisfied the need. Carries what was excluded and why, so the caller can see which requirement ruled the field out.
Unmeasured
An eligible backend with no measurement of the ranking workload in the needed environment.

Enums§

Durability
How much a stored value survives. Ordered: a higher class includes the lower ones.
Eligibility
Whether a backend passed the contract for the leaves a need names.
Why
Why a backend is not in the ranking.

Functions§

choose
Order the candidates for need using speed. Pure: it reads the evidence it is given and invents none.