pub struct AttestationLog { /* private fields */ }Expand description
Persistent log of Attestation records.
Mirrors crate::OpLog / crate::IntentLog in shape: one
canonical-JSON file per attestation, atomic writes via tempfile +
rename, idempotent on re-puts. Maintains two secondary indices
for cheap reverse lookups:
by-stage/<StageId>/<AttestationId>— every attestation, indexed by the stage it records evidence for.by-run/<TraceRunId>/<AttestationId>(#246) — onlyAttestationKind::Traceentries are indexed here, solist_for_runisO(traces of that run)rather than scanning the whole log.
Implementations§
Source§impl AttestationLog
impl AttestationLog
pub fn open(root: &Path) -> Result<Self>
Sourcepub fn put(&self, attestation: &Attestation) -> Result<()>
pub fn put(&self, attestation: &Attestation) -> Result<()>
Persist an attestation. Idempotent on existing ids — content addressing guarantees the same logical attestation produces the same id, so re-putting is a no-op for the primary file. The by-stage index is also re-written idempotently.
pub fn get(&self, id: &AttestationId) -> Result<Option<Attestation>>
Sourcepub fn list_all(&self) -> Result<Vec<Attestation>>
pub fn list_all(&self) -> Result<Vec<Attestation>>
Enumerate every attestation in the log. Walks
<root>/attestations/*.json directly — no per-stage index
— so cost is O(total attestations). Used by lex attest filter for CI / dashboard queries that span stages.
Order is not stable; callers that need stable ordering
should sort by timestamp or attestation_id.
Sourcepub fn list_for_stage(&self, stage_id: &StageId) -> Result<Vec<Attestation>>
pub fn list_for_stage(&self, stage_id: &StageId) -> Result<Vec<Attestation>>
Enumerate attestations for a given stage. Order is not
stable across calls (it follows directory iteration order).
Callers that need a stable ordering should sort by
timestamp or attestation_id.
Sourcepub fn list_for_run(&self, run_id: &TraceRunId) -> Result<Vec<Attestation>>
pub fn list_for_run(&self, run_id: &TraceRunId) -> Result<Vec<Attestation>>
Enumerate AttestationKind::Trace entries for a given
run_id (#246). Walks the by-run/<run_id>/ directory; cost
is O(trace attestations for that run), typically 1.
Returns an empty vec if the run has no Trace attestations.
Order is not stable.