Files
scylla/locator/everywhere_replication_strategy.hh
Benny Halevy 1e2741d2fe abstract_replication_strategy: recognized_options: return unordered_set
An unordered_set is more efficient and there is no need
to return an ordered set for this purpose.

This change facilitates a follow-up change of adding
topology::get_datacenters(), returning an unordered_set
of datacenter names.

Refs #11987

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

Closes #12003
2022-11-17 11:27:05 +02:00

45 lines
1.4 KiB
C++

/*
*
* Modified by ScyllaDB
* Copyright (C) 2015-present ScyllaDB
*/
/*
* SPDX-License-Identifier: (AGPL-3.0-or-later and Apache-2.0)
*/
#pragma once
#include "locator/abstract_replication_strategy.hh"
#include <optional>
namespace locator {
class everywhere_replication_strategy : public abstract_replication_strategy {
public:
everywhere_replication_strategy(const replication_strategy_config_options& config_options);
virtual bool natural_endpoints_depend_on_token() const noexcept override { return false; }
virtual future<endpoint_set> calculate_natural_endpoints(const token& search_token, const token_metadata& tm) const override;
virtual void validate_options() const override { /* noop */ }
std::optional<std::unordered_set<sstring>> recognized_options(const topology&) const override {
// We explicitely allow all options
return std::nullopt;
}
virtual size_t get_replication_factor(const token_metadata& tm) const override;
virtual bool allow_remove_node_being_replaced_from_natural_endpoints() const override {
return true;
}
/**
* We need to override this because the default implementation depends
* on token calculations but everywhere_replication_strategy may be used before tokens are set up.
*/
virtual inet_address_vector_replica_set get_natural_endpoints(const token&, const effective_replication_map&) const override;
};
}