Struct kvdb_rocksdb::Database [−][src]
pub struct Database { /* fields omitted */ }
Key-Value database.
Methods
impl Database
[src]
impl Database
pub fn open_default(path: &str) -> Result<Database>
[src]
pub fn open_default(path: &str) -> Result<Database>
Open database with default settings.
pub fn open(config: &DatabaseConfig, path: &str) -> Result<Database>
[src]
pub fn open(config: &DatabaseConfig, path: &str) -> Result<Database>
Open database file. Creates if it does not exist.
pub fn transaction(&self) -> DBTransaction
[src]
pub fn transaction(&self) -> DBTransaction
Helper to create new transaction for this database.
pub fn write_buffered(&self, tr: DBTransaction)
[src]
pub fn write_buffered(&self, tr: DBTransaction)
Commit transaction to database.
pub fn flush(&self) -> Result<()>
[src]
pub fn flush(&self) -> Result<()>
Commit buffered changes to database.
pub fn write(&self, tr: DBTransaction) -> Result<()>
[src]
pub fn write(&self, tr: DBTransaction) -> Result<()>
Commit transaction to database.
pub fn get(&self, col: Option<u32>, key: &[u8]) -> Result<Option<DBValue>>
[src]
pub fn get(&self, col: Option<u32>, key: &[u8]) -> Result<Option<DBValue>>
Get value by key.
pub fn get_by_prefix(
&self,
col: Option<u32>,
prefix: &[u8]
) -> Option<Box<[u8]>>
[src]
pub fn get_by_prefix(
&self,
col: Option<u32>,
prefix: &[u8]
) -> Option<Box<[u8]>>
Get value by partial key. Prefix size should match configured prefix size. Only searches flushed values.
pub fn iter(&self, col: Option<u32>) -> Option<DatabaseIterator>
[src]
pub fn iter(&self, col: Option<u32>) -> Option<DatabaseIterator>
Get database iterator for flushed data.
pub fn restore(&self, new_db: &str) -> Result<()>
[src]
pub fn restore(&self, new_db: &str) -> Result<()>
Restore the database from a copy at given path.
pub fn num_columns(&self) -> u32
[src]
pub fn num_columns(&self) -> u32
The number of non-default column families.
pub fn drop_column(&self) -> Result<()>
[src]
pub fn drop_column(&self) -> Result<()>
Drop a column family.
pub fn add_column(&self) -> Result<()>
[src]
pub fn add_column(&self) -> Result<()>
Add a column family.
Trait Implementations
impl KeyValueDB for Database
[src]
impl KeyValueDB for Database
fn get(&self, col: Option<u32>, key: &[u8]) -> Result<Option<DBValue>>
[src]
fn get(&self, col: Option<u32>, key: &[u8]) -> Result<Option<DBValue>>
Get a value by key.
fn get_by_prefix(&self, col: Option<u32>, prefix: &[u8]) -> Option<Box<[u8]>>
[src]
fn get_by_prefix(&self, col: Option<u32>, prefix: &[u8]) -> Option<Box<[u8]>>
Get a value by partial key. Only works for flushed data.
fn write_buffered(&self, transaction: DBTransaction)
[src]
fn write_buffered(&self, transaction: DBTransaction)
Write a transaction of changes to the buffer.
fn write(&self, transaction: DBTransaction) -> Result<()>
[src]
fn write(&self, transaction: DBTransaction) -> Result<()>
Write a transaction of changes to the backing store.
fn flush(&self) -> Result<()>
[src]
fn flush(&self) -> Result<()>
Flush all buffered data.
fn iter<'a>(
&'a self,
col: Option<u32>
) -> Box<Iterator<Item = (Box<[u8]>, Box<[u8]>)> + 'a>
[src]
fn iter<'a>(
&'a self,
col: Option<u32>
) -> Box<Iterator<Item = (Box<[u8]>, Box<[u8]>)> + 'a>
Iterate over flushed data for a given column.
fn iter_from_prefix<'a>(
&'a self,
col: Option<u32>,
prefix: &'a [u8]
) -> Box<Iterator<Item = (Box<[u8]>, Box<[u8]>)> + 'a>
[src]
fn iter_from_prefix<'a>(
&'a self,
col: Option<u32>,
prefix: &'a [u8]
) -> Box<Iterator<Item = (Box<[u8]>, Box<[u8]>)> + 'a>
Iterate over flushed data for a given column, starting from a given prefix.
fn restore(&self, new_db: &str) -> Result<()>
[src]
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
[src]
fn transaction(&self) -> DBTransaction
Helper to create a new transaction.
impl Drop for Database
[src]
impl Drop for Database