pub struct ChecksumManager { /* private fields */ }Expand description
Metadata manager that encapsulates the checksum logic extracted from BlockStorage
Implementations§
Source§impl ChecksumManager
impl ChecksumManager
Sourcepub fn new(default_algorithm: ChecksumAlgorithm) -> Self
pub fn new(default_algorithm: ChecksumAlgorithm) -> Self
Create new checksum manager with default algorithm
Sourcepub fn with_data(
checksums: HashMap<u64, u64>,
checksum_algos: HashMap<u64, ChecksumAlgorithm>,
default_algorithm: ChecksumAlgorithm,
) -> Self
pub fn with_data( checksums: HashMap<u64, u64>, checksum_algos: HashMap<u64, ChecksumAlgorithm>, default_algorithm: ChecksumAlgorithm, ) -> Self
Initialize with existing data (used during restoration)
Sourcepub fn compute_checksum_with(data: &[u8], algo: ChecksumAlgorithm) -> u64
pub fn compute_checksum_with(data: &[u8], algo: ChecksumAlgorithm) -> u64
MOVED from BlockStorage::compute_checksum_with (lines 1803-1818)
Sourcepub fn store_checksum(&mut self, block_id: u64, data: &[u8])
pub fn store_checksum(&mut self, block_id: u64, data: &[u8])
Store checksum for a block (MOVED from lines 2442-2444)
Sourcepub fn validate_checksum(
&self,
block_id: u64,
data: &[u8],
) -> Result<(), DatabaseError>
pub fn validate_checksum( &self, block_id: u64, data: &[u8], ) -> Result<(), DatabaseError>
Validate checksum for a block (MOVED from lines 1843-1870)
Sourcepub fn remove_checksum(&mut self, block_id: u64)
pub fn remove_checksum(&mut self, block_id: u64)
Remove checksum for a block (MOVED from lines 1709-1710)
Sourcepub fn get_checksum(&self, block_id: u64) -> Option<u64>
pub fn get_checksum(&self, block_id: u64) -> Option<u64>
Get checksum for a block
Sourcepub fn get_algorithm(&self, block_id: u64) -> ChecksumAlgorithm
pub fn get_algorithm(&self, block_id: u64) -> ChecksumAlgorithm
Get algorithm for a block
Sourcepub fn replace_all(
&mut self,
new_checksums: HashMap<u64, u64>,
new_algos: HashMap<u64, ChecksumAlgorithm>,
)
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)
Sourcepub fn checksums(&self) -> &HashMap<u64, u64>
pub fn checksums(&self) -> &HashMap<u64, u64>
Get reference to internal checksums map (for compatibility)
Sourcepub fn algorithms(&self) -> &HashMap<u64, ChecksumAlgorithm>
pub fn algorithms(&self) -> &HashMap<u64, ChecksumAlgorithm>
Get reference to internal algorithms map (for compatibility)
Sourcepub fn default_algorithm(&self) -> ChecksumAlgorithm
pub fn default_algorithm(&self) -> ChecksumAlgorithm
Get default algorithm
Sourcepub fn set_checksum_for_testing(&mut self, block_id: u64, checksum: u64)
pub fn set_checksum_for_testing(&mut self, block_id: u64, checksum: u64)
Set checksum for testing purposes
Sourcepub fn clear_checksums(&mut self)
pub fn clear_checksums(&mut self)
Clear all checksums (useful after database import)