pub trait FilterPolicy {
    // Required methods
    fn name(&self) -> &'static str;
    fn create_filter(&self, keys: &[u8], key_offsets: &[usize]) -> Vec<u8>;
    fn key_may_match(&self, key: &[u8], filter: &[u8]) -> bool;
}
Expand description

Encapsulates a filter algorithm allowing to search for keys more efficiently. Usually, policies are used as a BoxedFilterPolicy (see below), so they can be easily cloned and nested.

Required Methods§

source

fn name(&self) -> &'static str

Returns a string identifying this policy.

source

fn create_filter(&self, keys: &[u8], key_offsets: &[usize]) -> Vec<u8>

Create a filter matching the given keys. Keys are given as a long byte array that is indexed by the offsets contained in key_offsets.

source

fn key_may_match(&self, key: &[u8], filter: &[u8]) -> bool

Check whether the given key may match the filter.

Implementations on Foreign Types§

source§

impl FilterPolicy for Arc<Box<dyn FilterPolicy>>

source§

fn name(&self) -> &'static str

source§

fn create_filter(&self, keys: &[u8], key_offsets: &[usize]) -> Vec<u8>

source§

fn key_may_match(&self, key: &[u8], filter: &[u8]) -> bool

Implementors§