Implement vitastor-kv rescue command

This commit is contained in:
Vitaliy Filippov
2025-11-29 16:34:34 +03:00
parent 59e6527303
commit eb0deaa3f5
3 changed files with 144 additions and 4 deletions
+12
View File
@@ -97,6 +97,7 @@ void kv_cli_t::parse_args(int narg, const char *args[])
" dump [<start> [end]]\n"
" dumpjson [<start> [end]]\n"
" loadjson\n"
" rescue\n"
"\n"
"<IMAGE> should be the name of Vitastor image with the DB.\n"
"Without <COMMAND>, you get an interactive DB shell.\n"
@@ -672,6 +673,17 @@ void kv_cli_t::handle_cmd(const std::vector<std::string> & cmd, std::function<vo
lst->handle_key(res, key, value);
});
}
else if (opname == "rescue")
{
kv_cli_list_t *lst = new kv_cli_list_t;
lst->db = db;
lst->format = 2;
lst->cb = std::move(cb);
db->rescue([lst](int res, const std::string & key, const std::string & value)
{
lst->handle_key(res, key, value);
});
}
else if (opname == "loadjson")
{
loading_json = true;