Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/db.h
Show First 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | CWalletDBWrapper(const fs::path &wallet_path, bool mock = false) | ||||
} | } | ||||
} | } | ||||
/** Return object for accessing database at specified path. */ | /** Return object for accessing database at specified path. */ | ||||
static std::unique_ptr<CWalletDBWrapper> Create(const fs::path &path) { | static std::unique_ptr<CWalletDBWrapper> Create(const fs::path &path) { | ||||
return std::make_unique<CWalletDBWrapper>(path); | return std::make_unique<CWalletDBWrapper>(path); | ||||
} | } | ||||
/** Return object for accessing dummy database with no read/write | /** | ||||
* capabilities. */ | * Return object for accessing dummy database with no read/write | ||||
* capabilities. | |||||
*/ | |||||
static std::unique_ptr<CWalletDBWrapper> CreateDummy() { | static std::unique_ptr<CWalletDBWrapper> CreateDummy() { | ||||
return std::make_unique<CWalletDBWrapper>(); | return std::make_unique<CWalletDBWrapper>(); | ||||
} | } | ||||
/** Return object for accessing temporary in-memory database. */ | /** | ||||
* Return object for accessing temporary in-memory database. | |||||
*/ | |||||
static std::unique_ptr<CWalletDBWrapper> CreateMock() { | static std::unique_ptr<CWalletDBWrapper> CreateMock() { | ||||
return std::make_unique<CWalletDBWrapper>("", true /* mock */); | return std::make_unique<CWalletDBWrapper>("", true /* mock */); | ||||
} | } | ||||
/** Rewrite the entire database on disk, with the exception of key pszSkip | /** | ||||
* if non-zero | * Rewrite the entire database on disk, with the exception of key pszSkip if | ||||
* 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. | |||||
*/ | */ | ||||
bool Backup(const std::string &strDest); | bool Backup(const std::string &strDest); | ||||
/** Make sure all changes are flushed to disk. | /** | ||||
* Make sure all changes are flushed to disk. | |||||
*/ | */ | ||||
void Flush(bool shutdown); | void Flush(bool shutdown); | ||||
void IncrementUpdateCounter(); | void IncrementUpdateCounter(); | ||||
std::atomic<unsigned int> nUpdateCounter; | std::atomic<unsigned int> nUpdateCounter; | ||||
unsigned int nLastSeen; | unsigned int nLastSeen; | ||||
unsigned int nLastFlushed; | unsigned int nLastFlushed; | ||||
▲ Show 20 Lines • Show All 256 Lines • Show Last 20 Lines |