0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

ircd:Ⓜ️ Add head_idx(room) convenience to get one head event idx.

This commit is contained in:
Jason Volk 2018-04-18 15:09:13 -07:00
parent a91c4314d4
commit fbc78c9c60
2 changed files with 17 additions and 0 deletions

View file

@ -43,6 +43,10 @@ namespace ircd::m
id::event::buf head(std::nothrow_t, const id::room &); id::event::buf head(std::nothrow_t, const id::room &);
id::event::buf head(const id::room &); id::event::buf head(const id::room &);
// [GET] Current Event idx (non-locking) (one only)
event::idx head_idx(std::nothrow_t, const id::room &);
event::idx head_idx(const id::room &);
// [GET] Current Event depth (non-locking) (one only) // [GET] Current Event depth (non-locking) (one only)
int64_t depth(std::nothrow_t, const id::room &); int64_t depth(std::nothrow_t, const id::room &);
int64_t depth(const id::room &); int64_t depth(const id::room &);

View file

@ -23,6 +23,19 @@ ircd::m::depth(std::nothrow_t,
return std::get<int64_t>(top(std::nothrow, room_id)); return std::get<int64_t>(top(std::nothrow, room_id));
} }
ircd::m::event::idx
ircd::m::head_idx(const id::room &room_id)
{
return std::get<event::idx>(top(room_id));
}
ircd::m::event::idx
ircd::m::head_idx(std::nothrow_t,
const id::room &room_id)
{
return std::get<event::idx>(top(std::nothrow, room_id));
}
ircd::m::event::id::buf ircd::m::event::id::buf
ircd::m::head(const id::room &room_id) ircd::m::head(const id::room &room_id)
{ {