mirror of
https://github.com/matrix-construct/construct
synced 2024-12-28 16:34:13 +01:00
ircd:Ⓜ️:state: Reduce for_each stack.
This commit is contained in:
parent
19c58ca23e
commit
04959d946c
1 changed files with 4 additions and 20 deletions
|
@ -1246,27 +1246,11 @@ bool
|
||||||
ircd::m::room::state::for_each(const event::closure_idx_bool &closure)
|
ircd::m::room::state::for_each(const event::closure_idx_bool &closure)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
if(!present())
|
return for_each(closure_bool{[&closure]
|
||||||
return m::state::for_each(root_id, m::state::iter_bool_closure{[&closure]
|
(const string_view &type, const string_view &state_key, const event::idx &event_idx)
|
||||||
(const json::array &key, const string_view &event_id)
|
|
||||||
{
|
{
|
||||||
return closure(index(m::event::id(unquote(event_id)), std::nothrow));
|
return closure(event_idx);
|
||||||
}});
|
}});
|
||||||
|
|
||||||
db::gopts opts
|
|
||||||
{
|
|
||||||
this->fopts? this->fopts->gopts : db::gopts{}
|
|
||||||
};
|
|
||||||
|
|
||||||
if(!opts.readahead)
|
|
||||||
opts.readahead = size_t(readahead_size);
|
|
||||||
|
|
||||||
auto &column{dbs::room_state};
|
|
||||||
for(auto it{column.begin(room_id, opts)}; bool(it); ++it)
|
|
||||||
if(!closure(byte_view<event::idx>(it->second)))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
Loading…
Reference in a new issue