From f10d223559b16c576093eea080dc0d5638ab3323 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 8 Apr 2015 10:04:48 +0200 Subject: cleanup --- common/clientapi.h | 3 +++ dummyresource/domainadaptor.h | 1 - dummyresource/facade.cpp | 1 + dummyresource/resourcefactory.cpp | 19 ++++--------------- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/common/clientapi.h b/common/clientapi.h index 63305ab..0ee934c 100644 --- a/common/clientapi.h +++ b/common/clientapi.h @@ -298,6 +298,9 @@ using namespace async; * * what resources to search * * filters on various properties (parent collection, startDate range, ....) * * properties we need (for on-demand querying) + * + * syncOnDemand: Execute a source sync before executing the query + * processAll: Ensure all local messages are processed before querying to guarantee an up-to date dataset. */ class Query { diff --git a/dummyresource/domainadaptor.h b/dummyresource/domainadaptor.h index 9474176..a2fb8a9 100644 --- a/dummyresource/domainadaptor.h +++ b/dummyresource/domainadaptor.h @@ -1,4 +1,3 @@ - #pragma once #include "common/domainadaptor.h" diff --git a/dummyresource/facade.cpp b/dummyresource/facade.cpp index 4b7cd53..d196e54 100644 --- a/dummyresource/facade.cpp +++ b/dummyresource/facade.cpp @@ -120,6 +120,7 @@ Async::Job DummyResourceFacade::synchronizeResource(bool sync, bool proces //TODO check if a sync is necessary //TODO Only sync what was requested //TODO timeout + //TODO the synchronization should normally not be necessary: We just return what is already available. if (sync || processAll) { return Async::start([=](Async::Future &future) { 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: return; } auto queuedCommand = Akonadi2::GetQueuedCommand(ptr); - qDebug() << "Dequeued: " << queuedCommand->commandId(); + Trace() << "Dequeued: " << queuedCommand->commandId(); //TODO JOBAPI: job lifetime management //Right now we're just leaking jobs. In this case we'd like jobs that are heap allocated and delete //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) //Eventually the order should be self configuring, for now it's hardcoded. auto eventIndexer = new SimpleProcessor("summaryprocessor", [eventFactory](const Akonadi2::PipelineState &state, const Akonadi2::Entity &entity) { auto adaptor = eventFactory->createAdaptor(entity); - // qDebug() << "Summary preprocessor: " << adaptor->getProperty("summary").toString(); + // Log() << "Summary preprocessor: " << adaptor->getProperty("summary").toString(); }); auto uidIndexer = new SimpleProcessor("uidIndexer", [eventFactory](const Akonadi2::PipelineState &state, const Akonadi2::Entity &entity) { static Index uidIndex(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/akonadi2/storage", "org.kde.dummy.index.uid", Akonadi2::Storage::ReadWrite); + //TODO: Benchmark if this is performance wise acceptable, or if we have to access the buffer directly auto adaptor = eventFactory->createAdaptor(entity); const auto uid = adaptor->getProperty("uid"); if (uid.isValid()) { uidIndex.add(uid.toByteArray(), state.key()); } - - //TODO would this be worthwhile for performance reasons? - // flatbuffers::Verifier verifyer(entity.local()->Data(), entity.local()->size()); - // if (!Akonadi2::Domain::Buffer::VerifyEventBuffer(verifyer)) { - // qWarning() << "invalid local buffer"; - // return; - // } - // auto localEvent = Akonadi2::Domain::Buffer::GetEvent(entity.local()->Data()); - // if (localEvent && localEvent->uid()) { - // qDebug() << "got uid: " << QByteArray::fromRawData(reinterpret_cast(localEvent->uid()->Data()), localEvent->uid()->size()); - // uidIndex.add(QByteArray::fromRawData(reinterpret_cast(localEvent->uid()->Data()), localEvent->uid()->size()), state.key()); - // } }); //event is the entitytype and not the domain type @@ -288,7 +277,7 @@ void DummyResource::configurePipeline(Akonadi2::Pipeline *pipeline) void DummyResource::onProcessorError(int errorCode, const QString &errorMessage) { - qWarning() << "Received error from Processor: " << errorCode << errorMessage; + Warning() << "Received error from Processor: " << errorCode << errorMessage; mError = errorCode; } -- cgit v1.2.3