Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
BaseIndex::DB Class Reference

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. More...

#include <base.h>

Inheritance diagram for BaseIndex::DB:
[legend]
Collaboration diagram for BaseIndex::DB:
[legend]

Public Member Functions

 DB (const fs::path &path, size_t n_cache_size, bool f_memory=false, bool f_wipe=false, bool f_obfuscate=false)
CBlockLocator ReadBestBlock () const
 Read block locator of the chain that the index is in sync with.
void WriteBestBlock (CDBBatch &batch, const CBlockLocator &locator)
 Write block locator of the chain that the index is in sync with.
Public Member Functions inherited from CDBWrapper
 CDBWrapper (const DBParams &params)
 ~CDBWrapper ()
 CDBWrapper (const CDBWrapper &)=delete
CDBWrapperoperator= (const CDBWrapper &)=delete
template<typename K, typename V>
bool Read (const K &key, V &value) const
template<typename K, typename V>
void Write (const K &key, const V &value, bool fSync=false)
template<typename K>
bool Exists (const K &key) const
template<typename K>
void Erase (const K &key, bool fSync=false)
void WriteBatch (CDBBatch &batch, bool fSync=false)
size_t DynamicMemoryUsage () const
CDBIteratorNewIterator ()
bool IsEmpty ()
 Return true if the database managed by this class contains no entries.
template<typename K>
size_t EstimateSize (const K &key_begin, const K &key_end) const

Detailed Description

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.

Definition at line 64 of file base.h.

Constructor & Destructor Documentation

◆ DB()

BaseIndex::DB::DB ( const fs::path & path,
size_t n_cache_size,
bool f_memory = false,
bool f_wipe = false,
bool f_obfuscate = false )

Definition at line 68 of file base.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ ReadBestBlock()

CBlockLocator BaseIndex::DB::ReadBestBlock ( ) const

Read block locator of the chain that the index is in sync with.

Note, the returned locator will be empty if no record exists.

Definition at line 78 of file base.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteBestBlock()

void BaseIndex::DB::WriteBestBlock ( CDBBatch & batch,
const CBlockLocator & locator )

Write block locator of the chain that the index is in sync with.

Definition at line 90 of file base.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: