diff options
5 files changed, 15 insertions, 93 deletions
diff --git a/storage/src/vespa/storage/bucketdb/btree_lockable_map.h b/storage/src/vespa/storage/bucketdb/btree_lockable_map.h index b1bb7aa95d6..ba7f8dcb2a5 100644 --- a/storage/src/vespa/storage/bucketdb/btree_lockable_map.h +++ b/storage/src/vespa/storage/bucketdb/btree_lockable_map.h @@ -39,11 +39,6 @@ public: BTreeLockableMap(); ~BTreeLockableMap() override; - bool operator==(const BTreeLockableMap& other) const; - bool operator!=(const BTreeLockableMap& other) const { - return ! (*this == other); - } - bool operator<(const BTreeLockableMap& other) const; size_t size() const noexcept override; size_t getMemoryUsage() const noexcept override; vespalib::MemoryUsage detailed_memory_usage() const noexcept override; diff --git a/storage/src/vespa/storage/bucketdb/btree_lockable_map.hpp b/storage/src/vespa/storage/bucketdb/btree_lockable_map.hpp index 6a37b771c48..b92b3481845 100644 --- a/storage/src/vespa/storage/bucketdb/btree_lockable_map.hpp +++ b/storage/src/vespa/storage/bucketdb/btree_lockable_map.hpp @@ -92,52 +92,6 @@ size_t BTreeLockableMap<T>::LockWaiters::insert(const LockId & lid) { } template <typename T> -bool BTreeLockableMap<T>::operator==(const BTreeLockableMap& other) const { - std::lock_guard guard(_lock); - std::lock_guard guard2(other._lock); - if (_impl->size() != other._impl->size()) { - return false; - } - auto lhs = _impl->begin(); - auto rhs = other._impl->begin(); - for (; lhs.valid(); ++lhs, ++rhs) { - assert(rhs.valid()); - if (lhs.getKey() != rhs.getKey()) { - return false; - } - if (_impl->const_value_ref_from_valid_iterator(lhs) - != other._impl->const_value_ref_from_valid_iterator(rhs)) - { - return false; - } - } - return true; -} - -template <typename T> -bool BTreeLockableMap<T>::operator<(const BTreeLockableMap& other) const { - std::lock_guard guard(_lock); - std::lock_guard guard2(other._lock); - auto lhs = _impl->begin(); - auto rhs = other._impl->begin(); - for (; lhs.valid() && rhs.valid(); ++lhs, ++rhs) { - if (lhs.getKey() != rhs.getKey()) { - return (lhs.getKey() < rhs.getKey()); - } - if (_impl->const_value_ref_from_valid_iterator(lhs) - != other._impl->const_value_ref_from_valid_iterator(rhs)) - { - return (_impl->const_value_ref_from_valid_iterator(lhs) - < other._impl->const_value_ref_from_valid_iterator(rhs)); - } - } - if (lhs.valid() == rhs.valid()) { - return false; // All keys are equal in maps of equal size. - } - return rhs.valid(); // Rhs still valid, lhs is not; ergo lhs is "less". -} - -template <typename T> size_t BTreeLockableMap<T>::size() const noexcept { std::lock_guard guard(_lock); return _impl->size(); diff --git a/storage/src/vespa/storage/bucketdb/storagebucketinfo.h b/storage/src/vespa/storage/bucketdb/storagebucketinfo.h index fe9d197f0e9..220e1cc037e 100644 --- a/storage/src/vespa/storage/bucketdb/storagebucketinfo.h +++ b/storage/src/vespa/storage/bucketdb/storagebucketinfo.h @@ -10,23 +10,12 @@ struct StorageBucketInfo { api::BucketInfo info; StorageBucketInfo() noexcept : info() {} - static bool mayContain(const StorageBucketInfo&) { return true; } void print(std::ostream&, bool verbose, const std::string& indent) const; - bool valid() const { return info.valid(); } - void setBucketInfo(const api::BucketInfo& i) { info = i; } - const api::BucketInfo& getBucketInfo() const { return info; } - void setEmptyWithMetaData() { - info.setChecksum(1); - info.setMetaCount(1); - info.setDocumentCount(0); - info.setTotalDocumentSize(0); - } - bool verifyLegal() const { return true; } - uint32_t getMetaCount() const { return info.getMetaCount(); } - void setChecksum(uint32_t crc) { info.setChecksum(crc); } - bool operator == (const StorageBucketInfo & b) const; - bool operator != (const StorageBucketInfo & b) const; - bool operator < (const StorageBucketInfo & b) const; + bool valid() const noexcept { return info.valid(); } + void setBucketInfo(const api::BucketInfo& i) noexcept { info = i; } + const api::BucketInfo& getBucketInfo() const noexcept { return info; } + bool verifyLegal() const noexcept { return true; } + uint32_t getMetaCount() const noexcept { return info.getMetaCount(); } }; std::ostream& operator<<(std::ostream& out, const StorageBucketInfo& info); diff --git a/storage/src/vespa/storage/bucketdb/storbucketdb.cpp b/storage/src/vespa/storage/bucketdb/storbucketdb.cpp index d80c6734c36..e2b7b7e1e69 100644 --- a/storage/src/vespa/storage/bucketdb/storbucketdb.cpp +++ b/storage/src/vespa/storage/bucketdb/storbucketdb.cpp @@ -20,18 +20,6 @@ print(std::ostream& out, bool, const std::string&) const out << info; } -bool StorageBucketInfo::operator==(const StorageBucketInfo& ) const { - return true; -} - -bool StorageBucketInfo::operator!=(const StorageBucketInfo& b) const { - return !(*this == b); -} - -bool StorageBucketInfo::operator<(const StorageBucketInfo& ) const { - return false; -} - std::ostream& operator<<(std::ostream& out, const StorageBucketInfo& info) { info.print(out, false, ""); diff --git a/storage/src/vespa/storage/bucketdb/storbucketdb.h b/storage/src/vespa/storage/bucketdb/storbucketdb.h index fb54ac074d3..77051dc86d7 100644 --- a/storage/src/vespa/storage/bucketdb/storbucketdb.h +++ b/storage/src/vespa/storage/bucketdb/storbucketdb.h @@ -16,10 +16,11 @@ class StorBucketDatabase { std::unique_ptr<bucketdb::AbstractBucketMap<bucketdb::StorageBucketInfo>> _impl; public: using Entry = bucketdb::StorageBucketInfo; - using key_type = bucketdb::AbstractBucketMap<Entry>::key_type; - using Decision = bucketdb::AbstractBucketMap<Entry>::Decision; - using WrappedEntry = bucketdb::AbstractBucketMap<Entry>::WrappedEntry; - using EntryMap = bucketdb::AbstractBucketMap<Entry>::EntryMap; + using BucketMap = bucketdb::AbstractBucketMap<Entry>; + using key_type = BucketMap::key_type; + using Decision = BucketMap::Decision; + using WrappedEntry = BucketMap::WrappedEntry; + using EntryMap = BucketMap::EntryMap; using BucketId = document::BucketId; enum Flag { @@ -29,8 +30,7 @@ public: explicit StorBucketDatabase(const ContentBucketDbOptions&); - void insert(const document::BucketId&, const bucketdb::StorageBucketInfo&, - const char* clientId); + void insert(const document::BucketId&, const Entry&, const char* clientId); bool erase(const document::BucketId&, const char* clientId); @@ -57,16 +57,12 @@ public: * thread between each such such to allow other threads to get a chance * at acquiring a bucket lock. */ - void for_each_chunked(std::function<Decision(uint64_t, const bucketdb::StorageBucketInfo&)> func, - const char* clientId, - vespalib::duration yieldTime = 10us, - uint32_t chunkSize = bucketdb::AbstractBucketMap<bucketdb::StorageBucketInfo>::DEFAULT_CHUNK_SIZE); + void for_each_chunked(std::function<Decision(uint64_t, const Entry &)> func, const char* clientId, + vespalib::duration yieldTime = 10us, uint32_t chunkSize = BucketMap::DEFAULT_CHUNK_SIZE); - void for_each_mutable_unordered(std::function<Decision(uint64_t, bucketdb::StorageBucketInfo&)> func, - const char* clientId); + void for_each_mutable_unordered(std::function<Decision(uint64_t, Entry &)> func, const char* clientId); - void for_each(std::function<Decision(uint64_t, const bucketdb::StorageBucketInfo&)> func, - const char* clientId); + void for_each(std::function<Decision(uint64_t, const Entry &)> func, const char* clientId); [[nodiscard]] std::unique_ptr<bucketdb::ReadGuard<Entry>> acquire_read_guard() const; |