Fabcoin Core  0.16.2
P2P Digital Currency
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | 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 ()
 
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 &dataDir, std::string &errorStr)
 
static bool VerifyDatabaseFile (const std::string &walletFile, const fs::path &dataDir, 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
 

Private Member Functions

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

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 396 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 )
private

Member Function Documentation

void CDB::Close ( )

Definition at line 475 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 241 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 263 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 457 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 282 of file db.h.

Here is the caller graph for this function:

void CDB::operator= ( const CDB )
private
bool CDB::PeriodicFlush ( CWalletDBWrapper dbw)
static

Definition at line 638 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 177 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 293 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 358 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 197 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 507 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 349 of file db.h.

Here is the caller graph for this function:

bool CDB::TxnBegin ( )
inline

Definition at line 329 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 340 of file db.h.

Here is the caller graph for this function:

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

Definition at line 297 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 &  dataDir,
std::string &  errorStr 
)
static

Definition at line 263 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 212 of file db.h.

Here is the call graph for this function:

bool CDB::WriteVersion ( int  nVersion)
inline

Definition at line 364 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: