# 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.

## Trait Implementations

### `impl Drop for Database`
[src]

#### `fn drop(&mut self)`

A method called when the value goes out of scope. Read more

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)