summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-11-07 21:48:44 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-11-07 21:48:44 +0100
commit89b6f63bab839ab0504cd3067f0389afe4dc47e3 (patch)
tree62c527983d63827bb722010ea8c59d5af0e5a879
parent438c74630e5f8c9a46d00b991f5cb8ecd479dafe (diff)
downloadsink-89b6f63bab839ab0504cd3067f0389afe4dc47e3.tar.gz
sink-89b6f63bab839ab0504cd3067f0389afe4dc47e3.zip
Implement debug stream operators for query.
-rw-r--r--common/commands/synchronize.fbs1
-rw-r--r--common/genericresource.cpp6
-rw-r--r--common/genericresource.h2
-rw-r--r--common/listener.cpp8
-rw-r--r--common/query.cpp20
-rw-r--r--common/query.h4
-rw-r--r--common/queryrunner.cpp2
-rw-r--r--common/resource.cpp2
-rw-r--r--common/resource.h3
-rw-r--r--common/resourceaccess.cpp19
-rw-r--r--common/resourceaccess.h2
-rw-r--r--common/store.cpp30
-rw-r--r--common/store.h2
-rw-r--r--common/synchronizer.cpp4
-rw-r--r--common/synchronizer.h4
-rw-r--r--examples/dummyresource/resourcefactory.cpp6
-rw-r--r--examples/dummyresource/resourcefactory.h2
-rw-r--r--examples/imapresource/imapresource.cpp2
-rw-r--r--examples/maildirresource/maildirresource.cpp2
-rw-r--r--examples/mailtransportresource/mailtransportresource.cpp2
-rw-r--r--tests/dummyresourcetest.cpp2
-rw-r--r--tests/maildirsyncbenchmark.cpp2
-rw-r--r--tests/testimplementations.h6
23 files changed, 102 insertions, 31 deletions
diff --git a/common/commands/synchronize.fbs b/common/commands/synchronize.fbs
index 5528166..62f4b2b 100644
--- a/common/commands/synchronize.fbs
+++ b/common/commands/synchronize.fbs
@@ -3,6 +3,7 @@ namespace Sink.Commands;
3table Synchronize { 3table Synchronize {
4 sourceSync: bool; //Synchronize with source 4 sourceSync: bool; //Synchronize with source
5 localSync: bool; //Ensure all queues are processed so the local state is up-to date. 5 localSync: bool; //Ensure all queues are processed so the local state is up-to date.
6 query: string;
6} 7}
7 8
8root_type Synchronize; 9root_type Synchronize;
diff --git a/common/genericresource.cpp b/common/genericresource.cpp
index 39bd39e..1fc7744 100644
--- a/common/genericresource.cpp
+++ b/common/genericresource.cpp
@@ -399,9 +399,9 @@ void GenericResource::processCommand(int commandId, const QByteArray &data)
399 } 399 }
400} 400}
401 401
402KAsync::Job<void> GenericResource::synchronizeWithSource() 402KAsync::Job<void> GenericResource::synchronizeWithSource(const Sink::QueryBase &query)
403{ 403{
404 return KAsync::start<void>([this]() { 404 return KAsync::start<void>([this, query] {
405 405
406 Sink::Notification n; 406 Sink::Notification n;
407 n.id = "sync"; 407 n.id = "sync";
@@ -413,7 +413,7 @@ KAsync::Job<void> GenericResource::synchronizeWithSource()
413 SinkLog() << " Synchronizing"; 413 SinkLog() << " Synchronizing";
414 // Changereplay would deadlock otherwise when trying to open the synchronization store 414 // Changereplay would deadlock otherwise when trying to open the synchronization store
415 enableChangeReplay(false); 415 enableChangeReplay(false);
416 return mSynchronizer->synchronize() 416 return mSynchronizer->synchronize(query)
417 .then<void>([this](const KAsync::Error &error) { 417 .then<void>([this](const KAsync::Error &error) {
418 enableChangeReplay(true); 418 enableChangeReplay(true);
419 if (!error) { 419 if (!error) {
diff --git a/common/genericresource.h b/common/genericresource.h
index 687e307..3736c8f 100644
--- a/common/genericresource.h
+++ b/common/genericresource.h
@@ -47,7 +47,7 @@ public:
47 virtual ~GenericResource(); 47 virtual ~GenericResource();
48 48
49 virtual void processCommand(int commandId, const QByteArray &data) Q_DECL_OVERRIDE; 49 virtual void processCommand(int commandId, const QByteArray &data) Q_DECL_OVERRIDE;
50 virtual KAsync::Job<void> synchronizeWithSource() Q_DECL_OVERRIDE; 50 virtual KAsync::Job<void> synchronizeWithSource(const Sink::QueryBase &query) Q_DECL_OVERRIDE;
51 virtual KAsync::Job<void> processAllMessages() Q_DECL_OVERRIDE; 51 virtual KAsync::Job<void> processAllMessages() Q_DECL_OVERRIDE;
52 virtual void setLowerBoundRevision(qint64 revision) Q_DECL_OVERRIDE; 52 virtual void setLowerBoundRevision(qint64 revision) Q_DECL_OVERRIDE;
53 virtual KAsync::Job<void> 53 virtual KAsync::Job<void>
diff --git a/common/listener.cpp b/common/listener.cpp
index 0742017..c3c6bc2 100644
--- a/common/listener.cpp
+++ b/common/listener.cpp
@@ -245,7 +245,13 @@ void Listener::processCommand(int commandId, uint messageId, const QByteArray &c
245 timer->start(); 245 timer->start();
246 auto job = KAsync::null<void>(); 246 auto job = KAsync::null<void>();
247 if (buffer->sourceSync()) { 247 if (buffer->sourceSync()) {
248 job = loadResource().synchronizeWithSource(); 248 Sink::QueryBase query;
249 if (buffer->query()) {
250 auto data = QByteArray::fromStdString(buffer->query()->str());
251 QDataStream stream(&data, QIODevice::ReadOnly);
252 stream >> query;
253 }
254 job = loadResource().synchronizeWithSource(query);
249 } 255 }
250 if (buffer->localSync()) { 256 if (buffer->localSync()) {
251 job = job.then<void>(loadResource().processAllMessages()); 257 job = job.then<void>(loadResource().processAllMessages());
diff --git a/common/query.cpp b/common/query.cpp
index 3b717aa..caca775 100644
--- a/common/query.cpp
+++ b/common/query.cpp
@@ -26,7 +26,7 @@ using namespace Sink;
26 26
27static const int registerQuery = qRegisterMetaTypeStreamOperators<Sink::QueryBase>(); 27static const int registerQuery = qRegisterMetaTypeStreamOperators<Sink::QueryBase>();
28 28
29QDebug operator<<(QDebug dbg, const Sink::Query::Comparator &c) 29QDebug operator<<(QDebug dbg, const Sink::QueryBase::Comparator &c)
30{ 30{
31 if (c.comparator == Sink::Query::Comparator::Equals) { 31 if (c.comparator == Sink::Query::Comparator::Equals) {
32 dbg.nospace() << "== " << c.value; 32 dbg.nospace() << "== " << c.value;
@@ -39,6 +39,24 @@ QDebug operator<<(QDebug dbg, const Sink::Query::Comparator &c)
39 return dbg.space(); 39 return dbg.space();
40} 40}
41 41
42QDebug operator<<(QDebug dbg, const Sink::QueryBase &query)
43{
44 dbg.nospace() << "Query [" << query.type() << "]\n";
45 dbg.nospace() << " Filter: " << query.getBaseFilters() << "\n";
46 dbg.nospace() << " Ids: " << query.ids() << "\n";
47 dbg.nospace() << " Sorting: " << query.sortProperty() << "\n";
48 return dbg.maybeSpace();
49}
50
51QDebug operator<<(QDebug dbg, const Sink::Query &query)
52{
53 dbg << static_cast<Sink::QueryBase>(query);
54 dbg.nospace() << " Requested: " << query.requestedProperties << "\n";
55 dbg.nospace() << " Parent: " << query.parentProperty << "\n";
56 dbg.nospace() << " IsLive: " << query.liveQuery() << "\n";
57 return dbg.maybeSpace();
58}
59
42QDataStream & operator<< (QDataStream &stream, const Sink::QueryBase::Comparator &comparator) 60QDataStream & operator<< (QDataStream &stream, const Sink::QueryBase::Comparator &comparator)
43{ 61{
44 stream << comparator.comparator; 62 stream << comparator.comparator;
diff --git a/common/query.h b/common/query.h
index 4a73357..925b014 100644
--- a/common/query.h
+++ b/common/query.h
@@ -467,7 +467,9 @@ private:
467 467
468} 468}
469 469
470QDebug SINK_EXPORT operator<<(QDebug dbg, const Sink::Query::Comparator &c); 470QDebug SINK_EXPORT operator<<(QDebug dbg, const Sink::QueryBase::Comparator &);
471QDebug SINK_EXPORT operator<<(QDebug dbg, const Sink::QueryBase &);
472QDebug SINK_EXPORT operator<<(QDebug dbg, const Sink::Query &);
471QDataStream & SINK_EXPORT operator<< (QDataStream &stream, const Sink::QueryBase &query); 473QDataStream & SINK_EXPORT operator<< (QDataStream &stream, const Sink::QueryBase &query);
472QDataStream & SINK_EXPORT operator>> (QDataStream &stream, Sink::QueryBase &query); 474QDataStream & SINK_EXPORT operator>> (QDataStream &stream, Sink::QueryBase &query);
473 475
diff --git a/common/queryrunner.cpp b/common/queryrunner.cpp
index cf6fcf8..99f9c2d 100644
--- a/common/queryrunner.cpp
+++ b/common/queryrunner.cpp
@@ -62,7 +62,7 @@ template <class DomainType>
62QueryRunner<DomainType>::QueryRunner(const Sink::Query &query, const Sink::ResourceContext &context, const QByteArray &bufferType) 62QueryRunner<DomainType>::QueryRunner(const Sink::Query &query, const Sink::ResourceContext &context, const QByteArray &bufferType)
63 : QueryRunnerBase(), mResourceContext(context), mResourceAccess(mResourceContext.resourceAccess()), mResultProvider(new ResultProvider<typename DomainType::Ptr>), mBatchSize(query.limit) 63 : QueryRunnerBase(), mResourceContext(context), mResourceAccess(mResourceContext.resourceAccess()), mResultProvider(new ResultProvider<typename DomainType::Ptr>), mBatchSize(query.limit)
64{ 64{
65 SinkTrace() << "Starting query"; 65 SinkTrace() << "Starting query. Is live:" << query.liveQuery() << " Limit: " << query.limit;
66 if (query.limit && query.sortProperty().isEmpty()) { 66 if (query.limit && query.sortProperty().isEmpty()) {
67 SinkWarning() << "A limited query without sorting is typically a bad idea."; 67 SinkWarning() << "A limited query without sorting is typically a bad idea.";
68 } 68 }
diff --git a/common/resource.cpp b/common/resource.cpp
index db64d33..f81f094 100644
--- a/common/resource.cpp
+++ b/common/resource.cpp
@@ -46,7 +46,7 @@ void Resource::processCommand(int commandId, const QByteArray &data)
46 Q_UNUSED(data) 46 Q_UNUSED(data)
47} 47}
48 48
49KAsync::Job<void> Resource::synchronizeWithSource() 49KAsync::Job<void> Resource::synchronizeWithSource(const Sink::QueryBase &query)
50{ 50{
51 return KAsync::null<void>(); 51 return KAsync::null<void>();
52} 52}
diff --git a/common/resource.h b/common/resource.h
index 1dbc365..3cc326c 100644
--- a/common/resource.h
+++ b/common/resource.h
@@ -28,6 +28,7 @@ namespace Sink {
28class FacadeFactory; 28class FacadeFactory;
29class AdaptorFactoryRegistry; 29class AdaptorFactoryRegistry;
30class ResourceContext; 30class ResourceContext;
31class QueryBase;
31 32
32/** 33/**
33 * Resource interface 34 * Resource interface
@@ -44,7 +45,7 @@ public:
44 /** 45 /**
45 * Execute synchronization with the source. 46 * Execute synchronization with the source.
46 */ 47 */
47 virtual KAsync::Job<void> synchronizeWithSource(); 48 virtual KAsync::Job<void> synchronizeWithSource(const Sink::QueryBase &);
48 49
49 /** 50 /**
50 * Process all internal messages, thus ensuring the store is up to date and no pending modifications are left. 51 * Process all internal messages, thus ensuring the store is up to date and no pending modifications are left.
diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp
index e509292..1847949 100644
--- a/common/resourceaccess.cpp
+++ b/common/resourceaccess.cpp
@@ -301,6 +301,25 @@ KAsync::Job<void> ResourceAccess::synchronizeResource(bool sourceSync, bool loca
301 return sendCommand(Commands::SynchronizeCommand, fbb); 301 return sendCommand(Commands::SynchronizeCommand, fbb);
302} 302}
303 303
304KAsync::Job<void> ResourceAccess::synchronizeResource(const Sink::QueryBase &query)
305{
306 flatbuffers::FlatBufferBuilder fbb;
307 QByteArray queryString;
308 {
309 QDataStream stream(&queryString, QIODevice::WriteOnly);
310 stream << query;
311 }
312 auto q = fbb.CreateString(queryString.toStdString());
313 auto builder = Sink::Commands::SynchronizeBuilder(fbb);
314 builder.add_sourceSync(true);
315 builder.add_localSync(false);
316 builder.add_query(q);
317 Sink::Commands::FinishSynchronizeBuffer(fbb, builder.Finish());
318
319 open();
320 return sendCommand(Commands::SynchronizeCommand, fbb);
321}
322
304KAsync::Job<void> ResourceAccess::sendCreateCommand(const QByteArray &uid, const QByteArray &resourceBufferType, const QByteArray &buffer) 323KAsync::Job<void> ResourceAccess::sendCreateCommand(const QByteArray &uid, const QByteArray &resourceBufferType, const QByteArray &buffer)
305{ 324{
306 flatbuffers::FlatBufferBuilder fbb; 325 flatbuffers::FlatBufferBuilder fbb;
diff --git a/common/resourceaccess.h b/common/resourceaccess.h
index 5d66246..95cb667 100644
--- a/common/resourceaccess.h
+++ b/common/resourceaccess.h
@@ -50,6 +50,7 @@ public:
50 virtual KAsync::Job<void> sendCommand(int commandId) = 0; 50 virtual KAsync::Job<void> sendCommand(int commandId) = 0;
51 virtual KAsync::Job<void> sendCommand(int commandId, flatbuffers::FlatBufferBuilder &fbb) = 0; 51 virtual KAsync::Job<void> sendCommand(int commandId, flatbuffers::FlatBufferBuilder &fbb) = 0;
52 virtual KAsync::Job<void> synchronizeResource(bool remoteSync, bool localSync) = 0; 52 virtual KAsync::Job<void> synchronizeResource(bool remoteSync, bool localSync) = 0;
53 virtual KAsync::Job<void> synchronizeResource(const Sink::QueryBase &filter) = 0;
53 54
54 virtual KAsync::Job<void> sendCreateCommand(const QByteArray &uid, const QByteArray &resourceBufferType, const QByteArray &buffer) 55 virtual KAsync::Job<void> sendCreateCommand(const QByteArray &uid, const QByteArray &resourceBufferType, const QByteArray &buffer)
55 { 56 {
@@ -107,6 +108,7 @@ public:
107 KAsync::Job<void> sendCommand(int commandId) Q_DECL_OVERRIDE; 108 KAsync::Job<void> sendCommand(int commandId) Q_DECL_OVERRIDE;
108 KAsync::Job<void> sendCommand(int commandId, flatbuffers::FlatBufferBuilder &fbb) Q_DECL_OVERRIDE; 109 KAsync::Job<void> sendCommand(int commandId, flatbuffers::FlatBufferBuilder &fbb) Q_DECL_OVERRIDE;
109 KAsync::Job<void> synchronizeResource(bool remoteSync, bool localSync) Q_DECL_OVERRIDE; 110 KAsync::Job<void> synchronizeResource(bool remoteSync, bool localSync) Q_DECL_OVERRIDE;
111 KAsync::Job<void> synchronizeResource(const Sink::QueryBase &filter) Q_DECL_OVERRIDE;
110 KAsync::Job<void> sendCreateCommand(const QByteArray &uid, const QByteArray &resourceBufferType, const QByteArray &buffer) Q_DECL_OVERRIDE; 112 KAsync::Job<void> sendCreateCommand(const QByteArray &uid, const QByteArray &resourceBufferType, const QByteArray &buffer) Q_DECL_OVERRIDE;
111 KAsync::Job<void> 113 KAsync::Job<void>
112 sendModifyCommand(const QByteArray &uid, qint64 revision, const QByteArray &resourceBufferType, const QByteArrayList &deletedProperties, const QByteArray &buffer, const QByteArrayList &changedProperties) Q_DECL_OVERRIDE; 114 sendModifyCommand(const QByteArray &uid, qint64 revision, const QByteArray &resourceBufferType, const QByteArrayList &deletedProperties, const QByteArray &buffer, const QByteArrayList &changedProperties) Q_DECL_OVERRIDE;
diff --git a/common/store.cpp b/common/store.cpp
index 2ea5e22..41b4867 100644
--- a/common/store.cpp
+++ b/common/store.cpp
@@ -129,13 +129,8 @@ KAsync::Job<void> queryResource(const QByteArray resourceType, const QByteArray
129template <class DomainType> 129template <class DomainType>
130QSharedPointer<QAbstractItemModel> Store::loadModel(Query query) 130QSharedPointer<QAbstractItemModel> Store::loadModel(Query query)
131{ 131{
132 SinkTrace() << "Query: " << ApplicationDomain::getTypeName<DomainType>(); 132 query.setType(ApplicationDomain::getTypeName<DomainType>());
133 SinkTrace() << " Requested: " << query.requestedProperties; 133 SinkTrace() << "Loading model: " << query;
134 SinkTrace() << " Filter: " << query.getBaseFilters();
135 SinkTrace() << " Parent: " << query.parentProperty;
136 SinkTrace() << " Ids: " << query.ids();
137 SinkTrace() << " IsLive: " << query.liveQuery();
138 SinkTrace() << " Sorting: " << query.sortProperty();
139 auto model = QSharedPointer<ModelResult<DomainType, typename DomainType::Ptr>>::create(query, query.requestedProperties); 134 auto model = QSharedPointer<ModelResult<DomainType, typename DomainType::Ptr>>::create(query, query.requestedProperties);
140 135
141 //* Client defines lifetime of model 136 //* Client defines lifetime of model
@@ -276,6 +271,27 @@ KAsync::Job<void> Store::synchronize(const Sink::Query &query)
276 }); 271 });
277} 272}
278 273
274KAsync::Job<void> Store::synchronize(const Sink::SyncScope &scope)
275{
276 auto resources = getResources(scope.getResourceFilter()).keys();
277 SinkTrace() << "synchronize" << resources;
278 return KAsync::value(resources)
279 .template each([scope](const QByteArray &resource) {
280 SinkTrace() << "Synchronizing " << resource;
281 auto resourceAccess = ResourceAccessFactory::instance().getAccess(resource, ResourceConfig::getResourceType(resource));
282 return resourceAccess->synchronizeResource(scope)
283 .addToContext(resourceAccess)
284 .then<void>([](const KAsync::Error &error) {
285 if (error) {
286 SinkWarning() << "Error during sync.";
287 return KAsync::error<void>(error);
288 }
289 SinkTrace() << "synced.";
290 return KAsync::null<void>();
291 });
292 });
293}
294
279template <class DomainType> 295template <class DomainType>
280KAsync::Job<DomainType> Store::fetchOne(const Sink::Query &query) 296KAsync::Job<DomainType> Store::fetchOne(const Sink::Query &query)
281{ 297{
diff --git a/common/store.h b/common/store.h
index 571ffff..931e473 100644
--- a/common/store.h
+++ b/common/store.h
@@ -86,6 +86,8 @@ KAsync::Job<void> SINK_EXPORT remove(const DomainType &domainObject);
86 */ 86 */
87KAsync::Job<void> SINK_EXPORT synchronize(const Sink::Query &query); 87KAsync::Job<void> SINK_EXPORT synchronize(const Sink::Query &query);
88 88
89KAsync::Job<void> SINK_EXPORT synchronize(const Sink::SyncScope &query);
90
89/** 91/**
90 * Removes all resource data from disk. 92 * Removes all resource data from disk.
91 * 93 *
diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp
index 206cf5e..85c68e4 100644
--- a/common/synchronizer.cpp
+++ b/common/synchronizer.cpp
@@ -228,12 +228,12 @@ void Synchronizer::modify(const DomainType &entity)
228 modifyEntity(entity.identifier(), entity.revision(), ApplicationDomain::getTypeName<DomainType>(), entity); 228 modifyEntity(entity.identifier(), entity.revision(), ApplicationDomain::getTypeName<DomainType>(), entity);
229} 229}
230 230
231KAsync::Job<void> Synchronizer::synchronize() 231KAsync::Job<void> Synchronizer::synchronize(const Sink::QueryBase &query)
232{ 232{
233 SinkTrace() << "Synchronizing"; 233 SinkTrace() << "Synchronizing";
234 mSyncInProgress = true; 234 mSyncInProgress = true;
235 mMessageQueue->startTransaction(); 235 mMessageQueue->startTransaction();
236 return synchronizeWithSource().syncThen<void>([this]() { 236 return synchronizeWithSource(query).syncThen<void>([this]() {
237 mSyncStore.clear(); 237 mSyncStore.clear();
238 mMessageQueue->commit(); 238 mMessageQueue->commit();
239 mSyncInProgress = false; 239 mSyncInProgress = false;
diff --git a/common/synchronizer.h b/common/synchronizer.h
index 12bb587..c03c425 100644
--- a/common/synchronizer.h
+++ b/common/synchronizer.h
@@ -41,7 +41,7 @@ public:
41 virtual ~Synchronizer(); 41 virtual ~Synchronizer();
42 42
43 void setup(const std::function<void(int commandId, const QByteArray &data)> &enqueueCommandCallback, MessageQueue &messageQueue); 43 void setup(const std::function<void(int commandId, const QByteArray &data)> &enqueueCommandCallback, MessageQueue &messageQueue);
44 KAsync::Job<void> synchronize(); 44 KAsync::Job<void> synchronize(const Sink::QueryBase &query);
45 45
46 //Read only access to main storage 46 //Read only access to main storage
47 Storage::EntityStore &store(); 47 Storage::EntityStore &store();
@@ -91,7 +91,7 @@ protected:
91 // template <typename DomainType> 91 // template <typename DomainType>
92 // void remove(const DomainType &entity); 92 // void remove(const DomainType &entity);
93 93
94 virtual KAsync::Job<void> synchronizeWithSource() = 0; 94 virtual KAsync::Job<void> synchronizeWithSource(const Sink::QueryBase &query) = 0;
95 95
96private: 96private:
97 void modifyIfChanged(Storage::EntityStore &store, const QByteArray &bufferType, const QByteArray &sinkId, const Sink::ApplicationDomain::ApplicationDomainType &entity); 97 void modifyIfChanged(Storage::EntityStore &store, const QByteArray &bufferType, const QByteArray &sinkId, const Sink::ApplicationDomain::ApplicationDomainType &entity);
diff --git a/examples/dummyresource/resourcefactory.cpp b/examples/dummyresource/resourcefactory.cpp
index 242a772..46e67f3 100644
--- a/examples/dummyresource/resourcefactory.cpp
+++ b/examples/dummyresource/resourcefactory.cpp
@@ -109,7 +109,7 @@ class DummySynchronizer : public Sink::Synchronizer {
109 SinkTrace() << "Sync of " << count << " entities of type " << bufferType << " done." << Sink::Log::TraceTime(time->elapsed()); 109 SinkTrace() << "Sync of " << count << " entities of type " << bufferType << " done." << Sink::Log::TraceTime(time->elapsed());
110 } 110 }
111 111
112 KAsync::Job<void> synchronizeWithSource() Q_DECL_OVERRIDE 112 KAsync::Job<void> synchronizeWithSource(const Sink::QueryBase &) Q_DECL_OVERRIDE
113 { 113 {
114 SinkLog() << " Synchronizing with the source"; 114 SinkLog() << " Synchronizing with the source";
115 return KAsync::syncStart<void>([this]() { 115 return KAsync::syncStart<void>([this]() {
@@ -146,7 +146,7 @@ DummyResource::~DummyResource()
146 146
147} 147}
148 148
149KAsync::Job<void> DummyResource::synchronizeWithSource() 149KAsync::Job<void> DummyResource::synchronizeWithSource(const Sink::QueryBase &query)
150{ 150{
151 SinkTrace() << "Synchronize with source and sending a notification about it"; 151 SinkTrace() << "Synchronize with source and sending a notification about it";
152 Sink::Notification n; 152 Sink::Notification n;
@@ -155,7 +155,7 @@ KAsync::Job<void> DummyResource::synchronizeWithSource()
155 n.message = "We're connected"; 155 n.message = "We're connected";
156 n.code = Sink::ApplicationDomain::ConnectedStatus; 156 n.code = Sink::ApplicationDomain::ConnectedStatus;
157 emit notify(n); 157 emit notify(n);
158 return GenericResource::synchronizeWithSource(); 158 return GenericResource::synchronizeWithSource(query);
159} 159}
160 160
161KAsync::Job<void> DummyResource::inspect(int inspectionType, const QByteArray &inspectionId, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expectedValue) 161KAsync::Job<void> DummyResource::inspect(int inspectionType, const QByteArray &inspectionId, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expectedValue)
diff --git a/examples/dummyresource/resourcefactory.h b/examples/dummyresource/resourcefactory.h
index 46a557e..8ef27a6 100644
--- a/examples/dummyresource/resourcefactory.h
+++ b/examples/dummyresource/resourcefactory.h
@@ -32,7 +32,7 @@ public:
32 DummyResource(const Sink::ResourceContext &resourceContext, const QSharedPointer<Sink::Pipeline> &pipeline = QSharedPointer<Sink::Pipeline>()); 32 DummyResource(const Sink::ResourceContext &resourceContext, const QSharedPointer<Sink::Pipeline> &pipeline = QSharedPointer<Sink::Pipeline>());
33 virtual ~DummyResource(); 33 virtual ~DummyResource();
34 34
35 KAsync::Job<void> synchronizeWithSource() Q_DECL_OVERRIDE; 35 KAsync::Job<void> synchronizeWithSource(const Sink::QueryBase &) Q_DECL_OVERRIDE;
36 KAsync::Job<void> inspect(int inspectionType, const QByteArray &inspectionId, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expectedValue) Q_DECL_OVERRIDE; 36 KAsync::Job<void> inspect(int inspectionType, const QByteArray &inspectionId, const QByteArray &domainType, const QByteArray &entityId, const QByteArray &property, const QVariant &expectedValue) Q_DECL_OVERRIDE;
37}; 37};
38 38
diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp
index 34a4376..d5a59b9 100644
--- a/examples/imapresource/imapresource.cpp
+++ b/examples/imapresource/imapresource.cpp
@@ -272,7 +272,7 @@ public:
272 272
273 } 273 }
274 274
275 KAsync::Job<void> synchronizeWithSource() Q_DECL_OVERRIDE 275 KAsync::Job<void> synchronizeWithSource(const Sink::QueryBase &query) Q_DECL_OVERRIDE
276 { 276 {
277 SinkLog() << " Synchronizing"; 277 SinkLog() << " Synchronizing";
278 return KAsync::start<void>([this]() { 278 return KAsync::start<void>([this]() {
diff --git a/examples/maildirresource/maildirresource.cpp b/examples/maildirresource/maildirresource.cpp
index 23920d4..820ec2f 100644
--- a/examples/maildirresource/maildirresource.cpp
+++ b/examples/maildirresource/maildirresource.cpp
@@ -330,7 +330,7 @@ public:
330 SinkLog() << "Synchronized " << count << " mails in " << listingPath << Sink::Log::TraceTime(elapsed) << " " << elapsed/qMax(count, 1) << " [ms/mail]"; 330 SinkLog() << "Synchronized " << count << " mails in " << listingPath << Sink::Log::TraceTime(elapsed) << " " << elapsed/qMax(count, 1) << " [ms/mail]";
331 } 331 }
332 332
333 KAsync::Job<void> synchronizeWithSource() Q_DECL_OVERRIDE 333 KAsync::Job<void> synchronizeWithSource(const Sink::QueryBase &query) Q_DECL_OVERRIDE
334 { 334 {
335 SinkLog() << " Synchronizing"; 335 SinkLog() << " Synchronizing";
336 return KAsync::start<void>([this]() { 336 return KAsync::start<void>([this]() {
diff --git a/examples/mailtransportresource/mailtransportresource.cpp b/examples/mailtransportresource/mailtransportresource.cpp
index 5f8ba89..d1a2e77 100644
--- a/examples/mailtransportresource/mailtransportresource.cpp
+++ b/examples/mailtransportresource/mailtransportresource.cpp
@@ -108,7 +108,7 @@ public:
108 return KAsync::null<void>(); 108 return KAsync::null<void>();
109 } 109 }
110 110
111 KAsync::Job<void> synchronizeWithSource() Q_DECL_OVERRIDE 111 KAsync::Job<void> synchronizeWithSource(const Sink::QueryBase &query) Q_DECL_OVERRIDE
112 { 112 {
113 SinkLog() << " Synchronizing"; 113 SinkLog() << " Synchronizing";
114 return KAsync::start<void>([this](KAsync::Future<void> future) { 114 return KAsync::start<void>([this](KAsync::Future<void> future) {
diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp
index f8d8543..eea63c0 100644
--- a/tests/dummyresourcetest.cpp
+++ b/tests/dummyresourcetest.cpp
@@ -136,7 +136,7 @@ private slots:
136 void testResourceSync() 136 void testResourceSync()
137 { 137 {
138 ::DummyResource resource(getContext()); 138 ::DummyResource resource(getContext());
139 auto job = resource.synchronizeWithSource(); 139 auto job = resource.synchronizeWithSource(Sink::QueryBase());
140 // TODO pass in optional timeout? 140 // TODO pass in optional timeout?
141 auto future = job.exec(); 141 auto future = job.exec();
142 future.waitForFinished(); 142 future.waitForFinished();
diff --git a/tests/maildirsyncbenchmark.cpp b/tests/maildirsyncbenchmark.cpp
index d84c758..ab09395 100644
--- a/tests/maildirsyncbenchmark.cpp
+++ b/tests/maildirsyncbenchmark.cpp
@@ -87,7 +87,7 @@ private slots:
87 MaildirResource resource("sink.maildir.test1", pipeline); 87 MaildirResource resource("sink.maildir.test1", pipeline);
88 QTime time; 88 QTime time;
89 time.start(); 89 time.start();
90 resource.Sink::GenericResource::synchronizeWithSource().exec().waitForFinished(); 90 resource.Sink::GenericResource::synchronizeWithSource(Sink::QueryBase()).exec().waitForFinished();
91 std::cout << "Sync took " << time.elapsed() << std::endl; 91 std::cout << "Sync took " << time.elapsed() << std::endl;
92 resource.processAllMessages().exec().waitForFinished(); 92 resource.processAllMessages().exec().waitForFinished();
93 const auto allProcessedTime = time.elapsed(); 93 const auto allProcessedTime = time.elapsed();
diff --git a/tests/testimplementations.h b/tests/testimplementations.h
index cf7a3da..111c884 100644
--- a/tests/testimplementations.h
+++ b/tests/testimplementations.h
@@ -70,6 +70,10 @@ public:
70 { 70 {
71 return KAsync::null<void>(); 71 return KAsync::null<void>();
72 } 72 }
73 KAsync::Job<void> synchronizeResource(const Sink::QueryBase &) Q_DECL_OVERRIDE
74 {
75 return KAsync::null<void>();
76 }
73 77
74public slots: 78public slots:
75 void open() Q_DECL_OVERRIDE 79 void open() Q_DECL_OVERRIDE
@@ -111,7 +115,7 @@ public:
111 { 115 {
112 } 116 }
113 117
114 KAsync::Job<void> synchronizeWithSource() Q_DECL_OVERRIDE 118 KAsync::Job<void> synchronizeWithSource(const Sink::QueryBase &query) Q_DECL_OVERRIDE
115 { 119 {
116 return KAsync::null<void>(); 120 return KAsync::null<void>();
117 } 121 }