0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 00:32:35 +01:00

ircd:Ⓜ️:room::events: Add prefetch() convenience to interface.

This commit is contained in:
Jason Volk 2019-09-17 10:35:58 -07:00
parent b6b630c3d1
commit b3f646b478
2 changed files with 30 additions and 14 deletions

View file

@ -71,6 +71,9 @@ struct ircd::m::room::events
const m::event &fetch(std::nothrow_t);
const m::event &fetch();
bool prefetch(const string_view &event_prop);
bool prefetch(); // uses property keys from any fetch::opts supplied.
bool seek_idx(const event::idx &);
bool seek(const uint64_t &depth = -1);
bool seek(const event::id &);

View file

@ -1800,6 +1800,33 @@ catch(const db::not_found &e)
return false;
}
bool
ircd::m::room::events::prefetch()
{
assert(_event.fopts);
return m::prefetch(event_idx(), *_event.fopts);
}
bool
ircd::m::room::events::prefetch(const string_view &event_prop)
{
return m::prefetch(event_idx(), event_prop);
}
const ircd::m::event &
ircd::m::room::events::fetch()
{
m::seek(_event, event_idx());
return _event;
}
const ircd::m::event &
ircd::m::room::events::fetch(std::nothrow_t)
{
m::seek(_event, event_idx(), std::nothrow);
return _event;
}
ircd::m::room::events::operator
ircd::m::event::idx()
const
@ -1840,20 +1867,6 @@ const
return std::get<1>(part);
}
const ircd::m::event &
ircd::m::room::events::fetch()
{
m::seek(_event, event_idx());
return _event;
}
const ircd::m::event &
ircd::m::room::events::fetch(std::nothrow_t)
{
m::seek(_event, event_idx(), std::nothrow);
return _event;
}
//
// room::state
//