From ef4b74960718bd492dc8f2e49f61ff9d3e5bd10a Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 4 Dec 2014 01:15:40 +0100 Subject: ReadTransaction to read stuff. --- store/database.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'store/database.h') diff --git a/store/database.h b/store/database.h index 999a89e..ab398a4 100644 --- a/store/database.h +++ b/store/database.h @@ -18,3 +18,21 @@ private: MDB_env *env; MDB_dbi dbi; }; + +/* + * This opens the db for a single read transaction. + * + * The lifetime of all read values is tied to this transaction. + */ +class ReadTransaction { +public: + ReadTransaction(const QString &path); + ~ReadTransaction(); + + void read(const std::string &sKey, const std::function &); + +private: + MDB_env *env; + MDB_dbi dbi; + MDB_txn *txn; +}; -- cgit v1.2.3