pub struct SharedBloomFilter { /* private fields */ }Implementations§
Sourcepub fn suggest_config(n_items: usize, p: f64) -> (usize, u32)
pub fn suggest_config(n_items: usize, p: f64) -> (usize, u32)
Suggest n_bits and n_hashes for a target false-positive rate
p and expected item count n. Both rounded up.
pub fn create( base_path: impl AsRef<Path>, n_bits: usize, n_hashes: u32, ) -> Result<Self, BloomError>
pub fn open( base_path: impl AsRef<Path>, n_bits: usize, n_hashes: u32, ) -> Result<Self, BloomError>
pub fn n_bits(&self) -> u64
pub fn n_hashes(&self) -> u32
pub fn insert(&self, item: &[u8]) -> Result<(), BloomError>
Sourcepub fn contains(&self, item: &[u8]) -> Result<bool, BloomError>
pub fn contains(&self, item: &[u8]) -> Result<bool, BloomError>
True if item MIGHT be in the set; false if definitely not.
False positives are possible; false negatives are NOT.
Sourcepub fn estimated_false_positive_rate(&self) -> f64
pub fn estimated_false_positive_rate(&self) -> f64
Estimate the current false-positive rate from the bit-set density. Returns 0.0 for an empty filter; approaches 1.0 as the filter saturates.
Sourcepub fn estimated_insert_count(&self) -> u64
pub fn estimated_insert_count(&self) -> u64
Estimate the number of distinct inserted items based on bit
density. Formula: -n_bits / n_hashes * ln(1 - fill / n_bits).
pub fn flush(&self) -> Result<(), BloomError>
pub fn flush_async(&self) -> Result<(), BloomError>
Trait Implementations§
fn header(&self) -> &HandshakeHeader
fn ring(&self) -> &ObservationRing
fn make_policy(&self) -> Box<dyn Policy>
Source§fn apply_migration(&self, new_tag: u32)
fn apply_migration(&self, new_tag: u32)
Called by the sidecar when the policy returns a new strategy
tag. Default implementation: just set the tag on the header.
Primitives that need heavier migration (data-layout swap)
override this to perform the swap before (or after) updating
the tag.
Auto Trait Implementations§
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