Bitcoin Core 28.99.0
P2P Digital Currency
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
wallet::BerkeleyBatch Class Reference

RAII class that provides access to a Berkeley database. More...

#include <bdb.h>

Inheritance diagram for wallet::BerkeleyBatch:
[legend]
Collaboration diagram for wallet::BerkeleyBatch:
[legend]

Public Member Functions

 BerkeleyBatch (BerkeleyDatabase &database, const bool fReadOnly, bool fFlushOnCloseIn=true)
 
 ~BerkeleyBatch () override
 
 BerkeleyBatch (const BerkeleyBatch &)=delete
 
BerkeleyBatchoperator= (const BerkeleyBatch &)=delete
 
void Flush () override
 
void Close () override
 
std::unique_ptr< DatabaseCursorGetNewCursor () override
 
std::unique_ptr< DatabaseCursorGetNewPrefixCursor (Span< const std::byte > prefix) override
 
bool TxnBegin () override
 
bool TxnCommit () override
 
bool TxnAbort () override
 
bool HasActiveTxn () override
 
DbTxn * txn () const
 
- Public Member Functions inherited from wallet::DatabaseBatch
 DatabaseBatch ()=default
 
virtual ~DatabaseBatch ()=default
 
 DatabaseBatch (const DatabaseBatch &)=delete
 
DatabaseBatchoperator= (const DatabaseBatch &)=delete
 
virtual void Flush ()=0
 
virtual void Close ()=0
 
template<typename K , typename T >
bool Read (const K &key, T &value)
 
template<typename K , typename T >
bool Write (const K &key, const T &value, bool fOverwrite=true)
 
template<typename K >
bool Erase (const K &key)
 
template<typename K >
bool Exists (const K &key)
 
virtual bool ErasePrefix (Span< const std::byte > prefix)=0
 
virtual std::unique_ptr< DatabaseCursorGetNewCursor ()=0
 
virtual std::unique_ptr< DatabaseCursorGetNewPrefixCursor (Span< const std::byte > prefix)=0
 
virtual bool TxnBegin ()=0
 
virtual bool TxnCommit ()=0
 
virtual bool TxnAbort ()=0
 
virtual bool HasActiveTxn ()=0
 

Protected Attributes

Db * pdb {nullptr}
 
std::string strFile
 
DbTxn * activeTxn {nullptr}
 
bool fReadOnly
 
bool fFlushOnClose
 
BerkeleyEnvironmentenv
 
BerkeleyDatabasem_database
 

Private Member Functions

bool ReadKey (DataStream &&key, DataStream &value) override
 
bool WriteKey (DataStream &&key, DataStream &&value, bool overwrite=true) override
 
bool EraseKey (DataStream &&key) override
 
bool HasKey (DataStream &&key) override
 
bool ErasePrefix (Span< const std::byte > prefix) override
 

Detailed Description

RAII class that provides access to a Berkeley database.

Definition at line 178 of file bdb.h.

Constructor & Destructor Documentation

◆ BerkeleyBatch() [1/2]

wallet::BerkeleyBatch::BerkeleyBatch ( BerkeleyDatabase database,
const bool  fReadOnly,
bool  fFlushOnCloseIn = true 
)
explicit

Definition at line 363 of file bdb.cpp.

Here is the call graph for this function:

◆ ~BerkeleyBatch()

wallet::BerkeleyBatch::~BerkeleyBatch ( )
override

Definition at line 444 of file bdb.cpp.

Here is the call graph for this function:

◆ BerkeleyBatch() [2/2]

wallet::BerkeleyBatch::BerkeleyBatch ( const BerkeleyBatch )
delete

Member Function Documentation

◆ Close()

void wallet::BerkeleyBatch::Close ( )
overridevirtual

Implements wallet::DatabaseBatch.

Definition at line 450 of file bdb.cpp.

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

◆ EraseKey()

bool wallet::BerkeleyBatch::EraseKey ( DataStream &&  key)
overrideprivatevirtual

Implements wallet::DatabaseBatch.

Definition at line 878 of file bdb.cpp.

Here is the call graph for this function:

◆ ErasePrefix()

bool wallet::BerkeleyBatch::ErasePrefix ( Span< const std::byte >  prefix)
overrideprivatevirtual

Implements wallet::DatabaseBatch.

Definition at line 902 of file bdb.cpp.

Here is the call graph for this function:

◆ Flush()

void wallet::BerkeleyBatch::Flush ( )
overridevirtual

Implements wallet::DatabaseBatch.

Definition at line 424 of file bdb.cpp.

Here is the caller graph for this function:

◆ GetNewCursor()

std::unique_ptr< DatabaseCursor > wallet::BerkeleyBatch::GetNewCursor ( )
overridevirtual

Implements wallet::DatabaseBatch.

Definition at line 783 of file bdb.cpp.

Here is the caller graph for this function:

◆ GetNewPrefixCursor()

std::unique_ptr< DatabaseCursor > wallet::BerkeleyBatch::GetNewPrefixCursor ( Span< const std::byte >  prefix)
overridevirtual

Implements wallet::DatabaseBatch.

Definition at line 789 of file bdb.cpp.

◆ HasActiveTxn()

bool wallet::BerkeleyBatch::HasActiveTxn ( )
inlineoverridevirtual

Implements wallet::DatabaseBatch.

Definition at line 211 of file bdb.h.

◆ HasKey()

bool wallet::BerkeleyBatch::HasKey ( DataStream &&  key)
overrideprivatevirtual

Implements wallet::DatabaseBatch.

Definition at line 891 of file bdb.cpp.

◆ operator=()

BerkeleyBatch & wallet::BerkeleyBatch::operator= ( const BerkeleyBatch )
delete

◆ ReadKey()

bool wallet::BerkeleyBatch::ReadKey ( DataStream &&  key,
DataStream value 
)
overrideprivatevirtual

Implements wallet::DatabaseBatch.

Definition at line 846 of file bdb.cpp.

Here is the call graph for this function:

◆ txn()

DbTxn * wallet::BerkeleyBatch::txn ( ) const
inline

Definition at line 212 of file bdb.h.

Here is the caller graph for this function:

◆ TxnAbort()

bool wallet::BerkeleyBatch::TxnAbort ( )
overridevirtual

Implements wallet::DatabaseBatch.

Definition at line 815 of file bdb.cpp.

◆ TxnBegin()

bool wallet::BerkeleyBatch::TxnBegin ( )
overridevirtual

Implements wallet::DatabaseBatch.

Definition at line 795 of file bdb.cpp.

Here is the call graph for this function:

◆ TxnCommit()

bool wallet::BerkeleyBatch::TxnCommit ( )
overridevirtual

Implements wallet::DatabaseBatch.

Definition at line 806 of file bdb.cpp.

◆ WriteKey()

bool wallet::BerkeleyBatch::WriteKey ( DataStream &&  key,
DataStream &&  value,
bool  overwrite = true 
)
overrideprivatevirtual

Implements wallet::DatabaseBatch.

Definition at line 863 of file bdb.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ activeTxn

DbTxn* wallet::BerkeleyBatch::activeTxn {nullptr}
protected

Definition at line 190 of file bdb.h.

◆ env

BerkeleyEnvironment* wallet::BerkeleyBatch::env
protected

Definition at line 193 of file bdb.h.

◆ fFlushOnClose

bool wallet::BerkeleyBatch::fFlushOnClose
protected

Definition at line 192 of file bdb.h.

◆ fReadOnly

bool wallet::BerkeleyBatch::fReadOnly
protected

Definition at line 191 of file bdb.h.

◆ m_database

BerkeleyDatabase& wallet::BerkeleyBatch::m_database
protected

Definition at line 194 of file bdb.h.

◆ pdb

Db* wallet::BerkeleyBatch::pdb {nullptr}
protected

Definition at line 188 of file bdb.h.

◆ strFile

std::string wallet::BerkeleyBatch::strFile
protected

Definition at line 189 of file bdb.h.


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