From 96dfcaa12259e79df56a258a3be1cb8a22e62018 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 9 May 2019 16:28:17 -0700 Subject: [PATCH] ircd::db::txn: Minor interface cleanup. --- include/ircd/db/txn.h | 26 ++++++++++++-------------- ircd/db.cc | 4 ++-- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/include/ircd/db/txn.h b/include/ircd/db/txn.h index d93624299..effad8ccc 100644 --- a/include/ircd/db/txn.h +++ b/include/ircd/db/txn.h @@ -15,35 +15,33 @@ namespace ircd::db { struct txn; - bool for_each(const txn &, const std::function &); - void for_each(const txn &, const std::function &); - std::string debug(const txn &); - - using seq_closure_bool = std::function; + using delta_closure = std::function; + using delta_closure_bool = std::function; using seq_closure = std::function; + using seq_closure_bool = std::function; + + bool for_each(const txn &, const delta_closure_bool &); + void for_each(const txn &, const delta_closure &); 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 &); + std::string debug(const txn &); } struct ircd::db::txn { + struct opts; + struct checkpoint; + struct append; + struct handler; enum state :uint8_t; + using value_closure = std::function; database *d {nullptr}; std::unique_ptr wb; enum state state {0}; public: - struct opts; - struct checkpoint; - struct append; - struct handler; - - using delta_closure = std::function; - using delta_closure_bool = std::function; - using value_closure = std::function; - explicit operator const rocksdb::WriteBatch &() const; explicit operator const database &() const; explicit operator rocksdb::WriteBatch &(); diff --git a/ircd/db.cc b/ircd/db.cc index 012c17215..3d952e795 100644 --- a/ircd/db.cc +++ b/ircd/db.cc @@ -3784,7 +3784,7 @@ ircd::db::debug(const txn &t) void ircd::db::for_each(const txn &t, - const std::function &closure) + const delta_closure &closure) { const auto re{[&closure] (const delta &delta) @@ -3801,7 +3801,7 @@ ircd::db::for_each(const txn &t, bool ircd::db::for_each(const txn &t, - const std::function &closure) + const delta_closure_bool &closure) { const database &d(t); const rocksdb::WriteBatch &wb{t};