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>
Public Member Functions | |
BerkeleyBatch (BerkeleyDatabase &database, const char *pszMode="r+", bool fFlushOnCloseIn=true) | |
~BerkeleyBatch () | |
BerkeleyBatch (const BerkeleyBatch &)=delete | |
BerkeleyBatch & | operator= (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 |
BerkeleyEnvironment * | env |
Detailed Description
Constructor & Destructor Documentation
◆ BerkeleyBatch() [1/2]
|
explicit |
Definition at line 443 of file db.cpp.
References CLIENT_VERSION, BerkeleyEnvironment::dbenv, BerkeleyDatabase::env, env, Exists(), fFlushOnClose, fReadOnly, BerkeleyDatabase::IsDummy(), BerkeleyEnvironment::IsMock(), LOCK, BerkeleyEnvironment::mapDb, BerkeleyEnvironment::mapFileUseCount, BerkeleyEnvironment::Open(), pdb, BerkeleyDatabase::strFile, strFile, strprintf, and WriteVersion().
◆ ~BerkeleyBatch()
◆ BerkeleyBatch() [2/2]
|
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()
|
inline |
Definition at line 262 of file db.h.
References activeTxn, CLIENT_VERSION, CDataStream::data(), fReadOnly, memory_cleanse(), pdb, CDataStream::reserve(), SER_DISK, and CDataStream::size().
Referenced by WalletBatch::EraseIC().
◆ Exists()
|
inline |
Definition at line 284 of file db.h.
References activeTxn, CLIENT_VERSION, CDataStream::data(), memory_cleanse(), pdb, CDataStream::reserve(), SER_DISK, and CDataStream::size().
Referenced by BerkeleyBatch().
◆ 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()
|
inline |
Definition at line 303 of file db.h.
References pdb.
Referenced by WalletBatch::FindWalletTx(), WalletBatch::ListAccountCreditDebit(), WalletBatch::LoadWallet(), and Rewrite().
◆ operator=()
|
delete |
◆ PeriodicFlush()
|
static |
Definition at line 701 of file db.cpp.
References BerkeleyEnvironment::CheckpointLSN(), BerkeleyEnvironment::CloseDb(), BCLog::DB, BerkeleyDatabase::env, env, GetTimeMillis(), BerkeleyDatabase::IsDummy(), LogPrint, BerkeleyEnvironment::mapFileUseCount, BerkeleyDatabase::strFile, strFile, and TRY_LOCK.
Referenced by MaybeCompactWalletDB().
◆ Read()
|
inline |
Definition at line 198 of file db.h.
References activeTxn, CLIENT_VERSION, CDataStream::data(), memory_cleanse(), pdb, CDataStream::reserve(), SER_DISK, and CDataStream::size().
Referenced by WalletBatch::FindWalletTx(), WalletBatch::LoadWallet(), WalletBatch::ReadAccount(), WalletBatch::ReadBestBlock(), WalletBatch::ReadPool(), WalletBatch::ReadPrivateSendSalt(), and ReadVersion().
◆ ReadAtCursor()
|
inline |
Definition at line 314 of file db.h.
References CDataStream::clear(), CDataStream::data(), memory_cleanse(), SER_DISK, CDataStream::SetType(), CDataStream::size(), and CDataStream::write().
Referenced by WalletBatch::FindWalletTx(), WalletBatch::ListAccountCreditDebit(), WalletBatch::LoadWallet(), and Rewrite().
◆ ReadVersion()
|
inline |
◆ Recover()
|
static |
Definition at line 247 of file db.cpp.
References CLIENT_VERSION, BerkeleyEnvironment::dbenv, env, GetTime(), GetWalletEnv(), LogPrintf, BerkeleyEnvironment::Salvage(), SER_DISK, strprintf, and BerkeleyEnvironment::TxnBegin().
Referenced by WalletBatch::Recover().
◆ Rewrite()
|
static |
Definition at line 572 of file db.cpp.
References BerkeleyEnvironment::CheckpointLSN(), CDataStream::clear(), CLIENT_VERSION, Close(), BerkeleyEnvironment::CloseDb(), CDataStream::data(), BerkeleyEnvironment::dbenv, BerkeleyDatabase::env, env, GetCursor(), BerkeleyDatabase::IsDummy(), LOCK, LogPrintf, BerkeleyEnvironment::mapFileUseCount, MilliSleep(), ReadAtCursor(), SER_DISK, CDataStream::size(), BerkeleyDatabase::strFile, and strFile.
Referenced by BerkeleyDatabase::Rewrite().
◆ TxnAbort()
|
inline |
Definition at line 370 of file db.h.
References activeTxn, and pdb.
Referenced by WalletBatch::TxnAbort().
◆ TxnBegin()
|
inline |
Definition at line 350 of file db.h.
References activeTxn, env, pdb, and BerkeleyEnvironment::TxnBegin().
Referenced by WalletBatch::TxnBegin().
◆ TxnCommit()
|
inline |
Definition at line 361 of file db.h.
References activeTxn, and pdb.
Referenced by WalletBatch::TxnCommit().
◆ VerifyDatabaseFile()
|
static |
Definition at line 340 of file db.cpp.
References _(), BerkeleyEnvironment::Directory(), env, GetWalletEnv(), BerkeleyEnvironment::RECOVER_FAIL, BerkeleyEnvironment::RECOVER_OK, strprintf, and BerkeleyEnvironment::Verify().
Referenced by WalletBatch::VerifyDatabaseFile().
◆ VerifyEnvironment()
|
static |
Definition at line 316 of file db.cpp.
References _(), BerkeleyEnvironment::Directory(), env, GetWalletEnv(), LogPrintf, BerkeleyEnvironment::Open(), and strprintf.
Referenced by WalletBatch::VerifyEnvironment().
◆ Write()
|
inline |
Definition at line 233 of file db.h.
References activeTxn, CLIENT_VERSION, CDataStream::data(), fReadOnly, memory_cleanse(), pdb, CDataStream::reserve(), SER_DISK, and CDataStream::size().
Referenced by WalletBatch::WriteIC(), and WriteVersion().
◆ WriteVersion()
|
inline |
Definition at line 385 of file db.h.
References Write().
Referenced by BerkeleyBatch(), and WalletBatch::WriteVersion().
Member Data Documentation
◆ activeTxn
|
protected |
Definition at line 172 of file db.h.
Referenced by Close(), Erase(), Exists(), Flush(), Read(), TxnAbort(), TxnBegin(), TxnCommit(), and Write().
◆ env
|
protected |
Definition at line 175 of file db.h.
Referenced by BerkeleyBatch(), Close(), Flush(), PeriodicFlush(), Recover(), Rewrite(), TxnBegin(), VerifyDatabaseFile(), and VerifyEnvironment().
◆ fFlushOnClose
|
protected |
Definition at line 174 of file db.h.
Referenced by BerkeleyBatch(), and Close().
◆ fReadOnly
|
protected |
◆ pdb
|
protected |
Definition at line 170 of file db.h.
Referenced by BerkeleyBatch(), Close(), Erase(), Exists(), GetCursor(), Read(), TxnAbort(), TxnBegin(), TxnCommit(), and Write().
◆ 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: