diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/clientapi.cpp | 8 | ||||
-rw-r--r-- | common/clientapi.h | 77 |
2 files changed, 44 insertions, 41 deletions
diff --git a/common/clientapi.cpp b/common/clientapi.cpp index 73bc194..e6878a6 100644 --- a/common/clientapi.cpp +++ b/common/clientapi.cpp | |||
@@ -160,7 +160,7 @@ KAsync::Job<void> Store::remove(const DomainType &domainObject) | |||
160 | }); | 160 | }); |
161 | } | 161 | } |
162 | 162 | ||
163 | KAsync::Job<void> Store::shutdown(const QByteArray &identifier) | 163 | KAsync::Job<void> Resources::shutdown(const QByteArray &identifier) |
164 | { | 164 | { |
165 | Trace() << "shutdown " << identifier; | 165 | Trace() << "shutdown " << identifier; |
166 | auto time = QSharedPointer<QTime>::create(); | 166 | auto time = QSharedPointer<QTime>::create(); |
@@ -183,7 +183,7 @@ KAsync::Job<void> Store::shutdown(const QByteArray &identifier) | |||
183 | .template then<void>([](){}); | 183 | .template then<void>([](){}); |
184 | } | 184 | } |
185 | 185 | ||
186 | KAsync::Job<void> Store::start(const QByteArray &identifier) | 186 | KAsync::Job<void> Resources::start(const QByteArray &identifier) |
187 | { | 187 | { |
188 | Trace() << "start " << identifier; | 188 | Trace() << "start " << identifier; |
189 | auto time = QSharedPointer<QTime>::create(); | 189 | auto time = QSharedPointer<QTime>::create(); |
@@ -231,7 +231,7 @@ KAsync::Job<void> Store::synchronize(const Sink::Query &query) | |||
231 | .template then<void>([](){}); | 231 | .template then<void>([](){}); |
232 | } | 232 | } |
233 | 233 | ||
234 | KAsync::Job<void> Store::flushMessageQueue(const QByteArrayList &resourceIdentifier) | 234 | KAsync::Job<void> Resources::flushMessageQueue(const QByteArrayList &resourceIdentifier) |
235 | { | 235 | { |
236 | Trace() << "flushMessageQueue" << resourceIdentifier; | 236 | Trace() << "flushMessageQueue" << resourceIdentifier; |
237 | return KAsync::iterate(resourceIdentifier) | 237 | return KAsync::iterate(resourceIdentifier) |
@@ -247,7 +247,7 @@ KAsync::Job<void> Store::flushMessageQueue(const QByteArrayList &resourceIdentif | |||
247 | .template then<void>([](){}); | 247 | .template then<void>([](){}); |
248 | } | 248 | } |
249 | 249 | ||
250 | KAsync::Job<void> Store::flushReplayQueue(const QByteArrayList &resourceIdentifier) | 250 | KAsync::Job<void> Resources::flushReplayQueue(const QByteArrayList &resourceIdentifier) |
251 | { | 251 | { |
252 | return flushMessageQueue(resourceIdentifier); | 252 | return flushMessageQueue(resourceIdentifier); |
253 | } | 253 | } |
diff --git a/common/clientapi.h b/common/clientapi.h index 19d42e0..36c923b 100644 --- a/common/clientapi.h +++ b/common/clientapi.h | |||
@@ -36,6 +36,19 @@ namespace Sink { | |||
36 | class ResourceAccess; | 36 | class ResourceAccess; |
37 | class Notification; | 37 | class Notification; |
38 | 38 | ||
39 | class SINKCOMMON_EXPORT Notifier { | ||
40 | public: | ||
41 | Notifier(const QSharedPointer<ResourceAccess> &resourceAccess); | ||
42 | Notifier(const QByteArray &resourceInstanceIdentifier); | ||
43 | // Notifier(const QByteArrayList &resource); | ||
44 | void registerHandler(std::function<void(const Notification &)>); | ||
45 | |||
46 | private: | ||
47 | class Private; | ||
48 | QSharedPointer<Private> d; | ||
49 | }; | ||
50 | |||
51 | |||
39 | /** | 52 | /** |
40 | * Store interface used in the client API. | 53 | * Store interface used in the client API. |
41 | */ | 54 | */ |
@@ -82,30 +95,6 @@ public: | |||
82 | static KAsync::Job<void> synchronize(const Sink::Query &query); | 95 | static KAsync::Job<void> synchronize(const Sink::Query &query); |
83 | 96 | ||
84 | /** | 97 | /** |
85 | * Shutdown resource. | ||
86 | */ | ||
87 | static KAsync::Job<void> shutdown(const QByteArray &resourceIdentifier); | ||
88 | |||
89 | /** | ||
90 | * Start resource. | ||
91 | * | ||
92 | * The resource is ready for operation once this command completes. | ||
93 | * This command is only necessary if a resource was shutdown previously, | ||
94 | * otherwise the resource process will automatically start as necessary. | ||
95 | */ | ||
96 | static KAsync::Job<void> start(const QByteArray &resourceIdentifier); | ||
97 | |||
98 | /** | ||
99 | * Flushes any pending messages to disk | ||
100 | */ | ||
101 | static KAsync::Job<void> flushMessageQueue(const QByteArrayList &resourceIdentifier); | ||
102 | |||
103 | /** | ||
104 | * Flushes any pending messages that haven't been replayed to the source. | ||
105 | */ | ||
106 | static KAsync::Job<void> flushReplayQueue(const QByteArrayList &resourceIdentifier); | ||
107 | |||
108 | /** | ||
109 | * Removes a resource from disk. | 98 | * Removes a resource from disk. |
110 | */ | 99 | */ |
111 | static void removeFromDisk(const QByteArray &resourceIdentifier); | 100 | static void removeFromDisk(const QByteArray &resourceIdentifier); |
@@ -128,21 +117,35 @@ public: | |||
128 | }; | 117 | }; |
129 | 118 | ||
130 | namespace Resources { | 119 | namespace Resources { |
131 | template <class DomainType> | ||
132 | KAsync::Job<void> SINKCOMMON_EXPORT inspect(const Inspection &inspectionCommand); | ||
133 | } | ||
134 | 120 | ||
135 | class SINKCOMMON_EXPORT Notifier { | 121 | template <class DomainType> |
136 | public: | 122 | KAsync::Job<void> SINKCOMMON_EXPORT inspect(const Inspection &inspectionCommand); |
137 | Notifier(const QSharedPointer<ResourceAccess> &resourceAccess); | ||
138 | Notifier(const QByteArray &resourceInstanceIdentifier); | ||
139 | // Notifier(const QByteArrayList &resource); | ||
140 | void registerHandler(std::function<void(const Notification &)>); | ||
141 | 123 | ||
142 | private: | 124 | /** |
143 | class Private; | 125 | * Shutdown resource. |
144 | QSharedPointer<Private> d; | 126 | */ |
145 | }; | 127 | KAsync::Job<void> SINKCOMMON_EXPORT shutdown(const QByteArray &resourceIdentifier); |
128 | |||
129 | /** | ||
130 | * Start resource. | ||
131 | * | ||
132 | * The resource is ready for operation once this command completes. | ||
133 | * This command is only necessary if a resource was shutdown previously, | ||
134 | * otherwise the resource process will automatically start as necessary. | ||
135 | */ | ||
136 | KAsync::Job<void> SINKCOMMON_EXPORT start(const QByteArray &resourceIdentifier); | ||
137 | |||
138 | /** | ||
139 | * Flushes any pending messages to disk | ||
140 | */ | ||
141 | KAsync::Job<void> SINKCOMMON_EXPORT flushMessageQueue(const QByteArrayList &resourceIdentifier); | ||
142 | |||
143 | /** | ||
144 | * Flushes any pending messages that haven't been replayed to the source. | ||
145 | */ | ||
146 | KAsync::Job<void> SINKCOMMON_EXPORT flushReplayQueue(const QByteArrayList &resourceIdentifier); | ||
147 | |||
148 | } | ||
146 | 149 | ||
147 | } | 150 | } |
148 | 151 | ||