diff --git a/api/api.cc b/api/api.cc index f323da431c..af159bf28f 100644 --- a/api/api.cc +++ b/api/api.cc @@ -104,9 +104,12 @@ future<> unset_rpc_controller(http_context& ctx) { return ctx.http_server.set_routes([&ctx] (routes& r) { unset_rpc_controller(ctx, r); }); } -future<> set_server_storage_service(http_context& ctx, sharded& ss, service::raft_group0_client& group0_client) { - return register_api(ctx, "storage_service", "The storage service API", [&ss, &group0_client] (http_context& ctx, routes& r) { - set_storage_service(ctx, r, ss, group0_client); +future<> set_server_storage_service(http_context& ctx, + const utils::directories& dirs, + sharded& ss, + service::raft_group0_client& group0_client) { + return register_api(ctx, "storage_service", "The storage service API", [&dirs, &ss, &group0_client] (http_context& ctx, routes& r) { + set_storage_service(ctx, r, ss, group0_client, dirs); }); } diff --git a/api/api_init.hh b/api/api_init.hh index 65ec067e53..8589f40d90 100644 --- a/api/api_init.hh +++ b/api/api_init.hh @@ -69,6 +69,8 @@ namespace tasks { class task_manager; } +namespace utils { class directories; } + namespace api { struct http_context { @@ -89,7 +91,10 @@ future<> set_server_init(http_context& ctx); future<> set_server_config(http_context& ctx, const db::config& cfg); future<> set_server_snitch(http_context& ctx, sharded& snitch); future<> unset_server_snitch(http_context& ctx); -future<> set_server_storage_service(http_context& ctx, sharded& ss, service::raft_group0_client&); +future<> set_server_storage_service(http_context& ctx, + const utils::directories& dirs, + sharded& ss, + service::raft_group0_client&); future<> unset_server_storage_service(http_context& ctx); future<> set_server_sstables_loader(http_context& ctx, sharded& sst_loader); future<> unset_server_sstables_loader(http_context& ctx); diff --git a/api/storage_service.cc b/api/storage_service.cc index 628a65586d..eda797b8ee 100644 --- a/api/storage_service.cc +++ b/api/storage_service.cc @@ -14,6 +14,7 @@ #include "api/scrub_status.hh" #include "db/config.hh" #include "db/schema_tables.hh" +#include "utils/directories.hh" #include "utils/hash.hh" #include #include @@ -547,7 +548,11 @@ static future describe_ring_as_json(sharded& ss, service::raft_group0_client& group0_client) { +void set_storage_service(http_context& ctx, + routes& r, + sharded& ss, + service::raft_group0_client& group0_client, + const utils::directories& dirs) { ss::get_commitlog.set(r, [&ctx](const_req req) { return ctx.db.local().commitlog()->active_config().commit_log_location; }); @@ -622,12 +627,12 @@ void set_storage_service(http_context& ctx, routes& r, sharded req) -> future { diff --git a/api/storage_service.hh b/api/storage_service.hh index fee8724d93..a5ae08aeaf 100644 --- a/api/storage_service.hh +++ b/api/storage_service.hh @@ -14,6 +14,8 @@ #include "db/data_listeners.hh" namespace cql_transport { class controller; } +namespace utils { class directories; } + class thrift_controller; namespace db { class snapshot_ctl; @@ -66,7 +68,11 @@ struct scrub_info { future parse_scrub_options(http_context& ctx, sharded& snap_ctl, std::unique_ptr req); -void set_storage_service(http_context& ctx, httpd::routes& r, sharded& ss, service::raft_group0_client&); +void set_storage_service(http_context& ctx, + httpd::routes& r, + sharded& ss, + service::raft_group0_client&, + const utils::directories& dirs); void unset_storage_service(http_context& ctx, httpd::routes& r); void set_sstables_loader(http_context& ctx, httpd::routes& r, sharded& sst_loader); void unset_sstables_loader(http_context& ctx, httpd::routes& r); diff --git a/main.cc b/main.cc index 43b3369d61..dc53fc19b7 100644 --- a/main.cc +++ b/main.cc @@ -1426,7 +1426,7 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl ss.stop().get(); }); - api::set_server_storage_service(ctx, ss, group0_client).get(); + api::set_server_storage_service(ctx, *dirs, ss, group0_client).get(); auto stop_ss_api = defer_verbose_shutdown("storage service API", [&ctx] { api::unset_server_storage_service(ctx).get(); });