diff options
author | Tor Brede Vekterli <vekterli@yahooinc.com> | 2022-07-18 10:48:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-18 10:48:53 +0200 |
commit | 74944c0b3b5941acfff055b9b003e293842285c5 (patch) | |
tree | 1c2ab30e2091092987efd8a7bbd22ac769cdb41d | |
parent | dc541af9d40ebbec841e1f3209f3bf2b733e27df (diff) | |
parent | 9c28bea523226db4fef99ba6896b7dc1ea63959b (diff) |
Merge pull request #23520 from vespa-engine/balder/gc-typedef-not-needed
GC typedef not needed anymore.
3 files changed, 8 insertions, 10 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/bucketdb/bucketdb.cpp b/searchcore/src/vespa/searchcore/proton/bucketdb/bucketdb.cpp index 37d04f6bcb9..ecdc679e4bc 100644 --- a/searchcore/src/vespa/searchcore/proton/bucketdb/bucketdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/bucketdb/bucketdb.cpp @@ -164,13 +164,15 @@ BucketDB::isActiveBucket(const BucketId &bucketId) const return (itr != _map.end()) && itr->second.isActive(); } -void -BucketDB::getBuckets(BucketId::List &buckets) const +document::BucketId::List +BucketDB::getBuckets() const { + BucketId::List buckets; buckets.reserve(_map.size()); for (const auto & entry : _map) { buckets.push_back(entry.first); } + return buckets; } bool @@ -261,8 +263,8 @@ BucketDB::populateActiveBuckets(BucketId::List buckets) BucketState activeState; activeState.setActive(true); for (const BucketId & bucketId : toAdd) { - InsertResult ins(_map.emplace(bucketId, activeState)); - assert(ins.second); + auto [itr, inserted] = _map.emplace(bucketId, activeState); + assert(inserted); } return fixupBuckets; } diff --git a/searchcore/src/vespa/searchcore/proton/bucketdb/bucketdb.h b/searchcore/src/vespa/searchcore/proton/bucketdb/bucketdb.h index 6fe46d97f46..da475f2969a 100644 --- a/searchcore/src/vespa/searchcore/proton/bucketdb/bucketdb.h +++ b/searchcore/src/vespa/searchcore/proton/bucketdb/bucketdb.h @@ -20,9 +20,7 @@ public: typedef storage::spi::BucketChecksum BucketChecksum; typedef bucketdb::BucketState BucketState; typedef std::map<BucketId, BucketState> Map; - typedef Map::iterator MapIterator; typedef Map::const_iterator ConstMapIterator; - typedef std::pair<MapIterator, bool> InsertResult; private: Map _map; @@ -58,7 +56,7 @@ public: storage::spi::BucketInfo cachedGetBucketInfo(const BucketId &bucketId) const; BucketState cachedGet(const BucketId &bucketId) const; bool hasBucket(const BucketId &bucketId) const; - void getBuckets(BucketId::List & buckets) const; + BucketId::List getBuckets() const; bool empty() const; void setBucketState(const BucketId &bucketId, bool active); void createBucket(const BucketId &bucketId); @@ -69,7 +67,6 @@ public: ConstMapIterator begin() const { return _map.begin(); } ConstMapIterator end() const { return _map.end(); } ConstMapIterator lowerBound(const BucketId &bucket) const { return _map.lower_bound(bucket); } - ConstMapIterator upperBound(const BucketId &bucket) const { return _map.upper_bound(bucket); } size_t size() const { return _map.size(); } bool isActiveBucket(const BucketId &bucketId) const; BucketState *getBucketStatePtr(const BucketId &bucket); diff --git a/searchcore/src/vespa/searchcore/proton/server/buckethandler.cpp b/searchcore/src/vespa/searchcore/proton/server/buckethandler.cpp index d9201ce5b9e..080d182d1fa 100644 --- a/searchcore/src/vespa/searchcore/proton/server/buckethandler.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/buckethandler.cpp @@ -90,8 +90,7 @@ BucketHandler::handleListBuckets(IBucketIdListResultHandler &resultHandler) // Called by SPI thread. // BucketDBOwner ensures synchronization between SPI thread and // master write thread in document database. - BucketIdListResult::List buckets; - _ready->getBucketDB().takeGuard()->getBuckets(buckets); + BucketIdListResult::List buckets = _ready->getBucketDB().takeGuard()->getBuckets(); resultHandler.handle(BucketIdListResult(std::move(buckets))); } |