diff options
Diffstat (limited to 'common/store.cpp')
-rw-r--r-- | common/store.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/common/store.cpp b/common/store.cpp index 1c8620b..d266098 100644 --- a/common/store.cpp +++ b/common/store.cpp | |||
@@ -92,6 +92,7 @@ QPair<typename AggregatingResultEmitter<typename DomainType::Ptr>::Ptr, typenam | |||
92 | auto facade = FacadeFactory::instance().getFacade<ApplicationDomain::SinkResource>(); | 92 | auto facade = FacadeFactory::instance().getFacade<ApplicationDomain::SinkResource>(); |
93 | Q_ASSERT(facade); | 93 | Q_ASSERT(facade); |
94 | Sink::Query resourceQuery; | 94 | Sink::Query resourceQuery; |
95 | resourceQuery.request<ApplicationDomain::SinkResource::Capabilities>(); | ||
95 | if (query.liveQuery()) { | 96 | if (query.liveQuery()) { |
96 | SinkTraceCtx(ctx) << "Listening for new resources."; | 97 | SinkTraceCtx(ctx) << "Listening for new resources."; |
97 | resourceQuery.setFlags(Query::LiveQuery); | 98 | resourceQuery.setFlags(Query::LiveQuery); |
@@ -103,6 +104,7 @@ QPair<typename AggregatingResultEmitter<typename DomainType::Ptr>::Ptr, typenam | |||
103 | resourceFilter.propertyFilter.insert(ApplicationDomain::SinkResource::Capabilities::name, Query::Comparator{ApplicationDomain::getTypeName<DomainType>(), Query::Comparator::Contains}); | 104 | resourceFilter.propertyFilter.insert(ApplicationDomain::SinkResource::Capabilities::name, Query::Comparator{ApplicationDomain::getTypeName<DomainType>(), Query::Comparator::Contains}); |
104 | } | 105 | } |
105 | resourceQuery.setFilter(resourceFilter); | 106 | resourceQuery.setFilter(resourceFilter); |
107 | resourceQuery.requestedProperties << resourceFilter.propertyFilter.keys(); | ||
106 | 108 | ||
107 | auto result = facade->load(resourceQuery, resourceCtx); | 109 | auto result = facade->load(resourceQuery, resourceCtx); |
108 | auto emitter = result.second; | 110 | auto emitter = result.second; |
@@ -249,7 +251,7 @@ KAsync::Job<void> Store::remove(const Sink::Query &query) | |||
249 | KAsync::Job<void> Store::removeDataFromDisk(const QByteArray &identifier) | 251 | KAsync::Job<void> Store::removeDataFromDisk(const QByteArray &identifier) |
250 | { | 252 | { |
251 | // All databases are going to become invalid, nuke the environments | 253 | // All databases are going to become invalid, nuke the environments |
252 | // TODO: all clients should react to a notification the resource | 254 | // TODO: all clients should react to a notification from the resource |
253 | Sink::Storage::DataStore::clearEnv(); | 255 | Sink::Storage::DataStore::clearEnv(); |
254 | SinkTrace() << "Remove data from disk " << identifier; | 256 | SinkTrace() << "Remove data from disk " << identifier; |
255 | auto time = QSharedPointer<QTime>::create(); | 257 | auto time = QSharedPointer<QTime>::create(); |
@@ -277,18 +279,18 @@ KAsync::Job<void> Store::removeDataFromDisk(const QByteArray &identifier) | |||
277 | 279 | ||
278 | static KAsync::Job<void> synchronize(const QByteArray &resource, const Sink::SyncScope &scope) | 280 | static KAsync::Job<void> synchronize(const QByteArray &resource, const Sink::SyncScope &scope) |
279 | { | 281 | { |
280 | SinkLog() << "Synchronizing " << resource; | 282 | SinkLog() << "Synchronizing " << resource << scope; |
281 | auto resourceAccess = ResourceAccessFactory::instance().getAccess(resource, ResourceConfig::getResourceType(resource)); | 283 | auto resourceAccess = ResourceAccessFactory::instance().getAccess(resource, ResourceConfig::getResourceType(resource)); |
282 | return resourceAccess->synchronizeResource(scope) | 284 | return resourceAccess->synchronizeResource(scope) |
283 | .addToContext(resourceAccess) | 285 | .addToContext(resourceAccess) |
284 | .then<void>([](const KAsync::Error &error) { | 286 | .then([=](const KAsync::Error &error) { |
285 | if (error) { | 287 | if (error) { |
286 | SinkWarning() << "Error during sync."; | 288 | SinkWarning() << "Error during sync."; |
287 | return KAsync::error<void>(error); | 289 | return KAsync::error(error); |
288 | } | 290 | } |
289 | SinkTrace() << "synced."; | 291 | SinkTrace() << "Synchronization of resource " << resource << " complete."; |
290 | return KAsync::null<void>(); | 292 | return KAsync::null(); |
291 | }); | 293 | }); |
292 | } | 294 | } |
293 | 295 | ||
294 | KAsync::Job<void> Store::synchronize(const Sink::Query &query) | 296 | KAsync::Job<void> Store::synchronize(const Sink::Query &query) |