Raven Core  3.0.0
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 27 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.

◆ recoverFunc_type

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

Definition at line 60 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 57 of file db.h.

Constructor & Destructor Documentation

◆ CDBEnv()

CDBEnv::CDBEnv ( )

Definition at line 85 of file db.cpp.

Here is the call graph for this function:

◆ ~CDBEnv()

CDBEnv::~CDBEnv ( )

Definition at line 90 of file db.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ CheckpointLSN()

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

Definition at line 388 of file db.cpp.

Here is the caller graph for this function:

◆ Close()

void CDBEnv::Close ( )

Definition at line 97 of file db.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CloseDb()

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

Definition at line 494 of file db.cpp.

Here is the caller graph for this function:

◆ EnvShutdown()

void CDBEnv::EnvShutdown ( )
private

Definition at line 64 of file db.cpp.

Here is the caller graph for this function:

◆ Flush()

void CDBEnv::Flush ( bool  fShutdown)

Definition at line 598 of file db.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsMock()

bool CDBEnv::IsMock ( ) const
inline

Definition at line 49 of file db.h.

Here is the caller graph for this function:

◆ MakeMock()

void CDBEnv::MakeMock ( )

Definition at line 149 of file db.cpp.

Here is the caller graph for this function:

◆ Open()

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

debug

Definition at line 102 of file db.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Reset()

void CDBEnv::Reset ( )

Definition at line 77 of file db.cpp.

Here is the caller graph for this function:

◆ Salvage()

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

Definition at line 327 of file db.cpp.

Here is the caller graph for this function:

◆ TxnBegin()

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

Definition at line 79 of file db.h.

Here is the caller graph for this function:

◆ Verify()

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

Definition at line 181 of file db.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ cs_db

CCriticalSection CDBEnv::cs_db
mutable

Definition at line 39 of file db.h.

◆ dbenv

DbEnv* CDBEnv::dbenv

Definition at line 40 of file db.h.

◆ fDbEnvInit

bool CDBEnv::fDbEnvInit
private

Definition at line 30 of file db.h.

◆ fMockDb

bool CDBEnv::fMockDb
private

Definition at line 31 of file db.h.

◆ mapDb

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

Definition at line 42 of file db.h.

◆ mapFileUseCount

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

Definition at line 41 of file db.h.

◆ strPath

std::string CDBEnv::strPath
private

Definition at line 34 of file db.h.


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