dht: incremental_owned_ranges_checker: belongs_to_current_node: mark as const

Its _it member keeps state about the current range.
Although it's modified by the method, this is an implementation
detail that irrelevant to the caller, hence mark the
belongs_to_current_node method as const (and noexcept while
at it).

This allows the caller, cleanup_compaction, to use it from
inside a const method, without having to mark
its respective member as mutable too.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>

Closes #12634
This commit is contained in:
Benny Halevy
2023-01-25 09:51:06 +02:00
committed by Botond Dénes
parent ce96b472d3
commit 82011fc489
2 changed files with 2 additions and 2 deletions

View File

@@ -1176,7 +1176,7 @@ private:
class cleanup_compaction final : public regular_compaction {
owned_ranges_ptr _owned_ranges;
mutable dht::incremental_owned_ranges_checker _owned_ranges_checker;
dht::incremental_owned_ranges_checker _owned_ranges_checker;
private:
// Called in a seastar thread
dht::partition_range_vector

View File

@@ -24,7 +24,7 @@ public:
}
// Must be called with increasing token values.
bool belongs_to_current_node(const dht::token& t) {
bool belongs_to_current_node(const dht::token& t) const noexcept {
// While token T is after a range Rn, advance the iterator.
// iterator will be stopped at a range which either overlaps with T (if T belongs to node),
// or at a range which is after T (if T doesn't belong to this node).