Skip to content

Commit 5c2b3cd

Browse files
TheCharlatanMarcoFalke
authored andcommitted
dbwrapper: Use DataStream for batch operations
1 parent fd69ffb commit 5c2b3cd

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/dbwrapper.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#include <dbwrapper.h>
66

7-
#include <clientversion.h>
87
#include <logging.h>
98
#include <random.h>
109
#include <serialize.h>
@@ -156,9 +155,9 @@ struct CDBBatch::WriteBatchImpl {
156155
leveldb::WriteBatch batch;
157156
};
158157

159-
CDBBatch::CDBBatch(const CDBWrapper& _parent) : parent(_parent),
160-
m_impl_batch{std::make_unique<CDBBatch::WriteBatchImpl>()},
161-
ssValue(SER_DISK, CLIENT_VERSION){};
158+
CDBBatch::CDBBatch(const CDBWrapper& _parent)
159+
: parent{_parent},
160+
m_impl_batch{std::make_unique<CDBBatch::WriteBatchImpl>()} {};
162161

163162
CDBBatch::~CDBBatch() = default;
164163

@@ -168,7 +167,7 @@ void CDBBatch::Clear()
168167
size_estimate = 0;
169168
}
170169

171-
void CDBBatch::WriteImpl(Span<const std::byte> key, CDataStream& ssValue)
170+
void CDBBatch::WriteImpl(Span<const std::byte> key, DataStream& ssValue)
172171
{
173172
leveldb::Slice slKey(CharCast(key.data()), key.size());
174173
ssValue.Xor(dbwrapper_private::GetObfuscateKey(parent));

src/dbwrapper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ class CDBBatch
8080
const std::unique_ptr<WriteBatchImpl> m_impl_batch;
8181

8282
DataStream ssKey{};
83-
CDataStream ssValue;
83+
DataStream ssValue{};
8484

8585
size_t size_estimate{0};
8686

87-
void WriteImpl(Span<const std::byte> key, CDataStream& ssValue);
87+
void WriteImpl(Span<const std::byte> key, DataStream& ssValue);
8888
void EraseImpl(Span<const std::byte> key);
8989

9090
public:

0 commit comments

Comments
 (0)