Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
#include <db.h>
Public Types | |
enum | VerifyResult { VERIFY_OK, RECOVER_OK, RECOVER_FAIL } |
Verify that database file strFile is OK. More... | |
typedef bool(* | recoverFunc_type) (const fs::path &file_path, std::string &out_backup_filename) |
typedef std::pair< std::vector< unsigned char >, std::vector< unsigned char > > | KeyValPair |
Salvage data from a file that Verify says is bad. More... | |
Public Member Functions | |
BerkeleyEnvironment (const fs::path &env_directory) | |
~BerkeleyEnvironment () | |
void | Reset () |
void | MakeMock () |
bool | IsMock () const |
bool | IsInitialized () const |
fs::path | Directory () const |
VerifyResult | Verify (const std::string &strFile, recoverFunc_type recoverFunc, std::string &out_backup_filename) |
bool | Salvage (const std::string &strFile, bool fAggressive, std::vector< KeyValPair > &vResult) |
bool | Open (bool retry) |
void | Close () |
void | Flush (bool fShutdown) |
void | CheckpointLSN (const std::string &strFile) |
void | CloseDb (const std::string &strFile) |
DbTxn * | TxnBegin (int flags=DB_TXN_WRITE_NOSYNC) |
Public Attributes | |
std::unique_ptr< DbEnv > | dbenv |
std::map< std::string, int > | mapFileUseCount |
std::map< std::string, Db * > | mapDb |
Private Attributes | |
bool | fDbEnvInit |
bool | fMockDb |
std::string | strPath |
Detailed Description
Member Typedef Documentation
◆ KeyValPair
typedef std::pair<std::vector<unsigned char>, std::vector<unsigned char> > BerkeleyEnvironment::KeyValPair |
Salvage data from a file that Verify says is bad.
fAggressive sets the DB_AGGRESSIVE flag (see berkeley DB->verify() method documentation). Appends binary key/value pairs to vResult, returns true if successful. NOTE: reads the entire database into memory, so cannot be used for huge databases.
◆ recoverFunc_type
typedef bool(* BerkeleyEnvironment::recoverFunc_type) (const fs::path &file_path, std::string &out_backup_filename) |
Member Enumeration Documentation
◆ VerifyResult
Constructor & Destructor Documentation
◆ BerkeleyEnvironment()
BerkeleyEnvironment::BerkeleyEnvironment | ( | const fs::path & | env_directory | ) |
◆ ~BerkeleyEnvironment()
BerkeleyEnvironment::~BerkeleyEnvironment | ( | ) |
Member Function Documentation
◆ CheckpointLSN()
void BerkeleyEnvironment::CheckpointLSN | ( | const std::string & | strFile | ) |
Definition at line 434 of file db.cpp.
References dbenv, and fMockDb.
Referenced by BerkeleyDatabase::Backup(), BerkeleyBatch::PeriodicFlush(), and BerkeleyBatch::Rewrite().
◆ Close()
void BerkeleyEnvironment::Close | ( | ) |
Definition at line 87 of file db.cpp.
References count, dbenv, fDbEnvInit, fMockDb, LogPrintf, mapDb, mapFileUseCount, and strPath.
Referenced by BerkeleyDatabase::BerkeleyDatabase(), Flush(), and ~BerkeleyEnvironment().
◆ CloseDb()
void BerkeleyEnvironment::CloseDb | ( | const std::string & | strFile | ) |
Definition at line 558 of file db.cpp.
Referenced by BerkeleyDatabase::Backup(), Flush(), BerkeleyBatch::PeriodicFlush(), and BerkeleyBatch::Rewrite().
◆ Directory()
|
inline |
Definition at line 49 of file db.h.
References strPath.
Referenced by CWallet::AutoBackupWallet(), BerkeleyDatabase::Backup(), BerkeleyBatch::VerifyDatabaseFile(), and BerkeleyBatch::VerifyEnvironment().
◆ Flush()
void BerkeleyEnvironment::Flush | ( | bool | fShutdown | ) |
Definition at line 661 of file db.cpp.
References Close(), CloseDb(), BCLog::DB, dbenv, fDbEnvInit, fMockDb, GetTimeMillis(), LOCK, LogPrint, mapFileUseCount, and strPath.
Referenced by BerkeleyDatabase::Flush().
◆ IsInitialized()
|
inline |
Definition at line 48 of file db.h.
References fDbEnvInit.
◆ IsMock()
|
inline |
Definition at line 47 of file db.h.
References fMockDb.
Referenced by BerkeleyBatch::BerkeleyBatch().
◆ MakeMock()
void BerkeleyEnvironment::MakeMock | ( | ) |
Definition at line 198 of file db.cpp.
References BCLog::DB, dbenv, fDbEnvInit, fMockDb, LogPrint, and strprintf.
Referenced by BerkeleyDatabase::BerkeleyDatabase().
◆ Open()
bool BerkeleyEnvironment::Open | ( | bool | retry | ) |
debug
Definition at line 128 of file db.cpp.
References dbenv, DEFAULT_WALLET_PRIVDB, fDbEnvInit, fMockDb, fsbridge::fopen(), gArgs, ArgsManager::GetBoolArg(), GetTime(), LockDirectory(), LogPrintf, strPath, strprintf, and TryCreateDirectories().
Referenced by BerkeleyBatch::BerkeleyBatch(), and BerkeleyBatch::VerifyEnvironment().
◆ Reset()
void BerkeleyEnvironment::Reset | ( | ) |
Definition at line 111 of file db.cpp.
References dbenv, fDbEnvInit, and fMockDb.
Referenced by BerkeleyDatabase::BerkeleyDatabase(), and BerkeleyEnvironment().
◆ Salvage()
bool BerkeleyEnvironment::Salvage | ( | const std::string & | strFile, |
bool | fAggressive, | ||
std::vector< KeyValPair > & | vResult | ||
) |
Definition at line 373 of file db.cpp.
References DATA_END, dbenv, flags, HEADER_END, LOCK, LogPrintf, mapFileUseCount, and ParseHex().
Referenced by BerkeleyBatch::Recover().
◆ TxnBegin()
|
inline |
Definition at line 79 of file db.h.
Referenced by BerkeleyBatch::Recover(), and BerkeleyBatch::TxnBegin().
◆ Verify()
BerkeleyEnvironment::VerifyResult BerkeleyEnvironment::Verify | ( | const std::string & | strFile, |
recoverFunc_type | recoverFunc, | ||
std::string & | out_backup_filename | ||
) |
Definition at line 230 of file db.cpp.
References dbenv, LOCK, mapFileUseCount, RECOVER_FAIL, RECOVER_OK, strPath, and VERIFY_OK.
Referenced by BerkeleyBatch::VerifyDatabaseFile().
Member Data Documentation
◆ dbenv
std::unique_ptr<DbEnv> BerkeleyEnvironment::dbenv |
Definition at line 38 of file db.h.
Referenced by BerkeleyBatch::BerkeleyBatch(), CheckpointLSN(), Close(), Flush(), BerkeleyBatch::Flush(), MakeMock(), Open(), BerkeleyBatch::Recover(), Reset(), BerkeleyBatch::Rewrite(), Salvage(), TxnBegin(), and Verify().
◆ fDbEnvInit
|
private |
Definition at line 31 of file db.h.
Referenced by Close(), Flush(), IsInitialized(), MakeMock(), Open(), and Reset().
◆ fMockDb
|
private |
Definition at line 32 of file db.h.
Referenced by CheckpointLSN(), Close(), Flush(), IsMock(), MakeMock(), Open(), and Reset().
◆ mapDb
std::map<std::string, Db*> BerkeleyEnvironment::mapDb |
Definition at line 40 of file db.h.
Referenced by BerkeleyBatch::BerkeleyBatch(), Close(), and CloseDb().
◆ mapFileUseCount
std::map<std::string, int> BerkeleyEnvironment::mapFileUseCount |
Definition at line 39 of file db.h.
Referenced by BerkeleyDatabase::Backup(), BerkeleyBatch::BerkeleyBatch(), Close(), BerkeleyBatch::Close(), Flush(), BerkeleyBatch::PeriodicFlush(), BerkeleyBatch::Rewrite(), Salvage(), and Verify().
◆ strPath
|
private |
The documentation for this class was generated from the following files: