Changeset View
Changeset View
Standalone View
Standalone View
src/dbwrapper.h
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | |||||
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) | 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() { | |||||
batch.Clear(); | |||||
size_estimate = 0; | |||||
} | |||||
template <typename K, typename V> void Write(const K &key, const V &value) { | template <typename K, typename V> void Write(const K &key, const V &value) { | ||||
ssKey.reserve(DBWRAPPER_PREALLOC_KEY_SIZE); | ssKey.reserve(DBWRAPPER_PREALLOC_KEY_SIZE); | ||||
ssKey << key; | ssKey << key; | ||||
leveldb::Slice slKey(ssKey.data(), ssKey.size()); | leveldb::Slice slKey(ssKey.data(), ssKey.size()); | ||||
ssValue.reserve(DBWRAPPER_PREALLOC_VALUE_SIZE); | ssValue.reserve(DBWRAPPER_PREALLOC_VALUE_SIZE); | ||||
ssValue << value; | ssValue << value; | ||||
ssValue.Xor(dbwrapper_private::GetObfuscateKey(parent)); | ssValue.Xor(dbwrapper_private::GetObfuscateKey(parent)); | ||||
▲ Show 20 Lines • Show All 237 Lines • Show Last 20 Lines |