Master Core  v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
CDBEnv Class Reference

#include <db.h>

+ Collaboration diagram for CDBEnv:

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 MakeMock ()
 
bool IsMock ()
 
VerifyResult Verify (std::string strFile, bool(*recoverFunc)(CDBEnv &dbenv, std::string strFile))
 
bool Salvage (std::string strFile, bool fAggressive, std::vector< KeyValPair > &vResult)
 
bool Open (const boost::filesystem::path &path)
 
void Close ()
 
void Flush (bool fShutdown)
 
void CheckpointLSN (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, intmapFileUseCount
 
std::map< std::string, Db * > mapDb
 

Private Member Functions

void EnvShutdown ()
 

Private Attributes

bool fDbEnvInit
 
bool fMockDb
 
boost::filesystem::path path
 

Detailed Description

Definition at line 30 of file db.h.

Member Typedef Documentation

typedef std::pair<std::vector<unsigned char>, std::vector<unsigned char> > CDBEnv::KeyValPair

Definition at line 65 of file db.h.

Member Enumeration Documentation

Enumerator
VERIFY_OK 
RECOVER_OK 
RECOVER_FAIL 

Definition at line 56 of file db.h.

Constructor & Destructor Documentation

CDBEnv::CDBEnv ( )

Definition at line 50 of file db.cpp.

References fDbEnvInit, and fMockDb.

CDBEnv::~CDBEnv ( )

Definition at line 56 of file db.cpp.

References EnvShutdown().

+ Here is the call graph for this function:

Member Function Documentation

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

Definition at line 215 of file db.cpp.

References dbenv, and fMockDb.

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

+ Here is the caller graph for this function:

void CDBEnv::Close ( )

Definition at line 61 of file db.cpp.

References EnvShutdown().

Referenced by Flush().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 317 of file db.cpp.

References cs_db, LOCK, and mapDb.

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

+ Here is the caller graph for this function:

void CDBEnv::EnvShutdown ( )
private

Definition at line 37 of file db.cpp.

References LogPrintf.

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

+ Here is the caller graph for this function:

void CDBEnv::Flush ( bool  fShutdown)

Definition at line 435 of file db.cpp.

References Close(), CloseDb(), cs_db, dbenv, fDbEnvInit, fMockDb, GetTimeMillis(), LOCK, LogPrint(), mapFileUseCount, and path.

Referenced by Shutdown().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool CDBEnv::IsMock ( )
inline

Definition at line 48 of file db.h.

References fMockDb.

Referenced by CDB::CDB().

+ Here is the caller graph for this function:

void CDBEnv::MakeMock ( )

Definition at line 111 of file db.cpp.

References dbenv, fDbEnvInit, fMockDb, LogPrint(), and strprintf.

+ Here is the call graph for this function:

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

debug

Definition at line 66 of file db.cpp.

References dbenv, error(), fDbEnvInit, fMockDb, GetBoolArg(), LogPrintf, path, and TryCreateDirectory().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 332 of file db.cpp.

References CloseDb(), cs_db, dbenv, and LOCK.

+ Here is the call graph for this function:

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

Definition at line 160 of file db.cpp.

References cs_db, dbenv, LOCK, LogPrintf, mapFileUseCount, and ParseHex().

Referenced by CWalletDB::Recover().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 76 of file db.h.

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

+ Here is the caller graph for this function:

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

Definition at line 143 of file db.cpp.

References cs_db, LOCK, mapFileUseCount, RECOVER_FAIL, RECOVER_OK, and VERIFY_OK.

Referenced by AppInit2().

+ Here is the caller graph for this function:

Member Data Documentation

CCriticalSection CDBEnv::cs_db
mutable
DbEnv CDBEnv::dbenv
bool CDBEnv::fDbEnvInit
private

Definition at line 33 of file db.h.

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

bool CDBEnv::fMockDb
private

Definition at line 34 of file db.h.

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

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

Definition at line 43 of file db.h.

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

std::map<std::string, int> CDBEnv::mapFileUseCount
boost::filesystem::path CDBEnv::path
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: