Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/bdb.h
Show First 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | public: | ||||
~BerkeleyDatabase() { | ~BerkeleyDatabase() { | ||||
if (env) { | if (env) { | ||||
size_t erased = env->m_databases.erase(strFile); | size_t erased = env->m_databases.erase(strFile); | ||||
assert(erased == 1); | assert(erased == 1); | ||||
} | } | ||||
} | } | ||||
/** Return object for accessing database at specified path. */ | |||||
static std::unique_ptr<BerkeleyDatabase> Create(const fs::path &path) { | |||||
std::string filename; | |||||
return std::make_unique<BerkeleyDatabase>(GetWalletEnv(path, filename), | |||||
std::move(filename)); | |||||
} | |||||
/** | |||||
* Return object for accessing dummy database with no read/write | |||||
* capabilities. | |||||
*/ | |||||
static std::unique_ptr<BerkeleyDatabase> CreateDummy() { | |||||
return std::make_unique<BerkeleyDatabase>(); | |||||
} | |||||
/** | |||||
* Return object for accessing temporary in-memory database. | |||||
*/ | |||||
static std::unique_ptr<BerkeleyDatabase> CreateMock() { | |||||
return std::make_unique<BerkeleyDatabase>( | |||||
std::make_shared<BerkeleyEnvironment>(), ""); | |||||
} | |||||
/** | /** | ||||
* Rewrite the entire database on disk, with the exception of key pszSkip if | * Rewrite the entire database on disk, with the exception of key pszSkip if | ||||
* non-zero | * non-zero | ||||
*/ | */ | ||||
bool Rewrite(const char *pszSkip = nullptr); | bool Rewrite(const char *pszSkip = nullptr); | ||||
/** | /** | ||||
* Back up the entire database to a file. | * Back up the entire database to a file. | ||||
▲ Show 20 Lines • Show All 166 Lines • Show Last 20 Lines |