0
0
Fork 0
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:
Jason Volk 2018-04-20 14:10:59 -07:00
parent f805344604
commit 666e509c97
3 changed files with 36 additions and 0 deletions

View file

@ -46,6 +46,7 @@ namespace ircd::db
void del(column &, const string_view &key, const sopts & = {}); void del(column &, const string_view &key, const sopts & = {});
// [SET] Other operations // [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 compact(column &, const string_view &begin = {}, const string_view &end = {});
void flush(column &, const bool &blocking = false); void flush(column &, const bool &blocking = false);
} }

View file

@ -43,6 +43,7 @@ namespace ircd::db
uint32_t histogram_id(const string_view &key); uint32_t histogram_id(const string_view &key);
// Control panel // Control panel
void setopt(database &, const string_view &key, const string_view &val);
void compact(database &); void compact(database &);
void fdeletions(database &, const bool &enable, const bool &force = false); void fdeletions(database &, const bool &enable, const bool &force = false);
void checkpoint(database &, const string_view &dir); void checkpoint(database &, const string_view &dir);

View file

@ -193,6 +193,22 @@ ircd::db::compact(database &d)
compact(*column, string_view{}, string_view{}); 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 uint64_t
ircd::db::ticker(const database &d, ircd::db::ticker(const database &d,
const string_view &key) const string_view &key)
@ -3956,6 +3972,24 @@ ircd::db::compact(column &column,
compact(c, begin, end); 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 void
ircd::db::del(column &column, ircd::db::del(column &column,
const string_view &key, const string_view &key,