/* * Copyright 2015 Cloudius Systems */ #include "commitlog.hh" #include #include "api/api-doc/commitlog.json.hh" #include namespace api { void set_commitlog(http_context& ctx, routes& r) { httpd::commitlog_json::get_active_segment_names.set(r, [&ctx](std::unique_ptr req) { auto res = make_shared>(); return ctx.db.map_reduce([res](std::vector names) { res->insert(res->end(), names.begin(), names.end()); }, [](database& db) { if (db.commitlog() == nullptr) { return make_ready_future>(std::vector()); } return make_ready_future>(db.commitlog()->get_active_segment_names()); }).then([res] { return make_ready_future(*res.get()); }); }); // We currently do not support archive segments httpd::commitlog_json::get_archiving_segment_names.set(r, [](const_req req) { std::vector res; return res; }); httpd::commitlog_json::get_completed_tasks.set(r, [](std::unique_ptr req) { //TBD return make_ready_future(0); }); httpd::commitlog_json::get_pending_tasks.set(r, [](std::unique_ptr req) { //TBD return make_ready_future(0); }); httpd::commitlog_json::get_total_commit_log_size.set(r, [](std::unique_ptr req) { //TBD return make_ready_future(0); }); } }