Changeset View
Changeset View
Standalone View
Standalone View
src/dbwrapper.h
Show First 20 Lines • Show All 190 Lines • ▼ Show 20 Lines | private: | ||||
leveldb::WriteOptions writeoptions; | leveldb::WriteOptions writeoptions; | ||||
//! options used when sync writing to the database | //! options used when sync writing to the database | ||||
leveldb::WriteOptions syncoptions; | leveldb::WriteOptions syncoptions; | ||||
//! the database itself | //! the database itself | ||||
leveldb::DB *pdb; | leveldb::DB *pdb; | ||||
//! the name of this database | |||||
std::string m_name; | |||||
//! a key used for optional XOR-obfuscation of the database | //! a key used for optional XOR-obfuscation of the database | ||||
std::vector<uint8_t> obfuscate_key; | std::vector<uint8_t> obfuscate_key; | ||||
//! the key under which the obfuscation key is stored | //! the key under which the obfuscation key is stored | ||||
static const std::string OBFUSCATE_KEY_KEY; | static const std::string OBFUSCATE_KEY_KEY; | ||||
//! the length of the obfuscate key in number of bytes | //! the length of the obfuscate key in number of bytes | ||||
static const unsigned int OBFUSCATE_KEY_NUM_BYTES; | static const unsigned int OBFUSCATE_KEY_NUM_BYTES; | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | public: | ||||
template <typename K> bool Erase(const K &key, bool fSync = false) { | template <typename K> bool Erase(const K &key, bool fSync = false) { | ||||
CDBBatch batch(*this); | CDBBatch batch(*this); | ||||
batch.Erase(key); | batch.Erase(key); | ||||
return WriteBatch(batch, fSync); | return WriteBatch(batch, fSync); | ||||
} | } | ||||
bool WriteBatch(CDBBatch &batch, bool fSync = false); | bool WriteBatch(CDBBatch &batch, bool fSync = false); | ||||
// Get an estimate of LevelDB memory usage (in bytes). | |||||
size_t DynamicMemoryUsage() const; | |||||
// not available for LevelDB; provide for compatibility with BDB | // not available for LevelDB; provide for compatibility with BDB | ||||
bool Flush() { return true; } | bool Flush() { return true; } | ||||
bool Sync() { | bool Sync() { | ||||
CDBBatch batch(*this); | CDBBatch batch(*this); | ||||
return WriteBatch(batch, true); | return WriteBatch(batch, true); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |