PIVX Core  5.6.99
P2P Digital Currency
Public Member Functions | Private Attributes | List of all members
CDBWrapper Class Reference

#include <dbwrapper.h>

Inheritance diagram for CDBWrapper:
[legend]

Public Member Functions

 CDBWrapper (const fs::path &path, size_t nCacheSize, bool fMemory=false, bool fWipe=false, int nVersion=CLIENT_VERSION)
 
 ~CDBWrapper ()
 
template<typename K >
bool ReadDataStream (const K &key, CDataStream &ssValue) const
 
bool ReadDataStream (const CDataStream &ssKey, CDataStream &ssValue) const
 
template<typename K , typename V >
bool Read (const K &key, V &value) const
 
template<typename V >
bool Read (const CDataStream &ssKey, V &value) const
 
template<typename K , typename V >
bool Write (const K &key, const V &value, bool fSync=false)
 
template<typename K >
bool Exists (const K &key) const
 
bool Exists (const CDataStream &key) const
 
template<typename K >
bool Erase (const K &key, bool fSync=false)
 
bool WriteBatch (CDBBatch &batch, bool fSync=false)
 
bool Flush ()
 
bool Sync ()
 
CDBIteratorNewIterator ()
 
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
 
template<typename K >
void CompactRange (const K &key_begin, const K &key_end) const
 Compact a certain range of keys in the database. More...
 
void CompactFull () const
 

Private Attributes

leveldb::Env * penv
 custom environment this database is using (may be nullptr in case of default environment) More...
 
leveldb::Options options
 database options used More...
 
leveldb::ReadOptions readoptions
 options used when reading from the database More...
 
leveldb::ReadOptions iteroptions
 options used when iterating over values of the database More...
 
leveldb::WriteOptions writeoptions
 options used when writing to the database More...
 
leveldb::WriteOptions syncoptions
 options used when sync writing to the database More...
 
leveldb::DB * pdb
 the database itself More...
 
int nVersion
 the version used to serialize data More...
 

Detailed Description

Definition at line 195 of file dbwrapper.h.

Constructor & Destructor Documentation

◆ CDBWrapper()

CDBWrapper::CDBWrapper ( const fs::path &  path,
size_t  nCacheSize,
bool  fMemory = false,
bool  fWipe = false,
int  nVersion = CLIENT_VERSION 
)
Parameters
[in]pathLocation in the filesystem where leveldb data will be stored.
[in]nCacheSizeConfigures various leveldb cache settings.
[in]fMemoryIf true, use leveldb's memory environment.
[in]fWipeIf true, remove all existing data.
[in]nVersionThe version used to serialize data.

Definition at line 55 of file dbwrapper.cpp.

◆ ~CDBWrapper()

CDBWrapper::~CDBWrapper ( )

Definition at line 82 of file dbwrapper.cpp.

Member Function Documentation

◆ CompactFull()

void CDBWrapper::CompactFull ( ) const
inline

Definition at line 380 of file dbwrapper.h.

◆ CompactRange()

template<typename K >
void CDBWrapper::CompactRange ( const K &  key_begin,
const K &  key_end 
) const
inline

Compact a certain range of keys in the database.

Definition at line 368 of file dbwrapper.h.

◆ Erase()

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

Definition at line 316 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 349 of file dbwrapper.h.

Here is the caller graph for this function:

◆ Exists() [1/2]

bool CDBWrapper::Exists ( const CDataStream key) const
inline

Definition at line 300 of file dbwrapper.h.

Here is the call graph for this function:

◆ Exists() [2/2]

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

Definition at line 292 of file dbwrapper.h.

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

◆ Flush()

bool CDBWrapper::Flush ( )
inline

Definition at line 326 of file dbwrapper.h.

◆ IsEmpty()

bool CDBWrapper::IsEmpty ( )

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

Definition at line 101 of file dbwrapper.cpp.

Here is the call graph for this function:

◆ NewIterator()

CDBIterator* CDBWrapper::NewIterator ( )
inline

Definition at line 338 of file dbwrapper.h.

Here is the caller graph for this function:

◆ Read() [1/2]

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

Definition at line 269 of file dbwrapper.h.

Here is the call graph for this function:

◆ Read() [2/2]

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

Definition at line 260 of file dbwrapper.h.

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

◆ ReadDataStream() [1/2]

bool CDBWrapper::ReadDataStream ( const CDataStream ssKey,
CDataStream ssValue 
) const
inline

Definition at line 242 of file dbwrapper.h.

Here is the call graph for this function:

◆ ReadDataStream() [2/2]

template<typename K >
bool CDBWrapper::ReadDataStream ( const K &  key,
CDataStream ssValue 
) const
inline

Definition at line 234 of file dbwrapper.h.

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

◆ Sync()

bool CDBWrapper::Sync ( )
inline

Definition at line 331 of file dbwrapper.h.

Here is the call graph for this function:

◆ Write()

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

Definition at line 284 of file dbwrapper.h.

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

◆ WriteBatch()

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

Definition at line 94 of file dbwrapper.cpp.

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

Member Data Documentation

◆ iteroptions

leveldb::ReadOptions CDBWrapper::iteroptions
private

options used when iterating over values of the database

Definition at line 208 of file dbwrapper.h.

◆ nVersion

int CDBWrapper::nVersion
private

the version used to serialize data

Definition at line 220 of file dbwrapper.h.

◆ options

leveldb::Options CDBWrapper::options
private

database options used

Definition at line 202 of file dbwrapper.h.

◆ pdb

leveldb::DB* CDBWrapper::pdb
private

the database itself

Definition at line 217 of file dbwrapper.h.

◆ penv

leveldb::Env* CDBWrapper::penv
private

custom environment this database is using (may be nullptr in case of default environment)

Definition at line 199 of file dbwrapper.h.

◆ readoptions

leveldb::ReadOptions CDBWrapper::readoptions
private

options used when reading from the database

Definition at line 205 of file dbwrapper.h.

◆ syncoptions

leveldb::WriteOptions CDBWrapper::syncoptions
private

options used when sync writing to the database

Definition at line 214 of file dbwrapper.h.

◆ writeoptions

leveldb::WriteOptions CDBWrapper::writeoptions
private

options used when writing to the database

Definition at line 211 of file dbwrapper.h.


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