Merge pull request #186 from ekmartin/set_wal_dir

Add DBOptions.set_wal_dir
master
Tyler Neely 6 years ago committed by GitHub
commit 301eb78ba6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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};
@ -986,6 +987,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