From 27eaff9d4444b0ee07a2bb368d05d3054fd0c370 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Tue, 26 Sep 2023 12:08:46 +0300 Subject: [PATCH] api/storage_service: Get gossiper from storage service Some handlers in set_storage_service() have implicit dependency on gossiper. It's not API that should track it, but storage service itself, so get the gossiper from service, not from the external argument (it will be removed soon) Signed-off-by: Pavel Emelyanov --- api/storage_service.cc | 18 +++++++++--------- service/storage_service.hh | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/api/storage_service.cc b/api/storage_service.cc index 0defa3a100..7d0f53ec7e 100644 --- a/api/storage_service.cc +++ b/api/storage_service.cc @@ -647,9 +647,9 @@ void set_storage_service(http_context& ctx, routes& r, sharded req) { + ss::get_current_generation_number.set(r, [&ss](std::unique_ptr req) { gms::inet_address ep(utils::fb_utilities::get_broadcast_address()); - return g.get_current_generation_number(ep).then([](gms::generation_type res) { + return ss.local().gossiper().get_current_generation_number(ep).then([](gms::generation_type res) { return make_ready_future(res.value()); }); }); @@ -894,11 +894,11 @@ void set_storage_service(http_context& ctx, routes& r, sharded(json_void()); }); - ss::is_initialized.set(r, [&ss, &g](std::unique_ptr req) { - return ss.local().get_operation_mode().then([&g] (auto mode) { + ss::is_initialized.set(r, [&ss](std::unique_ptr req) { + return ss.local().get_operation_mode().then([&ss] (auto mode) { bool is_initialized = mode >= service::storage_service::mode::STARTING; if (mode == service::storage_service::mode::NORMAL) { - is_initialized = g.is_enabled(); + is_initialized = ss.local().gossiper().is_enabled(); } return make_ready_future(is_initialized); }); @@ -1119,12 +1119,12 @@ void set_storage_service(http_context& ctx, routes& r, sharded(json_void()); }); - ss::get_cluster_name.set(r, [&g](const_req req) { - return g.get_cluster_name(); + ss::get_cluster_name.set(r, [&ss](const_req req) { + return ss.local().gossiper().get_cluster_name(); }); - ss::get_partitioner_name.set(r, [&g](const_req req) { - return g.get_partitioner_name(); + ss::get_partitioner_name.set(r, [&ss](const_req req) { + return ss.local().gossiper().get_partitioner_name(); }); ss::get_tombstone_warn_threshold.set(r, [](std::unique_ptr req) { diff --git a/service/storage_service.hh b/service/storage_service.hh index ec17b41b6c..b6bedd7051 100644 --- a/service/storage_service.hh +++ b/service/storage_service.hh @@ -228,6 +228,9 @@ private: return _batchlog_manager; } + friend struct ::node_ops_ctl; +public: + const gms::gossiper& gossiper() const noexcept { return _gossiper; }; @@ -236,9 +239,6 @@ private: return _gossiper; }; - friend struct ::node_ops_ctl; -public: - locator::effective_replication_map_factory& get_erm_factory() noexcept { return _erm_factory; }