mirror of
https://github.com/matrix-construct/construct
synced 2025-02-18 17:50:16 +01:00
ircd::db: Add function to get single txn into closure by seqnum.
This commit is contained in:
parent
301b1d684b
commit
7657fde5db
2 changed files with 14 additions and 0 deletions
|
@ -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
|
||||
|
|
13
ircd/db.cc
13
ircd/db.cc
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue