add compression_per_level options

master
zhangjinpeng1987 9 years ago committed by Karl Hobley
parent a783093048
commit b9bcc0900e
  1. 3
      src/ffi.rs
  2. 10
      src/rocksdb_options.rs

@ -182,6 +182,9 @@ extern "C" {
cs: DBCompactionStyle); cs: DBCompactionStyle);
pub fn rocksdb_options_set_compression(options: DBOptions, pub fn rocksdb_options_set_compression(options: DBOptions,
compression_style_no: DBCompressionType); compression_style_no: DBCompressionType);
pub fn rocksdb_options_set_compression_per_level(options: DBOptions,
level_values: *const DBCompressionType,
num_levels: size_t);
pub fn rocksdb_options_set_max_background_compactions( pub fn rocksdb_options_set_max_background_compactions(
options: DBOptions, max_bg_compactions: c_int); options: DBOptions, max_bg_compactions: c_int);
pub fn rocksdb_options_set_max_background_flushes(options: DBOptions, pub fn rocksdb_options_set_max_background_flushes(options: DBOptions,

@ -13,7 +13,7 @@
// limitations under the License. // limitations under the License.
// //
extern crate libc; extern crate libc;
use self::libc::c_int; use self::libc::{c_int,size_t};
use std::ffi::CString; use std::ffi::CString;
use std::mem; use std::mem;
@ -117,6 +117,14 @@ impl Options {
} }
} }
pub fn compression_per_level(&mut self, level_types: &[DBCompressionType]) {
unsafe {
rocksdb_ffi::rocksdb_options_set_compression_per_level(self.inner,
level_types.as_ptr(),
level_types.len() as size_t)
}
}
pub fn add_merge_operator(&mut self, pub fn add_merge_operator(&mut self,
name: &str, name: &str,
merge_fn: MergeFn) { merge_fn: MergeFn) {

Loading…
Cancel
Save