aboutsummaryrefslogtreecommitdiff
path: root/src/dbwrapper.h
diff options
context:
space:
mode:
authorTheCharlatan <seb.kung@gmail.com>2023-07-14 11:30:52 +0200
committerTheCharlatan <seb.kung@gmail.com>2023-08-05 10:42:51 +0200
commitef941ff1281e76308c3e746e592375bec023e9e4 (patch)
treec47d288c3c2aa819139af440f21d7cc374804fee /src/dbwrapper.h
parentb7a1ab5cb4e60230f62c94efb3a10d07c9af4883 (diff)
refactor: Split dbwrapper CDBIterator::GetValue implementation
Keep the generic serialization in the header, while moving leveldb-specifics to the implementation file. The context of this commit is an effort to decouple the dbwrapper header file from leveldb includes. To this end, the includes are moved to the dbwrapper implementation file. This is done as part of the kernel project to reduce the number of required includes for users of the kernel.
Diffstat (limited to 'src/dbwrapper.h')
-rw-r--r--src/dbwrapper.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/dbwrapper.h b/src/dbwrapper.h
index 9aadeef76d..2e6cc4d81e 100644
--- a/src/dbwrapper.h
+++ b/src/dbwrapper.h
@@ -16,7 +16,6 @@
#include <cstdint>
#include <exception>
#include <leveldb/db.h>
-#include <leveldb/iterator.h>
#include <leveldb/options.h>
#include <leveldb/slice.h>
#include <leveldb/status.h>
@@ -27,6 +26,7 @@
#include <vector>
namespace leveldb {
class Env;
+class Iterator;
}
static const size_t DBWRAPPER_PREALLOC_KEY_SIZE = 64;
@@ -142,6 +142,7 @@ private:
void SeekImpl(Span<const std::byte> ssKey);
Span<const std::byte> GetKeyImpl() const;
+ Span<const std::byte> GetValueImpl() const;
public:
@@ -177,9 +178,8 @@ public:
}
template<typename V> bool GetValue(V& value) {
- leveldb::Slice slValue = piter->value();
try {
- CDataStream ssValue{MakeByteSpan(slValue), SER_DISK, CLIENT_VERSION};
+ CDataStream ssValue{GetValueImpl(), SER_DISK, CLIENT_VERSION};
ssValue.Xor(dbwrapper_private::GetObfuscateKey(parent));
ssValue >> value;
} catch (const std::exception&) {