diff --git a/src/ffi.rs b/src/ffi.rs index 9b160ae..1437c6c 100644 --- a/src/ffi.rs +++ b/src/ffi.rs @@ -182,6 +182,9 @@ extern "C" { cs: DBCompactionStyle); pub fn rocksdb_options_set_compression(options: DBOptions, 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( options: DBOptions, max_bg_compactions: c_int); pub fn rocksdb_options_set_max_background_flushes(options: DBOptions, diff --git a/src/rocksdb_options.rs b/src/rocksdb_options.rs index 4e3dfb3..92dd2a1 100644 --- a/src/rocksdb_options.rs +++ b/src/rocksdb_options.rs @@ -13,7 +13,7 @@ // limitations under the License. // extern crate libc; -use self::libc::c_int; +use self::libc::{c_int,size_t}; use std::ffi::CString; 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, name: &str, merge_fn: MergeFn) {