summaryrefslogtreecommitdiffstats
path: root/dummyresource/resourcefactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dummyresource/resourcefactory.cpp')
-rw-r--r--dummyresource/resourcefactory.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/dummyresource/resourcefactory.cpp b/dummyresource/resourcefactory.cpp
index 869ddbf..ea37466 100644
--- a/dummyresource/resourcefactory.cpp
+++ b/dummyresource/resourcefactory.cpp
@@ -190,7 +190,7 @@ private slots:
190 return; 190 return;
191 } 191 }
192 auto queuedCommand = Akonadi2::GetQueuedCommand(ptr); 192 auto queuedCommand = Akonadi2::GetQueuedCommand(ptr);
193 qDebug() << "Dequeued: " << queuedCommand->commandId(); 193 Trace() << "Dequeued: " << queuedCommand->commandId();
194 //TODO JOBAPI: job lifetime management 194 //TODO JOBAPI: job lifetime management
195 //Right now we're just leaking jobs. In this case we'd like jobs that are heap allocated and delete 195 //Right now we're just leaking jobs. In this case we'd like jobs that are heap allocated and delete
196 //themselves once done. In other cases we'd like jobs that only live as long as their handle though. 196 //themselves once done. In other cases we'd like jobs that only live as long as their handle though.
@@ -255,29 +255,18 @@ void DummyResource::configurePipeline(Akonadi2::Pipeline *pipeline)
255 //Eventually the order should be self configuring, for now it's hardcoded. 255 //Eventually the order should be self configuring, for now it's hardcoded.
256 auto eventIndexer = new SimpleProcessor("summaryprocessor", [eventFactory](const Akonadi2::PipelineState &state, const Akonadi2::Entity &entity) { 256 auto eventIndexer = new SimpleProcessor("summaryprocessor", [eventFactory](const Akonadi2::PipelineState &state, const Akonadi2::Entity &entity) {
257 auto adaptor = eventFactory->createAdaptor(entity); 257 auto adaptor = eventFactory->createAdaptor(entity);
258 // qDebug() << "Summary preprocessor: " << adaptor->getProperty("summary").toString(); 258 // Log() << "Summary preprocessor: " << adaptor->getProperty("summary").toString();
259 }); 259 });
260 260
261 auto uidIndexer = new SimpleProcessor("uidIndexer", [eventFactory](const Akonadi2::PipelineState &state, const Akonadi2::Entity &entity) { 261 auto uidIndexer = new SimpleProcessor("uidIndexer", [eventFactory](const Akonadi2::PipelineState &state, const Akonadi2::Entity &entity) {
262 static Index uidIndex(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/akonadi2/storage", "org.kde.dummy.index.uid", Akonadi2::Storage::ReadWrite); 262 static Index uidIndex(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/akonadi2/storage", "org.kde.dummy.index.uid", Akonadi2::Storage::ReadWrite);
263 263
264 //TODO: Benchmark if this is performance wise acceptable, or if we have to access the buffer directly
264 auto adaptor = eventFactory->createAdaptor(entity); 265 auto adaptor = eventFactory->createAdaptor(entity);
265 const auto uid = adaptor->getProperty("uid"); 266 const auto uid = adaptor->getProperty("uid");
266 if (uid.isValid()) { 267 if (uid.isValid()) {
267 uidIndex.add(uid.toByteArray(), state.key()); 268 uidIndex.add(uid.toByteArray(), state.key());
268 } 269 }
269
270 //TODO would this be worthwhile for performance reasons?
271 // flatbuffers::Verifier verifyer(entity.local()->Data(), entity.local()->size());
272 // if (!Akonadi2::Domain::Buffer::VerifyEventBuffer(verifyer)) {
273 // qWarning() << "invalid local buffer";
274 // return;
275 // }
276 // auto localEvent = Akonadi2::Domain::Buffer::GetEvent(entity.local()->Data());
277 // if (localEvent && localEvent->uid()) {
278 // qDebug() << "got uid: " << QByteArray::fromRawData(reinterpret_cast<const char *>(localEvent->uid()->Data()), localEvent->uid()->size());
279 // uidIndex.add(QByteArray::fromRawData(reinterpret_cast<const char *>(localEvent->uid()->Data()), localEvent->uid()->size()), state.key());
280 // }
281 }); 270 });
282 271
283 //event is the entitytype and not the domain type 272 //event is the entitytype and not the domain type
@@ -288,7 +277,7 @@ void DummyResource::configurePipeline(Akonadi2::Pipeline *pipeline)
288 277
289void DummyResource::onProcessorError(int errorCode, const QString &errorMessage) 278void DummyResource::onProcessorError(int errorCode, const QString &errorMessage)
290{ 279{
291 qWarning() << "Received error from Processor: " << errorCode << errorMessage; 280 Warning() << "Received error from Processor: " << errorCode << errorMessage;
292 mError = errorCode; 281 mError = errorCode;
293} 282}
294 283