0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-28 00:14:07 +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)
const
{
if(!present())
return m::state::for_each(root_id, m::state::iter_bool_closure{[&closure]
(const json::array &key, const string_view &event_id)
{
return closure(index(m::event::id(unquote(event_id)), std::nothrow));
}});
db::gopts opts
return for_each(closure_bool{[&closure]
(const string_view &type, const string_view &state_key, const event::idx &event_idx)
{
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;
return closure(event_idx);
}});
}
bool