Bitcoin Core 31.99.0
P2P Digital Currency
Public Member Functions | Public Attributes | Private Member Functions | List of all members
TxIndex::DB Class Reference

Access to the txindex database (indexes/txindex/) More...

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

Public Member Functions

 DB (size_t n_cache_size, bool f_memory=false, bool f_wipe=false)
 
void WriteTxs (const interfaces::BlockInfo &block)
 Write a block of transaction positions to the DB. More...
 
CBlockLocator ReadBestBlock () const override
 Read block locator of the chain that the index is in sync with. More...
 
void WriteBestBlock (CDBBatch &batch, const CBlockLocator &locator) override
 Write block locator of the chain that the index is in sync with. More...
 
- Public Member Functions inherited from BaseIndex::DB
 DB (const fs::path &path, size_t n_cache_size, bool f_memory=false, bool f_wipe=false, bool f_obfuscate=false, bool f_bloom=true)
 
virtual ~DB ()=default
 
virtual CBlockLocator ReadBestBlock () const
 Read block locator of the chain that the index is in sync with. More...
 
virtual void WriteBestBlock (CDBBatch &batch, const CBlockLocator &locator)
 Write block locator of the chain that the index is in sync with. More...
 
- 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)
 
void CompactFull ()
 Perform a blocking full compaction of the underlying LevelDB. More...
 
std::optional< std::string > GetProperty (const std::string &property) const
 Return a LevelDB property value, if available. More...
 
size_t DynamicMemoryUsage () const
 
CDBIteratorNewIterator ()
 
bool IsEmpty ()
 Return true if the database managed by this class contains no entries. More...
 
template<typename K >
size_t EstimateSize (const K &key_begin, const K &key_end) const
 

Public Attributes

const SipHasher13UJ m_hasher
 Used to hash the txid to compute the prefix. More...
 
const bool m_has_legacy
 Whether the database contains any legacy ('t' + txid) entries. More...
 

Private Member Functions

 DB (size_t n_cache_size, bool f_memory, bool f_wipe, bool has_legacy)
 

Additional Inherited Members

- Static Public Member Functions inherited from CDBWrapper
static bool HasKeyStartingWith (const fs::path &path, uint8_t prefix)
 Probe an unopened database for a key prefix. More...
 

Detailed Description

Access to the txindex database (indexes/txindex/)

Definition at line 57 of file txindex.cpp.

Constructor & Destructor Documentation

◆ DB() [1/2]

TxIndex::DB::DB ( size_t  n_cache_size,
bool  f_memory = false,
bool  f_wipe = false 
)
explicit

Definition at line 80 of file txindex.cpp.

◆ DB() [2/2]

TxIndex::DB::DB ( size_t  n_cache_size,
bool  f_memory,
bool  f_wipe,
bool  has_legacy 
)
private

Definition at line 90 of file txindex.cpp.

Member Function Documentation

◆ ReadBestBlock()

CBlockLocator TxIndex::DB::ReadBestBlock ( ) const
overridevirtual

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

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

Reimplemented from BaseIndex::DB.

Definition at line 96 of file txindex.cpp.

Here is the call graph for this function:

◆ WriteBestBlock()

void TxIndex::DB::WriteBestBlock ( CDBBatch batch,
const CBlockLocator locator 
)
overridevirtual

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

Reimplemented from BaseIndex::DB.

Definition at line 106 of file txindex.cpp.

Here is the call graph for this function:

◆ WriteTxs()

void TxIndex::DB::WriteTxs ( const interfaces::BlockInfo block)

Write a block of transaction positions to the DB.

Definition at line 111 of file txindex.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ m_has_legacy

const bool TxIndex::DB::m_has_legacy

Whether the database contains any legacy ('t' + txid) entries.

Definition at line 69 of file txindex.cpp.

◆ m_hasher

const SipHasher13UJ TxIndex::DB::m_hasher

Used to hash the txid to compute the prefix.

Definition at line 66 of file txindex.cpp.


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