Dash Core  0.12.2.1
P2P Digital Currency
CDBEnv Class Reference

#include <db.h>

Public Types

enum  VerifyResult { VERIFY_OK, RECOVER_OK, RECOVER_FAIL }
 
typedef std::pair< std::vector< unsigned char >, std::vector< unsigned char > > KeyValPair
 

Public Member Functions

 CDBEnv ()
 
 ~CDBEnv ()
 
void Reset ()
 
void MakeMock ()
 
bool IsMock ()
 
VerifyResult Verify (const std::string &strFile, bool(*recoverFunc)(CDBEnv &dbenv, const std::string &strFile))
 
bool Salvage (const std::string &strFile, bool fAggressive, std::vector< KeyValPair > &vResult)
 
bool Open (const boost::filesystem::path &path)
 
void Close ()
 
void Flush (bool fShutdown)
 
void CheckpointLSN (const std::string &strFile)
 
void CloseDb (const std::string &strFile)
 
bool RemoveDb (const std::string &strFile)
 
DbTxn * TxnBegin (int flags=DB_TXN_WRITE_NOSYNC)
 

Public Attributes

CCriticalSection cs_db
 
DbEnv * dbenv
 
std::map< std::string, int > mapFileUseCount
 
std::map< std::string, Db * > mapDb
 

Private Member Functions

void EnvShutdown ()
 

Private Attributes

bool fDbEnvInit
 
bool fMockDb
 
std::string strPath
 

Detailed Description

Definition at line 28 of file db.h.

Member Typedef Documentation

◆ KeyValPair

typedef std::pair<std::vector<unsigned char>, std::vector<unsigned char> > CDBEnv::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.

Definition at line 69 of file db.h.

Member Enumeration Documentation

◆ VerifyResult

Verify that database file strFile is OK. If it is not, call the callback to try to recover. This must be called BEFORE strFile is opened. Returns true if strFile is OK.

Enumerator
VERIFY_OK 
RECOVER_OK 
RECOVER_FAIL 

Definition at line 58 of file db.h.

Constructor & Destructor Documentation

◆ CDBEnv()

CDBEnv::CDBEnv ( )

Definition at line 57 of file db.cpp.

◆ ~CDBEnv()

CDBEnv::~CDBEnv ( )

Definition at line 62 of file db.cpp.

Member Function Documentation

◆ CheckpointLSN()

void CDBEnv::CheckpointLSN ( const std::string &  strFile)

Definition at line 218 of file db.cpp.

Referenced by BackupWallet(), CDB::Rewrite(), and ThreadFlushWalletDB().

◆ Close()

void CDBEnv::Close ( )

Definition at line 69 of file db.cpp.

Referenced by Flush().

◆ CloseDb()

void CDBEnv::CloseDb ( const std::string &  strFile)

Definition at line 317 of file db.cpp.

Referenced by BackupWallet(), Flush(), RemoveDb(), CDB::Rewrite(), and ThreadFlushWalletDB().

◆ EnvShutdown()

void CDBEnv::EnvShutdown ( )
private

Definition at line 36 of file db.cpp.

Referenced by Close(), and ~CDBEnv().

◆ Flush()

void CDBEnv::Flush ( bool  fShutdown)

Definition at line 424 of file db.cpp.

Referenced by CWallet::Flush().

◆ IsMock()

bool CDBEnv::IsMock ( )
inline

Definition at line 50 of file db.h.

Referenced by CDB::CDB().

◆ MakeMock()

void CDBEnv::MakeMock ( )

Definition at line 119 of file db.cpp.

◆ Open()

bool CDBEnv::Open ( const boost::filesystem::path &  path)

debug

Definition at line 74 of file db.cpp.

Referenced by CDB::CDB(), and CWallet::Verify().

◆ RemoveDb()

bool CDBEnv::RemoveDb ( const std::string &  strFile)

Definition at line 331 of file db.cpp.

◆ Reset()

void CDBEnv::Reset ( )

Definition at line 49 of file db.cpp.

Referenced by CDBEnv().

◆ Salvage()

bool CDBEnv::Salvage ( const std::string &  strFile,
bool  fAggressive,
std::vector< KeyValPair > &  vResult 
)

Definition at line 168 of file db.cpp.

Referenced by CWalletDB::Recover().

◆ TxnBegin()

DbTxn* CDBEnv::TxnBegin ( int  flags = DB_TXN_WRITE_NOSYNC)
inline

Definition at line 80 of file db.h.

Referenced by CWalletDB::Recover(), and CDB::TxnBegin().

◆ Verify()

CDBEnv::VerifyResult CDBEnv::Verify ( const std::string &  strFile,
bool(*)(CDBEnv &dbenv, const std::string &strFile)  recoverFunc 
)

Definition at line 151 of file db.cpp.

Referenced by CWallet::Verify().

Member Data Documentation

◆ cs_db

CCriticalSection CDBEnv::cs_db
mutable

◆ dbenv

◆ fDbEnvInit

bool CDBEnv::fDbEnvInit
private

Definition at line 31 of file db.h.

Referenced by Flush(), MakeMock(), and Open().

◆ fMockDb

bool CDBEnv::fMockDb
private

Definition at line 32 of file db.h.

Referenced by CheckpointLSN(), Flush(), IsMock(), MakeMock(), and Open().

◆ mapDb

std::map<std::string, Db*> CDBEnv::mapDb

Definition at line 43 of file db.h.

Referenced by CDB::CDB(), and CloseDb().

◆ mapFileUseCount

std::map<std::string, int> CDBEnv::mapFileUseCount

◆ strPath

std::string CDBEnv::strPath
private

Definition at line 35 of file db.h.

Referenced by Flush(), and Open().


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