Wraps a LevelDB database, providing typed, serialized key‐value access.

Synopsis

Declared in <dbwrapper.h>

class CDBWrapper;

Member Functions

Name

Description

CDBWrapper [constructor]

Constructors

~CDBWrapper [destructor]

Closes the database and releases its resources.

operator= [deleted]

Copy assignment is disabled.

CompactFull

Perform a blocking full compaction of the underlying LevelDB.

DynamicMemoryUsage

Get an estimate of LevelDB memory usage (in bytes).

Erase

Removes the value stored under the given key.

EstimateSize

Estimates the on‐disk size of the entries in the given key range.

Exists

Checks whether a value is stored under the given key.

GetProperty

Return a LevelDB property value, if available.

IsEmpty

Return true if the database managed by this class contains no entries.

NewIterator

Creates a new iterator over the database. The caller owns the returned iterator.

Read

Reads and de‐obfuscates the value stored under the given key.

Write

Writes a single key‐value pair to the database.

WriteBatch

Atomically applies all writes and erases queued in a batch.

Static Member Functions

Name

Description

HasKeyStartingWith

Probe an unopened database for a key prefix. Return true if a database at path exists and contains at least 1 entry beginning with prefix; missing or empty databases return false, and database errors throw dbwrapper_error.

Friends

Name

Description

dbwrapper_private::GetObfuscation

Work around circular dependency, as well as for testing in dbwrapper_tests. Database obfuscation should be considered an implementation detail of the specific database.

Non-Member Functions

Name

Description

index_util::LookUpOne

Look up a single index entry for a block, trying the height index then the hash index.

Derived Classes

Name

Description

BlockTreeDB

Access to the block database (blocks/index/)

DB

The database stores a block locator of the chain the database is synced to so that the index can efficiently determine the point it last stopped at. A locator is used instead of a simple hash of the chain tip because blocks and block index entries may not be flushed to disk until after this database is updated.

Created with MrDocs