Commit 150bf4f5 authored by ngaut's avatar ngaut

*: add an option to disable write-ahead-log.

parent 015e65bb
......@@ -41,7 +41,6 @@ pub extern "C" fn name_callback(raw_cb: *mut c_void) -> *const c_char {
}
}
#[allow(too_many_arguments)]
pub extern "C" fn full_merge_callback(raw_cb: *mut c_void,
raw_key: *const c_char,
key_len: size_t,
......@@ -75,7 +74,6 @@ pub extern "C" fn full_merge_callback(raw_cb: *mut c_void,
}
}
#[allow(too_many_arguments)]
pub extern "C" fn partial_merge_callback(raw_cb: *mut c_void,
raw_key: *const c_char,
key_len: size_t,
......
......@@ -440,6 +440,12 @@ impl DB {
self.write_opt(batch, &WriteOptions::new())
}
pub fn write_withou_wal(&self, batch: WriteBatch) -> Result<(), String> {
let mut wo = WriteOptions::new();
wo.disable_wal();
self.write_opt(batch, &wo)
}
pub fn get_opt(&self,
key: &[u8],
readopts: &ReadOptions)
......
......@@ -377,9 +377,16 @@ impl WriteOptions {
pub fn new() -> WriteOptions {
WriteOptions::default()
}
pub fn set_sync(&mut self, sync: bool) {
unsafe {
rocksdb_ffi::rocksdb_writeoptions_set_sync(self.inner, sync);
}
}
pub fn disable_wal(&mut self) {
unsafe {
rocksdb_ffi::rocksdb_writeoptions_disable_WAL(self.inner, 1);
}
}
}
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