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. Adds a by-stage/ index so “list
every attestation for stage X” is O(attestations on X) rather
than O(all attestations).
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.