Bitcoin Core  0.15.99
P2P Digital Currency
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
CDB Class Reference

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

#include <db.h>

Collaboration diagram for CDB:
[legend]

Public Member Functions

 CDB (CWalletDBWrapper &dbw, const char *pszMode="r+", bool fFlushOnCloseIn=true)
 
 ~CDB ()
 
 CDB (const CDB &)=delete
 
CDBoperator= (const CDB &)=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)
 
Dbc * GetCursor ()
 
int ReadAtCursor (Dbc *pcursor, CDataStream &ssKey, CDataStream &ssValue, bool setRange=false)
 
bool TxnBegin ()
 
bool TxnCommit ()
 
bool TxnAbort ()
 
bool ReadVersion (int &nVersion)
 
bool WriteVersion (int nVersion)
 

Static Public Member Functions

static bool Recover (const std::string &filename, void *callbackDataIn, bool(*recoverKVcallback)(void *callbackData, CDataStream ssKey, CDataStream ssValue), std::string &out_backup_filename)
 
static bool PeriodicFlush (CWalletDBWrapper &dbw)
 
static bool VerifyEnvironment (const std::string &walletFile, const fs::path &walletDir, std::string &errorStr)
 
static bool VerifyDatabaseFile (const std::string &walletFile, const fs::path &walletDir, std::string &warningStr, std::string &errorStr, CDBEnv::recoverFunc_type recoverFunc)
 
static bool Rewrite (CWalletDBWrapper &dbw, const char *pszSkip=nullptr)
 

Protected Attributes

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

Detailed Description

RAII class that provides access to a Berkeley database.

Definition at line 145 of file db.h.

Constructor & Destructor Documentation

CDB::CDB ( CWalletDBWrapper dbw,
const char *  pszMode = "r+",
bool  fFlushOnCloseIn = true 
)
explicit

Definition at line 394 of file db.cpp.

Here is the call graph for this function:

CDB::~CDB ( )
inline

Definition at line 157 of file db.h.

Here is the call graph for this function:

CDB::CDB ( const CDB )
delete

Member Function Documentation

void CDB::Close ( )

Definition at line 473 of file db.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 240 of file db.h.

Here is the call graph for this function:

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

Definition at line 262 of file db.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void CDB::Flush ( )

Definition at line 455 of file db.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Dbc* CDB::GetCursor ( )
inline

Definition at line 281 of file db.h.

Here is the caller graph for this function:

CDB& CDB::operator= ( const CDB )
delete
bool CDB::PeriodicFlush ( CWalletDBWrapper dbw)
static

Definition at line 634 of file db.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 176 of file db.h.

Here is the call graph for this function:

Here is the caller graph for this function:

int CDB::ReadAtCursor ( Dbc *  pcursor,
CDataStream ssKey,
CDataStream ssValue,
bool  setRange = false 
)
inline

Definition at line 292 of file db.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CDB::ReadVersion ( int &  nVersion)
inline

Definition at line 357 of file db.h.

Here is the caller graph for this function:

bool CDB::Recover ( const std::string &  filename,
void *  callbackDataIn,
bool(*)(void *callbackData, CDataStream ssKey, CDataStream ssValue)  recoverKVcallback,
std::string &  out_backup_filename 
)
static

Definition at line 195 of file db.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CDB::Rewrite ( CWalletDBWrapper dbw,
const char *  pszSkip = nullptr 
)
static

Definition at line 505 of file db.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CDB::TxnAbort ( )
inline

Definition at line 348 of file db.h.

Here is the caller graph for this function:

bool CDB::TxnBegin ( )
inline

Definition at line 328 of file db.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CDB::TxnCommit ( )
inline

Definition at line 339 of file db.h.

Here is the caller graph for this function:

bool CDB::VerifyDatabaseFile ( const std::string &  walletFile,
const fs::path &  walletDir,
std::string &  warningStr,
std::string &  errorStr,
CDBEnv::recoverFunc_type  recoverFunc 
)
static

Definition at line 295 of file db.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CDB::VerifyEnvironment ( const std::string &  walletFile,
const fs::path &  walletDir,
std::string &  errorStr 
)
static

Definition at line 261 of file db.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 211 of file db.h.

Here is the call graph for this function:

bool CDB::WriteVersion ( int  nVersion)
inline

Definition at line 363 of file db.h.

Here is the caller graph for this function:

Member Data Documentation

DbTxn* CDB::activeTxn
protected

Definition at line 150 of file db.h.

CDBEnv* CDB::env
protected

Definition at line 153 of file db.h.

bool CDB::fFlushOnClose
protected

Definition at line 152 of file db.h.

bool CDB::fReadOnly
protected

Definition at line 151 of file db.h.

Db* CDB::pdb
protected

Definition at line 148 of file db.h.

std::string CDB::strFile
protected

Definition at line 149 of file db.h.


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