diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2014-12-04 01:15:40 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2014-12-04 01:15:40 +0100 |
commit | ef4b74960718bd492dc8f2e49f61ff9d3e5bd10a (patch) | |
tree | e60ac555f5697cc63e7be7a19c6c0adffc41fbd9 /store/database.h | |
parent | 44757d932abac6c8346366dfa3c0fb94e5ee0d06 (diff) | |
download | sink-ef4b74960718bd492dc8f2e49f61ff9d3e5bd10a.tar.gz sink-ef4b74960718bd492dc8f2e49f61ff9d3e5bd10a.zip |
ReadTransaction to read stuff.
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 | }; | ||