FilterBuilder

Trait FilterBuilder 

Source
pub trait FilterBuilder: Send {
    // Required methods
    fn add_key(&mut self, dist_key: &[u8], table_id: u32);
    fn finish(&mut self, memory_limiter: Option<Arc<MemoryLimiter>>) -> Vec<u8> ;
    fn approximate_len(&self) -> usize;
    fn create(options: FilterBuilderOptions) -> Self;
    fn approximate_building_memory(&self) -> usize;
    fn filter_type(&self) -> PbSstableFilterType;

    // Provided methods
    fn switch_block(&mut self, _memory_limiter: Option<Arc<MemoryLimiter>>) { ... }
    fn add_raw_data(&mut self, _raw: Vec<u8>) { ... }
    fn support_blocked_raw_data(&self) -> bool { ... }
}

Required Methods§

Source

fn add_key(&mut self, dist_key: &[u8], table_id: u32)

add key which need to be filter for construct filter data.

Source

fn finish(&mut self, memory_limiter: Option<Arc<MemoryLimiter>>) -> Vec<u8>

Builds serialized filter bytes from key hashes.

Source

fn approximate_len(&self) -> usize

Approximate serialized filter bytes counted toward SST builder capacity.

SstableBuilder::reach_capacity uses this value to decide when to seal the current SST. It should track the filter bytes that would be appended to the SST if the builder were finished now, including any pending block-local filter bytes. It is not a heap memory estimate for the builder or the decoded filter reader. Use approximate_building_memory for build-time temporary memory.

Source

fn create(options: FilterBuilderOptions) -> Self

Source

fn approximate_building_memory(&self) -> usize

Approximate temporary memory needed when finishing the filter.

Source

fn filter_type(&self) -> PbSstableFilterType

Provided Methods§

Source

fn switch_block(&mut self, _memory_limiter: Option<Arc<MemoryLimiter>>)

Source

fn add_raw_data(&mut self, _raw: Vec<u8>)

Add raw data which build by keys directly. Please make sure that you have finished the last block by calling switch_block

Source

fn support_blocked_raw_data(&self) -> bool

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§