0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-16 06:51:08 +01:00

ircd:Ⓜ️:dbs: Add interface to manipulate the blacklist column.

This commit is contained in:
Jason Volk 2018-05-04 15:14:19 -07:00
parent cff90c79ae
commit 7ca2e8797d
2 changed files with 19 additions and 0 deletions

View file

@ -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

View file

@ -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<string_view>(opts.idx):
string_view{}
}
};
}
ircd::string_view
ircd::m::dbs::write(db::txn &txn,
const event &event,