[#kernel-BlockTreeDB] = xref:kernel.adoc[kernel]::BlockTreeDB :relfileprefix: ../ :mrdocs: Access to the block database (blocks/index/) == Synopsis Declared in `<node/blockstorage.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class BlockTreeDB : public xref:CDBWrapper.adoc[CDBWrapper] ---- == Base Classes [cols="1,4"] |=== | Name| Description | `xref:CDBWrapper.adoc[CDBWrapper]` | Wraps a LevelDB database, providing typed, serialized key‐value access. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:CDBWrapper/operator_assign.adoc[`operator=`] [.small]#[deleted]# | Copy assignment is disabled. | xref:CDBWrapper/CompactFull.adoc[`CompactFull`] | Perform a blocking full compaction of the underlying LevelDB. | xref:CDBWrapper/DynamicMemoryUsage.adoc[`DynamicMemoryUsage`] | Get an estimate of LevelDB memory usage (in bytes). | xref:CDBWrapper/Erase.adoc[`Erase`] | Removes the value stored under the given key. | xref:CDBWrapper/EstimateSize.adoc[`EstimateSize`] | Estimates the on‐disk size of the entries in the given key range. | xref:CDBWrapper/Exists.adoc[`Exists`] | Checks whether a value is stored under the given key. | xref:CDBWrapper/GetProperty.adoc[`GetProperty`] | Return a LevelDB property value, if available. | xref:CDBWrapper/IsEmpty.adoc[`IsEmpty`] | Return true if the database managed by this class contains no entries. | xref:kernel/BlockTreeDB/LoadBlockIndexGuts.adoc[`LoadBlockIndexGuts`] | Load every block‐index entry from the database into memory. | xref:CDBWrapper/NewIterator.adoc[`NewIterator`] | Creates a new iterator over the database. The caller owns the returned iterator. | xref:CDBWrapper/Read.adoc[`Read`] | Reads and de‐obfuscates the value stored under the given key. | xref:kernel/BlockTreeDB/ReadBlockFileInfo.adoc[`ReadBlockFileInfo`] | Read the stored info for one block file. | xref:kernel/BlockTreeDB/ReadFlag.adoc[`ReadFlag`] | Read a named boolean flag. | xref:kernel/BlockTreeDB/ReadLastBlockFile.adoc[`ReadLastBlockFile`] | Read the number of the last block file in use. | xref:kernel/BlockTreeDB/ReadReindexing.adoc[`ReadReindexing`] | Read whether a reindex was in progress. | xref:CDBWrapper/Write.adoc[`Write`] | Writes a single key‐value pair to the database. | xref:CDBWrapper/WriteBatch.adoc[`WriteBatch`] | Atomically applies all writes and erases queued in a batch. | xref:kernel/BlockTreeDB/WriteBatchSync.adoc[`WriteBatchSync`] | Atomically write block‐file info, the last‐file marker, and block‐index entries. | xref:kernel/BlockTreeDB/WriteFlag.adoc[`WriteFlag`] | Persist a named boolean flag. | xref:kernel/BlockTreeDB/WriteReindexing.adoc[`WriteReindexing`] | Persist whether a reindex is in progress. |=== == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:CDBWrapper/HasKeyStartingWith.adoc[`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 [cols="1,4"] |=== | Name| Description | xref:kernel/BlockTreeDB/2constructor.adoc[`BlockTreeDB`] | Inherit the CDBWrapper constructors to open the underlying database. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:dbwrapper_private/GetObfuscation.adoc[`::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. | xref:index_util/LookUpOne.adoc[`::index_util::LookUpOne`] | Look up a single index entry for a block, trying the height index then the hash index. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#