pub struct BlockIntegrityChecker {
pub config: CheckerConfig,
}Expand description
Checks stored blocks by verifying that their CIDs match the computed CID derived from the block content.
Fields§
§config: CheckerConfigConfiguration controlling check behaviour.
Implementations§
Source§impl BlockIntegrityChecker
impl BlockIntegrityChecker
Sourcepub fn new(config: CheckerConfig) -> Self
pub fn new(config: CheckerConfig) -> Self
Creates a new checker with the given configuration.
Sourcepub fn verify_cid_format(&self, cid: &str) -> Result<(), IntegrityError>
pub fn verify_cid_format(&self, cid: &str) -> Result<(), IntegrityError>
Verifies that cid is a syntactically valid CID string.
Currently this is a simplified check: an empty string is rejected, any non-empty string is considered valid.
Sourcepub fn check_block(&self, cid: &str, data: &[u8]) -> CheckedBlock
pub fn check_block(&self, cid: &str, data: &[u8]) -> CheckedBlock
Checks the integrity of a single block.
§Arguments
cid– The CID stored alongside the block.data– The raw block bytes.
Sourcepub fn check_blocks(&self, blocks: &[(&str, &[u8])]) -> IntegrityReport
pub fn check_blocks(&self, blocks: &[(&str, &[u8])]) -> IntegrityReport
Checks a slice of (cid, data) pairs and returns an aggregated report.
Respects config.max_blocks: stops after that many checks.
Auto Trait Implementations§
impl Freeze for BlockIntegrityChecker
impl RefUnwindSafe for BlockIntegrityChecker
impl Send for BlockIntegrityChecker
impl Sync for BlockIntegrityChecker
impl Unpin for BlockIntegrityChecker
impl UnsafeUnpin for BlockIntegrityChecker
impl UnwindSafe for BlockIntegrityChecker
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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