Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
An instance of this class represents one database. More...
#include <db.h>
Public Member Functions | |
BerkeleyDatabase () | |
Create dummy DB handle. More... | |
BerkeleyDatabase (const fs::path &wallet_path, bool mock=false) | |
Create DB handle to real database. More... | |
bool | Rewrite (const char *pszSkip=nullptr) |
Rewrite the entire database on disk, with the exception of key pszSkip if non-zero. More... | |
bool | Backup (const std::string &strDest) |
Back up the entire database to a file. More... | |
void | Flush (bool shutdown) |
Make sure all changes are flushed to disk. More... | |
void | IncrementUpdateCounter () |
Static Public Member Functions | |
static std::unique_ptr< BerkeleyDatabase > | Create (const fs::path &path) |
Return object for accessing database at specified path. More... | |
static std::unique_ptr< BerkeleyDatabase > | CreateDummy () |
Return object for accessing dummy database with no read/write capabilities. More... | |
static std::unique_ptr< BerkeleyDatabase > | CreateMock () |
Return object for accessing temporary in-memory database. More... | |
Public Attributes | |
std::atomic< unsigned int > | nUpdateCounter |
unsigned int | nLastSeen |
unsigned int | nLastFlushed |
int64_t | nLastWalletUpdate |
Private Member Functions | |
bool | IsDummy () |
Return whether this database handle is a dummy for testing. More... | |
Private Attributes | |
BerkeleyEnvironment * | env |
BerkeleyDB specific. More... | |
std::string | strFile |
Friends | |
class | BerkeleyBatch |
Detailed Description
An instance of this class represents one database.
For BerkeleyDB this is just a (env, strFile) tuple.
Constructor & Destructor Documentation
◆ BerkeleyDatabase() [1/2]
|
inline |
◆ BerkeleyDatabase() [2/2]
|
inline |
Create DB handle to real database.
Definition at line 105 of file db.h.
References BerkeleyEnvironment::Close(), env, GetWalletEnv(), BerkeleyEnvironment::MakeMock(), BerkeleyEnvironment::Reset(), and strFile.
Member Function Documentation
◆ Backup()
bool BerkeleyDatabase::Backup | ( | const std::string & | strDest | ) |
Back up the entire database to a file.
Definition at line 749 of file db.cpp.
References BerkeleyEnvironment::CheckpointLSN(), BerkeleyEnvironment::CloseDb(), BerkeleyEnvironment::Directory(), env, IsDummy(), LOCK, LogPrintf, BerkeleyEnvironment::mapFileUseCount, MilliSleep(), and strFile.
◆ Create()
|
inlinestatic |
Return object for accessing database at specified path.
Definition at line 117 of file db.h.
Referenced by CWallet::CreateWalletFromFile(), and CWallet::Verify().
◆ CreateDummy()
|
inlinestatic |
Return object for accessing dummy database with no read/write capabilities.
Definition at line 123 of file db.h.
Referenced by BOOST_FIXTURE_TEST_CASE(), CoinSelection(), and CWallet::Verify().
◆ CreateMock()
|
inlinestatic |
Return object for accessing temporary in-memory database.
Definition at line 129 of file db.h.
Referenced by CreateTransactionTestSetup::CreateTransactionTestSetup(), and ListCoinsTestingSetup::ListCoinsTestingSetup().
◆ Flush()
void BerkeleyDatabase::Flush | ( | bool | shutdown | ) |
Make sure all changes are flushed to disk.
Definition at line 790 of file db.cpp.
References env, BerkeleyEnvironment::Flush(), and IsDummy().
◆ IncrementUpdateCounter()
void BerkeleyDatabase::IncrementUpdateCounter | ( | ) |
Definition at line 535 of file db.cpp.
References nUpdateCounter.
Referenced by WalletBatch::EraseIC(), and WalletBatch::WriteIC().
◆ IsDummy()
|
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.
Definition at line 162 of file db.h.
References env.
Referenced by Backup(), BerkeleyBatch::BerkeleyBatch(), Flush(), BerkeleyBatch::PeriodicFlush(), and BerkeleyBatch::Rewrite().
◆ Rewrite()
bool BerkeleyDatabase::Rewrite | ( | const char * | pszSkip = nullptr | ) |
Rewrite the entire database on disk, with the exception of key pszSkip if non-zero.
Definition at line 744 of file db.cpp.
References BerkeleyBatch::Rewrite().
Friends And Related Function Documentation
◆ BerkeleyBatch
|
friend |
Member Data Documentation
◆ env
|
private |
BerkeleyDB specific.
Definition at line 155 of file db.h.
Referenced by Backup(), BerkeleyBatch::BerkeleyBatch(), BerkeleyDatabase(), Flush(), IsDummy(), BerkeleyBatch::PeriodicFlush(), and BerkeleyBatch::Rewrite().
◆ nLastFlushed
unsigned int BerkeleyDatabase::nLastFlushed |
Definition at line 150 of file db.h.
Referenced by MaybeCompactWalletDB().
◆ nLastSeen
unsigned int BerkeleyDatabase::nLastSeen |
Definition at line 149 of file db.h.
Referenced by MaybeCompactWalletDB().
◆ nLastWalletUpdate
int64_t BerkeleyDatabase::nLastWalletUpdate |
Definition at line 151 of file db.h.
Referenced by MaybeCompactWalletDB().
◆ nUpdateCounter
std::atomic<unsigned int> BerkeleyDatabase::nUpdateCounter |
Definition at line 148 of file db.h.
Referenced by IncrementUpdateCounter(), and MaybeCompactWalletDB().
◆ strFile
|
private |
Definition at line 156 of file db.h.
Referenced by Backup(), BerkeleyBatch::BerkeleyBatch(), BerkeleyDatabase(), BerkeleyBatch::PeriodicFlush(), and BerkeleyBatch::Rewrite().
The documentation for this class was generated from the following files: