diff options
author | TheCharlatan <seb.kung@gmail.com> | 2023-09-09 13:30:50 +0200 |
---|---|---|
committer | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-09-12 12:07:39 +0200 |
commit | 5c2b3cd4b856f1bb536daaf7f576b1b1b42293ca (patch) | |
tree | 8146ce8427c3c29edef7ca7dc139a5b2297d20f4 /src | |
parent | fd69ffbbfb3e08b474b33540e56cf4f81e5c21d4 (diff) |
dbwrapper: Use DataStream for batch operations
Diffstat (limited to 'src')
-rw-r--r-- | src/dbwrapper.cpp | 9 | ||||
-rw-r--r-- | src/dbwrapper.h | 4 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp index c95937ba75..775496e21b 100644 --- a/src/dbwrapper.cpp +++ b/src/dbwrapper.cpp @@ -4,7 +4,6 @@ #include <dbwrapper.h> -#include <clientversion.h> #include <logging.h> #include <random.h> #include <serialize.h> @@ -156,9 +155,9 @@ struct CDBBatch::WriteBatchImpl { leveldb::WriteBatch batch; }; -CDBBatch::CDBBatch(const CDBWrapper& _parent) : parent(_parent), - m_impl_batch{std::make_unique<CDBBatch::WriteBatchImpl>()}, - ssValue(SER_DISK, CLIENT_VERSION){}; +CDBBatch::CDBBatch(const CDBWrapper& _parent) + : parent{_parent}, + m_impl_batch{std::make_unique<CDBBatch::WriteBatchImpl>()} {}; CDBBatch::~CDBBatch() = default; @@ -168,7 +167,7 @@ void CDBBatch::Clear() size_estimate = 0; } -void CDBBatch::WriteImpl(Span<const std::byte> key, CDataStream& ssValue) +void CDBBatch::WriteImpl(Span<const std::byte> key, DataStream& ssValue) { leveldb::Slice slKey(CharCast(key.data()), key.size()); ssValue.Xor(dbwrapper_private::GetObfuscateKey(parent)); diff --git a/src/dbwrapper.h b/src/dbwrapper.h index 2f7448e878..63c2f99d2a 100644 --- a/src/dbwrapper.h +++ b/src/dbwrapper.h @@ -80,11 +80,11 @@ private: const std::unique_ptr<WriteBatchImpl> m_impl_batch; DataStream ssKey{}; - CDataStream ssValue; + DataStream ssValue{}; size_t size_estimate{0}; - void WriteImpl(Span<const std::byte> key, CDataStream& ssValue); + void WriteImpl(Span<const std::byte> key, DataStream& ssValue); void EraseImpl(Span<const std::byte> key); public: |