0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 07:23:53 +01:00

ircd:Ⓜ️:dbs: Add overload to generate partial origins prefix key.

This commit is contained in:
Jason Volk 2018-04-03 12:49:03 -07:00
parent 86b0f8248f
commit 8b5d27d1fc
2 changed files with 13 additions and 0 deletions

View file

@ -35,6 +35,7 @@ namespace ircd::m::dbs
std::tuple<string_view, string_view> room_state_key(const string_view &amalgam);
string_view room_origins_key(const mutable_buffer &out, const id::room &, const string_view &origin, const id::user &member);
string_view room_origins_key(const mutable_buffer &out, const id::room &, const string_view &origin);
std::tuple<string_view, string_view> room_origins_key(const string_view &amalgam);
string_view room_events_key(const mutable_buffer &out, const id::room &, const uint64_t &depth, const id::event &);

View file

@ -655,6 +655,18 @@ ircd::m::dbs::desc::events__room_origins__pfx
}
};
ircd::string_view
ircd::m::dbs::room_origins_key(const mutable_buffer &out_,
const id::room &room_id,
const string_view &origin)
{
mutable_buffer out{out_};
consume(out, copy(out, room_id));
consume(out, copy(out, "\0"_sv));
consume(out, copy(out, origin));
return { data(out_), data(out) };
}
ircd::string_view
ircd::m::dbs::room_origins_key(const mutable_buffer &out_,
const id::room &room_id,