Bitcoin Core 28.99.0
P2P Digital Currency
Public Member Functions | Public Attributes | Private Attributes | List of all members
wallet::BerkeleyRODatabase Class Reference

A class representing a BerkeleyDB file from which we can only read records. More...

#include <migrate.h>

Inheritance diagram for wallet::BerkeleyRODatabase:
[legend]
Collaboration diagram for wallet::BerkeleyRODatabase:
[legend]

Public Member Functions

 BerkeleyRODatabase (const fs::path &filepath, bool open=true)
 Create DB handle. More...
 
 ~BerkeleyRODatabase ()=default
 
void Open () override
 Open the database if it is not already opened. 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 Rewrite (const char *pszSkip=nullptr) override
 Rewrite the entire database on disk, with the exception of key pszSkip if non-zero. 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
 
void IncrementUpdateCounter () override
 
void ReloadDbEnv () override
 
std::string Filename () override
 Return path to main database file for logs and error messages. More...
 
std::string Format () override
 
std::unique_ptr< DatabaseBatchMakeBatch (bool flush_on_close=true) override
 Make a DatabaseBatch connected to this database. More...
 
- Public Member Functions inherited from wallet::WalletDatabase
 WalletDatabase ()
 Create dummy DB handle. More...
 
virtual ~WalletDatabase ()=default
 
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

BerkeleyROData m_records
 
- Public Attributes inherited from wallet::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 {0}
 
unsigned int nLastFlushed {0}
 
int64_t nLastWalletUpdate {0}
 

Private Attributes

const fs::path m_filepath
 

Detailed Description

A class representing a BerkeleyDB file from which we can only read records.

This is used only for migration of legacy to descriptor wallets

Definition at line 20 of file migrate.h.

Constructor & Destructor Documentation

◆ BerkeleyRODatabase()

wallet::BerkeleyRODatabase::BerkeleyRODatabase ( const fs::path filepath,
bool  open = true 
)
inline

Create DB handle.

Definition at line 27 of file migrate.h.

Here is the call graph for this function:

◆ ~BerkeleyRODatabase()

wallet::BerkeleyRODatabase::~BerkeleyRODatabase ( )
default

Member Function Documentation

◆ AddRef()

void wallet::BerkeleyRODatabase::AddRef ( )
inlineoverridevirtual

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

Increments m_refcount

Implements wallet::WalletDatabase.

Definition at line 39 of file migrate.h.

◆ Backup()

bool wallet::BerkeleyRODatabase::Backup ( const std::string &  strDest) const
overridevirtual

Back up the entire database to a file.

Implements wallet::WalletDatabase.

Definition at line 707 of file migrate.cpp.

Here is the call graph for this function:

◆ Close()

void wallet::BerkeleyRODatabase::Close ( )
inlineoverridevirtual

Flush to the database file and close the database.

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

Implements wallet::WalletDatabase.

Definition at line 57 of file migrate.h.

◆ Filename()

std::string wallet::BerkeleyRODatabase::Filename ( )
inlineoverridevirtual

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

Implements wallet::WalletDatabase.

Definition at line 67 of file migrate.h.

Here is the call graph for this function:

◆ Flush()

void wallet::BerkeleyRODatabase::Flush ( )
inlineoverridevirtual

Make sure all changes are flushed to database file.

Implements wallet::WalletDatabase.

Definition at line 53 of file migrate.h.

◆ Format()

std::string wallet::BerkeleyRODatabase::Format ( )
inlineoverridevirtual

Implements wallet::WalletDatabase.

Definition at line 69 of file migrate.h.

◆ IncrementUpdateCounter()

void wallet::BerkeleyRODatabase::IncrementUpdateCounter ( )
inlineoverridevirtual

Implements wallet::WalletDatabase.

Definition at line 62 of file migrate.h.

◆ MakeBatch()

std::unique_ptr< DatabaseBatch > wallet::BerkeleyRODatabase::MakeBatch ( bool  flush_on_close = true)
overridevirtual

Make a DatabaseBatch connected to this database.

Implements wallet::WalletDatabase.

Definition at line 702 of file migrate.cpp.

◆ Open()

void wallet::BerkeleyRODatabase::Open ( )
overridevirtual

Open the database if it is not already opened.

Implements wallet::WalletDatabase.

Definition at line 524 of file migrate.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PeriodicFlush()

bool wallet::BerkeleyRODatabase::PeriodicFlush ( )
inlineoverridevirtual

Implements wallet::WalletDatabase.

Definition at line 60 of file migrate.h.

◆ ReloadDbEnv()

void wallet::BerkeleyRODatabase::ReloadDbEnv ( )
inlineoverridevirtual

Implements wallet::WalletDatabase.

Definition at line 64 of file migrate.h.

◆ RemoveRef()

void wallet::BerkeleyRODatabase::RemoveRef ( )
inlineoverridevirtual

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

Decrement m_refcount

Implements wallet::WalletDatabase.

Definition at line 41 of file migrate.h.

◆ Rewrite()

bool wallet::BerkeleyRODatabase::Rewrite ( const char *  pszSkip = nullptr)
inlineoverridevirtual

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

Implements wallet::WalletDatabase.

Definition at line 45 of file migrate.h.

Member Data Documentation

◆ m_filepath

const fs::path wallet::BerkeleyRODatabase::m_filepath
private

Definition at line 23 of file migrate.h.

◆ m_records

BerkeleyROData wallet::BerkeleyRODatabase::m_records

Definition at line 33 of file migrate.h.


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