mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-23 16:22:15 +00:00
calculate_natural_endpoints: fix indentation
This commit is contained in:
@@ -21,12 +21,12 @@ everywhere_replication_strategy::everywhere_replication_strategy(const replicati
|
||||
}
|
||||
|
||||
future<host_id_set> everywhere_replication_strategy::calculate_natural_endpoints(const token& search_token, const token_metadata2& tm) const {
|
||||
if (tm.sorted_tokens().empty()) {
|
||||
host_id_set result{host_id_vector_replica_set({host_id{}})};
|
||||
return make_ready_future<host_id_set>(std::move(result));
|
||||
}
|
||||
const auto& all_endpoints = tm.get_all_endpoints();
|
||||
return make_ready_future<host_id_set>(host_id_set(all_endpoints.begin(), all_endpoints.end()));
|
||||
if (tm.sorted_tokens().empty()) {
|
||||
host_id_set result{host_id_vector_replica_set({host_id{}})};
|
||||
return make_ready_future<host_id_set>(std::move(result));
|
||||
}
|
||||
const auto& all_endpoints = tm.get_all_endpoints();
|
||||
return make_ready_future<host_id_set>(host_id_set(all_endpoints.begin(), all_endpoints.end()));
|
||||
}
|
||||
|
||||
size_t everywhere_replication_strategy::get_replication_factor(const token_metadata& tm) const {
|
||||
|
||||
@@ -19,7 +19,7 @@ local_strategy::local_strategy(const replication_strategy_config_options& config
|
||||
}
|
||||
|
||||
future<host_id_set> local_strategy::calculate_natural_endpoints(const token& t, const token_metadata2& tm) const {
|
||||
return make_ready_future<host_id_set>(host_id_set{host_id{}});
|
||||
return make_ready_future<host_id_set>(host_id_set{host_id{}});
|
||||
}
|
||||
|
||||
void local_strategy::validate_options(const gms::feature_service&) const {
|
||||
|
||||
@@ -241,18 +241,18 @@ future<host_id_set>
|
||||
network_topology_strategy::calculate_natural_endpoints(
|
||||
const token& search_token, const token_metadata2& tm) const {
|
||||
|
||||
natural_endpoints_tracker tracker(tm, _dc_rep_factor);
|
||||
natural_endpoints_tracker tracker(tm, _dc_rep_factor);
|
||||
|
||||
for (auto& next : tm.ring_range(search_token)) {
|
||||
co_await coroutine::maybe_yield();
|
||||
for (auto& next : tm.ring_range(search_token)) {
|
||||
co_await coroutine::maybe_yield();
|
||||
|
||||
host_id ep = *tm.get_endpoint(next);
|
||||
if (tracker.add_endpoint_and_check_if_done(ep)) {
|
||||
break;
|
||||
}
|
||||
host_id ep = *tm.get_endpoint(next);
|
||||
if (tracker.add_endpoint_and_check_if_done(ep)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
co_return std::move(tracker.replicas());
|
||||
co_return std::move(tracker.replicas());
|
||||
}
|
||||
|
||||
void network_topology_strategy::validate_options(const gms::feature_service& fs) const {
|
||||
|
||||
@@ -34,33 +34,33 @@ simple_strategy::simple_strategy(const replication_strategy_config_options& conf
|
||||
}
|
||||
|
||||
future<host_id_set> simple_strategy::calculate_natural_endpoints(const token& t, const token_metadata2& tm) const {
|
||||
const std::vector<token>& tokens = tm.sorted_tokens();
|
||||
const std::vector<token>& tokens = tm.sorted_tokens();
|
||||
|
||||
if (tokens.empty()) {
|
||||
co_return host_id_set{};
|
||||
if (tokens.empty()) {
|
||||
co_return host_id_set{};
|
||||
}
|
||||
|
||||
size_t replicas = _replication_factor;
|
||||
host_id_set endpoints;
|
||||
endpoints.reserve(replicas);
|
||||
|
||||
for (auto& token : tm.ring_range(t)) {
|
||||
// If the number of nodes in the cluster is smaller than the desired
|
||||
// replication factor we should return the loop when endpoints already
|
||||
// contains all the nodes in the cluster because no more nodes could be
|
||||
// added to endpoints lists.
|
||||
if (endpoints.size() == replicas || endpoints.size() == tm.count_normal_token_owners()) {
|
||||
break;
|
||||
}
|
||||
|
||||
size_t replicas = _replication_factor;
|
||||
host_id_set endpoints;
|
||||
endpoints.reserve(replicas);
|
||||
auto ep = tm.get_endpoint(token);
|
||||
assert(ep);
|
||||
|
||||
for (auto& token : tm.ring_range(t)) {
|
||||
// If the number of nodes in the cluster is smaller than the desired
|
||||
// replication factor we should return the loop when endpoints already
|
||||
// contains all the nodes in the cluster because no more nodes could be
|
||||
// added to endpoints lists.
|
||||
if (endpoints.size() == replicas || endpoints.size() == tm.count_normal_token_owners()) {
|
||||
break;
|
||||
}
|
||||
endpoints.push_back(*ep);
|
||||
co_await coroutine::maybe_yield();
|
||||
}
|
||||
|
||||
auto ep = tm.get_endpoint(token);
|
||||
assert(ep);
|
||||
|
||||
endpoints.push_back(*ep);
|
||||
co_await coroutine::maybe_yield();
|
||||
}
|
||||
|
||||
co_return endpoints;
|
||||
co_return endpoints;
|
||||
}
|
||||
|
||||
size_t simple_strategy::get_replication_factor(const token_metadata&) const {
|
||||
|
||||
Reference in New Issue
Block a user