Struct ethcore_util::kvdb::Database
[−]
[src]
pub struct Database { /* fields omitted */ }
Key-Value database.
Methods
impl Database
[src]
fn open_default(path: &str) -> Result<Database, String>
Open database with default settings.
fn open(config: &DatabaseConfig, path: &str) -> Result<Database, String>
Open database file. Creates if it does not exist.
fn transaction(&self) -> DBTransaction
Creates new transaction for this database.
fn write_buffered(&self, tr: DBTransaction)
Commit transaction to database.
fn flush(&self) -> Result<(), String>
Commit buffered changes to database.
fn write(&self, tr: DBTransaction) -> Result<(), String>
Commit transaction to database.
fn get(&self, col: Option<u32>, key: &[u8]) -> Result<Option<DBValue>, String>
Get value by key.
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.
fn iter(&self, col: Option<u32>) -> DatabaseIterator
Get database iterator for flushed data.
fn restore(&self, new_db: &str) -> Result<(), UtilError>
Restore the database from a copy at given path.