From 6659ceca4f0a2132cdc14ba39ba704b4eff81ff6 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Tue, 10 Dec 2024 12:43:49 +0300 Subject: [PATCH] api: Disqualify const config reference Some endpoints in config block will need to actually _update_ values on config (see next patches why), and const reference stands on the way. Signed-off-by: Pavel Emelyanov --- api/api.cc | 2 +- api/api_init.hh | 2 +- api/config.cc | 2 +- api/config.hh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/api.cc b/api/api.cc index 8069acc4aa..fdf3c1ea1f 100644 --- a/api/api.cc +++ b/api/api.cc @@ -80,7 +80,7 @@ future<> set_server_init(http_context& ctx) { }); } -future<> set_server_config(http_context& ctx, const db::config& cfg) { +future<> set_server_config(http_context& ctx, db::config& cfg) { auto rb02 = std::make_shared < api_registry_builder20 > (ctx.api_doc, "/v2"); return ctx.http_server.set_routes([&ctx, &cfg, rb02](routes& r) { set_config(rb02, ctx, r, cfg, false); diff --git a/api/api_init.hh b/api/api_init.hh index dee938e388..140d171055 100644 --- a/api/api_init.hh +++ b/api/api_init.hh @@ -88,7 +88,7 @@ struct http_context { }; future<> set_server_init(http_context& ctx); -future<> set_server_config(http_context& ctx, const db::config& cfg); +future<> set_server_config(http_context& ctx, db::config& cfg); future<> unset_server_config(http_context& ctx); future<> set_server_snitch(http_context& ctx, sharded& snitch); future<> unset_server_snitch(http_context& ctx); diff --git a/api/config.cc b/api/config.cc index f4260a3d64..2b6b3d3a27 100644 --- a/api/config.cc +++ b/api/config.cc @@ -83,7 +83,7 @@ future<> get_config_swagger_entry(std::string_view name, const std::string& desc namespace cs = httpd::config_json; -void set_config(std::shared_ptr < api_registry_builder20 > rb, http_context& ctx, routes& r, const db::config& cfg, bool first) { +void set_config(std::shared_ptr < api_registry_builder20 > rb, http_context& ctx, routes& r, db::config& cfg, bool first) { rb->register_function(r, [&cfg, first] (output_stream& os) { return do_with(first, [&os, &cfg] (bool& first) { auto f = make_ready_future(); diff --git a/api/config.hh b/api/config.hh index 06bd1e92d0..5bf42b368b 100644 --- a/api/config.hh +++ b/api/config.hh @@ -13,6 +13,6 @@ namespace api { -void set_config(std::shared_ptr rb, http_context& ctx, httpd::routes& r, const db::config& cfg, bool first = false); +void set_config(std::shared_ptr rb, http_context& ctx, httpd::routes& r, db::config& cfg, bool first = false); void unset_config(http_context& ctx, httpd::routes& r); }