diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/index.cpp | 8 | ||||
-rw-r--r-- | common/index.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/common/index.cpp b/common/index.cpp index a4641bc..ff87ae2 100644 --- a/common/index.cpp +++ b/common/index.cpp | |||
@@ -10,6 +10,14 @@ Index::Index(const QString &storageRoot, const QString &name, Sink::Storage::Dat | |||
10 | { | 10 | { |
11 | } | 11 | } |
12 | 12 | ||
13 | Index::Index(const QString &storageRoot, const Sink::Storage::DbLayout &layout, Sink::Storage::DataStore::AccessMode mode) | ||
14 | : mTransaction(Sink::Storage::DataStore(storageRoot, layout, mode).createTransaction(mode)), | ||
15 | mDb(mTransaction.openDatabase(layout.name, std::function<void(const Sink::Storage::DataStore::Error &)>(), true)), | ||
16 | mName(layout.name), | ||
17 | mLogCtx("index." + layout.name) | ||
18 | { | ||
19 | } | ||
20 | |||
13 | Index::Index(const QByteArray &name, Sink::Storage::DataStore::Transaction &transaction) | 21 | Index::Index(const QByteArray &name, Sink::Storage::DataStore::Transaction &transaction) |
14 | : mDb(transaction.openDatabase(name, std::function<void(const Sink::Storage::DataStore::Error &)>(), true)), mName(name), | 22 | : mDb(transaction.openDatabase(name, std::function<void(const Sink::Storage::DataStore::Error &)>(), true)), mName(name), |
15 | mLogCtx("index." + name) | 23 | mLogCtx("index." + name) |
diff --git a/common/index.h b/common/index.h index 81dc5bf..f16a426 100644 --- a/common/index.h +++ b/common/index.h | |||
@@ -30,6 +30,7 @@ public: | |||
30 | }; | 30 | }; |
31 | 31 | ||
32 | Index(const QString &storageRoot, const QString &name, Sink::Storage::DataStore::AccessMode mode = Sink::Storage::DataStore::ReadOnly); | 32 | Index(const QString &storageRoot, const QString &name, Sink::Storage::DataStore::AccessMode mode = Sink::Storage::DataStore::ReadOnly); |
33 | Index(const QString &storageRoot, const Sink::Storage::DbLayout &layout, Sink::Storage::DataStore::AccessMode mode = Sink::Storage::DataStore::ReadOnly); | ||
33 | Index(const QByteArray &name, Sink::Storage::DataStore::Transaction &); | 34 | Index(const QByteArray &name, Sink::Storage::DataStore::Transaction &); |
34 | 35 | ||
35 | void add(const QByteArray &key, const QByteArray &value); | 36 | void add(const QByteArray &key, const QByteArray &value); |