pub struct StandardHashTable { /* private fields */ }Expand description
Hash table for block deduplication with identity hashing.
Uses an identity hasher since keys are BLAKE3 hashes (already uniformly
distributed), giving ~3-6x speedup over the default SipHash.
Implementations§
Source§impl StandardHashTable
impl StandardHashTable
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a hash table with pre-allocated capacity for capacity entries.
Sourcepub fn insert(&mut self, hash: [u8; 32], offset: u64) -> Option<u64>
pub fn insert(&mut self, hash: [u8; 32], offset: u64) -> Option<u64>
Inserts a hash-to-offset mapping, returning the previous offset if the hash was already present.
Sourcepub fn get(&self, hash: &[u8; 32]) -> Option<u64>
pub fn get(&self, hash: &[u8; 32]) -> Option<u64>
Looks up the offset for a given hash, returning None if not found.
Sourcepub fn load_factor(&self) -> f64
pub fn load_factor(&self) -> f64
Returns the ratio of entries to capacity (0.0 when empty).
Sourcepub fn memory_bytes(&self) -> usize
pub fn memory_bytes(&self) -> usize
Returns the estimated memory usage of the table in bytes.
Sourcepub fn stats(&self) -> TableStats
pub fn stats(&self) -> TableStats
Returns performance statistics for this table.
Trait Implementations§
Source§impl Debug for StandardHashTable
impl Debug for StandardHashTable
Source§impl Default for StandardHashTable
impl Default for StandardHashTable
impl Sync for StandardHashTable
Auto Trait Implementations§
impl !Freeze for StandardHashTable
impl !RefUnwindSafe for StandardHashTable
impl Send for StandardHashTable
impl Unpin for StandardHashTable
impl UnsafeUnpin for StandardHashTable
impl UnwindSafe for StandardHashTable
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 more