Skip to main content

PerceptionLog

Struct PerceptionLog 

Source
pub struct PerceptionLog { /* private fields */ }
Expand description

Append-only, plaintext, hash-linked log of sensor-frame provenance records. Reuses the black-box chain semantics ([entry_hash], genesis_prev_hash), so a perception log verifies the same way as the safety ledger. Each entry binds a sequence number, a timestamp, the sensor id, the modality, the frame hash, and the hash of the previous entry; the frames are not stored.

Implementations§

Source§

impl PerceptionLog

Source

pub fn new(genesis_prev_hash_override: Option<&str>) -> Self

Build a log. A None genesis uses genesis_prev_hash.

Source

pub fn record( &mut self, sensor_id: &str, modality: &str, frame: Option<&[u8]>, frame_hash: Option<&str>, timestamp: &str, ) -> Result<Value>

Append one frame-provenance record, link it to the chain head, and return the entry. Provide either the raw frame (it is hashed) or a precomputed frame_hash, not both.

Source

pub fn head(&self) -> &str

Source

pub fn genesis(&self) -> &str

Source

pub fn entries(&self) -> &[Value]

Source

pub fn count(&self) -> usize

The number of records, the count a perception attestation anchors.

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.