summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-08-08 22:01:47 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-08-08 22:01:47 +0000
commit74f4db465f03c772827ad679d47566d031c562c7 (patch)
tree5d3dadff1f133786b4e837da4275a19cbd7eb74f
parentb0e64927bc95abe3587262084dd57fbb3ef038e4 (diff)
Add noexcept and minor style changes
-rw-r--r--storage/src/vespa/storage/bucketdb/bucketinfo.h2
-rw-r--r--storage/src/vespa/storage/distributor/activecopy.cpp6
-rw-r--r--vdslib/src/vespa/vdslib/distribution/distribution.cpp3
-rw-r--r--vdslib/src/vespa/vdslib/distribution/group.cpp4
-rw-r--r--vdslib/src/vespa/vdslib/distribution/group.h25
5 files changed, 18 insertions, 22 deletions
diff --git a/storage/src/vespa/storage/bucketdb/bucketinfo.h b/storage/src/vespa/storage/bucketdb/bucketinfo.h
index 1870d4c91d4..57ebf505a50 100644
--- a/storage/src/vespa/storage/bucketdb/bucketinfo.h
+++ b/storage/src/vespa/storage/bucketdb/bucketinfo.h
@@ -102,7 +102,7 @@ public:
array. This operation has undefined behaviour if the index given
is not within the node count.
*/
- const BucketCopy& getNodeRef(uint16_t idx) const {
+ const BucketCopy& getNodeRef(uint16_t idx) const noexcept {
return _nodes[idx];
}
diff --git a/storage/src/vespa/storage/distributor/activecopy.cpp b/storage/src/vespa/storage/distributor/activecopy.cpp
index a4ee4a51135..c46e9868cc8 100644
--- a/storage/src/vespa/storage/distributor/activecopy.cpp
+++ b/storage/src/vespa/storage/distributor/activecopy.cpp
@@ -24,9 +24,9 @@ namespace std {
namespace storage::distributor {
-ActiveCopy::ActiveCopy(uint16_t node, const BucketDatabase::Entry& e, const std::vector<uint16_t>& idealState) :
- _nodeIndex(node),
- _ideal(0xffff)
+ActiveCopy::ActiveCopy(uint16_t node, const BucketDatabase::Entry& e, const std::vector<uint16_t>& idealState)
+ : _nodeIndex(node),
+ _ideal(0xffff)
{
const BucketCopy* copy = e->getNode(node);
assert(copy != nullptr);
diff --git a/vdslib/src/vespa/vdslib/distribution/distribution.cpp b/vdslib/src/vespa/vdslib/distribution/distribution.cpp
index e9113d7dd23..637a5089822 100644
--- a/vdslib/src/vespa/vdslib/distribution/distribution.cpp
+++ b/vdslib/src/vespa/vdslib/distribution/distribution.cpp
@@ -494,8 +494,7 @@ Distribution::splitNodesIntoLeafGroups(IndexList nodeList) const
for (auto node : nodeList) {
const Group* group((node < _node2Group.size()) ? _node2Group[node] : nullptr);
if (group == nullptr) {
- LOGBP(warning, "Node %u is not assigned to a group. "
- "Should not happen?", node);
+ LOGBP(warning, "Node %u is not assigned to a group. Should not happen?", node);
} else {
assert(group->isLeafGroup());
nodes[group->getIndex()].push_back(node);
diff --git a/vdslib/src/vespa/vdslib/distribution/group.cpp b/vdslib/src/vespa/vdslib/distribution/group.cpp
index 537b4635e75..254a20e1052 100644
--- a/vdslib/src/vespa/vdslib/distribution/group.cpp
+++ b/vdslib/src/vespa/vdslib/distribution/group.cpp
@@ -11,7 +11,7 @@
namespace storage::lib {
-Group::Group(uint16_t index, vespalib::stringref name)
+Group::Group(uint16_t index, vespalib::stringref name) noexcept
: _name(name),
_index(index),
_distributionHash(0),
@@ -46,7 +46,7 @@ Group::~Group()
}
bool
-Group::operator==(const Group& other) const
+Group::operator==(const Group& other) const noexcept
{
return (_name == other._name &&
_index == other._index &&
diff --git a/vdslib/src/vespa/vdslib/distribution/group.h b/vdslib/src/vespa/vdslib/distribution/group.h
index 5767f55d20a..3f468bee995 100644
--- a/vdslib/src/vespa/vdslib/distribution/group.h
+++ b/vdslib/src/vespa/vdslib/distribution/group.h
@@ -49,28 +49,25 @@ private:
public:
// Create leaf node
- Group(uint16_t index, vespalib::stringref name);
+ Group(uint16_t index, vespalib::stringref name) noexcept;
// Create branch node
Group(uint16_t index, vespalib::stringref name,
const Distribution&, uint16_t redundancy);
virtual ~Group();
- bool isLeafGroup() const { return _nodes.size() > 0; }
- bool operator==(const Group& other) const;
+ bool isLeafGroup() const noexcept { return ! _nodes.empty(); }
+ bool operator==(const Group& other) const noexcept;
void print(std::ostream& out, bool verbose, const std::string& indent) const override;
- vespalib::Double getCapacity() const { return _capacity; }
- const vespalib::string & getName() const { return _name; }
- uint16_t getIndex() const { return _index; }
+ vespalib::Double getCapacity() const noexcept { return _capacity; }
+ const vespalib::string & getName() const noexcept { return _name; }
+ uint16_t getIndex() const noexcept { return _index; }
std::map<uint16_t, Group*>& getSubGroups() { return _subGroups; }
- const std::map<uint16_t, Group*>& getSubGroups() const
- { return _subGroups; }
- const std::vector<uint16_t>& getNodes() const { return _nodes; };
- const Distribution& getDistributionSpec() const
- { return _distributionSpec; }
- const Distribution& getDistribution(uint16_t redundancy) const
- { return _preCalculated[redundancy]; }
- uint32_t getDistributionHash() const { return _distributionHash; }
+ const std::map<uint16_t, Group*>& getSubGroups() const noexcept { return _subGroups; }
+ const std::vector<uint16_t>& getNodes() const noexcept { return _nodes; };
+ const Distribution& getDistributionSpec() const noexcept { return _distributionSpec; }
+ const Distribution& getDistribution(uint16_t redundancy) const noexcept { return _preCalculated[redundancy]; }
+ uint32_t getDistributionHash() const noexcept { return _distributionHash; }
void addSubGroup(Group::UP);
void setCapacity(vespalib::Double capacity);