Struct kvdb_rocksdb::Database
source · pub struct Database { /* private fields */ }
Expand description
Key-Value database.
Implementations§
source§impl Database
impl Database
sourcepub fn open_default(path: &str) -> Result<Database>
pub fn open_default(path: &str) -> Result<Database>
Open database with default settings.
sourcepub fn open(config: &DatabaseConfig, path: &str) -> Result<Database>
pub fn open(config: &DatabaseConfig, path: &str) -> Result<Database>
Open database file. Creates if it does not exist.
sourcepub fn transaction(&self) -> DBTransaction
pub fn transaction(&self) -> DBTransaction
Helper to create new transaction for this database.
sourcepub fn write_buffered(&self, tr: DBTransaction)
pub fn write_buffered(&self, tr: DBTransaction)
Commit transaction to database.
sourcepub fn restore(&self, new_db: &str) -> Result<()>
pub fn restore(&self, new_db: &str) -> Result<()>
Restore the database from a copy at given path.
sourcepub fn num_columns(&self) -> u32
pub fn num_columns(&self) -> u32
The number of non-default column families.
sourcepub fn drop_column(&self) -> Result<()>
pub fn drop_column(&self) -> Result<()>
Drop a column family.
sourcepub fn add_column(&self) -> Result<()>
pub fn add_column(&self) -> Result<()>
Add a column family.
Trait Implementations§
source§impl KeyValueDB for Database
impl KeyValueDB for Database
source§fn get_by_prefix(&self, _col: u32, _prefix: &[u8]) -> Option<Box<[u8]>>
fn get_by_prefix(&self, _col: u32, _prefix: &[u8]) -> Option<Box<[u8]>>
Get a value by partial key. Only works for flushed data.
source§fn write_buffered(&self, transaction: DBTransaction)
fn write_buffered(&self, transaction: DBTransaction)
Write a transaction of changes to the buffer.
source§fn write(&self, transaction: DBTransaction) -> Result<()>
fn write(&self, transaction: DBTransaction) -> Result<()>
Write a transaction of changes to the backing store.
source§fn iter<'a>(
&'a self,
_col: u32
) -> Box<dyn Iterator<Item = (Box<[u8]>, Box<[u8]>)> + 'a>
fn iter<'a>( &'a self, _col: u32 ) -> Box<dyn Iterator<Item = (Box<[u8]>, Box<[u8]>)> + 'a>
Iterate over flushed data for a given column.
source§fn iter_from_prefix<'a>(
&'a self,
_col: u32,
_prefix: &'a [u8]
) -> Box<dyn Iterator<Item = (Box<[u8]>, Box<[u8]>)> + 'a>
fn iter_from_prefix<'a>( &'a self, _col: u32, _prefix: &'a [u8] ) -> Box<dyn Iterator<Item = (Box<[u8]>, Box<[u8]>)> + 'a>
Iterate over flushed data for a given column, starting from a given prefix.
source§fn restore(&self, new_db: &str) -> Result<()>
fn restore(&self, new_db: &str) -> Result<()>
Attempt to replace this database with a new one located at the given path.
§fn transaction(&self) -> DBTransaction
fn transaction(&self) -> DBTransaction
Helper to create a new transaction.
source§impl MallocSizeOf for Database
impl MallocSizeOf for Database
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
impl Send for Database
impl Sync for Database
Auto Trait Implementations§
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> MallocSizeOfExt for Twhere
T: MallocSizeOf,
impl<T> MallocSizeOfExt for Twhere
T: MallocSizeOf,
§fn malloc_size_of(&self) -> usize
fn malloc_size_of(&self) -> usize
Method to launch a heapsize measurement with a
fresh state.