pub struct ChainHasher { /* private fields */ }Expand description
Streaming chain hasher: computes chain checksum incrementally during LTX decode.
Pages MUST be fed in sorted order (by page number). Our encoder sorts pages, so they arrive sorted during decode. This eliminates the need to accumulate all decoded pages in a Vec just for checksum verification.
Implementations§
Source§impl ChainHasher
impl ChainHasher
Sourcepub fn new(pre: Checksum) -> Self
pub fn new(pre: Checksum) -> Self
Create a new chain hasher seeded with the pre-apply checksum.
Sourcepub fn update(&mut self, page_num: u32, page_data: &[u8])
pub fn update(&mut self, page_num: u32, page_data: &[u8])
Feed a page into the hash. Pages must arrive in sorted order.
Sourcepub fn page_count(&self) -> usize
pub fn page_count(&self) -> usize
Number of pages fed into the hasher.
Auto Trait Implementations§
impl Freeze for ChainHasher
impl RefUnwindSafe for ChainHasher
impl Send for ChainHasher
impl Sync for ChainHasher
impl Unpin for ChainHasher
impl UnsafeUnpin for ChainHasher
impl UnwindSafe for ChainHasher
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
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 moreCreates a shared type from an unshared type.