mirror of
https://github.com/matrix-construct/construct
synced 2024-11-17 23:40:57 +01:00
ircd::db: Expose setoptions interface.
This commit is contained in:
parent
f805344604
commit
666e509c97
3 changed files with 36 additions and 0 deletions
|
@ -46,6 +46,7 @@ namespace ircd::db
|
|||
void del(column &, const string_view &key, const sopts & = {});
|
||||
|
||||
// [SET] Other operations
|
||||
void setopt(column &, const string_view &key, const string_view &val);
|
||||
void compact(column &, const string_view &begin = {}, const string_view &end = {});
|
||||
void flush(column &, const bool &blocking = false);
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace ircd::db
|
|||
uint32_t histogram_id(const string_view &key);
|
||||
|
||||
// Control panel
|
||||
void setopt(database &, const string_view &key, const string_view &val);
|
||||
void compact(database &);
|
||||
void fdeletions(database &, const bool &enable, const bool &force = false);
|
||||
void checkpoint(database &, const string_view &dir);
|
||||
|
|
34
ircd/db.cc
34
ircd/db.cc
|
@ -193,6 +193,22 @@ ircd::db::compact(database &d)
|
|||
compact(*column, string_view{}, string_view{});
|
||||
}
|
||||
|
||||
void
|
||||
ircd::db::setopt(database &d,
|
||||
const string_view &key,
|
||||
const string_view &val)
|
||||
{
|
||||
const std::unordered_map<std::string, std::string> options
|
||||
{
|
||||
{ std::string{key}, std::string{val} }
|
||||
};
|
||||
|
||||
throw_on_error
|
||||
{
|
||||
d.d->SetDBOptions(options)
|
||||
};
|
||||
}
|
||||
|
||||
uint64_t
|
||||
ircd::db::ticker(const database &d,
|
||||
const string_view &key)
|
||||
|
@ -3956,6 +3972,24 @@ ircd::db::compact(column &column,
|
|||
compact(c, begin, end);
|
||||
}
|
||||
|
||||
void
|
||||
ircd::db::setopt(column &column,
|
||||
const string_view &key,
|
||||
const string_view &val)
|
||||
{
|
||||
const std::unordered_map<std::string, std::string> options
|
||||
{
|
||||
{ std::string{key}, std::string{val} }
|
||||
};
|
||||
|
||||
database::column &c(column);
|
||||
database &d(c);
|
||||
throw_on_error
|
||||
{
|
||||
d.d->SetOptions(c, options)
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
ircd::db::del(column &column,
|
||||
const string_view &key,
|
||||
|
|
Loading…
Reference in a new issue