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:
parent
d42126693b
commit
b70877eee2
2 changed files with 25 additions and 0 deletions
|
@ -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=;
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue