Struct exonum_leveldb::database::Database [] [src]

pub struct Database { /* fields omitted */ }

The main database object.

leveldb databases are based on ordered keys. By default, leveldb orders by the binary value of the key. Additionally, a custom Comparator can be passed when opening the database. This library ships with an Comparator implementation for keys that are Ord.

When re-CString a database, you must use the same key type &[u8] and comparator type C.

Multiple Database objects can be kept around, as leveldb synchronises internally.

Methods

impl Database
[src]

Open a new database

If the database is missing, the behaviour depends on options.create_if_missing. The database will be created using the settings given in options.

Open a new database with a custom comparator

If the database is missing, the behaviour depends on options.create_if_missing. The database will be created using the settings given in options.

The comparator must implement a total ordering over the keyspace.

For keys that implement Ord, consider the OrdComparator.

Trait Implementations

impl<'a> Iterable<'a> for Database
[src]

Return an Iterator iterating over (Key,Value) pairs

impl Snapshots for Database
[src]

Creates a snapshot and returns a struct representing it. Read more

impl KV for Database
[src]

put a binary value into the database.

If the key is already present in the database, it will be overwritten.

The passed key will be compared using the comparator.

The database will be synced to disc if options.sync == true. This is NOT the default.

delete a value from the database.

The passed key will be compared using the comparator.

The database will be synced to disc if options.sync == true. This is NOT the default.

get a value from the database.

The passed key will be compared using the comparator.

impl Batch for Database
[src]

Write a batch to the database, ensuring success for all items or an error

impl<'a> Compaction<'a> for Database
[src]

impl Sync for Database
[src]

impl Send for Database
[src]