mirror of
https://github.com/matrix-construct/construct
synced 2024-09-26 02:18:53 +02:00
ircd:Ⓜ️ Reenable one of the m::room::members iterations now over the state b-tree.
This commit is contained in:
parent
ec2f44f409
commit
62dbef1df6
1 changed files with 31 additions and 7 deletions
|
@ -381,19 +381,43 @@ ircd::m::room::get(const string_view &type,
|
||||||
const event::closure &closure)
|
const event::closure &closure)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
const vm::query<vm::where::equal> query
|
const event::id::buf event_id_buf
|
||||||
{
|
{
|
||||||
{ "room_id", room_id },
|
!event_id? head(room_id) : string_view{}
|
||||||
{ "type", type },
|
|
||||||
{ "state_key", state_key },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return m::vm::test(query, [&closure]
|
const event::id event_id
|
||||||
(const auto &event)
|
|
||||||
{
|
{
|
||||||
|
this->event_id? this->event_id : event_id_buf
|
||||||
|
};
|
||||||
|
|
||||||
|
m::state::id_buffer state_root_buf;
|
||||||
|
const auto state_root
|
||||||
|
{
|
||||||
|
dbs::state_root(state_root_buf, room_id, event_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
bool ret{false};
|
||||||
|
m::state::get(state_root, type, state_key, [&closure, &ret]
|
||||||
|
(const string_view &event_id)
|
||||||
|
{
|
||||||
|
static const event _dummy_;
|
||||||
|
std::array<db::cell, dbs::event_columns> cell;
|
||||||
|
db::row row
|
||||||
|
{
|
||||||
|
*dbs::events, event_id, _dummy_, cell
|
||||||
|
};
|
||||||
|
|
||||||
|
if(!row.valid(event_id))
|
||||||
|
return;
|
||||||
|
|
||||||
|
m::event event;
|
||||||
|
assign(event, row, event_id);
|
||||||
|
ret = true;
|
||||||
closure(event);
|
closure(event);
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
Loading…
Reference in a new issue