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
impl PerceptionLog
Sourcepub fn new(genesis_prev_hash_override: Option<&str>) -> Self
pub fn new(genesis_prev_hash_override: Option<&str>) -> Self
Build a log. A None genesis uses genesis_prev_hash.
Sourcepub fn resume(prev_hash: &str, next_seq: u64) -> Self
pub fn resume(prev_hash: &str, next_seq: u64) -> Self
Continue a log whose head is prev_hash and whose next entry is
number next_seq.
Sourcepub fn record(
&mut self,
sensor_id: &str,
modality: &str,
frame: Option<&[u8]>,
frame_hash: Option<&str>,
timestamp: &str,
) -> Result<Value>
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.
pub fn head(&self) -> &str
pub fn genesis(&self) -> &str
pub fn entries(&self) -> &[Value]
Auto Trait Implementations§
impl Forget for PerceptionLog
impl Freeze for PerceptionLog
impl Move for PerceptionLog
impl RefUnwindSafe for PerceptionLog
impl Send for PerceptionLog
impl Sync for PerceptionLog
impl Unpin for PerceptionLog
impl UnsafeUnpin for PerceptionLogwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
impl UnwindSafe for PerceptionLog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more