pub struct StorageBlockVerifier { /* private fields */ }Expand description
Verifies storage block integrity using FNV-1a checksums.
Tracks per-block verification history and accumulates lifetime statistics suitable for auditing and self-healing pipelines.
Implementations§
Source§impl StorageBlockVerifier
impl StorageBlockVerifier
Sourcepub fn register(&mut self, cid: String, content: &[u8]) -> u64
pub fn register(&mut self, cid: String, content: &[u8]) -> u64
Registers a block, computing its FNV-1a checksum from content.
Returns the newly assigned block_id.
Sourcepub fn verify_block(
&mut self,
block_id: u64,
content: Option<&[u8]>,
current_tick: u64,
) -> VerificationResult
pub fn verify_block( &mut self, block_id: u64, content: Option<&[u8]>, current_tick: u64, ) -> VerificationResult
Verifies a single block against its registered checksum.
- If
block_idis unknown →Missing(stats updated, no record mutation). - If
contentisNone→Missing(record updated). - Otherwise computes the FNV-1a checksum and returns
OkorCorrupted.
Always increments stats.total_verifications_run.
Sourcepub fn verify_batch(
&mut self,
batch: Vec<(u64, Option<Vec<u8>>)>,
current_tick: u64,
) -> VerificationReport
pub fn verify_batch( &mut self, batch: Vec<(u64, Option<Vec<u8>>)>, current_tick: u64, ) -> VerificationReport
Verifies a batch of (block_id, content) pairs and returns a summary report.
corrupted_ids and missing_ids in the returned report are sorted ascending.
Sourcepub fn get_record(&self, block_id: u64) -> Option<&BlockRecord>
pub fn get_record(&self, block_id: u64) -> Option<&BlockRecord>
Returns a reference to the record for block_id, if it exists.
Sourcepub fn stats(&self) -> &VerifierStats
pub fn stats(&self) -> &VerifierStats
Returns a reference to the cumulative statistics.
Sourcepub fn unverified_blocks(&self) -> Vec<u64>
pub fn unverified_blocks(&self) -> Vec<u64>
Returns block IDs that have never been verified, sorted ascending.
Sourcepub fn corrupted_blocks(&self) -> Vec<u64>
pub fn corrupted_blocks(&self) -> Vec<u64>
Returns block IDs whose most recent verification was Corrupted, sorted ascending.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StorageBlockVerifier
impl RefUnwindSafe for StorageBlockVerifier
impl Send for StorageBlockVerifier
impl Sync for StorageBlockVerifier
impl Unpin for StorageBlockVerifier
impl UnsafeUnpin for StorageBlockVerifier
impl UnwindSafe for StorageBlockVerifier
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more