diff options
Diffstat (limited to 'common/index.cpp')
-rw-r--r-- | common/index.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/common/index.cpp b/common/index.cpp index 86a2dd5..238a745 100644 --- a/common/index.cpp +++ b/common/index.cpp | |||
@@ -2,6 +2,8 @@ | |||
2 | 2 | ||
3 | #include "log.h" | 3 | #include "log.h" |
4 | 4 | ||
5 | using Sink::Storage::Identifier; | ||
6 | |||
5 | Index::Index(const QString &storageRoot, const QString &dbName, const QString &indexName, Sink::Storage::DataStore::AccessMode mode) | 7 | Index::Index(const QString &storageRoot, const QString &dbName, const QString &indexName, Sink::Storage::DataStore::AccessMode mode) |
6 | : mTransaction(Sink::Storage::DataStore(storageRoot, dbName, mode).createTransaction(mode)), | 8 | : mTransaction(Sink::Storage::DataStore(storageRoot, dbName, mode).createTransaction(mode)), |
7 | mDb(mTransaction.openDatabase(indexName.toLatin1(), std::function<void(const Sink::Storage::DataStore::Error &)>(), true)), | 9 | mDb(mTransaction.openDatabase(indexName.toLatin1(), std::function<void(const Sink::Storage::DataStore::Error &)>(), true)), |
@@ -32,6 +34,11 @@ Index::Index(const QByteArray &name, Sink::Storage::DataStore::Transaction &tran | |||
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
37 | void Index::add(const Identifier &key, const QByteArray &value) | ||
38 | { | ||
39 | add(key.toInternalByteArray(), value); | ||
40 | } | ||
41 | |||
35 | void Index::add(const QByteArray &key, const QByteArray &value) | 42 | void Index::add(const QByteArray &key, const QByteArray &value) |
36 | { | 43 | { |
37 | Q_ASSERT(!key.isEmpty()); | 44 | Q_ASSERT(!key.isEmpty()); |
@@ -40,6 +47,11 @@ void Index::add(const QByteArray &key, const QByteArray &value) | |||
40 | }); | 47 | }); |
41 | } | 48 | } |
42 | 49 | ||
50 | void Index::remove(const Identifier &key, const QByteArray &value) | ||
51 | { | ||
52 | remove(key.toInternalByteArray(), value); | ||
53 | } | ||
54 | |||
43 | void Index::remove(const QByteArray &key, const QByteArray &value) | 55 | void Index::remove(const QByteArray &key, const QByteArray &value) |
44 | { | 56 | { |
45 | mDb.remove(key, value, [&] (const Sink::Storage::DataStore::Error &error) { | 57 | mDb.remove(key, value, [&] (const Sink::Storage::DataStore::Error &error) { |