mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
api: Streamify view_build_statuses handler
Similarly to previous patch, the handler can stream the map of build statuses. Unlike previous patch, it doesn't need to fmt::format() key and value, as these are strings already. It could be a map_to_json<string, string> partial specialization, but there's so far only one caller, so probably not worth it yet. Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
@@ -530,9 +530,12 @@ void set_view_builder(http_context& ctx, routes& r, sharded<db::view::view_build
|
||||
ss::view_build_statuses.set(r, [&ctx, &vb, &g] (std::unique_ptr<http::request> req) -> future<json::json_return_type> {
|
||||
auto keyspace = validate_keyspace(ctx, req);
|
||||
auto view = req->get_path_param("view");
|
||||
auto status = co_await vb.local().view_build_statuses(std::move(keyspace), std::move(view), g.local());
|
||||
std::vector<storage_service_json::mapper> res;
|
||||
co_return json::json_return_type(map_to_key_value(std::move(status), res));
|
||||
co_return json::json_return_type(stream_range_as_array(co_await vb.local().view_build_statuses(std::move(keyspace), std::move(view), g.local()), [] (const auto& i) {
|
||||
storage_service_json::mapper res;
|
||||
res.key = i.first;
|
||||
res.value = i.second;
|
||||
return res;
|
||||
}));
|
||||
});
|
||||
|
||||
cf::get_built_indexes.set(r, [&vb](std::unique_ptr<http::request> req) -> future<json::json_return_type> {
|
||||
|
||||
Reference in New Issue
Block a user