diff --git a/include/ircd/m/room/content.h b/include/ircd/m/room/content.h index 37ba048d2..6f0d23629 100644 --- a/include/ircd/m/room/content.h +++ b/include/ircd/m/room/content.h @@ -15,9 +15,10 @@ /// struct ircd::m::room::content { - using closure = std::function + using entry = pair; + using closure = util::closure_bool < - bool (const json::object &, const uint64_t &, const event::idx &) + std::function, const json::object &, const uint64_t &, const event::idx & >; static const size_t prefetch_max; @@ -25,12 +26,17 @@ struct ircd::m::room::content m::room room; std::pair range; // highest (inclusive) to lowest (exclusive) + size_t queue_max; + std::unique_ptr buf; public: bool for_each(const closure &) const; content(const m::room &, const decltype(range) & = { -1UL, -1L }); + + content(const content &) = delete; + content(content &&) = delete; }; inline @@ -38,4 +44,12 @@ ircd::m::room::content::content(const m::room &room, const decltype(range) &range) :room{room} ,range{range} +,queue_max{prefetch} +,buf +{ + new entry[queue_max] + { + { 0UL, 0UL } + } +} {} diff --git a/matrix/room_content.cc b/matrix/room_content.cc index 43ae04ed3..2337d3df5 100644 --- a/matrix/room_content.cc +++ b/matrix/room_content.cc @@ -19,18 +19,6 @@ bool ircd::m::room::content::for_each(const closure &closure) const { - using entry = pair; - const size_t queue_max - { - size_t(content::prefetch) - }; - - // ring queue buffer - const std::unique_ptr buf - { - new entry[queue_max] {{0UL, 0UL}} - }; - entry *const __restrict__ queue { buf.get()