summaryrefslogtreecommitdiffstats
path: root/common/store.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-07-03 14:02:27 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-07-03 14:02:27 +0200
commit55fe06979ceebe67553135b43aa47e70d931304b (patch)
tree16b10a744879cc1872d6c07624b59ae64469ddbf /common/store.cpp
parent56fae95f49a1ca8ca614bd9f89b0ea5f872765e9 (diff)
parent288946f1694c2abe1d2c5800c87339d1e8780e4b (diff)
downloadsink-55fe06979ceebe67553135b43aa47e70d931304b.tar.gz
sink-55fe06979ceebe67553135b43aa47e70d931304b.zip
Merge branch 'develop'
Diffstat (limited to 'common/store.cpp')
-rw-r--r--common/store.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/common/store.cpp b/common/store.cpp
index d266098..4735113 100644
--- a/common/store.cpp
+++ b/common/store.cpp
@@ -36,8 +36,6 @@
36#include "storage.h" 36#include "storage.h"
37#include "log.h" 37#include "log.h"
38 38
39SINK_DEBUG_AREA("store")
40
41Q_DECLARE_METATYPE(QSharedPointer<Sink::ResultEmitter<Sink::ApplicationDomain::SinkResource::Ptr>>) 39Q_DECLARE_METATYPE(QSharedPointer<Sink::ResultEmitter<Sink::ApplicationDomain::SinkResource::Ptr>>)
42Q_DECLARE_METATYPE(QSharedPointer<Sink::ResourceAccessInterface>); 40Q_DECLARE_METATYPE(QSharedPointer<Sink::ResourceAccessInterface>);
43Q_DECLARE_METATYPE(std::shared_ptr<void>); 41Q_DECLARE_METATYPE(std::shared_ptr<void>);
@@ -277,6 +275,19 @@ KAsync::Job<void> Store::removeDataFromDisk(const QByteArray &identifier)
277 }); 275 });
278} 276}
279 277
278KAsync::Job<void> Store::upgrade()
279{
280 SinkLog() << "Upgrading...";
281 return fetchAll<ApplicationDomain::SinkResource>({})
282 .template each([](const ApplicationDomain::SinkResource::Ptr &resource) -> KAsync::Job<void> {
283 SinkLog() << "Removing caches for " << resource->identifier();
284 return removeDataFromDisk(resource->identifier());
285 })
286 .then([] {
287 SinkLog() << "Upgrade complete.";
288 });
289}
290
280static KAsync::Job<void> synchronize(const QByteArray &resource, const Sink::SyncScope &scope) 291static KAsync::Job<void> synchronize(const QByteArray &resource, const Sink::SyncScope &scope)
281{ 292{
282 SinkLog() << "Synchronizing " << resource << scope; 293 SinkLog() << "Synchronizing " << resource << scope;