mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
Instead of lengthy blurbs, switch to single-line, machine-readable standardized (https://spdx.dev) license identifiers. The Linux kernel switched long ago, so there is strong precedent. Three cases are handled: AGPL-only, Apache-only, and dual licensed. For the latter case, I chose (AGPL-3.0-or-later and Apache-2.0), reasoning that our changes are extensive enough to apply our license. The changes we applied mechanically with a script, except to licenses/README.md. Closes #9937
42 lines
1.8 KiB
C++
42 lines
1.8 KiB
C++
/*
|
|
*
|
|
* Modified by ScyllaDB
|
|
* Copyright (C) 2015-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: (AGPL-3.0-or-later and Apache-2.0)
|
|
*/
|
|
|
|
|
|
#include "locator/everywhere_replication_strategy.hh"
|
|
#include "utils/class_registrator.hh"
|
|
#include "utils/fb_utilities.hh"
|
|
#include "locator/token_metadata.hh"
|
|
|
|
namespace locator {
|
|
|
|
everywhere_replication_strategy::everywhere_replication_strategy(snitch_ptr& snitch, const replication_strategy_config_options& config_options) :
|
|
abstract_replication_strategy(snitch, config_options, replication_strategy_type::everywhere_topology) {}
|
|
|
|
future<inet_address_vector_replica_set> everywhere_replication_strategy::calculate_natural_endpoints(const token& search_token, const token_metadata& tm) const {
|
|
return make_ready_future<inet_address_vector_replica_set>(boost::copy_range<inet_address_vector_replica_set>(tm.get_all_endpoints()));
|
|
}
|
|
|
|
size_t everywhere_replication_strategy::get_replication_factor(const token_metadata& tm) const {
|
|
return tm.sorted_tokens().empty() ? 1 : tm.count_normal_token_owners();
|
|
}
|
|
|
|
inet_address_vector_replica_set everywhere_replication_strategy::get_natural_endpoints(const token&, const effective_replication_map& erm) const {
|
|
const auto& tm = *erm.get_token_metadata_ptr();
|
|
if (tm.sorted_tokens().empty()) {
|
|
return inet_address_vector_replica_set({utils::fb_utilities::get_broadcast_address()});
|
|
}
|
|
return boost::copy_range<inet_address_vector_replica_set>(tm.get_all_endpoints());
|
|
}
|
|
|
|
using registry = class_registrator<abstract_replication_strategy, everywhere_replication_strategy, snitch_ptr&, const replication_strategy_config_options&>;
|
|
static registry registrator("org.apache.cassandra.locator.EverywhereStrategy");
|
|
static registry registrator_short_name("EverywhereStrategy");
|
|
}
|