summaryrefslogtreecommitdiffstats
path: root/common/clientapi.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/clientapi.h')
-rw-r--r--common/clientapi.h42
1 files changed, 40 insertions, 2 deletions
diff --git a/common/clientapi.h b/common/clientapi.h
index 4e55432..06376c2 100644
--- a/common/clientapi.h
+++ b/common/clientapi.h
@@ -26,11 +26,14 @@
26#include <Async/Async> 26#include <Async/Async>
27 27
28#include "query.h" 28#include "query.h"
29#include "inspection.h"
29#include "applicationdomaintype.h" 30#include "applicationdomaintype.h"
30 31
31class QAbstractItemModel; 32class QAbstractItemModel;
32 33
33namespace Akonadi2 { 34namespace Akonadi2 {
35class ResourceAccess;
36class Notification;
34 37
35/** 38/**
36 * Store interface used in the client API. 39 * Store interface used in the client API.
@@ -73,6 +76,11 @@ public:
73 static KAsync::Job<void> remove(const DomainType &domainObject); 76 static KAsync::Job<void> remove(const DomainType &domainObject);
74 77
75 /** 78 /**
79 * Synchronize data to local cache.
80 */
81 static KAsync::Job<void> synchronize(const Akonadi2::Query &query);
82
83 /**
76 * Shutdown resource. 84 * Shutdown resource.
77 */ 85 */
78 static KAsync::Job<void> shutdown(const QByteArray &resourceIdentifier); 86 static KAsync::Job<void> shutdown(const QByteArray &resourceIdentifier);
@@ -87,16 +95,46 @@ public:
87 static KAsync::Job<void> start(const QByteArray &resourceIdentifier); 95 static KAsync::Job<void> start(const QByteArray &resourceIdentifier);
88 96
89 /** 97 /**
90 * Synchronize data to local cache. 98 * Flushes any pending messages to disk
91 */ 99 */
92 static KAsync::Job<void> synchronize(const Akonadi2::Query &query); 100 static KAsync::Job<void> flushMessageQueue(const QByteArrayList &resourceIdentifier);
101
102 /**
103 * Flushes any pending messages that haven't been replayed to the source.
104 */
105 static KAsync::Job<void> flushReplayQueue(const QByteArrayList &resourceIdentifier);
93 106
94 /** 107 /**
95 * Removes a resource from disk. 108 * Removes a resource from disk.
96 */ 109 */
97 static void removeFromDisk(const QByteArray &resourceIdentifier); 110 static void removeFromDisk(const QByteArray &resourceIdentifier);
111
112 template <class DomainType>
113 static KAsync::Job<DomainType> fetchOne(const Akonadi2::Query &query);
114
115 template <class DomainType>
116 static KAsync::Job<QList<typename DomainType::Ptr> > fetchAll(const Akonadi2::Query &query);
117
118 template <class DomainType>
119 static KAsync::Job<QList<typename DomainType::Ptr> > fetch(const Akonadi2::Query &query, int minimumAmount = 0);
98}; 120};
99 121
122namespace Resources {
123 template <class DomainType>
124 KAsync::Job<void> inspect(const Inspection &inspectionCommand);
125}
126
127class Notifier {
128public:
129 Notifier(const QSharedPointer<ResourceAccess> &resourceAccess);
130 // Notifier(const QByteArray &resource);
131 // Notifier(const QByteArrayList &resource);
132 void registerHandler(std::function<void(const Notification &)>);
133
134private:
135 class Private;
136 QScopedPointer<Private> d;
137};
100 138
101} 139}
102 140