summaryrefslogtreecommitdiffstats
path: root/common/index.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-07-11 11:55:29 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-07-11 11:55:29 +0200
commit3a3118e768e1447dc7524328e84b8d7faef81fe1 (patch)
treeaf5582170ed6164fffc9365f34b17bf449c0db40 /common/index.cpp
parentf9379318d801df204cc50385c5eca1f28e91755e (diff)
parentce2fd2666f084eebe443598f6f3740a02913091e (diff)
downloadsink-3a3118e768e1447dc7524328e84b8d7faef81fe1.tar.gz
sink-3a3118e768e1447dc7524328e84b8d7faef81fe1.zip
Merge branch 'feature/notifications' into develop
Diffstat (limited to 'common/index.cpp')
-rw-r--r--common/index.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/common/index.cpp b/common/index.cpp
index 151f7af..beed45c 100644
--- a/common/index.cpp
+++ b/common/index.cpp
@@ -2,8 +2,7 @@
2 2
3#include "log.h" 3#include "log.h"
4 4
5#undef Trace 5SINK_DEBUG_AREA("index")
6#define Trace() Trace_area("index." + mName.toLatin1())
7 6
8Index::Index(const QString &storageRoot, const QString &name, Sink::Storage::AccessMode mode) 7Index::Index(const QString &storageRoot, const QString &name, Sink::Storage::AccessMode mode)
9 : mTransaction(Sink::Storage(storageRoot, name, mode).createTransaction(mode)), 8 : mTransaction(Sink::Storage(storageRoot, name, mode).createTransaction(mode)),
@@ -34,8 +33,8 @@ void Index::lookup(const QByteArray &key, const std::function<void(const QByteAr
34 resultHandler(value); 33 resultHandler(value);
35 return true; 34 return true;
36 }, 35 },
37 [errorHandler](const Sink::Storage::Error &error) { 36 [this, errorHandler](const Sink::Storage::Error &error) {
38 Warning() << "Error while retrieving value" << error.message; 37 SinkWarning() << "Error while retrieving value" << error.message;
39 errorHandler(Error(error.store, error.code, error.message)); 38 errorHandler(Error(error.store, error.code, error.message));
40 }, 39 },
41 matchSubStringKeys); 40 matchSubStringKeys);
@@ -45,6 +44,6 @@ QByteArray Index::lookup(const QByteArray &key)
45{ 44{
46 QByteArray result; 45 QByteArray result;
47 //We have to create a deep copy, otherwise the returned data may become invalid when the transaction ends. 46 //We have to create a deep copy, otherwise the returned data may become invalid when the transaction ends.
48 lookup(key, [&result](const QByteArray &value) { result = QByteArray(value.constData(), value.size()); }, [this](const Index::Error &error) { Trace() << "Error while retrieving value" << error.message; }); 47 lookup(key, [&result](const QByteArray &value) { result = QByteArray(value.constData(), value.size()); }, [this](const Index::Error &error) { SinkTrace() << "Error while retrieving value" << error.message; });
49 return result; 48 return result;
50} 49}