diff --git a/include/ircd/db/column.h b/include/ircd/db/column.h index 6691b66a3..a0650d532 100644 --- a/include/ircd/db/column.h +++ b/include/ircd/db/column.h @@ -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); } diff --git a/include/ircd/db/database/database.h b/include/ircd/db/database/database.h index 44d0a47ff..d5b03c8b7 100644 --- a/include/ircd/db/database/database.h +++ b/include/ircd/db/database/database.h @@ -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); diff --git a/ircd/db.cc b/ircd/db.cc index 8ae90ef2e..66ca1f40e 100644 --- a/ircd/db.cc +++ b/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 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 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,