mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd:Ⓜ️:dbs: Add a room_events_key generator which doesn't require event_id.
This commit is contained in:
parent
032156a18e
commit
ad56d381a5
2 changed files with 15 additions and 0 deletions
|
@ -29,6 +29,7 @@ namespace ircd::m::dbs
|
|||
|
||||
// Lowlevel util
|
||||
string_view room_events_key(const mutable_buffer &out, const id::room &, const uint64_t &depth, const id::event &);
|
||||
string_view room_events_key(const mutable_buffer &out, const id::room &, const uint64_t &depth);
|
||||
std::tuple<uint64_t, string_view> room_events_key(const string_view &amalgam);
|
||||
|
||||
// Get the state root for an event (with as much information as you have)
|
||||
|
|
|
@ -381,6 +381,20 @@ ircd::m::dbs::desc::events__room_events__cmp
|
|||
}
|
||||
};
|
||||
|
||||
//TODO: optimize
|
||||
//TODO: Needs The Gramslam
|
||||
ircd::string_view
|
||||
ircd::m::dbs::room_events_key(const mutable_buffer &out,
|
||||
const id::room &room_id,
|
||||
const uint64_t &depth)
|
||||
{
|
||||
size_t len{0};
|
||||
len = strlcpy(out, room_id);
|
||||
len = strlcat(out, ":::");
|
||||
len = strlcat(out, lex_cast(depth));
|
||||
return { data(out), len };
|
||||
}
|
||||
|
||||
//TODO: optimize
|
||||
//TODO: Needs The Gramslam
|
||||
ircd::string_view
|
||||
|
|
Loading…
Reference in a new issue