|
|
@ -31,6 +31,10 @@ pub struct Options { |
|
|
|
pub inner: rocksdb_ffi::DBOptions, |
|
|
|
pub inner: rocksdb_ffi::DBOptions, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub struct WriteOptions { |
|
|
|
|
|
|
|
pub inner: rocksdb_ffi::DBWriteOptions, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl Drop for Options { |
|
|
|
impl Drop for Options { |
|
|
|
fn drop(&mut self) { |
|
|
|
fn drop(&mut self) { |
|
|
|
unsafe { |
|
|
|
unsafe { |
|
|
@ -47,6 +51,14 @@ impl Drop for BlockBasedOptions { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl Drop for WriteOptions { |
|
|
|
|
|
|
|
fn drop(&mut self) { |
|
|
|
|
|
|
|
unsafe { |
|
|
|
|
|
|
|
rocksdb_ffi::rocksdb_writeoptions_destroy(self.inner); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl BlockBasedOptions { |
|
|
|
impl BlockBasedOptions { |
|
|
|
pub fn new() -> BlockBasedOptions { |
|
|
|
pub fn new() -> BlockBasedOptions { |
|
|
|
let block_opts = unsafe { |
|
|
|
let block_opts = unsafe { |
|
|
@ -311,3 +323,19 @@ impl Options { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl WriteOptions { |
|
|
|
|
|
|
|
pub fn new() -> WriteOptions { |
|
|
|
|
|
|
|
let write_opts = unsafe { rocksdb_ffi::rocksdb_writeoptions_create() }; |
|
|
|
|
|
|
|
let rocksdb_ffi::DBWriteOptions(opt_ptr) = write_opts; |
|
|
|
|
|
|
|
if opt_ptr.is_null() { |
|
|
|
|
|
|
|
panic!("Could not create rocksdb write options".to_string()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
WriteOptions { inner: write_opts } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
pub fn set_sync(&mut self, sync: bool) { |
|
|
|
|
|
|
|
unsafe { |
|
|
|
|
|
|
|
rocksdb_ffi::rocksdb_writeoptions_set_sync(self.inner, sync); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|