Bitcoin Core  0.15.99
P2P Digital Currency
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:
[legend]

Public Types

enum  VerifyResult { VERIFY_OK, RECOVER_OK, RECOVER_FAIL }
 Verify that database file strFile is OK. More...
 
typedef bool(* recoverFunc_type) (const std::string &strFile, 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

 CDBEnv ()
 
 ~CDBEnv ()
 
void Reset ()
 
void MakeMock ()
 
bool IsMock () 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 (const fs::path &path)
 
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

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 26 of file db.h.

Member Typedef Documentation

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 68 of file db.h.

typedef bool(* CDBEnv::recoverFunc_type) (const std::string &strFile, std::string &out_backup_filename)

Definition at line 59 of file db.h.

Member Enumeration Documentation

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 56 of file db.h.

Constructor & Destructor Documentation

CDBEnv::CDBEnv ( )

Definition at line 50 of file db.cpp.

Here is the call graph for this function:

CDBEnv::~CDBEnv ( )

Definition at line 55 of file db.cpp.

Here is the call graph for this function:

Member Function Documentation

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

Definition at line 353 of file db.cpp.

Here is the caller graph for this function:

void CDBEnv::Close ( )

Definition at line 62 of file db.cpp.

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 460 of file db.cpp.

Here is the caller graph for this function:

void CDBEnv::EnvShutdown ( )
private

Definition at line 29 of file db.cpp.

Here is the caller graph for this function:

void CDBEnv::Flush ( bool  fShutdown)

Definition at line 564 of file db.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CDBEnv::IsMock ( ) const
inline

Definition at line 48 of file db.h.

Here is the caller graph for this function:

void CDBEnv::MakeMock ( )

Definition at line 114 of file db.cpp.

Here is the caller graph for this function:

bool CDBEnv::Open ( const fs::path &  path)

debug

Definition at line 67 of file db.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void CDBEnv::Reset ( )

Definition at line 42 of file db.cpp.

Here is the caller graph for this function:

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

Definition at line 292 of file db.cpp.

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 78 of file db.h.

Here is the caller graph for this function:

CDBEnv::VerifyResult CDBEnv::Verify ( const std::string &  strFile,
recoverFunc_type  recoverFunc,
std::string &  out_backup_filename 
)

Definition at line 146 of file db.cpp.

Here is the caller graph for this function:

Member Data Documentation

CCriticalSection CDBEnv::cs_db
mutable

Definition at line 38 of file db.h.

DbEnv* CDBEnv::dbenv

Definition at line 39 of file db.h.

bool CDBEnv::fDbEnvInit
private

Definition at line 29 of file db.h.

bool CDBEnv::fMockDb
private

Definition at line 30 of file db.h.

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

Definition at line 41 of file db.h.

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

Definition at line 40 of file db.h.

std::string CDBEnv::strPath
private

Definition at line 33 of file db.h.


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