pub struct BloomFilter { /* private fields */ }Expand description
Concurrent Bloom filter with atomic rebuild support.
Inserts made while a rebuild is active are recorded and applied to the new filter immediately before it replaces the old filter.
Implementations§
Source§impl BloomFilter
impl BloomFilter
Sourcepub fn new(config: BloomConfig) -> Result<Self, BloomError>
pub fn new(config: BloomConfig) -> Result<Self, BloomError>
Creates a Bloom filter from the expected item count and false-positive rate.
Sourcepub fn insert_many<'a>(&self, keys: impl IntoIterator<Item = &'a str>)
pub fn insert_many<'a>(&self, keys: impl IntoIterator<Item = &'a str>)
Inserts several keys into the current filter.
Sourcepub fn clear(&self, config: BloomConfig) -> Result<(), BloomError>
pub fn clear(&self, config: BloomConfig) -> Result<(), BloomError>
Replaces the current filter with an empty filter using new sizing.
Sourcepub fn start_rebuild(
self: &Arc<Self>,
config: BloomConfig,
) -> Result<BloomRebuild, BloomError>
pub fn start_rebuild( self: &Arc<Self>, config: BloomConfig, ) -> Result<BloomRebuild, BloomError>
Starts an atomic rebuild session.
Feed streamed batches into the returned session and call
BloomRebuild::commit after the source has completed. Dropping the
session leaves the previous filter active and stops buffering inserts.
Auto Trait Implementations§
impl !Freeze for BloomFilter
impl !RefUnwindSafe for BloomFilter
impl Send for BloomFilter
impl Sync for BloomFilter
impl Unpin for BloomFilter
impl UnsafeUnpin for BloomFilter
impl UnwindSafe for BloomFilter
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