diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-08-09 11:19:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-09 11:19:55 +0200 |
commit | 439d5f9e989822b4674038e085f9df788e78b1b3 (patch) | |
tree | f7c6c161589a3c9f1e18930d55674b80032d69c8 /vdslib | |
parent | d5974cfb1f089e79da8f53452d259ff0213d7d23 (diff) | |
parent | 74f4db465f03c772827ad679d47566d031c562c7 (diff) |
Merge pull request #27990 from vespa-engine/balder/minor-noexcept
Add noexcept and minor style changes
Diffstat (limited to 'vdslib')
-rw-r--r-- | vdslib/src/vespa/vdslib/distribution/distribution.cpp | 3 | ||||
-rw-r--r-- | vdslib/src/vespa/vdslib/distribution/group.cpp | 4 | ||||
-rw-r--r-- | vdslib/src/vespa/vdslib/distribution/group.h | 25 |
3 files changed, 14 insertions, 18 deletions
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); |