0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-29 08:54:02 +01:00

ircd:Ⓜ️:state: Reduce for_each stack.

This commit is contained in:
Jason Volk 2019-03-31 15:12:38 -07:00
parent 19c58ca23e
commit 04959d946c

View file

@ -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