mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-29 11:10:40 +00:00
everywhere_replication_strategy: move methods out of line
Move methods depending on token_metadata to source file so we can avoid including token_metadata.hh in header files where spossible. Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
@@ -40,12 +40,17 @@
|
||||
#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(const sstring& keyspace_name, const token_metadata& token_metadata, snitch_ptr& snitch, const std::map<sstring, sstring>& config_options) :
|
||||
abstract_replication_strategy(keyspace_name, token_metadata, snitch, config_options, replication_strategy_type::everywhere_topology) {}
|
||||
|
||||
std::vector<inet_address> everywhere_replication_strategy::calculate_natural_endpoints(const token& search_token, const token_metadata& tm) const {
|
||||
return tm.get_all_endpoints();
|
||||
}
|
||||
|
||||
std::vector<inet_address> everywhere_replication_strategy::get_natural_endpoints(const token& search_token) {
|
||||
if (_token_metadata.sorted_tokens().empty()) {
|
||||
return std::vector<inet_address>({utils::fb_utilities::get_broadcast_address()});
|
||||
@@ -53,6 +58,10 @@ std::vector<inet_address> everywhere_replication_strategy::get_natural_endpoints
|
||||
return calculate_natural_endpoints(search_token, _token_metadata);
|
||||
}
|
||||
|
||||
size_t everywhere_replication_strategy::get_replication_factor() const {
|
||||
return _token_metadata.get_all_endpoints_count();
|
||||
}
|
||||
|
||||
using registry = class_registrator<abstract_replication_strategy, everywhere_replication_strategy, const sstring&, const token_metadata&, snitch_ptr&, const std::map<sstring, sstring>&>;
|
||||
static registry registrator("org.apache.cassandra.locator.EverywhereStrategy");
|
||||
static registry registrator_short_name("EverywhereStrategy");
|
||||
|
||||
@@ -46,9 +46,7 @@ class everywhere_replication_strategy : public abstract_replication_strategy {
|
||||
public:
|
||||
everywhere_replication_strategy(const sstring& keyspace_name, const token_metadata& token_metadata, snitch_ptr& snitch, const std::map<sstring,sstring>& config_options);
|
||||
|
||||
virtual std::vector<inet_address> calculate_natural_endpoints(const token& search_token, const token_metadata& tm) const override {
|
||||
return tm.get_all_endpoints();
|
||||
}
|
||||
virtual std::vector<inet_address> calculate_natural_endpoints(const token& search_token, const token_metadata& tm) const override;
|
||||
std::vector<inet_address> get_natural_endpoints(const token& search_token) override;
|
||||
|
||||
virtual void validate_options() const override { /* noop */ }
|
||||
@@ -58,9 +56,7 @@ public:
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
virtual size_t get_replication_factor() const override {
|
||||
return _token_metadata.get_all_endpoints_count();
|
||||
}
|
||||
virtual size_t get_replication_factor() const override;
|
||||
|
||||
virtual bool allow_remove_node_being_replaced_from_natural_endpoints() const override {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user