Skip to main content

AttestationLog

Struct AttestationLog 

Source
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) — only AttestationKind::Trace entries are indexed here, so list_for_run is O(traces of that run) rather than scanning the whole log.

Implementations§

Source§

impl AttestationLog

Source

pub fn open(root: &Path) -> Result<Self>

Source

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.

Source

pub fn get(&self, id: &AttestationId) -> Result<Option<Attestation>>

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.