Trait rusty_leveldb_arc::FilterPolicy
source · 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§
sourcefn create_filter(&self, keys: &[u8], key_offsets: &[usize]) -> Vec<u8>
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.
sourcefn key_may_match(&self, key: &[u8], filter: &[u8]) -> bool
fn key_may_match(&self, key: &[u8], filter: &[u8]) -> bool
Check whether the given key may match the filter.