token_metadata: add count_normal_token_owners method

This commit is contained in:
Kamil Braun
2020-01-24 18:17:31 +01:00
parent 52d71832f8
commit 96e5d6c924
2 changed files with 12 additions and 0 deletions

View File

@@ -556,6 +556,14 @@ future<> token_metadata::calculate_pending_ranges(abstract_replication_strategy&
}
size_t token_metadata::count_normal_token_owners() const {
std::set<inet_address> eps;
for (auto [t, ep]: _token_to_endpoint_map) {
eps.insert(ep);
}
return eps.size();
}
sstring token_metadata::print_pending_ranges() {
std::stringstream ss;

View File

@@ -679,6 +679,10 @@ public:
return _endpoint_to_host_id_map.size();
}
/* Returns the number of different endpoints that own tokens in the ring.
* Bootstrapping tokens are not taken into account. */
size_t count_normal_token_owners() const;
#if 0
public Set<InetAddress> getAllEndpoints()
{