From 12cc3f612c3ebe9522f98c808f9d7115d8e222ce Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 21 Oct 2015 14:21:16 +0200 Subject: Cleanup --- common/domainadaptor.h | 4 ++-- common/facade.h | 11 +++++------ common/genericresource.cpp | 3 ++- common/log.cpp | 2 +- common/pipeline.cpp | 1 - common/pipeline.h | 2 +- common/resource.h | 12 ++++++++++++ 7 files changed, 23 insertions(+), 12 deletions(-) (limited to 'common') diff --git a/common/domainadaptor.h b/common/domainadaptor.h index 4943cc0..e881b9a 100644 --- a/common/domainadaptor.h +++ b/common/domainadaptor.h @@ -173,13 +173,13 @@ public: { flatbuffers::FlatBufferBuilder localFbb; if (mLocalWriteMapper) { - Trace() << "Creating local buffer part"; + // Trace() << "Creating local buffer part"; createBufferPartBuffer(domainObject, localFbb, *mLocalWriteMapper); } flatbuffers::FlatBufferBuilder resFbb; if (mResourceWriteMapper) { - Trace() << "Creating resouce buffer part"; + // Trace() << "Creating resouce buffer part"; createBufferPartBuffer(domainObject, resFbb, *mResourceWriteMapper); } diff --git a/common/facade.h b/common/facade.h index 0ddc205..13734f0 100644 --- a/common/facade.h +++ b/common/facade.h @@ -271,7 +271,7 @@ public: } //We have to capture the runner to keep it alive - return synchronizeResource(query.syncOnDemand, query.processAll).template then([runner](KAsync::Future &future) { + return synchronizeResource(query).template then([runner](KAsync::Future &future) { runner->run().then([&future]() { future.setFinished(); }).exec(); @@ -281,19 +281,18 @@ public: }); } -protected: - KAsync::Job synchronizeResource(bool sync, bool processAll) +private: + KAsync::Job synchronizeResource(const Akonadi2::Query &query) { //TODO check if a sync is necessary //TODO Only sync what was requested //TODO timeout - if (sync || processAll) { - return mResourceAccess->synchronizeResource(sync, processAll); + if (query.syncOnDemand || query.processAll) { + return mResourceAccess->synchronizeResource(query.syncOnDemand, query.processAll); } return KAsync::null(); } -private: virtual KAsync::Job load(const Akonadi2::Query &query, const QSharedPointer > &resultProvider, qint64 oldRevision) { return KAsync::start([=]() -> qint64 { diff --git a/common/genericresource.cpp b/common/genericresource.cpp index 8ae20ed..dcae43d 100644 --- a/common/genericresource.cpp +++ b/common/genericresource.cpp @@ -26,7 +26,7 @@ public: typedef std::function(const QByteArray &type, const QByteArray &key, const QByteArray &value)> ReplayFunction; - ChangeReplay(const QString &resourceName, const ReplayFunction replayFunction) + ChangeReplay(const QString &resourceName, const ReplayFunction &replayFunction) : mStorage(storageLocation(), resourceName, Storage::ReadOnly), mChangeReplayStore(storageLocation(), resourceName + ".changereplay", Storage::ReadWrite), mReplayFunction(replayFunction) @@ -224,6 +224,7 @@ private slots: KAsync::Job processPipeline() { mPipeline->startTransaction(); + Trace() << "Cleaning up from " << mPipeline->cleanedUpRevision() + 1 << " to " << mLowerBoundRevision; for (qint64 revision = mPipeline->cleanedUpRevision() + 1; revision <= mLowerBoundRevision; revision++) { mPipeline->cleanupRevision(revision); } diff --git a/common/log.cpp b/common/log.cpp index 25102dd..c33c700 100644 --- a/common/log.cpp +++ b/common/log.cpp @@ -187,7 +187,7 @@ QDebug Akonadi2::Log::debugStream(DebugLevel debugLevel, int line, const char* f } if (showLocation) { output += QString(" %3").arg(function); - /*debug << file << ":" << line */ + output += QString("%1:%2").arg(file).arg(line); } output += ":"; diff --git a/common/pipeline.cpp b/common/pipeline.cpp index 9816129..15d2401 100644 --- a/common/pipeline.cpp +++ b/common/pipeline.cpp @@ -518,7 +518,6 @@ void PipelineState::step() void PipelineState::processingCompleted(Preprocessor *filter) { - //TODO record processing progress if (d->pipeline && filter == d->filterIt.peekPrevious()) { d->idle = true; d->pipeline->pipelineStepped(*this); diff --git a/common/pipeline.h b/common/pipeline.h index 837c18a..c8d9ddc 100644 --- a/common/pipeline.h +++ b/common/pipeline.h @@ -164,7 +164,7 @@ public: }); } - QString id() const + QString id() const Q_DECL_OVERRIDE { return mId; } diff --git a/common/resource.h b/common/resource.h index 33805ca..4ed21b5 100644 --- a/common/resource.h +++ b/common/resource.h @@ -37,8 +37,20 @@ public: virtual ~Resource(); virtual void processCommand(int commandId, const QByteArray &data); + + /** + * Execute synchronization with the source. + */ virtual KAsync::Job synchronizeWithSource(); + + /** + * Process all internal messages, thus ensuring the store is up to date and no pending modifications are left. + */ virtual KAsync::Job processAllMessages(); + + /** + * Set the lowest revision that is still referenced by external clients. + */ virtual void setLowerBoundRevision(qint64 revision); Q_SIGNALS: -- cgit v1.2.3