0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-15 14:31:11 +01:00

ircd:Ⓜ️:fetch: Add a request count() to interface.

This commit is contained in:
Jason Volk 2019-06-04 18:50:17 -07:00
parent 6b467733a8
commit f5df386e1c
2 changed files with 15 additions and 0 deletions

View file

@ -22,6 +22,7 @@ namespace ircd::m::fetch
// Observers
bool for_each(const std::function<bool (request &)> &);
bool exists(const m::event::id &);
size_t count();
// Control panel
bool cancel(request &);

View file

@ -590,6 +590,20 @@ ircd::m::fetch::start(const m::room::id &room_id,
return submit(event_id, room_id);
}
size_t
IRCD_MODULE_EXPORT
ircd::m::fetch::count()
{
size_t ret(0);
for_each([&ret](const auto &request)
{
++ret;
return true;
});
return ret;
}
bool
IRCD_MODULE_EXPORT
ircd::m::fetch::for_each(const std::function<bool (request &)> &closure)