Struct tetsy_kvdb_rocksdb::Database [−][src]
Key-Value database.
Implementations
impl Database
[src]
pub fn open(config: &DatabaseConfig, path: &str) -> Result<Database>
[src]
Open database file. Creates if it does not exist.
Safety
The number of config.columns
must not be zero.
pub fn transaction(&self) -> DBTransaction
[src]
Helper to create new transaction for this database.
pub fn write_buffered(&self, tr: DBTransaction)
[src]
Commit transaction to database.
pub fn flush(&self) -> Result<()>
[src]
Commit buffered changes to database.
pub fn write(&self, tr: DBTransaction) -> Result<()>
[src]
Commit transaction to database.
pub fn get(&self, col: u32, key: &[u8]) -> Result<Option<DBValue>>
[src]
Get value by key.
pub fn get_by_prefix(&self, col: u32, prefix: &[u8]) -> Option<Box<[u8]>>
[src]
Get value by partial key. Prefix size should match configured prefix size. Only searches flushed values.
pub fn iter<'a>(
&'a self,
col: u32
) -> impl Iterator<Item = (Box<[u8]>, Box<[u8]>)> + 'a
[src]
&'a self,
col: u32
) -> impl Iterator<Item = (Box<[u8]>, Box<[u8]>)> + 'a
Get database iterator for flushed data. Will hold a lock until the iterator is dropped preventing the database from being closed.
pub fn restore(&self, new_db: &str) -> Result<()>
[src]
Restore the database from a copy at given path.
pub fn num_columns(&self) -> u32
[src]
The number of column families in the db.
pub fn num_keys(&self, col: u32) -> Result<u64>
[src]
The number of keys in a column (estimated). Does not take into account the unflushed data.
pub fn remove_last_column(&self) -> Result<()>
[src]
Remove the last column family in the database. The deletion is definitive.
pub fn add_column(&self) -> Result<()>
[src]
Add a new column family to the DB.
pub fn get_statistics(&self) -> HashMap<String, RocksDbStatsValue>
[src]
Get RocksDB statistics.
Trait Implementations
impl Drop for Database
[src]
impl KeyValueDB for Database
[src]
fn get(&self, col: u32, key: &[u8]) -> Result<Option<DBValue>>
[src]
fn get_by_prefix(&self, col: u32, prefix: &[u8]) -> Option<Box<[u8]>>
[src]
fn write_buffered(&self, transaction: DBTransaction)
[src]
fn write(&self, transaction: DBTransaction) -> Result<()>
[src]
fn flush(&self) -> Result<()>
[src]
fn iter<'a>(
&'a self,
col: u32
) -> Box<dyn Iterator<Item = (Box<[u8]>, Box<[u8]>)> + 'a>
[src]
&'a self,
col: u32
) -> 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>
[src]
&'a self,
col: u32,
prefix: &'a [u8]
) -> Box<dyn Iterator<Item = (Box<[u8]>, Box<[u8]>)> + 'a>
fn restore(&self, new_db: &str) -> Result<()>
[src]
fn io_stats(&self, kind: IoStatsKind) -> IoStats
[src]
pub fn transaction(&self) -> DBTransaction
[src]
impl MallocSizeOf for Database
[src]
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl UnwindSafe for Database
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> MallocSizeOfExt for T where
T: MallocSizeOf,
[src]
T: MallocSizeOf,
pub fn malloc_size_of(&self) -> usize
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,