0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-02-16 16:50:12 +01:00

ircd::db: Add interface for range deletions.

This commit is contained in:
Jason Volk 2019-01-25 12:32:04 -08:00
parent 5b3bee79a6
commit 246a5faba4
2 changed files with 26 additions and 0 deletions

View file

@ -58,6 +58,7 @@ namespace ircd::db
// [SET] Remove data from the db. not_found is never thrown.
void del(column &, const string_view &key, const sopts & = {});
void del(column &, const std::pair<string_view, string_view> &range, const sopts & = {});
// [SET] Other operations
void ingest(column &, const string_view &path);

View file

@ -5409,6 +5409,31 @@ ircd::db::ingest(column &column,
};
}
void
ircd::db::del(column &column,
const std::pair<string_view, string_view> &range,
const sopts &sopts)
{
database &d(column);
database::column &c(column);
auto opts(make_opts(sopts));
const std::lock_guard<decltype(write_mutex)> lock{write_mutex};
const ctx::uninterruptible::nothrow ui;
log::debug
{
log, "'%s' %lu '%s' RANGE DELETE",
name(d),
sequence(d),
name(c),
};
throw_on_error
{
d.d->DeleteRange(opts, c, slice(range.first), slice(range.second))
};
}
void
ircd::db::del(column &column,
const string_view &key,