db/hints: Remove find_ep_manager

The methods are redundant and are effectively
code boilerplate.
This commit is contained in:
Dawid Medrek
2023-09-29 18:58:48 +02:00
parent 1c70a18fc7
commit cfbacb29bb
2 changed files with 5 additions and 13 deletions

View File

@@ -308,7 +308,7 @@ future<> manager::wait_for_sync_point(abort_source& as, const sync_point::shard_
}
hint_endpoint_manager& manager::get_ep_manager(endpoint_id ep) {
auto it = find_ep_manager(ep);
auto it = _ep_managers.find(ep);
if (it == ep_managers_end()) {
manager_logger.trace("Creating an ep_manager for {}", ep);
hint_endpoint_manager& ep_man = _ep_managers.emplace(ep, hint_endpoint_manager(ep, *this)).first->second;
@@ -319,7 +319,7 @@ hint_endpoint_manager& manager::get_ep_manager(endpoint_id ep) {
}
bool manager::have_ep_manager(endpoint_id ep) const noexcept {
return find_ep_manager(ep) != ep_managers_end();
return _ep_managers.contains(ep);
}
bool manager::store_hint(endpoint_id ep, schema_ptr s, lw_shared_ptr<const frozen_mutation> fm, tracing::trace_state_ptr tr_state) noexcept {
@@ -354,7 +354,7 @@ bool manager::can_hint_for(endpoint_id ep) const noexcept {
return false;
}
auto it = find_ep_manager(ep);
auto it = _ep_managers.find(ep);
if (it != ep_managers_end() && (it->second.stopping() || !it->second.can_hint())) {
return false;
}
@@ -462,7 +462,7 @@ void manager::drain_for(endpoint_id endpoint) {
_ep_managers.clear();
});
} else {
ep_managers_map_type::iterator ep_manager_it = find_ep_manager(endpoint);
ep_managers_map_type::iterator ep_manager_it = _ep_managers.find(endpoint);
if (ep_manager_it != ep_managers_end()) {
return ep_manager_it->second.stop(drain::yes).finally([this, endpoint, &ep_man = ep_manager_it->second] {
return ep_man.with_file_update_mutex([&ep_man] {

View File

@@ -205,7 +205,7 @@ public:
/// \param ep End point identificator
/// \return Number of hints in-flight to \param ep.
uint64_t hints_in_progress_for(endpoint_id ep) const noexcept {
auto it = find_ep_manager(ep);
auto it = _ep_managers.find(ep);
if (it == ep_managers_end()) {
return 0;
}
@@ -323,14 +323,6 @@ private:
}
public:
ep_managers_map_type::iterator find_ep_manager(endpoint_id ep_key) noexcept {
return _ep_managers.find(ep_key);
}
ep_managers_map_type::const_iterator find_ep_manager(endpoint_id ep_key) const noexcept {
return _ep_managers.find(ep_key);
}
ep_managers_map_type::iterator ep_managers_end() noexcept {
return _ep_managers.end();
}