Bitcoin Core  22.99.0
P2P Digital Currency
Public Member Functions | Public Attributes | List of all members
wallet::WalletDatabase Class Referenceabstract

An instance of this class represents one database. More...

#include <db.h>

Inheritance diagram for wallet::WalletDatabase:
[legend]

Public Member Functions

 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::string Format ()=0
 
virtual std::unique_ptr< DatabaseBatchMakeBatch (bool flush_on_close=true)=0
 Make a DatabaseBatch connected to this database. More...
 

Public Attributes

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
 

Detailed Description

An instance of this class represents one database.

Definition at line 104 of file db.h.

Constructor & Destructor Documentation

◆ WalletDatabase()

wallet::WalletDatabase::WalletDatabase ( )
inline

Create dummy DB handle.

Definition at line 108 of file db.h.

◆ ~WalletDatabase()

virtual wallet::WalletDatabase::~WalletDatabase ( )
inlinevirtual

Definition at line 109 of file db.h.

Member Function Documentation

◆ AddRef()

virtual void wallet::WalletDatabase::AddRef ( )
pure virtual

Indicate the a new database user has began using the database.

Increments m_refcount

Implemented in wallet::DummyDatabase, wallet::BerkeleyDatabase, and wallet::SQLiteDatabase.

◆ Backup()

virtual bool wallet::WalletDatabase::Backup ( const std::string &  strDest) const
pure virtual

Back up the entire database to a file.

Implemented in wallet::DummyDatabase, wallet::BerkeleyDatabase, and wallet::SQLiteDatabase.

Here is the caller graph for this function:

◆ Close()

virtual void wallet::WalletDatabase::Close ( )
pure virtual

Flush to the database file and close the database.

Also close the environment if no other databases are open in it.

Implemented in wallet::DummyDatabase, wallet::BerkeleyDatabase, and wallet::SQLiteDatabase.

Here is the caller graph for this function:

◆ Filename()

virtual std::string wallet::WalletDatabase::Filename ( )
pure virtual

Return path to main database file for logs and error messages.

Implemented in wallet::DummyDatabase, wallet::BerkeleyDatabase, and wallet::SQLiteDatabase.

◆ Flush()

virtual void wallet::WalletDatabase::Flush ( )
pure virtual

Make sure all changes are flushed to database file.

Implemented in wallet::DummyDatabase, wallet::BerkeleyDatabase, and wallet::SQLiteDatabase.

Here is the caller graph for this function:

◆ Format()

virtual std::string wallet::WalletDatabase::Format ( )
pure virtual

Implemented in wallet::DummyDatabase, wallet::BerkeleyDatabase, and wallet::SQLiteDatabase.

Here is the caller graph for this function:

◆ IncrementUpdateCounter()

virtual void wallet::WalletDatabase::IncrementUpdateCounter ( )
pure virtual

Implemented in wallet::DummyDatabase, wallet::BerkeleyDatabase, and wallet::SQLiteDatabase.

Here is the caller graph for this function:

◆ MakeBatch()

virtual std::unique_ptr<DatabaseBatch> wallet::WalletDatabase::MakeBatch ( bool  flush_on_close = true)
pure virtual

Make a DatabaseBatch connected to this database.

Implemented in wallet::DummyDatabase, wallet::BerkeleyDatabase, and wallet::SQLiteDatabase.

Here is the caller graph for this function:

◆ Open()

virtual void wallet::WalletDatabase::Open ( )
pure virtual

Open the database if it is not already opened.

Implemented in wallet::DummyDatabase, wallet::BerkeleyDatabase, and wallet::SQLiteDatabase.

◆ PeriodicFlush()

virtual bool wallet::WalletDatabase::PeriodicFlush ( )
pure virtual

Implemented in wallet::DummyDatabase, wallet::BerkeleyDatabase, and wallet::SQLiteDatabase.

Here is the caller graph for this function:

◆ ReloadDbEnv()

virtual void wallet::WalletDatabase::ReloadDbEnv ( )
pure virtual

Implemented in wallet::DummyDatabase, wallet::BerkeleyDatabase, and wallet::SQLiteDatabase.

Here is the caller graph for this function:

◆ RemoveRef()

virtual void wallet::WalletDatabase::RemoveRef ( )
pure virtual

Indicate that database user has stopped using the database and that it could be flushed or closed.

Decrement m_refcount

Implemented in wallet::DummyDatabase, wallet::BerkeleyDatabase, and wallet::SQLiteDatabase.

◆ Rewrite()

virtual bool wallet::WalletDatabase::Rewrite ( const char *  pszSkip = nullptr)
pure virtual

Rewrite the entire database on disk, with the exception of key pszSkip if non-zero.

Implemented in wallet::SQLiteDatabase, wallet::DummyDatabase, and wallet::BerkeleyDatabase.

Here is the caller graph for this function:

Member Data Documentation

◆ m_refcount

std::atomic<int> wallet::WalletDatabase::m_refcount {0}

Counts the number of active database users to be sure that the database is not closed while someone is using it.

Definition at line 115 of file db.h.

◆ nLastFlushed

unsigned int wallet::WalletDatabase::nLastFlushed

Definition at line 151 of file db.h.

◆ nLastSeen

unsigned int wallet::WalletDatabase::nLastSeen

Definition at line 150 of file db.h.

◆ nLastWalletUpdate

int64_t wallet::WalletDatabase::nLastWalletUpdate

Definition at line 152 of file db.h.

◆ nUpdateCounter

std::atomic<unsigned int> wallet::WalletDatabase::nUpdateCounter

Definition at line 149 of file db.h.


The documentation for this class was generated from the following file: