mirror of
https://github.com/matrix-construct/construct
synced 2024-12-27 07:54:05 +01:00
ircd:Ⓜ️ Add prefetch() to event::fetch interface.
This commit is contained in:
parent
62426ab210
commit
91dff38a57
2 changed files with 50 additions and 0 deletions
|
@ -232,6 +232,11 @@ struct ircd::m::event::fetch
|
|||
friend const_buffer get(std::nothrow_t, const id &, const string_view &key, const mutable_buffer &out);
|
||||
friend const_buffer get(const idx &, const string_view &key, const mutable_buffer &out);
|
||||
friend const_buffer get(const id &, const string_view &key, const mutable_buffer &out);
|
||||
|
||||
friend void prefetch(const idx &, const string_view &key);
|
||||
friend void prefetch(const idx &, const opts & = default_opts);
|
||||
friend void prefetch(const id &, const string_view &key);
|
||||
friend void prefetch(const id &, const opts & = default_opts);
|
||||
};
|
||||
|
||||
struct ircd::m::event::fetch::opts
|
||||
|
|
|
@ -1369,6 +1369,51 @@ decltype(ircd::m::event::fetch::default_opts)
|
|||
ircd::m::event::fetch::default_opts
|
||||
{};
|
||||
|
||||
void
|
||||
ircd::m::prefetch(const event::id &event_id,
|
||||
const event::fetch::opts &opts)
|
||||
{
|
||||
prefetch(index(event_id), opts);
|
||||
}
|
||||
|
||||
void
|
||||
ircd::m::prefetch(const event::id &event_id,
|
||||
const string_view &key)
|
||||
{
|
||||
prefetch(index(event_id), key);
|
||||
}
|
||||
|
||||
void
|
||||
ircd::m::prefetch(const event::idx &event_idx,
|
||||
const event::fetch::opts &opts)
|
||||
{
|
||||
const vector_view<const string_view> cols
|
||||
{
|
||||
opts.keys
|
||||
};
|
||||
|
||||
for(const auto &col : cols)
|
||||
if(col)
|
||||
prefetch(event_idx, col);
|
||||
}
|
||||
|
||||
void
|
||||
ircd::m::prefetch(const event::idx &event_idx,
|
||||
const string_view &key)
|
||||
{
|
||||
const auto &column_idx
|
||||
{
|
||||
json::indexof<event>(key)
|
||||
};
|
||||
|
||||
auto &column
|
||||
{
|
||||
dbs::event_column.at(column_idx)
|
||||
};
|
||||
|
||||
db::prefetch(column, byte_view<string_view>{event_idx});
|
||||
}
|
||||
|
||||
ircd::const_buffer
|
||||
ircd::m::get(const event::id &event_id,
|
||||
const string_view &key,
|
||||
|
|
Loading…
Reference in a new issue