summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-01-18 16:02:40 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-01-18 16:02:40 +0100
commit4983c40b580a2421c9be43760e6a8bebdb156ef3 (patch)
tree822416b239d0c1f702c88bc11d98a75a45a1e537
parent62d222f20de7558ebb266efdcadf458e3807e406 (diff)
downloadsink-4983c40b580a2421c9be43760e6a8bebdb156ef3.tar.gz
sink-4983c40b580a2421c9be43760e6a8bebdb156ef3.zip
Debug output
-rw-r--r--common/domain/applicationdomaintype.cpp4
-rw-r--r--common/index.cpp2
-rw-r--r--common/synchronizer.cpp6
-rw-r--r--common/synchronizerstore.cpp2
4 files changed, 9 insertions, 5 deletions
diff --git a/common/domain/applicationdomaintype.cpp b/common/domain/applicationdomaintype.cpp
index 75438d5..1647951 100644
--- a/common/domain/applicationdomaintype.cpp
+++ b/common/domain/applicationdomaintype.cpp
@@ -150,7 +150,7 @@ QByteArray ApplicationDomainType::getBlobProperty(const QByteArray &key) const
150 const auto path = getProperty(key).value<BLOB>().value; 150 const auto path = getProperty(key).value<BLOB>().value;
151 QFile file(path); 151 QFile file(path);
152 if (!file.open(QIODevice::ReadOnly)) { 152 if (!file.open(QIODevice::ReadOnly)) {
153 SinkError() << "Failed to open the file: " << file.errorString() << path; 153 SinkError() << "Failed to open the file for reading: " << file.errorString() << path << " For property " << key;
154 return QByteArray(); 154 return QByteArray();
155 } 155 }
156 return file.readAll(); 156 return file.readAll();
@@ -161,7 +161,7 @@ void ApplicationDomainType::setBlobProperty(const QByteArray &key, const QByteAr
161 const auto path = Sink::temporaryFileLocation() + "/" + QUuid::createUuid().toString(); 161 const auto path = Sink::temporaryFileLocation() + "/" + QUuid::createUuid().toString();
162 QFile file(path); 162 QFile file(path);
163 if (!file.open(QIODevice::WriteOnly)) { 163 if (!file.open(QIODevice::WriteOnly)) {
164 SinkError() << "Failed to open the file: " << file.errorString() << path; 164 SinkError() << "Failed to open the file for writing: " << file.errorString() << path<< " For property " << key;
165 return; 165 return;
166 } 166 }
167 file.write(value); 167 file.write(value);
diff --git a/common/index.cpp b/common/index.cpp
index c864e77..f3d05f1 100644
--- a/common/index.cpp
+++ b/common/index.cpp
@@ -44,6 +44,6 @@ QByteArray Index::lookup(const QByteArray &key)
44{ 44{
45 QByteArray result; 45 QByteArray result;
46 //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.
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; }); 47 lookup(key, [&result](const QByteArray &value) { result = QByteArray(value.constData(), value.size()); }, [this](const Index::Error &error) { SinkWarning() << "Error while retrieving value" << error.message; });
48 return result; 48 return result;
49} 49}
diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp
index d86b027..d94083b 100644
--- a/common/synchronizer.cpp
+++ b/common/synchronizer.cpp
@@ -277,6 +277,7 @@ void Synchronizer::flush(int commandId, const QByteArray &flushId)
277KAsync::Job<void> Synchronizer::processSyncQueue() 277KAsync::Job<void> Synchronizer::processSyncQueue()
278{ 278{
279 if (mSyncRequestQueue.isEmpty() || mSyncInProgress) { 279 if (mSyncRequestQueue.isEmpty() || mSyncInProgress) {
280 SinkTrace() << "Sync still in progress or nothing to do.";
280 return KAsync::null<void>(); 281 return KAsync::null<void>();
281 } 282 }
282 283
@@ -285,7 +286,7 @@ KAsync::Job<void> Synchronizer::processSyncQueue()
285 mSyncInProgress = true; 286 mSyncInProgress = true;
286 }); 287 });
287 while (!mSyncRequestQueue.isEmpty()) { 288 while (!mSyncRequestQueue.isEmpty()) {
288 auto request = mSyncRequestQueue.takeFirst(); 289 const auto request = mSyncRequestQueue.takeFirst();
289 if (request.requestType == Synchronizer::SyncRequest::Synchronization) { 290 if (request.requestType == Synchronizer::SyncRequest::Synchronization) {
290 job = job.then([this, request] { 291 job = job.then([this, request] {
291 Sink::Notification n; 292 Sink::Notification n;
@@ -343,6 +344,7 @@ KAsync::Job<void> Synchronizer::processSyncQueue()
343 } 344 }
344 } 345 }
345 return job.then<void>([this](const KAsync::Error &error) { 346 return job.then<void>([this](const KAsync::Error &error) {
347 SinkTrace() << "Sync request processed";
346 mSyncTransaction.abort(); 348 mSyncTransaction.abort();
347 mMessageQueue->commit(); 349 mMessageQueue->commit();
348 mSyncStore.clear(); 350 mSyncStore.clear();
@@ -446,6 +448,8 @@ KAsync::Job<void> Synchronizer::replay(const QByteArray &type, const QByteArray
446 } else if (type == ApplicationDomain::getTypeName<ApplicationDomain::Mail>()) { 448 } else if (type == ApplicationDomain::getTypeName<ApplicationDomain::Mail>()) {
447 auto mail = store().readEntity<ApplicationDomain::Mail>(key); 449 auto mail = store().readEntity<ApplicationDomain::Mail>(key);
448 job = replay(mail, operation, oldRemoteId, modifiedProperties); 450 job = replay(mail, operation, oldRemoteId, modifiedProperties);
451 } else {
452 SinkError() << "Replayed unknown type: " << type;
449 } 453 }
450 454
451 return job.then([this, operation, type, uid, oldRemoteId](const QByteArray &remoteId) { 455 return job.then([this, operation, type, uid, oldRemoteId](const QByteArray &remoteId) {
diff --git a/common/synchronizerstore.cpp b/common/synchronizerstore.cpp
index 31c1391..dea4821 100644
--- a/common/synchronizerstore.cpp
+++ b/common/synchronizerstore.cpp
@@ -73,7 +73,7 @@ QByteArray SynchronizerStore::resolveLocalId(const QByteArray &bufferType, const
73{ 73{
74 QByteArray remoteId = Index("localid.mapping." + bufferType, mTransaction).lookup(localId); 74 QByteArray remoteId = Index("localid.mapping." + bufferType, mTransaction).lookup(localId);
75 if (remoteId.isEmpty()) { 75 if (remoteId.isEmpty()) {
76 SinkWarning() << "Couldn't find the remote id for " << localId; 76 SinkWarning() << "Couldn't find the remote id for " << bufferType << localId;
77 return QByteArray(); 77 return QByteArray();
78 } 78 }
79 return remoteId; 79 return remoteId;