Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/db.h
Show All 14 Lines | |||||
#include <version.h> | #include <version.h> | ||||
#include <db_cxx.h> | #include <db_cxx.h> | ||||
#include <atomic> | #include <atomic> | ||||
#include <map> | #include <map> | ||||
#include <memory> | #include <memory> | ||||
#include <string> | #include <string> | ||||
#include <unordered_map> | |||||
#include <vector> | #include <vector> | ||||
static const unsigned int DEFAULT_WALLET_DBLOGSIZE = 100; | static const unsigned int DEFAULT_WALLET_DBLOGSIZE = 100; | ||||
static const bool DEFAULT_WALLET_PRIVDB = true; | static const bool DEFAULT_WALLET_PRIVDB = true; | ||||
struct WalletDatabaseFileId { | |||||
u_int8_t value[DB_FILE_ID_LEN]; | |||||
bool operator==(const WalletDatabaseFileId &rhs) const; | |||||
}; | |||||
class BerkeleyEnvironment { | class BerkeleyEnvironment { | ||||
private: | private: | ||||
bool fDbEnvInit; | bool fDbEnvInit; | ||||
bool fMockDb; | bool fMockDb; | ||||
// Don't change into fs::path, as that can result in | // Don't change into fs::path, as that can result in | ||||
// shutdown problems/crashes caused by a static initialized internal | // shutdown problems/crashes caused by a static initialized internal | ||||
// pointer. | // pointer. | ||||
std::string strPath; | std::string strPath; | ||||
public: | public: | ||||
std::unique_ptr<DbEnv> dbenv; | std::unique_ptr<DbEnv> dbenv; | ||||
std::map<std::string, int> mapFileUseCount; | std::map<std::string, int> mapFileUseCount; | ||||
std::map<std::string, Db *> mapDb; | std::map<std::string, Db *> mapDb; | ||||
std::unordered_map<std::string, WalletDatabaseFileId> m_fileids; | |||||
std::condition_variable_any m_db_in_use; | std::condition_variable_any m_db_in_use; | ||||
BerkeleyEnvironment(const fs::path &env_directory); | BerkeleyEnvironment(const fs::path &env_directory); | ||||
~BerkeleyEnvironment(); | ~BerkeleyEnvironment(); | ||||
void Reset(); | void Reset(); | ||||
void MakeMock(); | void MakeMock(); | ||||
bool IsMock() const { return fMockDb; } | bool IsMock() const { return fMockDb; } | ||||
▲ Show 20 Lines • Show All 374 Lines • Show Last 20 Lines |