summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/pipeline.cpp3
-rw-r--r--dummyresource/facade.cpp2
-rw-r--r--dummyresource/resourcefactory.cpp22
-rw-r--r--synchronizer/listener.cpp1
4 files changed, 10 insertions, 18 deletions
diff --git a/common/pipeline.cpp b/common/pipeline.cpp
index 13a3344..f440c6d 100644
--- a/common/pipeline.cpp
+++ b/common/pipeline.cpp
@@ -95,7 +95,7 @@ void Pipeline::null()
95 95
96Async::Job<void> Pipeline::newEntity(void const *command, size_t size) 96Async::Job<void> Pipeline::newEntity(void const *command, size_t size)
97{ 97{
98 qDebug() << "new entity" << size; 98 qDebug() << "Pipeline: New Entity";
99 99
100 //TODO toRFC4122 would probably be more efficient, but results in non-printable keys. 100 //TODO toRFC4122 would probably be more efficient, but results in non-printable keys.
101 const auto key = QUuid::createUuid().toString().toUtf8(); 101 const auto key = QUuid::createUuid().toString().toUtf8();
@@ -137,6 +137,7 @@ Async::Job<void> Pipeline::newEntity(void const *command, size_t size)
137 137
138 storage().write(key.data(), key.size(), fbb.GetBufferPointer(), fbb.GetSize()); 138 storage().write(key.data(), key.size(), fbb.GetBufferPointer(), fbb.GetSize());
139 storage().setMaxRevision(newRevision); 139 storage().setMaxRevision(newRevision);
140 qDebug() << "Pipeline: wrote entity: "<< newRevision;
140 141
141 return Async::start<void>([this, key, entityType](Async::Future<void> &future) { 142 return Async::start<void>([this, key, entityType](Async::Future<void> &future) {
142 PipelineState state(this, NewPipeline, key, d->newPipeline[entityType], [&future]() { 143 PipelineState state(this, NewPipeline, key, d->newPipeline[entityType], [&future]() {
diff --git a/dummyresource/facade.cpp b/dummyresource/facade.cpp
index fcce871..79763ef 100644
--- a/dummyresource/facade.cpp
+++ b/dummyresource/facade.cpp
@@ -189,7 +189,7 @@ void DummyResourceFacade::readValue(QSharedPointer<Akonadi2::Storage> storage, c
189 return true; 189 return true;
190 }, 190 },
191 [](const Akonadi2::Storage::Error &error) { 191 [](const Akonadi2::Storage::Error &error) {
192 qDebug() << QString::fromStdString(error.message); 192 qWarning() << "Error during query: " << QString::fromStdString(error.message);
193 }); 193 });
194} 194}
195 195
diff --git a/dummyresource/resourcefactory.cpp b/dummyresource/resourcefactory.cpp
index 3180b9a..aefd66f 100644
--- a/dummyresource/resourcefactory.cpp
+++ b/dummyresource/resourcefactory.cpp
@@ -67,15 +67,6 @@ protected:
67 QString mId; 67 QString mId;
68}; 68};
69 69
70// template <typename DomainType>
71// class SimpleReadOnlyProcessor : public SimpleProcessor<DomainType>
72// {
73// public:
74// using SimpleProcessor::SimpleProcessor;
75// void process(Akonadi2::PipelineState state) {
76// mFunction();
77// }
78// };
79 70
80 71
81static std::string createEvent() 72static std::string createEvent()
@@ -123,6 +114,7 @@ public:
123 { 114 {
124 for (auto queue : mCommandQueues) { 115 for (auto queue : mCommandQueues) {
125 bool ret = connect(queue, &MessageQueue::messageReady, this, &Processor::process); 116 bool ret = connect(queue, &MessageQueue::messageReady, this, &Processor::process);
117 Q_UNUSED(ret);
126 Q_ASSERT(ret); 118 Q_ASSERT(ret);
127 } 119 }
128 } 120 }
@@ -184,7 +176,7 @@ private slots:
184 future.setFinished(); 176 future.setFinished();
185 }, 177 },
186 [this, messageQueueCallback, whileCallback](int errorCode, const QString &errorMessage) { 178 [this, messageQueueCallback, whileCallback](int errorCode, const QString &errorMessage) {
187 qDebug() << "Error while creating entity: " << errorCode << errorMessage; 179 qWarning() << "Error while creating entity: " << errorCode << errorMessage;
188 emit error(errorCode, errorMessage); 180 emit error(errorCode, errorMessage);
189 messageQueueCallback(true); 181 messageQueueCallback(true);
190 whileCallback(false); 182 whileCallback(false);
@@ -200,7 +192,6 @@ private slots:
200 } 192 }
201 }, 193 },
202 [whileCallback](const MessageQueue::Error &error) { 194 [whileCallback](const MessageQueue::Error &error) {
203 qDebug() << "no more messages in queue";
204 whileCallback(true); 195 whileCallback(true);
205 }); 196 });
206 }, 197 },
@@ -260,7 +251,7 @@ void DummyResource::configurePipeline(Akonadi2::Pipeline *pipeline)
260 //Eventually the order should be self configuring, for now it's hardcoded. 251 //Eventually the order should be self configuring, for now it's hardcoded.
261 auto eventIndexer = new SimpleProcessor("summaryprocessor", [eventFactory](const Akonadi2::PipelineState &state, const Akonadi2::Entity &entity) { 252 auto eventIndexer = new SimpleProcessor("summaryprocessor", [eventFactory](const Akonadi2::PipelineState &state, const Akonadi2::Entity &entity) {
262 auto adaptor = eventFactory->createAdaptor(entity); 253 auto adaptor = eventFactory->createAdaptor(entity);
263 qDebug() << "Summary preprocessor: " << adaptor->getProperty("summary").toString(); 254 // qDebug() << "Summary preprocessor: " << adaptor->getProperty("summary").toString();
264 }); 255 });
265 256
266 auto uidIndexer = new SimpleProcessor("uidIndexer", [eventFactory](const Akonadi2::PipelineState &state, const Akonadi2::Entity &entity) { 257 auto uidIndexer = new SimpleProcessor("uidIndexer", [eventFactory](const Akonadi2::PipelineState &state, const Akonadi2::Entity &entity) {
@@ -293,7 +284,7 @@ void DummyResource::configurePipeline(Akonadi2::Pipeline *pipeline)
293 284
294void DummyResource::onProcessorError(int errorCode, const QString &errorMessage) 285void DummyResource::onProcessorError(int errorCode, const QString &errorMessage)
295{ 286{
296 qDebug() << "Received error from Processor: " << errorCode << errorMessage; 287 qWarning() << "Received error from Processor: " << errorCode << errorMessage;
297 mError = errorCode; 288 mError = errorCode;
298} 289}
299 290
@@ -340,7 +331,6 @@ void DummyResource::enqueueCommand(MessageQueue &mq, int commandId, const QByteA
340 331
341Async::Job<void> DummyResource::synchronizeWithSource(Akonadi2::Pipeline *pipeline) 332Async::Job<void> DummyResource::synchronizeWithSource(Akonadi2::Pipeline *pipeline)
342{ 333{
343 qDebug() << "synchronizeWithSource";
344 return Async::start<void>([this, pipeline](Async::Future<void> &f) { 334 return Async::start<void>([this, pipeline](Async::Future<void> &f) {
345 //TODO use a read-only transaction during the complete sync to sync against a defined revision 335 //TODO use a read-only transaction during the complete sync to sync against a defined revision
346 auto storage = QSharedPointer<Akonadi2::Storage>::create(Akonadi2::Store::storageLocation(), "org.kde.dummy"); 336 auto storage = QSharedPointer<Akonadi2::Storage>::create(Akonadi2::Store::storageLocation(), "org.kde.dummy");
@@ -387,7 +377,6 @@ Async::Job<void> DummyResource::synchronizeWithSource(Akonadi2::Pipeline *pipeli
387 } 377 }
388 } 378 }
389 //TODO find items to remove 379 //TODO find items to remove
390 qDebug() << "sync complete";
391 f.setFinished(); 380 f.setFinished();
392 }); 381 });
393} 382}
@@ -399,9 +388,11 @@ Async::Job<void> DummyResource::processAllMessages()
399 //TODO: report errors while processing sync? 388 //TODO: report errors while processing sync?
400 //TODO: also check user-queue? 389 //TODO: also check user-queue?
401 if (mSynchronizerQueue.isEmpty()) { 390 if (mSynchronizerQueue.isEmpty()) {
391 qDebug() << "synchronizer queue is empty";
402 f.setFinished(); 392 f.setFinished();
403 } else { 393 } else {
404 QObject::connect(&mSynchronizerQueue, &MessageQueue::drained, [&f]() { 394 QObject::connect(&mSynchronizerQueue, &MessageQueue::drained, [&f]() {
395 qDebug() << "synchronizer queue drained";
405 f.setFinished(); 396 f.setFinished();
406 }); 397 });
407 } 398 }
@@ -410,7 +401,6 @@ Async::Job<void> DummyResource::processAllMessages()
410 401
411void DummyResource::processCommand(int commandId, const QByteArray &data, uint size, Akonadi2::Pipeline *pipeline) 402void DummyResource::processCommand(int commandId, const QByteArray &data, uint size, Akonadi2::Pipeline *pipeline)
412{ 403{
413 qDebug() << "processCommand";
414 //TODO instead of copying the command including the full entity first into the command queue, we could directly 404 //TODO instead of copying the command including the full entity first into the command queue, we could directly
415 //create a new revision, only pushing a handle into the commandqueue with the relevant changeset (for changereplay). 405 //create a new revision, only pushing a handle into the commandqueue with the relevant changeset (for changereplay).
416 //The problem is that we then require write access from multiple threads (or even processes to avoid sending the full entity over the wire). 406 //The problem is that we then require write access from multiple threads (or even processes to avoid sending the full entity over the wire).
diff --git a/synchronizer/listener.cpp b/synchronizer/listener.cpp
index 147ed9f..1294c76 100644
--- a/synchronizer/listener.cpp
+++ b/synchronizer/listener.cpp
@@ -129,6 +129,7 @@ void Listener::clientDropped()
129void Listener::checkConnections() 129void Listener::checkConnections()
130{ 130{
131 if (m_connections.isEmpty()) { 131 if (m_connections.isEmpty()) {
132 log(QString("No connections, shutting down."));
132 m_server->close(); 133 m_server->close();
133 emit noClients(); 134 emit noClients();
134 } 135 }