diff --git a/include/ircd/m/dbs.h b/include/ircd/m/dbs.h index 0925e9c5b..40ae5dcd8 100644 --- a/include/ircd/m/dbs.h +++ b/include/ircd/m/dbs.h @@ -60,6 +60,7 @@ namespace ircd::m::dbs // [SET (txn)] Basic write suite string_view write(db::txn &, const event &, const write_opts &); + void blacklist(db::txn &, const event::id &, const write_opts &); } struct ircd::m::dbs::write_opts diff --git a/ircd/m/dbs.cc b/ircd/m/dbs.cc index 4c4d59e46..54a2930f9 100644 --- a/ircd/m/dbs.cc +++ b/ircd/m/dbs.cc @@ -102,6 +102,24 @@ namespace ircd::m::dbs static string_view _index_ephem(db::txn &, const event &, const write_opts &); } +void +ircd::m::dbs::blacklist(db::txn &txn, + const event::id &event_id, + const write_opts &opts) +{ + db::txn::append + { + txn, event_bad, + { + opts.op, + string_view{event_id}, + opts.idx != uint64_t(-1) && opts.op == db::op::SET? + byte_view(opts.idx): + string_view{} + } + }; +} + ircd::string_view ircd::m::dbs::write(db::txn &txn, const event &event,