0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 07:23:53 +01:00

ircd:Ⓜ️:event: Add parallel exists() to interface.

This commit is contained in:
Jason Volk 2020-06-08 23:11:05 -07:00
parent c0c9c2c4f0
commit 496567b837
2 changed files with 19 additions and 0 deletions

View file

@ -24,6 +24,9 @@ namespace ircd::m
bool good(const id::event &);
bool bad(const id::event &);
// parallel util; returns bitset
uint64_t exists(const vector_view<const id::event> &);
// Equality tests the event_id only! know this.
bool operator==(const event &a, const event &b);

View file

@ -999,6 +999,22 @@ ircd::m::operator==(const event &a, const event &b)
return a.event_id == b.event_id;
}
uint64_t
ircd::m::exists(const vector_view<const id::event> &event_ids)
{
const vector_view<const string_view> key
{
static_cast<const string_view *>(event_ids.data()), event_ids.size()
};
auto &column
{
dbs::event_idx
};
return db::has(column, key);
}
bool
ircd::m::bad(const id::event &event_id)
{