Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

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

#include <db.h>

+ Collaboration diagram for BerkeleyBatch:

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)
 
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 fs::path &file_path, void *callbackDataIn, bool(*recoverKVcallback)(void *callbackData, CDataStream ssKey, CDataStream ssValue), std::string &out_backup_filename)
 
static bool PeriodicFlush (BerkeleyDatabase &database)
 
static bool VerifyEnvironment (const fs::path &file_path, std::string &errorStr)
 
static bool VerifyDatabaseFile (const fs::path &file_path, std::string &warningStr, std::string &errorStr, BerkeleyEnvironment::recoverFunc_type recoverFunc)
 
static bool Rewrite (BerkeleyDatabase &database, const char *pszSkip=nullptr)
 

Protected Attributes

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

Detailed Description

RAII class that provides access to a Berkeley database.

Definition at line 167 of file db.h.

Constructor & Destructor Documentation

◆ BerkeleyBatch() [1/2]

◆ ~BerkeleyBatch()

BerkeleyBatch::~BerkeleyBatch ( )
inline

Definition at line 179 of file db.h.

References Close().

◆ BerkeleyBatch() [2/2]

BerkeleyBatch::BerkeleyBatch ( const BerkeleyBatch )
delete

Member Function Documentation

◆ Close()

void BerkeleyBatch::Close ( )

Definition at line 540 of file db.cpp.

References activeTxn, env, fFlushOnClose, Flush(), LOCK, BerkeleyEnvironment::mapFileUseCount, pdb, and strFile.

Referenced by Rewrite(), and ~BerkeleyBatch().

◆ Erase()

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

◆ Exists()

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

◆ Flush()

void BerkeleyBatch::Flush ( )

Definition at line 522 of file db.cpp.

References activeTxn, BerkeleyEnvironment::dbenv, DEFAULT_WALLET_DBLOGSIZE, env, fReadOnly, gArgs, and ArgsManager::GetArg().

Referenced by Close().

◆ GetCursor()

Dbc* BerkeleyBatch::GetCursor ( )
inline

◆ operator=()

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

◆ PeriodicFlush()

◆ Read()

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

◆ ReadAtCursor()

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

◆ ReadVersion()

bool BerkeleyBatch::ReadVersion ( int &  nVersion)
inline

Definition at line 379 of file db.h.

References Read().

Referenced by WalletBatch::ReadVersion().

◆ Recover()

bool BerkeleyBatch::Recover ( const fs::path &  file_path,
void *  callbackDataIn,
bool(*)(void *callbackData, CDataStream ssKey, CDataStream ssValue)  recoverKVcallback,
std::string &  out_backup_filename 
)
static

◆ Rewrite()

◆ TxnAbort()

bool BerkeleyBatch::TxnAbort ( )
inline

Definition at line 370 of file db.h.

References activeTxn, and pdb.

Referenced by WalletBatch::TxnAbort().

◆ TxnBegin()

bool BerkeleyBatch::TxnBegin ( )
inline

Definition at line 350 of file db.h.

References activeTxn, env, pdb, and BerkeleyEnvironment::TxnBegin().

Referenced by WalletBatch::TxnBegin().

◆ TxnCommit()

bool BerkeleyBatch::TxnCommit ( )
inline

Definition at line 361 of file db.h.

References activeTxn, and pdb.

Referenced by WalletBatch::TxnCommit().

◆ VerifyDatabaseFile()

bool BerkeleyBatch::VerifyDatabaseFile ( const fs::path &  file_path,
std::string &  warningStr,
std::string &  errorStr,
BerkeleyEnvironment::recoverFunc_type  recoverFunc 
)
static

◆ VerifyEnvironment()

bool BerkeleyBatch::VerifyEnvironment ( const fs::path &  file_path,
std::string &  errorStr 
)
static

◆ Write()

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

◆ WriteVersion()

bool BerkeleyBatch::WriteVersion ( int  nVersion)
inline

Definition at line 385 of file db.h.

References Write().

Referenced by BerkeleyBatch(), and WalletBatch::WriteVersion().

Member Data Documentation

◆ activeTxn

DbTxn* BerkeleyBatch::activeTxn
protected

Definition at line 172 of file db.h.

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

◆ env

BerkeleyEnvironment* BerkeleyBatch::env
protected

◆ fFlushOnClose

bool BerkeleyBatch::fFlushOnClose
protected

Definition at line 174 of file db.h.

Referenced by BerkeleyBatch(), and Close().

◆ fReadOnly

bool BerkeleyBatch::fReadOnly
protected

Definition at line 173 of file db.h.

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

◆ pdb

Db* BerkeleyBatch::pdb
protected

Definition at line 170 of file db.h.

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

◆ strFile

std::string BerkeleyBatch::strFile
protected

Definition at line 171 of file db.h.

Referenced by BerkeleyBatch(), Close(), PeriodicFlush(), and Rewrite().


The documentation for this class was generated from the following files:
Released under the MIT license