pub struct CidBloomFilter { /* private fields */ }Expand description
CID-specific wrapper around BloomFilter for write-time deduplication.
Converts CID strings to bytes and delegates to the inner filter. All
operations are thread-safe via the parking_lot::RwLock inside BloomFilter.
Implementations§
Source§impl CidBloomFilter
impl CidBloomFilter
Sourcepub fn new(config: BloomFilterConfig) -> Self
pub fn new(config: BloomFilterConfig) -> Self
Create a new CidBloomFilter with the given configuration.
Sourcepub fn default_config() -> Self
pub fn default_config() -> Self
Create a CidBloomFilter with default configuration (1 M-bit filter).
Sourcepub fn insert_cid(&self, cid: &str)
pub fn insert_cid(&self, cid: &str)
Insert a CID (as a UTF-8 string) into the filter.
Sourcepub fn may_contain_cid(&self, cid: &str) -> bool
pub fn may_contain_cid(&self, cid: &str) -> bool
Returns false iff the CID is definitely not in the filter.
Sourcepub fn snapshot(&self) -> BloomSnapshot
pub fn snapshot(&self) -> BloomSnapshot
Take a snapshot of the current filter state.
Sourcepub fn inner(&self) -> &BloomFilter
pub fn inner(&self) -> &BloomFilter
Access the underlying BloomFilter directly.
Sourcepub fn config(&self) -> &BloomFilterConfig
pub fn config(&self) -> &BloomFilterConfig
Return the configuration this filter was created with.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for CidBloomFilter
impl !RefUnwindSafe for CidBloomFilter
impl Send for CidBloomFilter
impl Sync for CidBloomFilter
impl Unpin for CidBloomFilter
impl UnsafeUnpin for CidBloomFilter
impl UnwindSafe for CidBloomFilter
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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