PRCYCoin  2.0.0.7rc1
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 std::pair< std::vector< unsigned char >, std::vector< unsigned char > > KeyValPair
 

Public Member Functions

 CDBEnv ()
 
 ~CDBEnv ()
 
void Reset ()
 
void MakeMock ()
 
bool IsMock ()
 
VerifyResult Verify (std::string strFile, bool(*recoverFunc)(CDBEnv &dbenv, std::string strFile))
 
bool Compact (const std::string &strFile)
 Salvage data from a file that Verify says is bad. More...
 
bool Salvage (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)
 
bool RemoveDb (const std::string &strFile)
 
DbTxn * TxnBegin (int flags=DB_TXN_WRITE_NOSYNC)
 

Public Attributes

RecursiveMutex 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

Definition at line 70 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 52 of file db.cpp.

Here is the call graph for this function:

◆ ~CDBEnv()

CDBEnv::~CDBEnv ( )

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

Here is the caller graph for this function:

◆ Close()

void CDBEnv::Close ( )

Definition at line 64 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 364 of file db.cpp.

Here is the caller graph for this function:

◆ Compact()

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

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

Here is the caller graph for this function:

◆ EnvShutdown()

void CDBEnv::EnvShutdown ( )
private

Definition at line 31 of file db.cpp.

Here is the caller graph for this function:

◆ Flush()

void CDBEnv::Flush ( bool  fShutdown)

Definition at line 473 of file db.cpp.

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

◆ IsMock()

bool CDBEnv::IsMock ( )
inline

Definition at line 50 of file db.h.

Here is the caller graph for this function:

◆ MakeMock()

void CDBEnv::MakeMock ( )

Definition at line 116 of file db.cpp.

◆ Open()

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

debug

Definition at line 69 of file db.cpp.

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

◆ RemoveDb()

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

Definition at line 378 of file db.cpp.

Here is the call graph for this function:

◆ Reset()

void CDBEnv::Reset ( )

Definition at line 44 of file db.cpp.

Here is the caller graph for this function:

◆ Salvage()

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

Definition at line 214 of file db.cpp.

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

◆ TxnBegin()

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

Definition at line 81 of file db.h.

Here is the caller graph for this function:

◆ Verify()

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

Definition at line 148 of file db.cpp.

Member Data Documentation

◆ cs_db

RecursiveMutex CDBEnv::cs_db
mutable

Definition at line 40 of file db.h.

◆ dbenv

DbEnv* CDBEnv::dbenv

Definition at line 41 of file db.h.

◆ fDbEnvInit

bool CDBEnv::fDbEnvInit
private

Definition at line 31 of file db.h.

◆ fMockDb

bool CDBEnv::fMockDb
private

Definition at line 32 of file db.h.

◆ mapDb

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

Definition at line 43 of file db.h.

◆ mapFileUseCount

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

Definition at line 42 of file db.h.

◆ strPath

std::string CDBEnv::strPath
private

Definition at line 35 of file db.h.


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