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:
parent
5b3bee79a6
commit
246a5faba4
2 changed files with 26 additions and 0 deletions
|
@ -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);
|
||||
|
|
25
ircd/db.cc
25
ircd/db.cc
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue