diff options
author | TheCharlatan <seb.kung@gmail.com> | 2023-08-03 16:07:59 +0200 |
---|---|---|
committer | TheCharlatan <seb.kung@gmail.com> | 2023-08-05 10:45:19 +0200 |
commit | d8f1222ac50f089a0af29eaf8ce0555bad8366ef (patch) | |
tree | a1658f75bd4d7ffc6655e15ce99767a592fd04d4 /src/dbwrapper.cpp | |
parent | be8f159ac59b9e700cbd3314ed71ebf39bd5b67a (diff) |
refactor: Correct dbwrapper key naming
The ss- prefix should connotate a DataStream variable. Now that these
variables are byte spans, drop the prefix.
Diffstat (limited to 'src/dbwrapper.cpp')
-rw-r--r-- | src/dbwrapper.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp index b8ee852bb5..847d40eefa 100644 --- a/src/dbwrapper.cpp +++ b/src/dbwrapper.cpp @@ -168,9 +168,9 @@ void CDBBatch::Clear() size_estimate = 0; } -void CDBBatch::WriteImpl(Span<const std::byte> ssKey, CDataStream& ssValue) +void CDBBatch::WriteImpl(Span<const std::byte> key, CDataStream& ssValue) { - leveldb::Slice slKey(CharCast(ssKey.data()), ssKey.size()); + leveldb::Slice slKey(CharCast(key.data()), key.size()); ssValue.Xor(dbwrapper_private::GetObfuscateKey(parent)); leveldb::Slice slValue(CharCast(ssValue.data()), ssValue.size()); m_impl_batch->batch.Put(slKey, slValue); @@ -184,9 +184,9 @@ void CDBBatch::WriteImpl(Span<const std::byte> ssKey, CDataStream& ssValue) size_estimate += 3 + (slKey.size() > 127) + slKey.size() + (slValue.size() > 127) + slValue.size(); } -void CDBBatch::EraseImpl(Span<const std::byte> ssKey) +void CDBBatch::EraseImpl(Span<const std::byte> key) { - leveldb::Slice slKey(CharCast(ssKey.data()), ssKey.size()); + leveldb::Slice slKey(CharCast(key.data()), key.size()); m_impl_batch->batch.Delete(slKey); // LevelDB serializes erases as: // - byte: header @@ -336,9 +336,9 @@ std::vector<unsigned char> CDBWrapper::CreateObfuscateKey() const return ret; } -std::optional<std::string> CDBWrapper::ReadImpl(Span<const std::byte> ssKey) const +std::optional<std::string> CDBWrapper::ReadImpl(Span<const std::byte> key) const { - leveldb::Slice slKey(CharCast(ssKey.data()), ssKey.size()); + leveldb::Slice slKey(CharCast(key.data()), key.size()); std::string strValue; leveldb::Status status = DBContext().pdb->Get(DBContext().readoptions, slKey, &strValue); if (!status.ok()) { @@ -350,9 +350,9 @@ std::optional<std::string> CDBWrapper::ReadImpl(Span<const std::byte> ssKey) con return strValue; } -bool CDBWrapper::ExistsImpl(Span<const std::byte> ssKey) const +bool CDBWrapper::ExistsImpl(Span<const std::byte> key) const { - leveldb::Slice slKey(CharCast(ssKey.data()), ssKey.size()); + leveldb::Slice slKey(CharCast(key.data()), key.size()); std::string strValue; leveldb::Status status = DBContext().pdb->Get(DBContext().readoptions, slKey, &strValue); @@ -365,10 +365,10 @@ bool CDBWrapper::ExistsImpl(Span<const std::byte> ssKey) const return true; } -size_t CDBWrapper::EstimateSizeImpl(Span<const std::byte> ssKey1, Span<const std::byte> ssKey2) const +size_t CDBWrapper::EstimateSizeImpl(Span<const std::byte> key1, Span<const std::byte> key2) const { - leveldb::Slice slKey1(CharCast(ssKey1.data()), ssKey1.size()); - leveldb::Slice slKey2(CharCast(ssKey2.data()), ssKey2.size()); + leveldb::Slice slKey1(CharCast(key1.data()), key1.size()); + leveldb::Slice slKey2(CharCast(key2.data()), key2.size()); uint64_t size = 0; leveldb::Range range(slKey1, slKey2); DBContext().pdb->GetApproximateSizes(&range, 1, &size); @@ -396,9 +396,9 @@ CDBIterator* CDBWrapper::NewIterator() return new CDBIterator{*this, std::make_unique<CDBIterator::IteratorImpl>(DBContext().pdb->NewIterator(DBContext().iteroptions))}; } -void CDBIterator::SeekImpl(Span<const std::byte> ssKey) +void CDBIterator::SeekImpl(Span<const std::byte> key) { - leveldb::Slice slKey(CharCast(ssKey.data()), ssKey.size()); + leveldb::Slice slKey(CharCast(key.data()), key.size()); m_impl_iter->iter->Seek(slKey); } |