|
|
|
@ -32,6 +32,7 @@ use rocksdb_options::{Options, WriteOptions}; |
|
|
|
|
pub struct DB { |
|
|
|
|
inner: rocksdb_ffi::DBInstance, |
|
|
|
|
cfs: BTreeMap<String, DBCFHandle>, |
|
|
|
|
path: String, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
unsafe impl Send for DB {} |
|
|
|
@ -405,6 +406,7 @@ impl DB { |
|
|
|
|
Ok(DB { |
|
|
|
|
inner: db, |
|
|
|
|
cfs: cf_map, |
|
|
|
|
path: path.to_owned(), |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -442,6 +444,10 @@ impl DB { |
|
|
|
|
Ok(()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pub fn path(&self) -> &str { |
|
|
|
|
&self.path |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pub fn write_opt(&self, |
|
|
|
|
batch: WriteBatch, |
|
|
|
|
writeopts: &WriteOptions) |
|
|
|
@ -814,6 +820,12 @@ impl Drop for DB { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
impl fmt::Debug for DB { |
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
|
|
|
|
write!(f, "RocksDB {{ path: {:?} }}", self.path()) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
impl Writable for WriteBatch { |
|
|
|
|
/// Insert a value into the database under the given key
|
|
|
|
|
fn put(&self, key: &[u8], value: &[u8]) -> Result<(), Error> { |
|
|
|
|