pub trait FilterTrait<Key: Send + Sync>: Clone + Sync + Send {
    // Required methods
    fn add(&self, key: &Key);
    fn contains_fast(&self, key: &Key) -> FilterResult;
    fn checked_add_assign(&mut self, other: &Self) -> bool;
    fn clear_filter(&mut self);

    // Provided methods
    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,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: '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§

source

fn add(&self, key: &Key)

Add key to filter

source

fn contains_fast(&self, key: &Key) -> FilterResult

Check if key in filter (should be implemented if filter can be checked without waiting)

source

fn checked_add_assign(&mut self, other: &Self) -> bool

Add another filter to this filter

source

fn clear_filter(&mut self)

Clear all filter data

Provided Methods§

source

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, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Check if key in filter (can take some time)

source

fn offload_filter(&mut self) -> usize

Offload filter from memory if possible

source

fn memory_allocated(&self) -> usize

Memory used by filter

source

fn is_filter_offloaded(&self) -> bool

Check if filter was offloaded

Implementations on Foreign Types§

source§

impl<T, K> FilterTrait<K> for Option<T>where K: Send + Sync, T: Send + Sync + Clone + FilterTrait<K>,

source§

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, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Check if key in filter (can take some time)

source§

fn add(&self, key: &K)

source§

fn contains_fast(&self, key: &K) -> FilterResult

source§

fn checked_add_assign(&mut self, other: &Self) -> bool

source§

fn clear_filter(&mut self)

source§

fn offload_filter(&mut self) -> usize

source§

fn memory_allocated(&self) -> usize

source§

fn is_filter_offloaded(&self) -> bool

Implementors§

source§

impl<K> FilterTrait<K> for Bloomwhere K: AsRef<[u8]> + Sync + Send + Debug,

source§

impl<K> FilterTrait<K> for RangeFilter<K>where for<'a> K: Key<'a>,

source§

impl<K> FilterTrait<K> for CombinedFilter<K>where for<'a> K: Key<'a> + Send + Sync, Bloom: FilterTrait<K>,

Trait filters should implement