pub struct DB { /* private fields */ }
Expand description

DB contains the actual database implemenation. As opposed to the original, this implementation is not concurrent (yet).

Implementations

Opens or creates a new or existing database. name is the name of the directory containing the database.

Whether a new database is created and what happens if a database exists at the given path depends on the options set (create_if_missing, error_if_exists).

Adds a single entry. It’s a short, non-synchronous, form of write(); in order to make sure that the written entry is on disk, call flush() afterwards.

Deletes a single entry. Like with put(), you can call flush() to guarantee that the operation made it to disk.

Writes an entire WriteBatch. sync determines whether the write should be flushed to disk.

flush makes sure that all pending changes (e.g. from put()) are stored on disk.

get_at reads the value for a given key at or before snapshot. It returns Ok(None) if the entry wasn’t found, and Err(_) if an error occurred.

get is a simplified version of get_at(), translating errors to None.

new_iter returns a DBIterator over the current state of the database. The iterator will not return elements added to the database after its creation.

new_iter_at returns a DBIterator at the supplied snapshot.

Returns a snapshot at the current state. It can be used to retrieve entries from the database as they were at an earlier point in time.

compact_range triggers an immediate compaction on the specified key range. Repeatedly calling this without actually adding new keys is not useful.

Compactions in general will cause the database to find entries more quickly, and take up less space on disk.

Trait Implementations

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.