diff options
Diffstat (limited to 'store/database.h')
-rw-r--r-- | store/database.h | 18 |
1 files changed, 18 insertions, 0 deletions
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: | |||
18 | MDB_env *env; | 18 | MDB_env *env; |
19 | MDB_dbi dbi; | 19 | MDB_dbi dbi; |
20 | }; | 20 | }; |
21 | |||
22 | /* | ||
23 | * This opens the db for a single read transaction. | ||
24 | * | ||
25 | * The lifetime of all read values is tied to this transaction. | ||
26 | */ | ||
27 | class ReadTransaction { | ||
28 | public: | ||
29 | ReadTransaction(const QString &path); | ||
30 | ~ReadTransaction(); | ||
31 | |||
32 | void read(const std::string &sKey, const std::function<void(void *ptr, int size)> &); | ||
33 | |||
34 | private: | ||
35 | MDB_env *env; | ||
36 | MDB_dbi dbi; | ||
37 | MDB_txn *txn; | ||
38 | }; | ||