Changeset View
Changeset View
Standalone View
Standalone View
src/dbwrapper.h
Show All 15 Lines | |||||
#include <leveldb/db.h> | #include <leveldb/db.h> | ||||
#include <leveldb/write_batch.h> | #include <leveldb/write_batch.h> | ||||
static const size_t DBWRAPPER_PREALLOC_KEY_SIZE = 64; | static const size_t DBWRAPPER_PREALLOC_KEY_SIZE = 64; | ||||
static const size_t DBWRAPPER_PREALLOC_VALUE_SIZE = 1024; | static const size_t DBWRAPPER_PREALLOC_VALUE_SIZE = 1024; | ||||
class dbwrapper_error : public std::runtime_error { | class dbwrapper_error : public std::runtime_error { | ||||
public: | public: | ||||
dbwrapper_error(const std::string &msg) : std::runtime_error(msg) {} | explicit dbwrapper_error(const std::string &msg) | ||||
: std::runtime_error(msg) {} | |||||
}; | }; | ||||
class CDBWrapper; | class CDBWrapper; | ||||
/** | /** | ||||
* These should be considered an implementation detail of the specific database. | * These should be considered an implementation detail of the specific database. | ||||
*/ | */ | ||||
namespace dbwrapper_private { | namespace dbwrapper_private { | ||||
Show All 23 Lines | private: | ||||
CDataStream ssValue; | CDataStream ssValue; | ||||
size_t size_estimate; | size_t size_estimate; | ||||
public: | public: | ||||
/** | /** | ||||
* @param[in] _parent CDBWrapper that this batch is to be submitted to | * @param[in] _parent CDBWrapper that this batch is to be submitted to | ||||
*/ | */ | ||||
CDBBatch(const CDBWrapper &_parent) | explicit CDBBatch(const CDBWrapper &_parent) | ||||
: parent(_parent), ssKey(SER_DISK, CLIENT_VERSION), | : parent(_parent), ssKey(SER_DISK, CLIENT_VERSION), | ||||
ssValue(SER_DISK, CLIENT_VERSION), size_estimate(0){}; | ssValue(SER_DISK, CLIENT_VERSION), size_estimate(0){}; | ||||
void Clear() { | void Clear() { | ||||
batch.Clear(); | batch.Clear(); | ||||
size_estimate = 0; | size_estimate = 0; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 258 Lines • Show Last 20 Lines |