diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-06-08 16:50:18 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-06-08 16:50:18 +0000 |
commit | 4d37089e5d1256fa5ef3561ab51c42212b335288 (patch) | |
tree | e23d3ff3fff1fd66e0cb06516d4be0d27233518c /storage/src | |
parent | e3bda63e89a8b75edba41ec589de5b7ce1c934ba (diff) |
Inline and add noexcept
Diffstat (limited to 'storage/src')
-rw-r--r-- | storage/src/vespa/storage/bucketdb/storagebucketinfo.h | 28 | ||||
-rw-r--r-- | storage/src/vespa/storage/bucketdb/storbucketdb.cpp | 12 | ||||
-rw-r--r-- | storage/src/vespa/storage/bucketdb/storbucketdb.h | 26 |
3 files changed, 24 insertions, 42 deletions
diff --git a/storage/src/vespa/storage/bucketdb/storagebucketinfo.h b/storage/src/vespa/storage/bucketdb/storagebucketinfo.h index fe9d197f0e9..f0abde636b4 100644 --- a/storage/src/vespa/storage/bucketdb/storagebucketinfo.h +++ b/storage/src/vespa/storage/bucketdb/storagebucketinfo.h @@ -10,23 +10,21 @@ 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 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(); } + bool operator == (const StorageBucketInfo &) const noexcept { + return true; + } + bool operator != (const StorageBucketInfo & rhs) const noexcept { + return !(*this == rhs); + } + bool operator < (const StorageBucketInfo &) const noexcept { + return false; } - 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; }; 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..ce7a199c4dc 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; @@ -74,7 +70,7 @@ public: * Returns true iff bucket has no superbuckets or sub-buckets in the * database. Usage assumption is that any operation that can cause the * bucket to become inconsistent will require taking its lock, so by - * requiring the lock to be provided here we avoid race conditions. + * requiring the lock to be provided here we avoid race conditions.q */ bool isConsistent(const WrappedEntry& entry); |