Trait pearl::filter::traits::FilterTrait
source · pub trait FilterTrait<Key: Send + Sync>: Clone + Sync + Send {
fn add(&mut self, key: &Key);
fn contains_fast(&self, key: &Key) -> FilterResult;
fn checked_add_assign(&mut self, other: &Self) -> bool;
fn clear_filter(&mut self);
fn contains<'life0, 'life1, 'life2, 'async_trait, P>(
&'life0 self,
_provider: &'life1 P,
key: &'life2 Key
) -> Pin<Box<dyn Future<Output = FilterResult> + Send + 'async_trait>>
where
P: 'async_trait + BloomDataProvider,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
{ ... }
fn offload_filter(&mut self) -> usize { ... }
fn memory_allocated(&self) -> usize { ... }
fn is_filter_offloaded(&self) -> bool { ... }
}
Expand description
Trait filters should implement
Required Methods
sourcefn contains_fast(&self, key: &Key) -> FilterResult
fn contains_fast(&self, key: &Key) -> FilterResult
Check if key in filter (should be implemented if filter can be checked without waiting)
sourcefn checked_add_assign(&mut self, other: &Self) -> bool
fn checked_add_assign(&mut self, other: &Self) -> bool
Add another filter to this filter
sourcefn clear_filter(&mut self)
fn clear_filter(&mut self)
Clear all filter data
Provided Methods
sourcefn contains<'life0, 'life1, 'life2, 'async_trait, P>(
&'life0 self,
_provider: &'life1 P,
key: &'life2 Key
) -> Pin<Box<dyn Future<Output = FilterResult> + Send + 'async_trait>>where
P: 'async_trait + BloomDataProvider,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn contains<'life0, 'life1, 'life2, 'async_trait, P>(
&'life0 self,
_provider: &'life1 P,
key: &'life2 Key
) -> Pin<Box<dyn Future<Output = FilterResult> + Send + 'async_trait>>where
P: 'async_trait + BloomDataProvider,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Check if key in filter (can take some time)
sourcefn offload_filter(&mut self) -> usize
fn offload_filter(&mut self) -> usize
Offload filter from memory if possible
sourcefn memory_allocated(&self) -> usize
fn memory_allocated(&self) -> usize
Memory used by filter
sourcefn is_filter_offloaded(&self) -> bool
fn is_filter_offloaded(&self) -> bool
Check if filter was offloaded
Implementations on Foreign Types
sourceimpl<T, K> FilterTrait<K> for Option<T>where
K: Send + Sync,
T: Send + Sync + Clone + FilterTrait<K>,
impl<T, K> FilterTrait<K> for Option<T>where
K: Send + Sync,
T: Send + Sync + Clone + FilterTrait<K>,
sourcefn contains<'life0, 'life1, 'life2, 'async_trait, P>(
&'life0 self,
provider: &'life1 P,
key: &'life2 K
) -> Pin<Box<dyn Future<Output = FilterResult> + Send + 'async_trait>>where
P: 'async_trait + BloomDataProvider,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn contains<'life0, 'life1, 'life2, 'async_trait, P>(
&'life0 self,
provider: &'life1 P,
key: &'life2 K
) -> Pin<Box<dyn Future<Output = FilterResult> + Send + 'async_trait>>where
P: 'async_trait + BloomDataProvider,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Check if key in filter (can take some time)
fn add(&mut self, key: &K)
fn contains_fast(&self, key: &K) -> FilterResult
fn checked_add_assign(&mut self, other: &Self) -> bool
fn clear_filter(&mut self)
fn offload_filter(&mut self) -> usize
fn memory_allocated(&self) -> usize
fn is_filter_offloaded(&self) -> bool
Implementors
impl<K> FilterTrait<K> for Bloomwhere
K: AsRef<[u8]> + Sync + Send + Debug,
impl<K> FilterTrait<K> for RangeFilter<K>where
for<'a> K: Key<'a>,
impl<K> FilterTrait<K> for CombinedFilter<K>where
for<'a> K: Key<'a> + Send + Sync,
Bloom: FilterTrait<K>,
Trait filters should implement