From be652c12dfa5162d952f5226de453e1a29957c3a Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 2 Mar 2017 12:27:09 +0100 Subject: Port away from syncStart --- common/asyncutils.h | 2 +- common/commandprocessor.cpp | 2 +- common/queryrunner.cpp | 2 +- common/resourcefacade.cpp | 6 +++--- common/synchronizer.cpp | 8 ++++---- common/test.cpp | 2 +- examples/dummyresource/resourcefactory.cpp | 2 +- tests/clientapitest.cpp | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/common/asyncutils.h b/common/asyncutils.h index 7b62eb2..67b5928 100644 --- a/common/asyncutils.h +++ b/common/asyncutils.h @@ -39,7 +39,7 @@ KAsync::Job run(const std::function &f, bool runAsync = true) }); }); } else { - return KAsync::syncStart([f]() { + return KAsync::start([f]() { return f(); }); } diff --git a/common/commandprocessor.cpp b/common/commandprocessor.cpp index 5d5261f..33e2f81 100644 --- a/common/commandprocessor.cpp +++ b/common/commandprocessor.cpp @@ -227,7 +227,7 @@ KAsync::Job CommandProcessor::processQueuedCommand(const QByteArray &dat KAsync::Job CommandProcessor::processQueue(MessageQueue *queue) { auto time = QSharedPointer::create(); - return KAsync::syncStart([this]() { mPipeline->startTransaction(); }) + return KAsync::start([this]() { mPipeline->startTransaction(); }) .then(KAsync::doWhile( [this, queue, time]() -> KAsync::Job { return queue->dequeueBatch(sBatchSize, diff --git a/common/queryrunner.cpp b/common/queryrunner.cpp index cb3687f..802fc48 100644 --- a/common/queryrunner.cpp +++ b/common/queryrunner.cpp @@ -125,7 +125,7 @@ QueryRunner::QueryRunner(const Sink::Query &query, const Sink::Resou return KAsync::null(); } Q_ASSERT(!mQueryInProgress); - return KAsync::syncStart([&] { + return KAsync::start([&] { mQueryInProgress = true; }) .then(async::run([=]() { diff --git a/common/resourcefacade.cpp b/common/resourcefacade.cpp index 13cad64..4a8037d 100644 --- a/common/resourcefacade.cpp +++ b/common/resourcefacade.cpp @@ -196,7 +196,7 @@ KAsync::Job LocalStorageFacade::create(const DomainType &domai { auto configStoreIdentifier = mIdentifier; auto typeName = mTypeName; - return KAsync::syncStart([domainObject, configStoreIdentifier, typeName]() { + return KAsync::start([domainObject, configStoreIdentifier, typeName]() { const QByteArray type = domainObject.getProperty(typeName).toByteArray(); const QByteArray providedIdentifier = domainObject.identifier().isEmpty() ? domainObject.getProperty("identifier").toByteArray() : domainObject.identifier(); const QByteArray identifier = providedIdentifier.isEmpty() ? ResourceConfig::newIdentifier(type) : providedIdentifier; @@ -222,7 +222,7 @@ KAsync::Job LocalStorageFacade::modify(const DomainType &domai { auto configStoreIdentifier = mIdentifier; auto typeName = mTypeName; - return KAsync::syncStart([domainObject, configStoreIdentifier, typeName]() { + return KAsync::start([domainObject, configStoreIdentifier, typeName]() { const QByteArray identifier = domainObject.identifier(); if (identifier.isEmpty()) { SinkWarning() << "We need an \"identifier\" property to identify the entity to configure."; @@ -263,7 +263,7 @@ KAsync::Job LocalStorageFacade::remove(const DomainType &domai { auto configStoreIdentifier = mIdentifier; auto typeName = mTypeName; - return KAsync::syncStart([domainObject, configStoreIdentifier, typeName]() { + return KAsync::start([domainObject, configStoreIdentifier, typeName]() { const QByteArray identifier = domainObject.identifier(); if (identifier.isEmpty()) { SinkWarning() << "We need an \"identifier\" property to identify the entity to configure"; diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp index 57c5d90..b147615 100644 --- a/common/synchronizer.cpp +++ b/common/synchronizer.cpp @@ -289,7 +289,7 @@ void Synchronizer::flushComplete(const QByteArray &flushId) KAsync::Job Synchronizer::processRequest(const SyncRequest &request) { if (request.options & SyncRequest::RequestFlush) { - return KAsync::syncStart([=] { + return KAsync::start([=] { //Trigger a flush and record original request without flush option auto modifiedRequest = request; modifiedRequest.options = SyncRequest::NoOptions; @@ -309,7 +309,7 @@ KAsync::Job Synchronizer::processRequest(const SyncRequest &request) enqueueCommand(Sink::Commands::FlushCommand, BufferUtils::extractBuffer(fbb)); }); } else if (request.requestType == Synchronizer::SyncRequest::Synchronization) { - return KAsync::syncStart([this, request] { + return KAsync::start([this, request] { Sink::Notification n; n.id = request.requestId; n.type = Notification::Status; @@ -343,7 +343,7 @@ KAsync::Job Synchronizer::processRequest(const SyncRequest &request) } }); } else if (request.requestType == Synchronizer::SyncRequest::Flush) { - return KAsync::syncStart([=] { + return KAsync::start([=] { Q_ASSERT(!request.requestId.isEmpty()); //FIXME it looks like this is emitted before the replay actually finishes if (request.flushType == Flush::FlushReplayQueue) { @@ -387,7 +387,7 @@ KAsync::Job Synchronizer::processSyncQueue() } const auto request = mSyncRequestQueue.takeFirst(); - return KAsync::syncStart([this] { + return KAsync::start([this] { mMessageQueue->startTransaction(); mEntityStore->startTransaction(Sink::Storage::DataStore::ReadOnly); mSyncInProgress = true; diff --git a/common/test.cpp b/common/test.cpp index 387fcda..90586ba 100644 --- a/common/test.cpp +++ b/common/test.cpp @@ -168,7 +168,7 @@ public: } resultProvider->initialResultSetComplete(parent, true); }); - auto job = KAsync::syncStart([query, resultProvider]() {}); + auto job = KAsync::start([query, resultProvider]() {}); return qMakePair(job, emitter); } diff --git a/examples/dummyresource/resourcefactory.cpp b/examples/dummyresource/resourcefactory.cpp index a7d30c5..e915710 100644 --- a/examples/dummyresource/resourcefactory.cpp +++ b/examples/dummyresource/resourcefactory.cpp @@ -115,7 +115,7 @@ class DummySynchronizer : public Sink::Synchronizer { n.message = "We're connected"; n.code = Sink::ApplicationDomain::ConnectedStatus; emit notify(n); - return KAsync::syncStart([this]() { + return KAsync::start([this]() { synchronize(ENTITY_TYPE_EVENT, DummyStore::instance().events(), [this](const QByteArray &ridBuffer, const QMap &data) { return createEvent(ridBuffer, data); }); diff --git a/tests/clientapitest.cpp b/tests/clientapitest.cpp index 008b408..da52afb 100644 --- a/tests/clientapitest.cpp +++ b/tests/clientapitest.cpp @@ -99,7 +99,7 @@ public: return 0; }, runAsync).exec(); }); - auto job = KAsync::syncStart([query, resultProvider]() {}); + auto job = KAsync::start([query, resultProvider]() {}); mResultProvider = resultProvider.data(); return qMakePair(job, emitter); } -- cgit v1.2.3