mirror of
https://github.com/matrix-construct/construct
synced 2025-01-14 00:34:18 +01:00
ircd::db: Consolidate write(column) overloads.
This commit is contained in:
parent
ec4453404e
commit
9af649f739
2 changed files with 4 additions and 19 deletions
|
@ -39,8 +39,7 @@ namespace ircd::db
|
||||||
std::string read(column &, const string_view &key, const gopts & = {});
|
std::string read(column &, const string_view &key, const gopts & = {});
|
||||||
|
|
||||||
// [SET] Write data to the db
|
// [SET] Write data to the db
|
||||||
void write(column &, const string_view &key, const string_view &value, const sopts & = {});
|
void write(column &, const string_view &key, const const_buffer &value, const sopts & = {});
|
||||||
void write(column &, const string_view &key, const mutable_buffer &, const sopts & = {});
|
|
||||||
|
|
||||||
// [SET] Remove data from the db. not_found is never thrown.
|
// [SET] Remove data from the db. not_found is never thrown.
|
||||||
void del(column &, const string_view &key, const sopts & = {});
|
void del(column &, const string_view &key, const sopts & = {});
|
||||||
|
|
20
ircd/db.cc
20
ircd/db.cc
|
@ -4084,21 +4084,7 @@ ircd::db::del(column &column,
|
||||||
void
|
void
|
||||||
ircd::db::write(column &column,
|
ircd::db::write(column &column,
|
||||||
const string_view &key,
|
const string_view &key,
|
||||||
const mutable_buffer &buf,
|
const const_buffer &val,
|
||||||
const sopts &sopts)
|
|
||||||
{
|
|
||||||
const string_view val
|
|
||||||
{
|
|
||||||
reinterpret_cast<const char *>(data(buf)), size(buf)
|
|
||||||
};
|
|
||||||
|
|
||||||
write(column, key, val, sopts);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ircd::db::write(column &column,
|
|
||||||
const string_view &key,
|
|
||||||
const string_view &val,
|
|
||||||
const sopts &sopts)
|
const sopts &sopts)
|
||||||
{
|
{
|
||||||
database &d(column);
|
database &d(column);
|
||||||
|
@ -4107,8 +4093,8 @@ ircd::db::write(column &column,
|
||||||
name(d),
|
name(d),
|
||||||
sequence(d),
|
sequence(d),
|
||||||
name(c),
|
name(c),
|
||||||
key.size(),
|
size(key),
|
||||||
val.size());
|
size(val));
|
||||||
|
|
||||||
auto opts(make_opts(sopts));
|
auto opts(make_opts(sopts));
|
||||||
throw_on_error
|
throw_on_error
|
||||||
|
|
Loading…
Reference in a new issue