mirror of
https://github.com/matrix-construct/construct
synced 2024-11-13 21:41:06 +01:00
ircd:Ⓜ️:event: Add parallel exists() to interface.
This commit is contained in:
parent
c0c9c2c4f0
commit
496567b837
2 changed files with 19 additions and 0 deletions
|
@ -24,6 +24,9 @@ namespace ircd::m
|
||||||
bool good(const id::event &);
|
bool good(const id::event &);
|
||||||
bool bad(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.
|
// Equality tests the event_id only! know this.
|
||||||
bool operator==(const event &a, const event &b);
|
bool operator==(const event &a, const event &b);
|
||||||
|
|
||||||
|
|
|
@ -999,6 +999,22 @@ ircd::m::operator==(const event &a, const event &b)
|
||||||
return a.event_id == b.event_id;
|
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
|
bool
|
||||||
ircd::m::bad(const id::event &event_id)
|
ircd::m::bad(const id::event &event_id)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue