Bitcoin Core 29.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...
 
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 Close () override
 Flush to the database file and close the database. More...
 
std::string Filename () override
 Return path to main database file for logs and error messages. More...
 
std::string Format () override
 
std::unique_ptr< DatabaseBatchMakeBatch () override
 Make a DatabaseBatch connected to this database. More...
 
- Public Member Functions inherited from wallet::WalletDatabase
 WalletDatabase ()=default
 Create dummy DB handle. More...
 
virtual ~WalletDatabase ()=default
 
virtual void Open ()=0
 Open the database if it is not already opened. 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 Close ()=0
 Flush to the database file and close the database. More...
 
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 ()=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...
 

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

◆ 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 49 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 52 of file migrate.h.

Here is the call graph for this function:

◆ Format()

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

Implements wallet::WalletDatabase.

Definition at line 54 of file migrate.h.

◆ MakeBatch()

std::unique_ptr< DatabaseBatch > wallet::BerkeleyRODatabase::MakeBatch ( )
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:

◆ 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 40 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: