ChecksumManager

Struct ChecksumManager 

Source
pub struct ChecksumManager { /* private fields */ }
Expand description

Metadata manager that encapsulates the checksum logic extracted from BlockStorage

Implementations§

Source§

impl ChecksumManager

Source

pub fn new(default_algorithm: ChecksumAlgorithm) -> Self

Create new checksum manager with default algorithm

Source

pub fn with_data( checksums: HashMap<u64, u64>, checksum_algos: HashMap<u64, ChecksumAlgorithm>, default_algorithm: ChecksumAlgorithm, ) -> Self

Initialize with existing data (used during restoration)

Source

pub fn compute_checksum_with(data: &[u8], algo: ChecksumAlgorithm) -> u64

MOVED from BlockStorage::compute_checksum_with (lines 1803-1818)

Source

pub fn store_checksum(&mut self, block_id: u64, data: &[u8])

Store checksum for a block (MOVED from lines 2442-2444)

Source

pub fn validate_checksum( &self, block_id: u64, data: &[u8], ) -> Result<(), DatabaseError>

Validate checksum for a block (MOVED from lines 1843-1870)

Source

pub fn remove_checksum(&mut self, block_id: u64)

Remove checksum for a block (MOVED from lines 1709-1710)

Source

pub fn get_checksum(&self, block_id: u64) -> Option<u64>

Get checksum for a block

Source

pub fn get_algorithm(&self, block_id: u64) -> ChecksumAlgorithm

Get algorithm for a block

Source

pub fn replace_all( &mut self, new_checksums: HashMap<u64, u64>, new_algos: HashMap<u64, ChecksumAlgorithm>, )

Replace all checksums (MOVED from lines 1331-1332, 1500-1501)

Source

pub fn checksums(&self) -> &HashMap<u64, u64>

Get reference to internal checksums map (for compatibility)

Source

pub fn algorithms(&self) -> &HashMap<u64, ChecksumAlgorithm>

Get reference to internal algorithms map (for compatibility)

Source

pub fn default_algorithm(&self) -> ChecksumAlgorithm

Get default algorithm

Source

pub fn set_checksum_for_testing(&mut self, block_id: u64, checksum: u64)

Set checksum for testing purposes

Source

pub fn clear_checksums(&mut self)

Clear all checksums (useful after database import)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.