summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/CMakeLists.txt1
-rw-r--r--common/clientapi.h3
-rw-r--r--common/commands/synchronize.fbs8
-rw-r--r--common/resource.cpp5
-rw-r--r--common/resource.h1
-rw-r--r--common/resourceaccess.cpp8
-rw-r--r--common/resourceaccess.h2
7 files changed, 24 insertions, 4 deletions
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 3d3a2b7..18bcad0 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -7,6 +7,7 @@ generate_flatbuffers(
7 commands/handshake 7 commands/handshake
8 commands/modifyentity 8 commands/modifyentity
9 commands/revisionupdate 9 commands/revisionupdate
10 commands/synchronize
10 domain/event 11 domain/event
11 entity 12 entity
12 metadata 13 metadata
diff --git a/common/clientapi.h b/common/clientapi.h
index 659ae91..55fbed1 100644
--- a/common/clientapi.h
+++ b/common/clientapi.h
@@ -297,7 +297,7 @@ using namespace async;
297class Query 297class Query
298{ 298{
299public: 299public:
300 Query() : syncOnDemand(true) {} 300 Query() : syncOnDemand(true), processAll(false) {}
301 //Could also be a propertyFilter 301 //Could also be a propertyFilter
302 QStringList resources; 302 QStringList resources;
303 //Could also be a propertyFilter 303 //Could also be a propertyFilter
@@ -307,6 +307,7 @@ public:
307 //Properties to retrieve 307 //Properties to retrieve
308 QSet<QString> requestedProperties; 308 QSet<QString> requestedProperties;
309 bool syncOnDemand; 309 bool syncOnDemand;
310 bool processAll;
310}; 311};
311 312
312 313
diff --git a/common/commands/synchronize.fbs b/common/commands/synchronize.fbs
new file mode 100644
index 0000000..d2d0364
--- /dev/null
+++ b/common/commands/synchronize.fbs
@@ -0,0 +1,8 @@
1namespace Akonadi2;
2
3table Synchronize {
4 sourceSync: bool; //Synchronize with source
5 localSync: bool; //Ensure all queues are processed so the local state is up-to date.
6}
7
8root_type Synchronize;
diff --git a/common/resource.cpp b/common/resource.cpp
index db08c4f..e158a40 100644
--- a/common/resource.cpp
+++ b/common/resource.cpp
@@ -60,6 +60,11 @@ Async::Job<void> Resource::synchronizeWithSource(Pipeline *pipeline)
60 }); 60 });
61} 61}
62 62
63Async::Job<void> Resource::processAllMessages()
64{
65 return Async::null<void>();
66}
67
63class ResourceFactory::Private 68class ResourceFactory::Private
64{ 69{
65public: 70public:
diff --git a/common/resource.h b/common/resource.h
index 52a28a6..bcce229 100644
--- a/common/resource.h
+++ b/common/resource.h
@@ -35,6 +35,7 @@ public:
35 35
36 virtual void processCommand(int commandId, const QByteArray &data, uint size, Pipeline *pipeline); 36 virtual void processCommand(int commandId, const QByteArray &data, uint size, Pipeline *pipeline);
37 virtual Async::Job<void> synchronizeWithSource(Pipeline *pipeline); 37 virtual Async::Job<void> synchronizeWithSource(Pipeline *pipeline);
38 virtual Async::Job<void> processAllMessages();
38 39
39 virtual void configurePipeline(Pipeline *pipeline); 40 virtual void configurePipeline(Pipeline *pipeline);
40 41
diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp
index 73a01ca..5d067c5 100644
--- a/common/resourceaccess.cpp
+++ b/common/resourceaccess.cpp
@@ -25,6 +25,7 @@
25#include "common/commandcompletion_generated.h" 25#include "common/commandcompletion_generated.h"
26#include "common/handshake_generated.h" 26#include "common/handshake_generated.h"
27#include "common/revisionupdate_generated.h" 27#include "common/revisionupdate_generated.h"
28#include "common/synchronize_generated.h"
28 29
29#include <QCoreApplication> 30#include <QCoreApplication>
30#include <QDebug> 31#include <QDebug>
@@ -186,9 +187,12 @@ Async::Job<void> ResourceAccess::sendCommand(int commandId, flatbuffers::FlatBu
186 }); 187 });
187} 188}
188 189
189Async::Job<void> ResourceAccess::synchronizeResource() 190Async::Job<void> ResourceAccess::synchronizeResource(bool sourceSync, bool localSync)
190{ 191{
191 return sendCommand(Commands::SynchronizeCommand); 192 auto command = Akonadi2::CreateSynchronize(d->fbb, sourceSync, localSync);
193 Akonadi2::FinishSynchronizeBuffer(d->fbb, command);
194 return sendCommand(Commands::SynchronizeCommand, d->fbb);
195 d->fbb.Clear();
192} 196}
193 197
194void ResourceAccess::open() 198void ResourceAccess::open()
diff --git a/common/resourceaccess.h b/common/resourceaccess.h
index a9e8c47..fbdd992 100644
--- a/common/resourceaccess.h
+++ b/common/resourceaccess.h
@@ -43,7 +43,7 @@ public:
43 43
44 Async::Job<void> sendCommand(int commandId); 44 Async::Job<void> sendCommand(int commandId);
45 Async::Job<void> sendCommand(int commandId, flatbuffers::FlatBufferBuilder &fbb); 45 Async::Job<void> sendCommand(int commandId, flatbuffers::FlatBufferBuilder &fbb);
46 Async::Job<void> synchronizeResource(); 46 Async::Job<void> synchronizeResource(bool remoteSync, bool localSync);
47 47
48public Q_SLOTS: 48public Q_SLOTS:
49 void open(); 49 void open();