summaryrefslogtreecommitdiffstats
path: root/common/pipeline.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-02-01 13:12:37 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-02-01 13:12:37 +0100
commit0b233494a69b5e9cd86e91c60016a294e6c9ef50 (patch)
treeecd21c0ddeb54f2fc43217016d0cc0f539cafd6d /common/pipeline.cpp
parent18a6b06ac47a69ec53c658ca7384fe1b16cff3fd (diff)
downloadsink-0b233494a69b5e9cd86e91c60016a294e6c9ef50.tar.gz
sink-0b233494a69b5e9cd86e91c60016a294e6c9ef50.zip
Fixed modifications
Diffstat (limited to 'common/pipeline.cpp')
-rw-r--r--common/pipeline.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/common/pipeline.cpp b/common/pipeline.cpp
index 0598bad..03d4e42 100644
--- a/common/pipeline.cpp
+++ b/common/pipeline.cpp
@@ -279,9 +279,16 @@ KAsync::Job<qint64> Pipeline::modifiedEntity(void const *command, size_t size)
279 //Apply diff 279 //Apply diff
280 //FIXME only apply the properties that are available in the buffer 280 //FIXME only apply the properties that are available in the buffer
281 Trace() << "Applying changed properties: " << diff->availableProperties(); 281 Trace() << "Applying changed properties: " << diff->availableProperties();
282 QSet<QByteArray> changeset;
282 for (const auto &property : diff->availableProperties()) { 283 for (const auto &property : diff->availableProperties()) {
283 newObject->setProperty(property, diff->getProperty(property)); 284 changeset << property;
285 const auto value = diff->getProperty(property);
286 if (value.isValid()) {
287 newObject->setProperty(property, value);
288 }
284 } 289 }
290 //Altough we only set some properties, we want all to be serialized
291 newObject->setChangedProperties(changeset);
285 292
286 //Remove deletions 293 //Remove deletions
287 if (modifyEntity->deletions()) { 294 if (modifyEntity->deletions()) {
@@ -304,8 +311,11 @@ KAsync::Job<qint64> Pipeline::modifiedEntity(void const *command, size_t size)
304 311
305 storeNewRevision(newRevision, fbb, bufferType, key); 312 storeNewRevision(newRevision, fbb, bufferType, key);
306 Log() << "Pipeline: modified entity: " << key << newRevision << bufferType; 313 Log() << "Pipeline: modified entity: " << key << newRevision << bufferType;
307 d->transaction.openDatabase(bufferType + ".main").scan(Sink::Storage::assembleKey(key, newRevision), [this, bufferType, newRevision, adaptorFactory, current, key](const QByteArray &, const QByteArray &value) -> bool { 314 d->transaction.openDatabase(bufferType + ".main").scan(Sink::Storage::assembleKey(key, newRevision), [this, bufferType, newRevision, adaptorFactory, current, key](const QByteArray &k, const QByteArray &value) -> bool {
308 auto entity = Sink::GetEntity(value); 315 if (value.isEmpty()) {
316 ErrorMsg() << "Read buffer is empty.";
317 }
318 auto entity = Sink::GetEntity(value.data());
309 auto newEntity = adaptorFactory->createAdaptor(*entity); 319 auto newEntity = adaptorFactory->createAdaptor(*entity);
310 for (auto processor : d->processors[bufferType]) { 320 for (auto processor : d->processors[bufferType]) {
311 processor->modifiedEntity(key, newRevision, *current, *newEntity, d->transaction); 321 processor->modifiedEntity(key, newRevision, *current, *newEntity, d->transaction);