Raven Core  3.0.0
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 &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
 

Detailed Description

RAII class that provides access to a Berkeley database.

Definition at line 146 of file db.h.

Constructor & Destructor Documentation

◆ CDB() [1/2]

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

Definition at line 397 of file db.cpp.

Here is the call graph for this function:

◆ ~CDB()

CDB::~CDB ( )
inline

Definition at line 158 of file db.h.

Here is the call graph for this function:

◆ CDB() [2/2]

CDB::CDB ( const CDB )
delete

Member Function Documentation

◆ Close()

void CDB::Close ( )

Definition at line 476 of file db.cpp.

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

◆ Erase()

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

Definition at line 241 of file db.h.

◆ Exists()

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

Definition at line 263 of file db.h.

Here is the caller graph for this function:

◆ Flush()

void CDB::Flush ( )

Definition at line 458 of file db.cpp.

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

◆ GetCursor()

Dbc* CDB::GetCursor ( )
inline

Definition at line 282 of file db.h.

Here is the caller graph for this function:

◆ operator=()

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

◆ PeriodicFlush()

bool CDB::PeriodicFlush ( CWalletDBWrapper dbw)
static

Definition at line 638 of file db.cpp.

Here is the call graph for this function:

◆ Read()

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 caller graph for this function:

◆ ReadAtCursor()

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:

◆ ReadVersion()

bool CDB::ReadVersion ( int &  nVersion)
inline

Definition at line 358 of file db.h.

Here is the caller graph for this function:

◆ Recover()

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 198 of file db.cpp.

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

◆ Rewrite()

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

Definition at line 508 of file db.cpp.

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

◆ TxnAbort()

bool CDB::TxnAbort ( )
inline

Definition at line 349 of file db.h.

Here is the caller graph for this function:

◆ TxnBegin()

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:

◆ TxnCommit()

bool CDB::TxnCommit ( )
inline

Definition at line 340 of file db.h.

Here is the caller graph for this function:

◆ VerifyDatabaseFile()

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 298 of file db.cpp.

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

◆ VerifyEnvironment()

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

Definition at line 264 of file db.cpp.

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

◆ Write()

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.

◆ WriteVersion()

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

◆ activeTxn

DbTxn* CDB::activeTxn
protected

Definition at line 151 of file db.h.

◆ env

CDBEnv* CDB::env
protected

Definition at line 154 of file db.h.

◆ fFlushOnClose

bool CDB::fFlushOnClose
protected

Definition at line 153 of file db.h.

◆ fReadOnly

bool CDB::fReadOnly
protected

Definition at line 152 of file db.h.

◆ pdb

Db* CDB::pdb
protected

Definition at line 149 of file db.h.

◆ strFile

std::string CDB::strFile
protected

Definition at line 150 of file db.h.


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