set num levels

master
zhangjinpeng1987 8 years ago committed by Karl Hobley
parent fa038809e1
commit 42c5bb92dc
  1. 1
      src/ffi.rs
  2. 6
      src/rocksdb_options.rs
  3. 1
      test/test.rs
  4. 12
      test/test_rocksdb_options.rs

@ -208,6 +208,7 @@ extern "C" {
pub fn rocksdb_options_set_wal_recovery_mode(options: DBOptions, mode: DBRecoveryMode);
pub fn rocksdb_options_enable_statistics(options: DBOptions);
pub fn rocksdb_options_set_stats_dump_period_sec(options: DBOptions, v: usize);
pub fn rocksdb_options_set_num_levels(options: DBOptions, v: c_int);
pub fn rocksdb_filterpolicy_create_bloom_full(bits_per_key: c_int)
-> DBFilterPolicy;
pub fn rocksdb_filterpolicy_create_bloom(bits_per_key: c_int)

@ -385,6 +385,12 @@ impl Options {
period);
}
}
pub fn set_num_levels(&mut self, n: c_int) {
unsafe {
rocksdb_ffi::rocksdb_options_set_num_levels(self.inner, n);
}
}
}
impl Default for Options {

@ -3,3 +3,4 @@ extern crate rocksdb;
mod test_iterator;
mod test_multithreaded;
mod test_column_family;
mod test_rocksdb_options;

@ -0,0 +1,12 @@
use rocksdb::{DB, Options};
#[test]
fn test_set_num_levels() {
let path = "_rust_rocksdb_test_set_num_levels";
let mut opts = Options::default();
opts.create_if_missing(true);
opts.set_num_levels(2);
let db = DB::open(&opts, path).unwrap();
drop(db);
}
Loading…
Cancel
Save