api: Add sharded<database>& arg to set_cache_service()

The reference is already available in set_server_column_family(), pass
it further so that "cache" handlers are able to use it (next patch).

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
Pavel Emelyanov
2025-08-26 11:20:13 +03:00
parent 4e556214ba
commit 596d4640ff
3 changed files with 10 additions and 3 deletions

View File

@@ -230,7 +230,9 @@ future<> set_server_column_family(http_context& ctx, sharded<replica::database>&
set_column_family(ctx, r, db, sys_ks);
});
co_await register_api(ctx, "cache_service",
"The cache service API", set_cache_service);
"The cache service API", [&db] (http_context& ctx, routes& r) {
set_cache_service(ctx, db, r);
});
}
future<> unset_server_column_family(http_context& ctx) {

View File

@@ -16,7 +16,7 @@ using namespace json;
using namespace seastar::httpd;
namespace cs = httpd::cache_service_json;
void set_cache_service(http_context& ctx, routes& r) {
void set_cache_service(http_context& ctx, sharded<replica::database>& db, routes& r) {
cs::get_row_cache_save_period_in_seconds.set(r, [](std::unique_ptr<http::request> req) {
// We never save the cache
// Origin uses 0 for never

View File

@@ -7,15 +7,20 @@
*/
#pragma once
#include <seastar/core/sharded.hh>
namespace seastar::httpd {
class routes;
}
namespace replica {
class database;
}
namespace api {
struct http_context;
void set_cache_service(http_context& ctx, seastar::httpd::routes& r);
void set_cache_service(http_context& ctx, seastar::sharded<replica::database>& db, seastar::httpd::routes& r);
void unset_cache_service(http_context& ctx, seastar::httpd::routes& r);
}