Bitcoin
|
#include <db.h>
Public Member Functions | |
BerkeleyDatabase () | |
BerkeleyDatabase (std::shared_ptr< BerkeleyEnvironment > env, std::string filename) | |
~BerkeleyDatabase () | |
bool | Rewrite (const char *pszSkip=nullptr) |
bool | Backup (const std::string &strDest) |
void | Flush (bool shutdown) |
void | IncrementUpdateCounter () |
void | ReloadDbEnv () |
Static Public Member Functions | |
static std::unique_ptr< BerkeleyDatabase > | Create (const fs::path &path) |
static std::unique_ptr< BerkeleyDatabase > | CreateDummy () |
static std::unique_ptr< BerkeleyDatabase > | CreateMock () |
Public Attributes | |
std::atomic< unsigned int > | nUpdateCounter |
unsigned int | nLastSeen |
unsigned int | nLastFlushed |
int64_t | nLastWalletUpdate |
std::shared_ptr< BerkeleyEnvironment > | env |
std::unique_ptr< Db > | m_db |
Private Member Functions | |
bool | IsDummy () |
Private Attributes | |
std::string | strFile |
Friends | |
class | BerkeleyBatch |
An instance of this class represents one database. For BerkeleyDB this is just a (env, strFile) tuple.
|
inline |
Create dummy DB handle
|
inline |
Create DB handle to real database
|
inline |
bool BerkeleyDatabase::Backup | ( | const std::string & | strDest | ) |
Back up the entire database to a file.
|
inlinestatic |
Return object for accessing database at specified path.
|
inlinestatic |
Return object for accessing dummy database with no read/write capabilities.
|
inlinestatic |
Return object for accessing temporary in-memory database.
void BerkeleyDatabase::Flush | ( | bool | shutdown | ) |
Make sure all changes are flushed to disk.
void BerkeleyDatabase::IncrementUpdateCounter | ( | ) |
|
inlineprivate |
Return whether this database handle is a dummy for testing. Only to be used at a low level, application should ideally not care about this.
void BerkeleyDatabase::ReloadDbEnv | ( | ) |
bool BerkeleyDatabase::Rewrite | ( | const char * | pszSkip = nullptr | ) |
Rewrite the entire database on disk, with the exception of key pszSkip if non-zero
|
friend |
std::shared_ptr<BerkeleyEnvironment> BerkeleyDatabase::env |
Pointer to shared database environment.
Normally there is only one BerkeleyDatabase object per BerkeleyEnvivonment, but in the special, backwards compatible case where multiple wallet BDB data files are loaded from the same directory, this will point to a shared instance that gets freed when the last data file is closed.
std::unique_ptr<Db> BerkeleyDatabase::m_db |
Database pointer. This is initialized lazily and reset during flushes, so it can be null.
unsigned int BerkeleyDatabase::nLastFlushed |
unsigned int BerkeleyDatabase::nLastSeen |
int64_t BerkeleyDatabase::nLastWalletUpdate |
std::atomic<unsigned int> BerkeleyDatabase::nUpdateCounter |
|
private |