mirror of
https://github.com/matrix-construct/construct
synced 2024-06-08 21:18:57 +02:00
ircd:Ⓜ️:room::content: Move prefetch buffer to class member.
This commit is contained in:
parent
e45dc31797
commit
49615517cc
|
@ -15,9 +15,10 @@
|
||||||
///
|
///
|
||||||
struct ircd::m::room::content
|
struct ircd::m::room::content
|
||||||
{
|
{
|
||||||
using closure = std::function
|
using entry = pair<uint64_t, m::event::idx>;
|
||||||
|
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;
|
static const size_t prefetch_max;
|
||||||
|
@ -25,12 +26,17 @@ struct ircd::m::room::content
|
||||||
|
|
||||||
m::room room;
|
m::room room;
|
||||||
std::pair<uint64_t, int64_t> range; // highest (inclusive) to lowest (exclusive)
|
std::pair<uint64_t, int64_t> range; // highest (inclusive) to lowest (exclusive)
|
||||||
|
size_t queue_max;
|
||||||
|
std::unique_ptr<entry[]> buf;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool for_each(const closure &) const;
|
bool for_each(const closure &) const;
|
||||||
|
|
||||||
content(const m::room &,
|
content(const m::room &,
|
||||||
const decltype(range) & = { -1UL, -1L });
|
const decltype(range) & = { -1UL, -1L });
|
||||||
|
|
||||||
|
content(const content &) = delete;
|
||||||
|
content(content &&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
@ -38,4 +44,12 @@ ircd::m::room::content::content(const m::room &room,
|
||||||
const decltype(range) &range)
|
const decltype(range) &range)
|
||||||
:room{room}
|
:room{room}
|
||||||
,range{range}
|
,range{range}
|
||||||
|
,queue_max{prefetch}
|
||||||
|
,buf
|
||||||
|
{
|
||||||
|
new entry[queue_max]
|
||||||
|
{
|
||||||
|
{ 0UL, 0UL }
|
||||||
|
}
|
||||||
|
}
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -19,18 +19,6 @@ bool
|
||||||
ircd::m::room::content::for_each(const closure &closure)
|
ircd::m::room::content::for_each(const closure &closure)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
using entry = pair<uint64_t, m::event::idx>;
|
|
||||||
const size_t queue_max
|
|
||||||
{
|
|
||||||
size_t(content::prefetch)
|
|
||||||
};
|
|
||||||
|
|
||||||
// ring queue buffer
|
|
||||||
const std::unique_ptr<entry[]> buf
|
|
||||||
{
|
|
||||||
new entry[queue_max] {{0UL, 0UL}}
|
|
||||||
};
|
|
||||||
|
|
||||||
entry *const __restrict__ queue
|
entry *const __restrict__ queue
|
||||||
{
|
{
|
||||||
buf.get()
|
buf.get()
|
||||||
|
|
Loading…
Reference in a new issue