Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
WalletDatabase Class Referenceabstract

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

#include <db.h>

Inheritance diagram for WalletDatabase:
[legend]

Public Member Functions

 WalletDatabase ()
 Create dummy DB handle.
 
virtual ~WalletDatabase ()
 
virtual void Open ()=0
 Open the database if it is not already opened.
 
virtual void AddRef ()=0
 Indicate the a new database user has began using the database.
 
virtual void RemoveRef ()=0
 Indicate that database user has stopped using the database and that it could be flushed or closed.
 
virtual bool Rewrite (const char *pszSkip=nullptr)=0
 Rewrite the entire database on disk, with the exception of key pszSkip if non-zero.
 
virtual bool Backup (const std::string &strDest) const =0
 Back up the entire database to a file.
 
virtual void Flush ()=0
 Make sure all changes are flushed to database file.
 
virtual void Close ()=0
 Flush to the database file and close the database.
 
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.
 
virtual std::unique_ptr< DatabaseBatchMakeBatch (bool flush_on_close=true)=0
 Make a DatabaseBatch connected to this database.
 

Public Attributes

std::atomic< intm_refcount {0}
 Counts the number of active database users to be sure that the database is not closed while someone is using it.
 
std::atomic< unsigned intnUpdateCounter
 
unsigned int nLastSeen
 
unsigned int nLastFlushed
 
int64_t nLastWalletUpdate
 

Detailed Description

An instance of this class represents one database.

Definition at line 100 of file db.h.

Constructor & Destructor Documentation

◆ WalletDatabase()

WalletDatabase::WalletDatabase ( )
inline

Create dummy DB handle.

Definition at line 103 of file db.h.

◆ ~WalletDatabase()

virtual WalletDatabase::~WalletDatabase ( )
inlinevirtual

Definition at line 106 of file db.h.

Member Function Documentation

◆ AddRef()

virtual void WalletDatabase::AddRef ( )
pure virtual

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

Increments m_refcount

Implemented in BerkeleyDatabase, DummyDatabase, and SQLiteDatabase.

◆ Backup()

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

Back up the entire database to a file.

Implemented in SQLiteDatabase, BerkeleyDatabase, and DummyDatabase.

◆ Close()

virtual void 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 BerkeleyDatabase, DummyDatabase, and SQLiteDatabase.

◆ Filename()

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

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

Implemented in BerkeleyDatabase, DummyDatabase, and SQLiteDatabase.

◆ Flush()

virtual void WalletDatabase::Flush ( )
pure virtual

Make sure all changes are flushed to database file.

Implemented in BerkeleyDatabase, DummyDatabase, and SQLiteDatabase.

◆ IncrementUpdateCounter()

virtual void WalletDatabase::IncrementUpdateCounter ( )
pure virtual

Implemented in BerkeleyDatabase, DummyDatabase, and SQLiteDatabase.

Here is the caller graph for this function:

◆ MakeBatch()

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

Make a DatabaseBatch connected to this database.

Implemented in BerkeleyDatabase, DummyDatabase, and SQLiteDatabase.

◆ Open()

virtual void WalletDatabase::Open ( )
pure virtual

Open the database if it is not already opened.

Implemented in BerkeleyDatabase, DummyDatabase, and SQLiteDatabase.

◆ PeriodicFlush()

virtual bool WalletDatabase::PeriodicFlush ( )
pure virtual

◆ ReloadDbEnv()

virtual void WalletDatabase::ReloadDbEnv ( )
pure virtual

◆ RemoveRef()

virtual void 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 BerkeleyDatabase, DummyDatabase, and SQLiteDatabase.

◆ Rewrite()

virtual bool 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 BerkeleyDatabase, DummyDatabase, and SQLiteDatabase.

Member Data Documentation

◆ m_refcount

std::atomic<int> 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 113 of file db.h.

◆ nLastFlushed

unsigned int WalletDatabase::nLastFlushed

Definition at line 158 of file db.h.

◆ nLastSeen

unsigned int WalletDatabase::nLastSeen

Definition at line 157 of file db.h.

◆ nLastWalletUpdate

int64_t WalletDatabase::nLastWalletUpdate

Definition at line 159 of file db.h.

◆ nUpdateCounter

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

Definition at line 156 of file db.h.


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