0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-15 14:31:11 +01:00

ircd::db: Add convenience overload debug(rocksdb::WriteBatch)

This commit is contained in:
Jason Volk 2020-10-27 22:00:35 -07:00
parent 3884e30b4c
commit 87b1b764c1
2 changed files with 26 additions and 0 deletions

View file

@ -25,7 +25,9 @@ namespace ircd::db
bool for_each(database &d, const uint64_t &seq, const seq_closure_bool &); bool for_each(database &d, const uint64_t &seq, const seq_closure_bool &);
void for_each(database &d, const uint64_t &seq, const seq_closure &); void for_each(database &d, const uint64_t &seq, const seq_closure &);
void get(database &d, const uint64_t &seq, const seq_closure &); void get(database &d, const uint64_t &seq, const seq_closure &);
string_view debug(const mutable_buffer &out, const txn &, const ulong &fmt = 0); string_view debug(const mutable_buffer &out, const txn &, const ulong &fmt = 0);
string_view debug(const mutable_buffer &out, database &, const rocksdb::WriteBatch &, const ulong &fmt = 0);
} }
struct ircd::db::txn struct ircd::db::txn

View file

@ -1027,6 +1027,30 @@ ircd::db::for_each(database &d,
return true; return true;
} }
ircd::string_view
ircd::db::debug(const mutable_buffer &buf,
database &d,
const rocksdb::WriteBatch &wb_,
const ulong &fmt)
{
auto &wb
{
mutable_cast(wb_)
};
txn t
{
d, std::unique_ptr<rocksdb::WriteBatch>{&wb}
};
const unwind release
{
std::bind(&txn::release, &t)
};
return debug(buf, t, fmt);
}
ircd::string_view ircd::string_view
ircd::db::debug(const mutable_buffer &buf, ircd::db::debug(const mutable_buffer &buf,
const txn &t, const txn &t,