Commit 488def48 authored by Jay Lee's avatar Jay Lee

options: add compression option

parent 443cb419
......@@ -178,7 +178,7 @@ extern "C" {
pub fn rocksdb_options_set_compaction_style(options: DBOptions,
cs: DBCompactionStyle);
pub fn rocksdb_options_set_compression(options: DBOptions,
compression_style_no: c_int);
compression_style_no: DBCompressionType);
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,
......
......@@ -26,7 +26,7 @@ pub mod merge_operator;
pub mod comparator;
pub use librocksdb_sys::{DBCompactionStyle, DBComparator, new_bloom_filter,
self as rocksdb_ffi};
self as rocksdb_ffi, DBCompressionType};
pub use rocksdb::{DB, DBIterator, DBVector, Direction, IteratorMode, Writable,
WriteBatch};
pub use rocksdb_options::{BlockBasedOptions, Options, WriteOptions};
......
......@@ -16,7 +16,7 @@ use libc::{c_int, size_t};
use std::ffi::CString;
use std::mem;
use rocksdb_ffi;
use rocksdb_ffi::{self, DBCompressionType};
use merge_operator::{self, MergeOperatorCallback, full_merge_callback,
partial_merge_callback};
use comparator::{self, ComparatorCallback, compare_callback};
......@@ -147,6 +147,12 @@ impl Options {
self.inner, create_if_missing);
}
}
pub fn compression(&mut self, t: DBCompressionType) {
unsafe {
rocksdb_ffi::rocksdb_options_set_compression(self.inner, t);
}
}
pub fn add_merge_operator(&mut self, name: &str, merge_fn: MergeFn) {
let cb = Box::new(MergeOperatorCallback {
......
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