diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-09-05 09:58:11 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-09-05 09:58:11 +0000 |
commit | f77f7d2d465ee7783972a8d3804a67172944ed76 (patch) | |
tree | 90d2324b2a68a57fdb07e4eda76fb44c2eeb0bbb | |
parent | b9f91bfb3317a37f6c0746a59c7081026a923d6e (diff) |
- Rename method for readability
- Use explicit index based vector iteration as we are exposing index.
4 files changed, 7 insertions, 7 deletions
diff --git a/storage/src/vespa/storage/bucketdb/bucketinfo.h b/storage/src/vespa/storage/bucketdb/bucketinfo.h index 665beefe598..fe8fcd340c2 100644 --- a/storage/src/vespa/storage/bucketdb/bucketinfo.h +++ b/storage/src/vespa/storage/bucketdb/bucketinfo.h @@ -86,7 +86,7 @@ public: * Returns the bucket copy struct for the given node, null if nonexisting */ const BucketCopy* getNode(uint16_t node) const noexcept; - uint16_t getRef(uint16_t node) const noexcept; + uint16_t internal_entry_index(uint16_t node) const noexcept; /** * Returns the number of nodes this entry has. diff --git a/storage/src/vespa/storage/bucketdb/bucketinfo.hpp b/storage/src/vespa/storage/bucketdb/bucketinfo.hpp index a390a747d67..087c8b378b0 100644 --- a/storage/src/vespa/storage/bucketdb/bucketinfo.hpp +++ b/storage/src/vespa/storage/bucketdb/bucketinfo.hpp @@ -149,10 +149,10 @@ BucketInfoBase<NodeSeq>::getNode(uint16_t node) const noexcept { template <typename NodeSeq> uint16_t -BucketInfoBase<NodeSeq>::getRef(uint16_t node) const noexcept { - for (const auto& n : _nodes) { - if (n.getNode() == node) { - return &n - &_nodes[0]; +BucketInfoBase<NodeSeq>::internal_entry_index(uint16_t node) const noexcept { + for (uint16_t i = 0; i < _nodes.size(); i++) { + if (_nodes[i].getNode() == node) { + return i; } } return 0xffff; // Not found signal diff --git a/storage/src/vespa/storage/distributor/activecopy.cpp b/storage/src/vespa/storage/distributor/activecopy.cpp index 05a6ca59612..42f97c95b95 100644 --- a/storage/src/vespa/storage/distributor/activecopy.cpp +++ b/storage/src/vespa/storage/distributor/activecopy.cpp @@ -98,7 +98,7 @@ buildNodeList(const BucketDatabase::Entry& e,vespalib::ConstArrayRef<uint16_t> n SmallActiveCopyList result; result.reserve(nodeIndexes.size()); for (uint16_t nodeIndex : nodeIndexes) { - uint16_t entryIndex = e->getRef(nodeIndex); + uint16_t entryIndex = e->internal_entry_index(nodeIndex); result.emplace_back(nodeIndex, e->getNodeRef(entryIndex), idealState.lookup(nodeIndex), entryIndex); } return result; diff --git a/storage/src/vespa/storage/distributor/activecopy.h b/storage/src/vespa/storage/distributor/activecopy.h index 0322309ae8d..2085b9632eb 100644 --- a/storage/src/vespa/storage/distributor/activecopy.h +++ b/storage/src/vespa/storage/distributor/activecopy.h @@ -23,7 +23,7 @@ public: _ready(false), _active(false) { } - ActiveCopy(uint16_t node, const BucketCopy & copy, uint16_t ideal, uint32_t entryIndex_in) noexcept + ActiveCopy(uint16_t node, const BucketCopy & copy, uint16_t ideal, uint16_t entryIndex_in) noexcept : _nodeIndex(node), _ideal(ideal), _doc_count(copy.getDocumentCount()), |