0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-10-02 21:59:02 +02:00

modules/console: Add db command to list files.

This commit is contained in:
Jason Volk 2018-04-03 11:48:21 -07:00
parent 2bce600a60
commit 86b0f8248f

View file

@ -518,6 +518,40 @@ console_cmd__db__prop(opt &out, const string_view &line)
return true;
}
bool
console_cmd__db__files(opt &out, const string_view &line)
try
{
const auto dbname
{
token(line, ' ', 0)
};
auto &database
{
*db::database::dbs.at(dbname)
};
uint64_t msz;
const auto files
{
db::files(database, msz)
};
for(const auto &file : files)
out << file << std::endl;
out << "-- " << files.size() << " files; "
<< "manifest is " << msz << " bytes.";
return true;
}
catch(const std::out_of_range &e)
{
out << "No open database by that name" << std::endl;
return true;
}
bool
console_cmd__db__txns(opt &out, const string_view &line)
try