Commit d3ef6eb9 authored by zhangjinpeng1987's avatar zhangjinpeng1987

address comments

parent c7d2448d
...@@ -17,7 +17,7 @@ extern crate libc; ...@@ -17,7 +17,7 @@ extern crate libc;
#[cfg(test)] #[cfg(test)]
extern crate tempdir; extern crate tempdir;
use libc::{c_char, c_uchar, c_int, c_uint, c_void, size_t, uint64_t}; use libc::{c_char, c_uchar, c_int, c_void, size_t, uint64_t};
use std::ffi::CStr; use std::ffi::CStr;
pub enum DBOptions {} pub enum DBOptions {}
...@@ -182,7 +182,7 @@ extern "C" { ...@@ -182,7 +182,7 @@ extern "C" {
pub fn rocksdb_options_set_report_bg_io_stats(options: *mut DBOptions, v: c_int); pub fn rocksdb_options_set_report_bg_io_stats(options: *mut DBOptions, v: c_int);
pub fn rocksdb_options_set_wal_recovery_mode(options: *mut DBOptions, mode: DBRecoveryMode); pub fn rocksdb_options_set_wal_recovery_mode(options: *mut DBOptions, mode: DBRecoveryMode);
pub fn rocksdb_options_enable_statistics(options: *mut DBOptions); pub fn rocksdb_options_enable_statistics(options: *mut DBOptions);
pub fn rocksdb_options_set_stats_dump_period_sec(options: *mut DBOptions, v: c_uint); pub fn rocksdb_options_set_stats_dump_period_sec(options: *mut DBOptions, v: usize);
pub fn rocksdb_filterpolicy_create_bloom_full(bits_per_key: c_int) pub fn rocksdb_filterpolicy_create_bloom_full(bits_per_key: c_int)
-> *mut DBFilterPolicy; -> *mut DBFilterPolicy;
pub fn rocksdb_filterpolicy_create_bloom(bits_per_key: c_int) pub fn rocksdb_filterpolicy_create_bloom(bits_per_key: c_int)
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
// //
use comparator::{self, ComparatorCallback, compare_callback}; use comparator::{self, ComparatorCallback, compare_callback};
use libc::{c_int, c_uint, size_t}; use libc::{c_int, size_t};
use merge_operator::{self, MergeOperatorCallback, full_merge_callback, use merge_operator::{self, MergeOperatorCallback, full_merge_callback,
partial_merge_callback}; partial_merge_callback};
use merge_operator::MergeFn; use merge_operator::MergeFn;
...@@ -512,7 +512,7 @@ impl Options { ...@@ -512,7 +512,7 @@ impl Options {
} }
} }
pub fn set_stats_dump_period_sec(&mut self, period: c_uint) { pub fn set_stats_dump_period_sec(&mut self, period: usize) {
unsafe { unsafe {
rocksdb_ffi::rocksdb_options_set_stats_dump_period_sec(self.inner, rocksdb_ffi::rocksdb_options_set_stats_dump_period_sec(self.inner,
period); period);
...@@ -530,4 +530,11 @@ mod tests { ...@@ -530,4 +530,11 @@ mod tests {
let size = 20 * 1024 * 1024; let size = 20 * 1024 * 1024;
opts.set_max_manifest_file_size(size) opts.set_max_manifest_file_size(size)
} }
#[test]
fn test_enable_statistics() {
let mut opts = Options::new();
opts.enable_statistics();
opts.set_stats_dump_period_sec(60);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment