Bitcoin Core  0.20.99
P2P Digital Currency
Classes | Public Member Functions | Protected Attributes | Private Member Functions | List of all members
BerkeleyBatch Class Reference

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

#include <bdb.h>

Collaboration diagram for BerkeleyBatch:
[legend]

Classes

class  SafeDbt
 RAII class that automatically cleanses its data on destruction. More...
 

Public Member Functions

 BerkeleyBatch (BerkeleyDatabase &database, const char *pszMode="r+", bool fFlushOnCloseIn=true)
 
 ~BerkeleyBatch ()
 
 BerkeleyBatch (const BerkeleyBatch &)=delete
 
BerkeleyBatchoperator= (const BerkeleyBatch &)=delete
 
void Flush ()
 
void Close ()
 
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)
 
bool StartCursor ()
 
bool ReadAtCursor (CDataStream &ssKey, CDataStream &ssValue, bool &complete)
 
void CloseCursor ()
 
bool TxnBegin ()
 
bool TxnCommit ()
 
bool TxnAbort ()
 

Protected Attributes

Db * pdb
 
std::string strFile
 
DbTxn * activeTxn
 
Dbc * m_cursor
 
bool fReadOnly
 
bool fFlushOnClose
 
BerkeleyEnvironmentenv
 

Private Member Functions

bool ReadKey (CDataStream &key, CDataStream &value)
 
bool WriteKey (CDataStream &key, CDataStream &value, bool overwrite=true)
 
bool EraseKey (CDataStream &key)
 
bool HasKey (CDataStream &key)
 

Detailed Description

RAII class that provides access to a Berkeley database.

Definition at line 175 of file bdb.h.

Constructor & Destructor Documentation

◆ BerkeleyBatch() [1/2]

BerkeleyBatch::BerkeleyBatch ( BerkeleyDatabase database,
const char *  pszMode = "r+",
bool  fFlushOnCloseIn = true 
)
explicit

Definition at line 328 of file bdb.cpp.

Here is the call graph for this function:

◆ ~BerkeleyBatch()

BerkeleyBatch::~BerkeleyBatch ( )
inline

Definition at line 214 of file bdb.h.

◆ BerkeleyBatch() [2/2]

BerkeleyBatch::BerkeleyBatch ( const BerkeleyBatch )
delete

Member Function Documentation

◆ Close()

void BerkeleyBatch::Close ( )

Definition at line 427 of file bdb.cpp.

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

◆ CloseCursor()

void BerkeleyBatch::CloseCursor ( )

Definition at line 758 of file bdb.cpp.

Here is the caller graph for this function:

◆ Erase()

template<typename K >
bool BerkeleyBatch::Erase ( const K &  key)
inline

Definition at line 263 of file bdb.h.

Here is the call graph for this function:

◆ EraseKey()

bool BerkeleyBatch::EraseKey ( CDataStream key)
private

Definition at line 835 of file bdb.cpp.

Here is the call graph for this function:

◆ Exists()

template<typename K >
bool BerkeleyBatch::Exists ( const K &  key)
inline

Definition at line 275 of file bdb.h.

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

◆ Flush()

void BerkeleyBatch::Flush ( )

Definition at line 407 of file bdb.cpp.

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

◆ HasKey()

bool BerkeleyBatch::HasKey ( CDataStream key)
private

Definition at line 850 of file bdb.cpp.

Here is the call graph for this function:

◆ operator=()

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

◆ Read()

template<typename K , typename T >
bool BerkeleyBatch::Read ( const K &  key,
T &  value 
)
inline

Definition at line 223 of file bdb.h.

Here is the call graph for this function:

◆ ReadAtCursor()

bool BerkeleyBatch::ReadAtCursor ( CDataStream ssKey,
CDataStream ssValue,
bool &  complete 
)

Definition at line 732 of file bdb.cpp.

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

◆ ReadKey()

bool BerkeleyBatch::ReadKey ( CDataStream key,
CDataStream value 
)
private

Definition at line 799 of file bdb.cpp.

Here is the call graph for this function:

◆ StartCursor()

bool BerkeleyBatch::StartCursor ( )

Definition at line 723 of file bdb.cpp.

Here is the caller graph for this function:

◆ TxnAbort()

bool BerkeleyBatch::TxnAbort ( )

Definition at line 785 of file bdb.cpp.

◆ TxnBegin()

bool BerkeleyBatch::TxnBegin ( )

Definition at line 765 of file bdb.cpp.

Here is the call graph for this function:

◆ TxnCommit()

bool BerkeleyBatch::TxnCommit ( )

Definition at line 776 of file bdb.cpp.

◆ Write()

template<typename K , typename T >
bool BerkeleyBatch::Write ( const K &  key,
const T &  value,
bool  fOverwrite = true 
)
inline

Definition at line 246 of file bdb.h.

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

◆ WriteKey()

bool BerkeleyBatch::WriteKey ( CDataStream key,
CDataStream value,
bool  overwrite = true 
)
private

Definition at line 817 of file bdb.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ activeTxn

DbTxn* BerkeleyBatch::activeTxn
protected

Definition at line 206 of file bdb.h.

◆ env

BerkeleyEnvironment* BerkeleyBatch::env
protected

Definition at line 210 of file bdb.h.

◆ fFlushOnClose

bool BerkeleyBatch::fFlushOnClose
protected

Definition at line 209 of file bdb.h.

◆ fReadOnly

bool BerkeleyBatch::fReadOnly
protected

Definition at line 208 of file bdb.h.

◆ m_cursor

Dbc* BerkeleyBatch::m_cursor
protected

Definition at line 207 of file bdb.h.

◆ pdb

Db* BerkeleyBatch::pdb
protected

Definition at line 204 of file bdb.h.

◆ strFile

std::string BerkeleyBatch::strFile
protected

Definition at line 205 of file bdb.h.


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