Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/db.h
Show First 20 Lines • Show All 152 Lines • ▼ Show 20 Lines | protected: | ||||
bool fFlushOnClose; | bool fFlushOnClose; | ||||
CDBEnv *env; | CDBEnv *env; | ||||
public: | public: | ||||
explicit CDB(CWalletDBWrapper &dbw, const char *pszMode = "r+", | explicit CDB(CWalletDBWrapper &dbw, const char *pszMode = "r+", | ||||
bool fFlushOnCloseIn = true); | bool fFlushOnCloseIn = true); | ||||
~CDB() { Close(); } | ~CDB() { Close(); } | ||||
CDB(const CDB &) = delete; | |||||
CDB &operator=(const CDB &) = delete; | |||||
void Flush(); | void Flush(); | ||||
void Close(); | void Close(); | ||||
static bool Recover(const std::string &filename, void *callbackDataIn, | static bool Recover(const std::string &filename, void *callbackDataIn, | ||||
bool (*recoverKVcallback)(void *callbackData, | bool (*recoverKVcallback)(void *callbackData, | ||||
CDataStream ssKey, | CDataStream ssKey, | ||||
CDataStream ssValue), | CDataStream ssValue), | ||||
std::string &out_backup_filename); | std::string &out_backup_filename); | ||||
/* flush the wallet passively (TRY_LOCK) | /* flush the wallet passively (TRY_LOCK) | ||||
ideal to be called periodically */ | ideal to be called periodically */ | ||||
static bool PeriodicFlush(CWalletDBWrapper &dbw); | static bool PeriodicFlush(CWalletDBWrapper &dbw); | ||||
/* verifies the database environment */ | /* verifies the database environment */ | ||||
static bool VerifyEnvironment(const std::string &walletFile, | static bool VerifyEnvironment(const std::string &walletFile, | ||||
const fs::path &walletDir, | const fs::path &walletDir, | ||||
std::string &errorStr); | std::string &errorStr); | ||||
/* verifies the database file */ | /* verifies the database file */ | ||||
static bool VerifyDatabaseFile(const std::string &walletFile, | static bool VerifyDatabaseFile(const std::string &walletFile, | ||||
const fs::path &walletDir, | const fs::path &walletDir, | ||||
std::string &warningStr, | std::string &warningStr, | ||||
std::string &errorStr, | std::string &errorStr, | ||||
CDBEnv::recoverFunc_type recoverFunc); | CDBEnv::recoverFunc_type recoverFunc); | ||||
private: | |||||
CDB(const CDB &); | |||||
void operator=(const CDB &); | |||||
public: | public: | ||||
template <typename K, typename T> bool Read(const K &key, T &value) { | template <typename K, typename T> bool Read(const K &key, T &value) { | ||||
if (!pdb) { | if (!pdb) { | ||||
return false; | return false; | ||||
} | } | ||||
// Key | // Key | ||||
CDataStream ssKey(SER_DISK, CLIENT_VERSION); | CDataStream ssKey(SER_DISK, CLIENT_VERSION); | ||||
▲ Show 20 Lines • Show All 195 Lines • Show Last 20 Lines |