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

ircd:Ⓜ️:room::head: Add room version hint to opts to reduce query.

This commit is contained in:
Jason Volk 2019-12-10 11:10:10 -08:00
parent 275f5aa3cd
commit 8dfbe808d6
3 changed files with 9 additions and 4 deletions

View file

@ -89,4 +89,7 @@ struct ircd::m::room::head::generate::opts
/// Requires that at least one reference is to an event created by this
/// server (origin).
bool need_my_head {false};
/// Hint the room version which determines the output format; avoid query.
string_view version;
};

View file

@ -52,7 +52,8 @@ ircd::m::room::head::generate::generate(json::stack::array &out,
char versionbuf[32];
const auto version
{
m::version(versionbuf, head.room, std::nothrow)
opts.version?:
m::version(versionbuf, head.room, std::nothrow)
};
// The output format depends on the room version; we select an output

View file

@ -212,9 +212,10 @@ ircd::m::vm::inject(eval &eval,
{
prev_buf, head,
{
16, // .limit = 16,
true, // .need_top_head = true,
true, // .need_my_head = false,
16, // .limit = 16,
true, // .need_top_head = true,
true, // .need_my_head = false,
eval.room_version // .version = eval.room_version,
}
};