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

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

#include <db.h>

Collaboration diagram for BerkeleyBatch:
[legend]

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::BerkeleyBatch ( BerkeleyDatabase database,
const char *  pszMode = "r+",
bool  fFlushOnCloseIn = true 
)
explicit

Definition at line 442 of file db.cpp.

Here is the call graph for this function:

BerkeleyBatch::~BerkeleyBatch ( )
inline

Definition at line 179 of file db.h.

Here is the call graph for this function:

BerkeleyBatch::BerkeleyBatch ( const BerkeleyBatch )
delete

Member Function Documentation

void BerkeleyBatch::Close ( )

Definition at line 539 of file db.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 262 of file db.h.

Here is the call graph for this function:

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

Definition at line 284 of file db.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void BerkeleyBatch::Flush ( )

Definition at line 521 of file db.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Dbc* BerkeleyBatch::GetCursor ( )
inline

Definition at line 303 of file db.h.

Here is the caller graph for this function:

BerkeleyBatch& BerkeleyBatch::operator= ( const BerkeleyBatch )
delete
bool BerkeleyBatch::PeriodicFlush ( BerkeleyDatabase database)
static

Definition at line 700 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 BerkeleyBatch::Read ( const K &  key,
T &  value 
)
inline

Definition at line 198 of file db.h.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 314 of file db.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool BerkeleyBatch::ReadVersion ( int &  nVersion)
inline

Definition at line 379 of file db.h.

Here is the caller graph for this function:

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

Definition at line 246 of file db.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool BerkeleyBatch::Rewrite ( BerkeleyDatabase database,
const char *  pszSkip = nullptr 
)
static

Definition at line 571 of file db.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool BerkeleyBatch::TxnAbort ( )
inline

Definition at line 370 of file db.h.

Here is the caller graph for this function:

bool BerkeleyBatch::TxnBegin ( )
inline

Definition at line 350 of file db.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool BerkeleyBatch::TxnCommit ( )
inline

Definition at line 361 of file db.h.

Here is the caller graph for this function:

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

Definition at line 339 of file db.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 315 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 BerkeleyBatch::Write ( const K &  key,
const T &  value,
bool  fOverwrite = true 
)
inline

Definition at line 233 of file db.h.

Here is the call graph for this function:

bool BerkeleyBatch::WriteVersion ( int  nVersion)
inline

Definition at line 385 of file db.h.

Here is the caller graph for this function:

Member Data Documentation

DbTxn* BerkeleyBatch::activeTxn
protected

Definition at line 172 of file db.h.

BerkeleyEnvironment* BerkeleyBatch::env
protected

Definition at line 175 of file db.h.

bool BerkeleyBatch::fFlushOnClose
protected

Definition at line 174 of file db.h.

bool BerkeleyBatch::fReadOnly
protected

Definition at line 173 of file db.h.

Db* BerkeleyBatch::pdb
protected

Definition at line 170 of file db.h.

std::string BerkeleyBatch::strFile
protected

Definition at line 171 of file db.h.


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