0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-02 18:18:56 +02:00

ircd::db: Add function to get single txn into closure by seqnum.

This commit is contained in:
Jason Volk 2018-03-27 15:21:30 -07:00
parent 301b1d684b
commit 7657fde5db
2 changed files with 14 additions and 0 deletions

View file

@ -24,6 +24,7 @@ namespace ircd::db
using seq_closure = std::function<void (txn &, const uint64_t &)>;
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 get(database &d, const uint64_t &seq, const seq_closure &);
}
struct ircd::db::txn

View file

@ -2248,6 +2248,19 @@ noexcept
// db/txn.h
//
void
ircd::db::get(database &d,
const uint64_t &seq,
const seq_closure &closure)
{
for_each(d, seq, seq_closure_bool{[&closure]
(txn &txn, const uint64_t &seq)
{
closure(txn, seq);
return false;
}});
}
void
ircd::db::for_each(database &d,
const uint64_t &seq,