0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-02 10:08:56 +02:00

ircd:Ⓜ️:event::fetch: Cache the event_idx as a class member.

This commit is contained in:
Jason Volk 2019-03-01 15:55:56 -08:00
parent c8bce8e251
commit 3a08d93c15
2 changed files with 11 additions and 5 deletions

View file

@ -40,6 +40,7 @@ struct ircd::m::event::fetch
static const opts default_opts;
const opts *fopts {&default_opts};
idx event_idx {0};
std::array<db::cell, event::size()> cell;
db::cell _json;
db::row row;

View file

@ -859,16 +859,17 @@ ircd::m::seek(event::fetch &fetch,
const event::idx &event_idx,
std::nothrow_t)
{
auto &event
{
static_cast<m::event &>(fetch)
};
fetch.event_idx = event_idx;
const string_view &key
{
byte_view<string_view>(event_idx)
};
auto &event
{
static_cast<m::event &>(fetch)
};
assert(fetch.fopts);
const auto &opts(*fetch.fopts);
if(!fetch.should_seek_json(opts))
@ -961,6 +962,10 @@ ircd::m::event::fetch::fetch(const event::idx &event_idx,
{
&opts
}
,event_idx
{
event_idx
}
,_json
{
dbs::event_json,