Dash Core  0.12.2.1
P2P Digital Currency
CDB Class Reference

#include <db.h>

+ Inheritance diagram for CDB:

Public Member Functions

void Flush ()
 
void Close ()
 
bool TxnBegin ()
 
bool TxnCommit ()
 
bool TxnAbort ()
 
bool ReadVersion (int &nVersion)
 
bool WriteVersion (int nVersion)
 

Static Public Member Functions

static bool Rewrite (const std::string &strFile, const char *pszSkip=NULL)
 

Protected Member Functions

 CDB (const std::string &strFilename, const char *pszMode="r+", bool fFlushOnCloseIn=true)
 
 ~CDB ()
 
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)
 
Dbc * GetCursor ()
 
int ReadAtCursor (Dbc *pcursor, CDataStream &ssKey, CDataStream &ssValue, unsigned int fFlags=DB_NEXT)
 

Protected Attributes

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

Private Member Functions

 CDB (const CDB &)
 
void operator= (const CDB &)
 

Detailed Description

RAII class that provides access to a Berkeley database

Definition at line 94 of file db.h.

Constructor & Destructor Documentation

◆ CDB() [1/2]

CDB::CDB ( const std::string &  strFilename,
const char *  pszMode = "r+",
bool  fFlushOnCloseIn = true 
)
explicitprotected

Definition at line 227 of file db.cpp.

◆ ~CDB()

CDB::~CDB ( )
inlineprotected

Definition at line 104 of file db.h.

◆ CDB() [2/2]

CDB::CDB ( const CDB )
private

Member Function Documentation

◆ Close()

void CDB::Close ( )

Definition at line 299 of file db.cpp.

Referenced by ~CDB().

◆ Erase()

template<typename K >
bool CDB::Erase ( const K &  key)
inlineprotected

Definition at line 179 of file db.h.

◆ Exists()

template<typename K >
bool CDB::Exists ( const K &  key)
inlineprotected

Definition at line 201 of file db.h.

Referenced by CDB().

◆ Flush()

void CDB::Flush ( )

Definition at line 286 of file db.cpp.

Referenced by Close().

◆ GetCursor()

Dbc* CDB::GetCursor ( )
inlineprotected

Definition at line 220 of file db.h.

◆ operator=()

void CDB::operator= ( const CDB )
private

◆ Read()

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

Definition at line 116 of file db.h.

Referenced by ReadVersion().

◆ ReadAtCursor()

int CDB::ReadAtCursor ( Dbc *  pcursor,
CDataStream ssKey,
CDataStream ssValue,
unsigned int  fFlags = DB_NEXT 
)
inlineprotected

Definition at line 231 of file db.h.

◆ ReadVersion()

bool CDB::ReadVersion ( int &  nVersion)
inline

Definition at line 298 of file db.h.

◆ Rewrite()

bool CDB::Rewrite ( const std::string &  strFile,
const char *  pszSkip = NULL 
)
static

Definition at line 340 of file db.cpp.

Referenced by CWallet::EncryptWallet(), CWallet::LoadWallet(), and CWallet::ZapWalletTx().

◆ TxnAbort()

bool CDB::TxnAbort ( )
inline

Definition at line 289 of file db.h.

◆ TxnBegin()

bool CDB::TxnBegin ( )
inline

Definition at line 269 of file db.h.

Referenced by movecmd().

◆ TxnCommit()

bool CDB::TxnCommit ( )
inline

Definition at line 280 of file db.h.

Referenced by movecmd().

◆ Write()

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

Definition at line 150 of file db.h.

Referenced by WriteVersion().

◆ WriteVersion()

bool CDB::WriteVersion ( int  nVersion)
inline

Definition at line 304 of file db.h.

Referenced by CDB().

Member Data Documentation

◆ activeTxn

DbTxn* CDB::activeTxn
protected

Definition at line 99 of file db.h.

Referenced by Close(), Erase(), Exists(), Flush(), Read(), TxnAbort(), TxnBegin(), TxnCommit(), and Write().

◆ fFlushOnClose

bool CDB::fFlushOnClose
protected

Definition at line 101 of file db.h.

Referenced by CDB(), and Close().

◆ fReadOnly

bool CDB::fReadOnly
protected

Definition at line 100 of file db.h.

Referenced by CDB(), Erase(), Flush(), and Write().

◆ pdb

Db* CDB::pdb
protected

Definition at line 97 of file db.h.

Referenced by CDB(), Close(), Erase(), Exists(), GetCursor(), Read(), TxnAbort(), TxnBegin(), TxnCommit(), and Write().

◆ strFile

std::string CDB::strFile
protected

Definition at line 98 of file db.h.

Referenced by CDB(), Close(), and Rewrite().


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