From b3559793aa43018c662b6cc08c6333012df2af55 Mon Sep 17 00:00:00 2001 From: Martin Ek Date: Thu, 5 Apr 2018 18:02:19 +0200 Subject: [PATCH] Add set_memtable_prefix_bloom_ratio --- src/db_options.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/db_options.rs b/src/db_options.rs index 716b6f7..cf8ba78 100644 --- a/src/db_options.rs +++ b/src/db_options.rs @@ -980,6 +980,28 @@ impl Options { ffi::rocksdb_options_set_num_levels(self.inner, n); } } + + /// When a `prefix_extractor` is defined through `opts.set_prefix_extractor` this creates a + /// prefix bloom filter for each memtable with the size of + /// `write_buffer_size * memtable_prefix_bloom_ratio` (capped at 0.25). + /// + /// Default: `0` + /// + /// # Example + /// + /// ``` + /// use rocksdb::{Options, SliceTransform}; + /// + /// let mut opts = Options::default(); + /// let transform = SliceTransform::create_fixed_prefix(10); + /// opts.set_prefix_extractor(transform); + /// opts.set_memtable_prefix_bloom_ratio(0.2); + /// ``` + pub fn set_memtable_prefix_bloom_ratio(&mut self, ratio: f64) { + unsafe { + ffi::rocksdb_options_set_memtable_prefix_bloom_size_ratio(self.inner, ratio); + } + } } impl Default for Options {