summaryrefslogtreecommitdiffstats
path: root/common/store.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-11-25 08:27:06 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-11-25 09:23:55 +0100
commit22af1ed535b4afc8db3804e72bc5adb1a1b28d60 (patch)
tree07665f41d5b40d658e95a64bb76020f1fd9d088e /common/store.cpp
parent64d7d7bdd1edb2bcc305ca007784d0708cf7ef3c (diff)
downloadsink-22af1ed535b4afc8db3804e72bc5adb1a1b28d60.tar.gz
sink-22af1ed535b4afc8db3804e72bc5adb1a1b28d60.zip
Added the flush command.
Instead of trying to actually flush queues, we send a special command through the same queues as the other commands and can thus guarantee that the respective commands have been processed without blocking anything.
Diffstat (limited to 'common/store.cpp')
-rw-r--r--common/store.cpp18
1 files changed, 1 insertions, 17 deletions
diff --git a/common/store.cpp b/common/store.cpp
index 6aae00f..8b8de1f 100644
--- a/common/store.cpp
+++ b/common/store.cpp
@@ -255,23 +255,7 @@ KAsync::Job<void> Store::removeDataFromDisk(const QByteArray &identifier)
255 255
256KAsync::Job<void> Store::synchronize(const Sink::Query &query) 256KAsync::Job<void> Store::synchronize(const Sink::Query &query)
257{ 257{
258 auto resources = getResources(query.getResourceFilter()).keys(); 258 return synchronize(Sink::SyncScope{static_cast<Sink::QueryBase>(query)});
259 SinkTrace() << "synchronize" << resources;
260 return KAsync::value(resources)
261 .template each([query](const QByteArray &resource) {
262 SinkTrace() << "Synchronizing " << resource;
263 auto resourceAccess = ResourceAccessFactory::instance().getAccess(resource, ResourceConfig::getResourceType(resource));
264 return resourceAccess->synchronizeResource(true, false)
265 .addToContext(resourceAccess)
266 .then<void>([](const KAsync::Error &error) {
267 if (error) {
268 SinkWarning() << "Error during sync.";
269 return KAsync::error<void>(error);
270 }
271 SinkTrace() << "synced.";
272 return KAsync::null<void>();
273 });
274 });
275} 259}
276 260
277KAsync::Job<void> Store::synchronize(const Sink::SyncScope &scope) 261KAsync::Job<void> Store::synchronize(const Sink::SyncScope &scope)