Bitcoin ABC 0.30.3
P2P Digital Currency
|
An instance of this class represents one database. More...
#include <bdb.h>
Public Member Functions | |
BerkeleyDatabase ()=delete | |
BerkeleyDatabase (std::shared_ptr< BerkeleyEnvironment > envIn, std::string filename) | |
Create DB handle to real database. More... | |
~BerkeleyDatabase () override | |
void | Open () override |
Open the database if it is not already opened. More... | |
bool | Rewrite (const char *pszSkip=nullptr) override |
Rewrite the entire database on disk, with the exception of key pszSkip if non-zero. More... | |
void | AddRef () override |
Indicate the a new database user has began using the database. More... | |
void | RemoveRef () override |
Indicate that database user has stopped using the database and that it could be flushed or closed. More... | |
bool | Backup (const std::string &strDest) const override |
Back up the entire database to a file. More... | |
void | Flush () override |
Make sure all changes are flushed to database file. More... | |
void | Close () override |
Flush to the database file and close the database. More... | |
bool | PeriodicFlush () override |
flush the wallet passively (TRY_LOCK) ideal to be called periodically More... | |
void | IncrementUpdateCounter () override |
void | ReloadDbEnv () override |
bool | Verify (bilingual_str &error) |
Verifies the environment and database file. More... | |
std::string | Filename () override |
Return path to main database filename. More... | |
std::unique_ptr< DatabaseBatch > | MakeBatch (bool flush_on_close=true) override |
Make a BerkeleyBatch connected to this database. More... | |
Public Member Functions inherited from WalletDatabase | |
WalletDatabase () | |
Create dummy DB handle. More... | |
virtual | ~WalletDatabase () |
virtual void | Open ()=0 |
Open the database if it is not already opened. More... | |
virtual void | AddRef ()=0 |
Indicate the a new database user has began using the database. More... | |
virtual void | RemoveRef ()=0 |
Indicate that database user has stopped using the database and that it could be flushed or closed. More... | |
virtual bool | Rewrite (const char *pszSkip=nullptr)=0 |
Rewrite the entire database on disk, with the exception of key pszSkip if non-zero. More... | |
virtual bool | Backup (const std::string &strDest) const =0 |
Back up the entire database to a file. More... | |
virtual void | Flush ()=0 |
Make sure all changes are flushed to database file. More... | |
virtual void | Close ()=0 |
Flush to the database file and close the database. More... | |
virtual bool | PeriodicFlush ()=0 |
virtual void | IncrementUpdateCounter ()=0 |
virtual void | ReloadDbEnv ()=0 |
virtual std::string | Filename ()=0 |
Return path to main database file for logs and error messages. More... | |
virtual std::unique_ptr< DatabaseBatch > | MakeBatch (bool flush_on_close=true)=0 |
Make a DatabaseBatch connected to this database. More... | |
Public Attributes | |
std::shared_ptr< BerkeleyEnvironment > | env |
Pointer to shared database environment. More... | |
std::unique_ptr< Db > | m_db |
Database pointer. More... | |
std::string | strFile |
Public Attributes inherited from WalletDatabase | |
std::atomic< int > | m_refcount {0} |
Counts the number of active database users to be sure that the database is not closed while someone is using it. More... | |
std::atomic< unsigned int > | nUpdateCounter |
unsigned int | nLastSeen |
unsigned int | nLastFlushed |
int64_t | nLastWalletUpdate |
An instance of this class represents one database.
For BerkeleyDB this is just a (env, strFile) tuple.
|
delete |
|
inline |
|
override |
|
overridevirtual |
Indicate the a new database user has began using the database.
Implements WalletDatabase.
Definition at line 878 of file bdb.cpp.
|
overridevirtual |
Back up the entire database to a file.
Implements WalletDatabase.
Definition at line 685 of file bdb.cpp.
|
overridevirtual |
Flush to the database file and close the database.
Also close the environment if no other databases are open in it.
Implements WalletDatabase.
|
inlineoverridevirtual |
Return path to main database filename.
Implements WalletDatabase.
Definition at line 158 of file bdb.h.
|
overridevirtual |
Make sure all changes are flushed to database file.
Implements WalletDatabase.
|
overridevirtual |
Implements WalletDatabase.
|
overridevirtual |
Make a BerkeleyBatch connected to this database.
Implements WalletDatabase.
|
overridevirtual |
Open the database if it is not already opened.
Implements WalletDatabase.
Definition at line 352 of file bdb.cpp.
|
overridevirtual |
flush the wallet passively (TRY_LOCK) ideal to be called periodically
Implements WalletDatabase.
Definition at line 652 of file bdb.cpp.
|
overridevirtual |
Implements WalletDatabase.
|
overridevirtual |
Indicate that database user has stopped using the database and that it could be flushed or closed.
Implements WalletDatabase.
Definition at line 887 of file bdb.cpp.
|
overridevirtual |
Rewrite the entire database on disk, with the exception of key pszSkip if non-zero.
Implements WalletDatabase.
Definition at line 493 of file bdb.cpp.
bool BerkeleyDatabase::Verify | ( | bilingual_str & | error | ) |
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 |