0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00

ircd:Ⓜ️:event::prev: Add optimal queries for any one reference existing.

This commit is contained in:
Jason Volk 2020-06-09 23:07:34 -07:00
parent d42126693b
commit b70877eee2
2 changed files with 25 additions and 0 deletions

View file

@ -58,6 +58,9 @@ struct ircd::m::event::prev
size_t auth_events_exist() const;
size_t prev_events_exist() const;
bool auth_exist() const;
bool prev_exist() const;
using super_type::tuple;
using super_type::operator=;
};

View file

@ -13,6 +13,28 @@
// event/prev.h
//
bool
ircd::m::event::prev::prev_exist()
const
{
for(size_t i(0); i < prev_events_count(); ++i)
if(prev_event_exists(i))
return true;
return false;
}
bool
ircd::m::event::prev::auth_exist()
const
{
for(size_t i(0); i < auth_events_count(); ++i)
if(auth_event_exists(i))
return true;
return false;
}
size_t
ircd::m::event::prev::prev_events_exist()
const