mirror of
https://github.com/matrix-construct/construct
synced 2024-11-17 23:40:57 +01:00
ircd::db: Add util to get file list for specific column.
This commit is contained in:
parent
8a514808f9
commit
f80aaa7904
2 changed files with 23 additions and 0 deletions
|
@ -19,6 +19,7 @@ namespace ircd::db
|
|||
uint32_t id(const column &);
|
||||
const std::string &name(const column &);
|
||||
const descriptor &describe(const column &);
|
||||
std::vector<std::string> files(const column &);
|
||||
size_t file_count(const column &);
|
||||
size_t bytes(const column &);
|
||||
|
||||
|
|
22
ircd/db.cc
22
ircd/db.cc
|
@ -7324,6 +7324,28 @@ ircd::db::describe(const column &column)
|
|||
return describe(c);
|
||||
}
|
||||
|
||||
std::vector<std::string>
|
||||
ircd::db::files(const column &column)
|
||||
{
|
||||
database::column &c(const_cast<db::column &>(column));
|
||||
database &d(*c.d);
|
||||
|
||||
rocksdb::ColumnFamilyMetaData cfmd;
|
||||
d.d->GetColumnFamilyMetaData(c, &cfmd);
|
||||
|
||||
size_t count(0);
|
||||
for(const auto &level : cfmd.levels)
|
||||
count += level.files.size();
|
||||
|
||||
std::vector<std::string> ret;
|
||||
ret.reserve(count);
|
||||
for(auto &level : cfmd.levels)
|
||||
for(auto &file : level.files)
|
||||
ret.emplace_back(std::move(file.name));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
ircd::db::sort(column &column,
|
||||
const bool &blocking)
|
||||
|
|
Loading…
Reference in a new issue