pub struct DataIntegrityChecker { /* private fields */ }Expand description
Deep integrity checker for stored blocks.
Maintains a registry of block records, performs FNV-1a checksum and size verification, tracks quarantined blocks, and accumulates statistics.
Implementations§
Source§impl DataIntegrityChecker
impl DataIntegrityChecker
Sourcepub fn new(config: IntegrityCheckerConfig) -> Self
pub fn new(config: IntegrityCheckerConfig) -> Self
Create a new integrity checker with the given configuration.
Sourcepub fn register_block(&mut self, record: BlockRecord)
pub fn register_block(&mut self, record: BlockRecord)
Register a block record for future integrity checks.
Sourcepub fn check_block(&mut self, cid: &str) -> Option<IntegrityReport>
pub fn check_block(&mut self, cid: &str) -> Option<IntegrityReport>
Check the integrity of a single block by CID.
Returns None if the CID is not registered (and records a Missing report).
Sourcepub fn check_all(&mut self) -> Vec<IntegrityReport>
pub fn check_all(&mut self) -> Vec<IntegrityReport>
Check integrity of all registered blocks.
Processes blocks in batches according to the configured batch_size.
Sourcepub fn compute_checksum(data: &[u8]) -> u64
pub fn compute_checksum(data: &[u8]) -> u64
Compute FNV-1a 64-bit hash of the given data.
Sourcepub fn quarantine(&mut self, cid: &str) -> bool
pub fn quarantine(&mut self, cid: &str) -> bool
Quarantine a block by CID. Returns true if newly quarantined.
Sourcepub fn unquarantine(&mut self, cid: &str) -> bool
pub fn unquarantine(&mut self, cid: &str) -> bool
Remove a block from quarantine. Returns true if it was quarantined.
Sourcepub fn is_quarantined(&self, cid: &str) -> bool
pub fn is_quarantined(&self, cid: &str) -> bool
Check if a block is currently quarantined.
Sourcepub fn quarantined_count(&self) -> usize
pub fn quarantined_count(&self) -> usize
Number of currently quarantined blocks.
Sourcepub fn get_report(&self, cid: &str) -> Option<&IntegrityReport>
pub fn get_report(&self, cid: &str) -> Option<&IntegrityReport>
Get the most recent report for a given CID.
Sourcepub fn corrupted_blocks(&self) -> Vec<&IntegrityReport>
pub fn corrupted_blocks(&self) -> Vec<&IntegrityReport>
Get all reports for corrupted blocks.
Sourcepub fn stats(&self) -> &IntegrityStats
pub fn stats(&self) -> &IntegrityStats
Get the current aggregate statistics.
Sourcepub fn clear_reports(&mut self)
pub fn clear_reports(&mut self)
Clear all stored reports (does not reset stats or quarantine).
Sourcepub fn remove_block(&mut self, cid: &str) -> bool
pub fn remove_block(&mut self, cid: &str) -> bool
Remove a block record from the registry. Returns true if it existed.
Auto Trait Implementations§
impl Freeze for DataIntegrityChecker
impl RefUnwindSafe for DataIntegrityChecker
impl Send for DataIntegrityChecker
impl Sync for DataIntegrityChecker
impl Unpin for DataIntegrityChecker
impl UnsafeUnpin for DataIntegrityChecker
impl UnwindSafe for DataIntegrityChecker
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