Access to the block database (blocks/index/)

Synopsis

Declared in <node/blockstorage.h>

class BlockTreeDB
    : public CDBWrapper

Base Classes

Name

Description

CDBWrapper

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

Member Functions

Name

Description

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.

LoadBlockIndexGuts

Load every block‐index entry from the database into memory.

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.

ReadBlockFileInfo

Read the stored info for one block file.

ReadFlag

Read a named boolean flag.

ReadLastBlockFile

Read the number of the last block file in use.

ReadReindexing

Read whether a reindex was in progress.

Write

Writes a single key‐value pair to the database.

WriteBatch

Atomically applies all writes and erases queued in a batch.

WriteBatchSync

Atomically write block‐file info, the last‐file marker, and block‐index entries.

WriteFlag

Persist a named boolean flag.

WriteReindexing

Persist whether a reindex is in progress.

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.

Using Declarations

Name

Description

BlockTreeDB

Inherit the CDBWrapper constructors to open the underlying database.

Non-Member Functions

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.

::index_util::LookUpOne

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

Created with MrDocs