treewide: Use replication_strategy_ptr as a shorter name for abstract_replication_strategy::ptr_type
This commit is contained in:
@@ -303,7 +303,7 @@ abstract_replication_strategy::get_pending_address_ranges(const token_metadata_p
|
||||
co_return ret;
|
||||
}
|
||||
|
||||
future<mutable_vnode_effective_replication_map_ptr> calculate_effective_replication_map(abstract_replication_strategy::ptr_type rs, token_metadata_ptr tmptr) {
|
||||
future<mutable_vnode_effective_replication_map_ptr> calculate_effective_replication_map(replication_strategy_ptr rs, token_metadata_ptr tmptr) {
|
||||
replication_map replication_map;
|
||||
const auto& sorted_tokens = tmptr->sorted_tokens();
|
||||
|
||||
@@ -368,7 +368,7 @@ vnode_effective_replication_map::~vnode_effective_replication_map() {
|
||||
}
|
||||
}
|
||||
|
||||
effective_replication_map::effective_replication_map(abstract_replication_strategy::ptr_type rs,
|
||||
effective_replication_map::effective_replication_map(replication_strategy_ptr rs,
|
||||
token_metadata_ptr tmptr,
|
||||
size_t replication_factor) noexcept
|
||||
: _rs(std::move(rs))
|
||||
@@ -376,11 +376,11 @@ effective_replication_map::effective_replication_map(abstract_replication_strate
|
||||
, _replication_factor(replication_factor)
|
||||
{ }
|
||||
|
||||
vnode_effective_replication_map::factory_key vnode_effective_replication_map::make_factory_key(const abstract_replication_strategy::ptr_type& rs, const token_metadata_ptr& tmptr) {
|
||||
vnode_effective_replication_map::factory_key vnode_effective_replication_map::make_factory_key(const replication_strategy_ptr& rs, const token_metadata_ptr& tmptr) {
|
||||
return factory_key(rs->get_type(), rs->get_config_options(), tmptr->get_ring_version());
|
||||
}
|
||||
|
||||
future<vnode_effective_replication_map_ptr> effective_replication_map_factory::create_effective_replication_map(abstract_replication_strategy::ptr_type rs, token_metadata_ptr tmptr) {
|
||||
future<vnode_effective_replication_map_ptr> effective_replication_map_factory::create_effective_replication_map(replication_strategy_ptr rs, token_metadata_ptr tmptr) {
|
||||
// lookup key on local shard
|
||||
auto key = vnode_effective_replication_map::make_factory_key(rs, tmptr);
|
||||
auto erm = find_effective_replication_map(key);
|
||||
|
||||
@@ -128,6 +128,9 @@ public:
|
||||
future<dht::token_range_vector> get_pending_address_ranges(const token_metadata_ptr tmptr, std::unordered_set<token> pending_tokens, inet_address pending_address, locator::endpoint_dc_rack dr) const;
|
||||
};
|
||||
|
||||
using replication_strategy_ptr = seastar::shared_ptr<const abstract_replication_strategy>;
|
||||
using mutable_replication_strategy_ptr = seastar::shared_ptr<abstract_replication_strategy>;
|
||||
|
||||
/// \brief Represents effective replication (assignment of replicas to keys).
|
||||
///
|
||||
/// It's a result of application of a given replication strategy instance
|
||||
@@ -140,11 +143,11 @@ public:
|
||||
/// keeping the token metadata version alive and seen as in use.
|
||||
class effective_replication_map {
|
||||
protected:
|
||||
abstract_replication_strategy::ptr_type _rs;
|
||||
replication_strategy_ptr _rs;
|
||||
token_metadata_ptr _tmptr;
|
||||
size_t _replication_factor;
|
||||
public:
|
||||
effective_replication_map(abstract_replication_strategy::ptr_type, token_metadata_ptr, size_t replication_factor) noexcept;
|
||||
effective_replication_map(replication_strategy_ptr, token_metadata_ptr, size_t replication_factor) noexcept;
|
||||
virtual ~effective_replication_map() = default;
|
||||
|
||||
const abstract_replication_strategy& get_replication_strategy() const noexcept { return *_rs; }
|
||||
@@ -213,7 +216,7 @@ public: // effective_replication_map
|
||||
inet_address_vector_replica_set get_natural_endpoints_without_node_being_replaced(const token& search_token) const override;
|
||||
inet_address_vector_topology_change get_pending_endpoints(const token& search_token, const sstring& ks_name) const override;
|
||||
public:
|
||||
explicit vnode_effective_replication_map(abstract_replication_strategy::ptr_type rs, token_metadata_ptr tmptr, replication_map replication_map, size_t replication_factor) noexcept
|
||||
explicit vnode_effective_replication_map(replication_strategy_ptr rs, token_metadata_ptr tmptr, replication_map replication_map, size_t replication_factor) noexcept
|
||||
: effective_replication_map(std::move(rs), std::move(tmptr), replication_factor)
|
||||
, _replication_map(std::move(replication_map))
|
||||
{ }
|
||||
@@ -263,7 +266,7 @@ private:
|
||||
dht::token_range_vector do_get_ranges(noncopyable_function<stop_iteration(bool& add_range, const inet_address& natural_endpoint)> consider_range_for_endpoint) const;
|
||||
|
||||
public:
|
||||
static factory_key make_factory_key(const abstract_replication_strategy::ptr_type& rs, const token_metadata_ptr& tmptr);
|
||||
static factory_key make_factory_key(const replication_strategy_ptr& rs, const token_metadata_ptr& tmptr);
|
||||
|
||||
const factory_key& get_factory_key() const noexcept {
|
||||
return *_factory_key;
|
||||
@@ -288,13 +291,13 @@ using mutable_vnode_effective_replication_map_ptr = shared_ptr<vnode_effective_r
|
||||
using vnode_erm_ptr = vnode_effective_replication_map_ptr;
|
||||
using mutable_vnode_erm_ptr = mutable_vnode_effective_replication_map_ptr;
|
||||
|
||||
inline mutable_vnode_erm_ptr make_effective_replication_map(abstract_replication_strategy::ptr_type rs, token_metadata_ptr tmptr, replication_map replication_map, size_t replication_factor) {
|
||||
inline mutable_vnode_erm_ptr make_effective_replication_map(replication_strategy_ptr rs, token_metadata_ptr tmptr, replication_map replication_map, size_t replication_factor) {
|
||||
return seastar::make_shared<vnode_effective_replication_map>(
|
||||
std::move(rs), std::move(tmptr), std::move(replication_map), replication_factor);
|
||||
}
|
||||
|
||||
// Apply the replication strategy over the current configuration and the given token_metadata.
|
||||
future<mutable_vnode_erm_ptr> calculate_effective_replication_map(abstract_replication_strategy::ptr_type rs, token_metadata_ptr tmptr);
|
||||
future<mutable_vnode_erm_ptr> calculate_effective_replication_map(replication_strategy_ptr rs, token_metadata_ptr tmptr);
|
||||
|
||||
// Class to hold a coherent view of a keyspace
|
||||
// effective replication map on all shards
|
||||
@@ -395,7 +398,7 @@ public:
|
||||
// vnode_effective_replication_map for the local shard.
|
||||
//
|
||||
// Therefore create should be called first on shard 0, then on all other shards.
|
||||
future<vnode_erm_ptr> create_effective_replication_map(abstract_replication_strategy::ptr_type rs, token_metadata_ptr tmptr);
|
||||
future<vnode_erm_ptr> create_effective_replication_map(replication_strategy_ptr rs, token_metadata_ptr tmptr);
|
||||
|
||||
future<> stop() noexcept;
|
||||
|
||||
|
||||
@@ -1163,7 +1163,7 @@ public:
|
||||
size_t view_update_concurrency_semaphore_limit;
|
||||
};
|
||||
private:
|
||||
locator::abstract_replication_strategy::ptr_type _replication_strategy;
|
||||
locator::replication_strategy_ptr _replication_strategy;
|
||||
locator::vnode_effective_replication_map_ptr _effective_replication_map;
|
||||
lw_shared_ptr<keyspace_metadata> _metadata;
|
||||
config _config;
|
||||
@@ -1200,7 +1200,7 @@ public:
|
||||
* should eventually be refactored.
|
||||
*/
|
||||
const locator::abstract_replication_strategy& get_replication_strategy() const;
|
||||
locator::abstract_replication_strategy::ptr_type get_replication_strategy_ptr() const {
|
||||
locator::replication_strategy_ptr get_replication_strategy_ptr() const {
|
||||
return _replication_strategy;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,12 +71,12 @@ static void check_ranges_are_sorted(vnode_effective_replication_map_ptr erm, gms
|
||||
}
|
||||
|
||||
void strategy_sanity_check(
|
||||
abstract_replication_strategy::ptr_type ars_ptr,
|
||||
replication_strategy_ptr ars_ptr,
|
||||
const token_metadata& tm,
|
||||
const std::map<sstring, sstring>& options) {
|
||||
|
||||
network_topology_strategy* nts_ptr =
|
||||
dynamic_cast<network_topology_strategy*>(ars_ptr.get());
|
||||
const network_topology_strategy* nts_ptr =
|
||||
dynamic_cast<const network_topology_strategy*>(ars_ptr.get());
|
||||
|
||||
//
|
||||
// Check that both total and per-DC RFs in options match the corresponding
|
||||
@@ -94,7 +94,7 @@ void strategy_sanity_check(
|
||||
}
|
||||
|
||||
void endpoints_check(
|
||||
abstract_replication_strategy::ptr_type ars_ptr,
|
||||
replication_strategy_ptr ars_ptr,
|
||||
const token_metadata& tm,
|
||||
inet_address_vector_replica_set& endpoints,
|
||||
const locator::topology& topo) {
|
||||
@@ -119,8 +119,8 @@ void endpoints_check(
|
||||
}
|
||||
}
|
||||
|
||||
network_topology_strategy* nts_ptr =
|
||||
dynamic_cast<network_topology_strategy*>(ars_ptr.get());
|
||||
const network_topology_strategy* nts_ptr =
|
||||
dynamic_cast<const network_topology_strategy*>(ars_ptr.get());
|
||||
for (auto& rf : dc_rf) {
|
||||
BOOST_CHECK(rf.second == nts_ptr->get_replication_factor(rf.first));
|
||||
}
|
||||
@@ -145,7 +145,7 @@ auto d2t = [](double d) -> int64_t {
|
||||
*/
|
||||
void full_ring_check(const std::vector<ring_point>& ring_points,
|
||||
const std::map<sstring, sstring>& options,
|
||||
abstract_replication_strategy::ptr_type ars_ptr,
|
||||
replication_strategy_ptr ars_ptr,
|
||||
locator::token_metadata_ptr tmptr) {
|
||||
auto& tm = *tmptr;
|
||||
const auto& topo = tm.get_topology();
|
||||
|
||||
Reference in New Issue
Block a user