mirror of
https://github.com/matrix-construct/construct
synced 2025-01-14 16:46:50 +01:00
ircd::db: Add file_count and bytes aggregator for all columns in db.
This commit is contained in:
parent
359ff91316
commit
330fe74035
2 changed files with 24 additions and 0 deletions
|
@ -20,6 +20,8 @@ namespace ircd::db
|
|||
uint64_t sequence(const database &); // Latest sequence number
|
||||
std::vector<std::string> files(const database &, uint64_t &msz);
|
||||
std::vector<std::string> files(const database &);
|
||||
size_t file_count(const database &);
|
||||
size_t bytes(const database &);
|
||||
|
||||
// Property information interface
|
||||
using prop_int = uint64_t;
|
||||
|
|
22
ircd/db.cc
22
ircd/db.cc
|
@ -206,6 +206,28 @@ ircd::db::ticker(const database &d,
|
|||
return d.stats->getTickerCount(id);
|
||||
}
|
||||
|
||||
size_t
|
||||
ircd::db::bytes(const database &d)
|
||||
{
|
||||
return std::accumulate(begin(d.columns), end(d.columns), size_t(0), []
|
||||
(auto ret, const auto &colptr)
|
||||
{
|
||||
db::column c{*colptr};
|
||||
return ret += db::bytes(c);
|
||||
});
|
||||
}
|
||||
|
||||
size_t
|
||||
ircd::db::file_count(const database &d)
|
||||
{
|
||||
return std::accumulate(begin(d.columns), end(d.columns), size_t(0), []
|
||||
(auto ret, const auto &colptr)
|
||||
{
|
||||
db::column c{*colptr};
|
||||
return ret += db::file_count(c);
|
||||
});
|
||||
}
|
||||
|
||||
/// Get the live file list for db; see overlord documentation.
|
||||
std::vector<std::string>
|
||||
ircd::db::files(const database &d)
|
||||
|
|
Loading…
Reference in a new issue