mirror of
https://github.com/matrix-construct/construct
synced 2024-11-17 15:30:52 +01:00
ircd:Ⓜ️ Remove duplicate exists(event_id) util.
This commit is contained in:
parent
046029725a
commit
e4d891abac
3 changed files with 1 additions and 20 deletions
|
@ -47,9 +47,6 @@ namespace ircd::m::dbs
|
||||||
string_view state_root(const mutable_buffer &out, const id::event &);
|
string_view state_root(const mutable_buffer &out, const id::event &);
|
||||||
string_view state_root(const mutable_buffer &out, const event &);
|
string_view state_root(const mutable_buffer &out, const event &);
|
||||||
|
|
||||||
// [GET] Query suite
|
|
||||||
bool exists(const event::id &);
|
|
||||||
|
|
||||||
// [SET (txn)] Basic write suite
|
// [SET (txn)] Basic write suite
|
||||||
string_view write(db::txn &, const event &, const write_opts &);
|
string_view write(db::txn &, const event &, const write_opts &);
|
||||||
}
|
}
|
||||||
|
|
|
@ -407,22 +407,6 @@ ircd::m::dbs::state_root(const mutable_buffer &out,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
ircd::m::dbs::exists(const event::id &event_id)
|
|
||||||
{
|
|
||||||
static constexpr auto idx
|
|
||||||
{
|
|
||||||
json::indexof<event, "event_id"_>()
|
|
||||||
};
|
|
||||||
|
|
||||||
auto &column
|
|
||||||
{
|
|
||||||
event_column.at(idx)
|
|
||||||
};
|
|
||||||
|
|
||||||
return has(column, event_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Database descriptors
|
// Database descriptors
|
||||||
//
|
//
|
||||||
|
|
|
@ -328,7 +328,7 @@ ircd::m::vm::_eval_pdu(eval &eval,
|
||||||
for(size_t i(0); i < prev_count; ++i)
|
for(size_t i(0); i < prev_count; ++i)
|
||||||
{
|
{
|
||||||
const auto prev_id{prev.prev_event(i)};
|
const auto prev_id{prev.prev_event(i)};
|
||||||
if(opts.prev_check_exists && !dbs::exists(prev_id))
|
if(opts.prev_check_exists && !exists(prev_id))
|
||||||
throw error
|
throw error
|
||||||
{
|
{
|
||||||
fault::EVENT, "Missing prev event %s", string_view{prev_id}
|
fault::EVENT, "Missing prev event %s", string_view{prev_id}
|
||||||
|
|
Loading…
Reference in a new issue