Bitcoin ABC 0.34.2
P2P Digital Currency
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
CDBWrapper Class Reference

#include <dbwrapper.h>

Inheritance diagram for CDBWrapper:
[legend]
Collaboration diagram for CDBWrapper:
[legend]

Public Member Functions

 CDBWrapper (const DBParams &params)
 
 ~CDBWrapper ()
 
 CDBWrapper (const CDBWrapper &)=delete
 
CDBWrapper & operator= (const CDBWrapper &)=delete
 
template<typename K , typename V >
bool Read (const K &key, V &value) const
 
template<typename K , typename V >
void Write (const K &key, const V &value, bool fSync=false)
 
std::optional< fs::path > StoragePath ()
 
template<typename K >
bool Exists (const K &key) const
 
template<typename K >
void Erase (const K &key, bool fSync=false)
 
void WriteBatch (CDBBatch &batch, bool fSync=false)
 
size_t DynamicMemoryUsage () const
 
CDBIterator * NewIterator ()
 
bool IsEmpty ()
 Return true if the database managed by this class contains no entries. More...
 
template<typename K >
size_t EstimateSize (const K &key_begin, const K &key_end) const
 

Private Member Functions

std::vector< uint8_t > CreateObfuscateKey () const
 Returns a string (consisting of 8 random bytes) suitable for use as an obfuscating XOR key. More...
 
std::optional< std::string > ReadImpl (Span< const std::byte > key) const
 
bool ExistsImpl (Span< const std::byte > key) const
 
size_t EstimateSizeImpl (Span< const std::byte > key1, Span< const std::byte > key2) const
 
auto & DBContext () const LIFETIMEBOUND
 

Private Attributes

std::unique_ptr< LevelDBContext > m_db_context
 holds all leveldb-specific fields of this class More...
 
std::string m_name
 the name of this database More...
 
std::vector< uint8_t > obfuscate_key
 a key used for optional XOR-obfuscation of the database More...
 
const fs::path m_path
 path to filesystem storage More...
 
bool m_is_memory
 whether or not the database resides in memory More...
 

Static Private Attributes

static const std::string OBFUSCATE_KEY_KEY
 the key under which the obfuscation key is stored More...
 
static const unsigned int OBFUSCATE_KEY_NUM_BYTES = 8
 the length of the obfuscate key in number of bytes More...
 

Friends

const std::vector< uint8_t > & dbwrapper_private::GetObfuscateKey (const CDBWrapper &w)
 

Detailed Description

Definition at line 177 of file dbwrapper.h.

Constructor & Destructor Documentation

◆ CDBWrapper() [1/2]

CDBWrapper::CDBWrapper ( const DBParams &  params)

Definition at line 220 of file dbwrapper.cpp.

Here is the call graph for this function:

◆ ~CDBWrapper()

CDBWrapper::~CDBWrapper ( )

Definition at line 283 of file dbwrapper.cpp.

Here is the call graph for this function:

◆ CDBWrapper() [2/2]

CDBWrapper::CDBWrapper ( const CDBWrapper &  )
delete

Member Function Documentation

◆ CreateObfuscateKey()

std::vector< uint8_t > CDBWrapper::CreateObfuscateKey ( ) const
private

Returns a string (consisting of 8 random bytes) suitable for use as an obfuscating XOR key.

Definition at line 341 of file dbwrapper.cpp.

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

◆ DBContext()

auto & CDBWrapper::DBContext ( ) const
inlineprivate

Definition at line 209 of file dbwrapper.h.

Here is the caller graph for this function:

◆ DynamicMemoryUsage()

size_t CDBWrapper::DynamicMemoryUsage ( ) const

Definition at line 316 of file dbwrapper.cpp.

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

◆ Erase()

template<typename K >
void CDBWrapper::Erase ( const K &  key,
bool  fSync = false 
)
inline

Definition at line 258 of file dbwrapper.h.

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

◆ EstimateSize()

template<typename K >
size_t CDBWrapper::EstimateSize ( const K &  key_begin,
const K &  key_end 
) const
inline

Definition at line 277 of file dbwrapper.h.

Here is the call graph for this function:

◆ EstimateSizeImpl()

size_t CDBWrapper::EstimateSizeImpl ( Span< const std::byte >  key1,
Span< const std::byte >  key2 
) const
private

Definition at line 379 of file dbwrapper.cpp.

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

◆ Exists()

template<typename K >
bool CDBWrapper::Exists ( const K &  key) const
inline

Definition at line 251 of file dbwrapper.h.

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

◆ ExistsImpl()

bool CDBWrapper::ExistsImpl ( Span< const std::byte >  key) const
private

Definition at line 363 of file dbwrapper.cpp.

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

◆ IsEmpty()

bool CDBWrapper::IsEmpty ( )

Return true if the database managed by this class contains no entries.

Definition at line 389 of file dbwrapper.cpp.

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

◆ NewIterator()

CDBIterator * CDBWrapper::NewIterator ( )

Definition at line 405 of file dbwrapper.cpp.

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

◆ operator=()

CDBWrapper & CDBWrapper::operator= ( const CDBWrapper &  )
delete

◆ Read()

template<typename K , typename V >
bool CDBWrapper::Read ( const K &  key,
V &  value 
) const
inline

Definition at line 218 of file dbwrapper.h.

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

◆ ReadImpl()

std::optional< std::string > CDBWrapper::ReadImpl ( Span< const std::byte >  key) const
private

Definition at line 348 of file dbwrapper.cpp.

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

◆ StoragePath()

std::optional< fs::path > CDBWrapper::StoragePath ( )
inline
Returns
filesystem path to the on-disk data.

Definition at line 244 of file dbwrapper.h.

◆ Write()

template<typename K , typename V >
void CDBWrapper::Write ( const K &  key,
const V &  value,
bool  fSync = false 
)
inline

Definition at line 237 of file dbwrapper.h.

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

◆ WriteBatch()

void CDBWrapper::WriteBatch ( CDBBatch &  batch,
bool  fSync = false 
)

Definition at line 296 of file dbwrapper.cpp.

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

Friends And Related Function Documentation

◆ dbwrapper_private::GetObfuscateKey

const std::vector< uint8_t > & dbwrapper_private::GetObfuscateKey ( const CDBWrapper &  w)
friend

Member Data Documentation

◆ m_db_context

std::unique_ptr<LevelDBContext> CDBWrapper::m_db_context
private

holds all leveldb-specific fields of this class

Definition at line 183 of file dbwrapper.h.

◆ m_is_memory

bool CDBWrapper::m_is_memory
private

whether or not the database resides in memory

Definition at line 203 of file dbwrapper.h.

◆ m_name

std::string CDBWrapper::m_name
private

the name of this database

Definition at line 186 of file dbwrapper.h.

◆ m_path

const fs::path CDBWrapper::m_path
private

path to filesystem storage

Definition at line 200 of file dbwrapper.h.

◆ obfuscate_key

std::vector<uint8_t> CDBWrapper::obfuscate_key
private

a key used for optional XOR-obfuscation of the database

Definition at line 189 of file dbwrapper.h.

◆ OBFUSCATE_KEY_KEY

const std::string CDBWrapper::OBFUSCATE_KEY_KEY
staticprivate

the key under which the obfuscation key is stored

Definition at line 192 of file dbwrapper.h.

◆ OBFUSCATE_KEY_NUM_BYTES

const unsigned int CDBWrapper::OBFUSCATE_KEY_NUM_BYTES = 8
staticprivate

the length of the obfuscate key in number of bytes

Definition at line 195 of file dbwrapper.h.


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