From f5df386e1c3a7e27fb422055465d64f31d0b5dc1 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 4 Jun 2019 18:50:17 -0700 Subject: [PATCH] ircd::m::fetch: Add a request count() to interface. --- include/ircd/m/fetch.h | 1 + modules/s_fetch.cc | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/ircd/m/fetch.h b/include/ircd/m/fetch.h index cb2f1aafd..be5211af3 100644 --- a/include/ircd/m/fetch.h +++ b/include/ircd/m/fetch.h @@ -22,6 +22,7 @@ namespace ircd::m::fetch // Observers bool for_each(const std::function &); bool exists(const m::event::id &); + size_t count(); // Control panel bool cancel(request &); diff --git a/modules/s_fetch.cc b/modules/s_fetch.cc index 1a3f51abb..39c4f0632 100644 --- a/modules/s_fetch.cc +++ b/modules/s_fetch.cc @@ -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 &closure)