BSHA3  0.17.99
P2P Blockchain, based on Bitcoin
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 178 of file db.h.

Constructor & Destructor Documentation

◆ BerkeleyBatch() [1/2]

BerkeleyBatch::BerkeleyBatch ( BerkeleyDatabase database,
const char *  pszMode = "r+",
bool  fFlushOnCloseIn = true 
)
explicit

Definition at line 446 of file db.cpp.

Here is the call graph for this function:

◆ ~BerkeleyBatch()

BerkeleyBatch::~BerkeleyBatch ( )
inline

Definition at line 190 of file db.h.

Here is the call graph for this function:

◆ BerkeleyBatch() [2/2]

BerkeleyBatch::BerkeleyBatch ( const BerkeleyBatch )
delete

Member Function Documentation

◆ Close()

void BerkeleyBatch::Close ( )

Definition at line 543 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 BerkeleyBatch::Erase ( const K &  key)
inline

Definition at line 273 of file db.h.

Here is the caller graph for this function:

◆ Exists()

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

Definition at line 295 of file db.h.

Here is the caller graph for this function:

◆ Flush()

void BerkeleyBatch::Flush ( )

Definition at line 525 of file db.cpp.

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

◆ GetCursor()

Dbc* BerkeleyBatch::GetCursor ( )
inline

Definition at line 314 of file db.h.

Here is the caller graph for this function:

◆ operator=()

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

◆ PeriodicFlush()

bool BerkeleyBatch::PeriodicFlush ( BerkeleyDatabase database)
static

Definition at line 732 of file db.cpp.

Here is the call graph for this function:

◆ Read()

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

Definition at line 209 of file db.h.

Here is the caller graph for this function:

◆ ReadAtCursor()

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

Definition at line 325 of file db.h.

Here is the call graph for this function:

◆ ReadVersion()

bool BerkeleyBatch::ReadVersion ( int &  nVersion)
inline

Definition at line 390 of file db.h.

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

◆ 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

Definition at line 250 of file db.cpp.

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

◆ Rewrite()

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

Definition at line 602 of file db.cpp.

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

◆ TxnAbort()

bool BerkeleyBatch::TxnAbort ( )
inline

Definition at line 381 of file db.h.

Here is the caller graph for this function:

◆ TxnBegin()

bool BerkeleyBatch::TxnBegin ( )
inline

Definition at line 361 of file db.h.

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

◆ TxnCommit()

bool BerkeleyBatch::TxnCommit ( )
inline

Definition at line 372 of file db.h.

Here is the caller graph for this function:

◆ VerifyDatabaseFile()

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

Definition at line 343 of file db.cpp.

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

◆ VerifyEnvironment()

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

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

Definition at line 244 of file db.h.

Here is the caller graph for this function:

◆ WriteVersion()

bool BerkeleyBatch::WriteVersion ( int  nVersion)
inline

Definition at line 396 of file db.h.

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

Member Data Documentation

◆ activeTxn

DbTxn* BerkeleyBatch::activeTxn
protected

Definition at line 183 of file db.h.

◆ env

BerkeleyEnvironment* BerkeleyBatch::env
protected

Definition at line 186 of file db.h.

◆ fFlushOnClose

bool BerkeleyBatch::fFlushOnClose
protected

Definition at line 185 of file db.h.

◆ fReadOnly

bool BerkeleyBatch::fReadOnly
protected

Definition at line 184 of file db.h.

◆ pdb

Db* BerkeleyBatch::pdb
protected

Definition at line 181 of file db.h.

◆ strFile

std::string BerkeleyBatch::strFile
protected

Definition at line 182 of file db.h.


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