Add DBOptions.set_wal_dir

master
Martin Ek 7 years ago
parent 701669d076
commit 530dc462d5
  1. 21
      src/db_options.rs

@ -14,6 +14,7 @@
use std::ffi::{CStr, CString};
use std::mem;
use std::path::Path;
use libc::{self, c_int, c_uchar, c_uint, c_void, size_t, uint64_t};
@ -980,6 +981,26 @@ impl Options {
ffi::rocksdb_options_set_num_levels(self.inner, n);
}
}
/// Specifies the absolute path of the directory the
/// write-ahead log (WAL) should be written to.
///
/// Default: same directory as the database
///
/// # Example
///
/// ```
/// use rocksdb::Options;
///
/// let mut opts = Options::default();
/// opts.set_wal_dir("/path/to/dir");
/// ```
pub fn set_wal_dir<P: AsRef<Path>>(&mut self, path: P) {
let p = CString::new(path.as_ref().to_string_lossy().as_bytes()).unwrap();
unsafe {
ffi::rocksdb_options_set_wal_dir(self.inner, p.as_ptr());
}
}
}
impl Default for Options {

Loading…
Cancel
Save