summaryrefslogtreecommitdiffstats
path: root/common/pipeline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/pipeline.cpp')
-rw-r--r--common/pipeline.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/common/pipeline.cpp b/common/pipeline.cpp
index 7863f67..a7059c1 100644
--- a/common/pipeline.cpp
+++ b/common/pipeline.cpp
@@ -228,7 +228,8 @@ KAsync::Job<qint64> Pipeline::modifiedEntity(void const *command, size_t size)
228 } 228 }
229 auto modifyEntity = Commands::GetModifyEntity(command); 229 auto modifyEntity = Commands::GetModifyEntity(command);
230 Q_ASSERT(modifyEntity); 230 Q_ASSERT(modifyEntity);
231 231 Q_ASSERT(modifyEntity->modifiedProperties());
232 auto changeset = BufferUtils::fromVector(*modifyEntity->modifiedProperties());
232 const qint64 baseRevision = modifyEntity->revision(); 233 const qint64 baseRevision = modifyEntity->revision();
233 const bool replayToSource = modifyEntity->replayToSource(); 234 const bool replayToSource = modifyEntity->replayToSource();
234 // TODO rename modifyEntity->domainType to bufferType 235 // TODO rename modifyEntity->domainType to bufferType
@@ -281,9 +282,7 @@ KAsync::Job<qint64> Pipeline::modifiedEntity(void const *command, size_t size)
281 // Apply diff 282 // Apply diff
282 // FIXME only apply the properties that are available in the buffer 283 // FIXME only apply the properties that are available in the buffer
283 Trace() << "Applying changed properties: " << diff->availableProperties(); 284 Trace() << "Applying changed properties: " << diff->availableProperties();
284 QSet<QByteArray> changeset; 285 for (const auto &property : changeset) {
285 for (const auto &property : diff->availableProperties()) {
286 changeset << property;
287 const auto value = diff->getProperty(property); 286 const auto value = diff->getProperty(property);
288 if (value.isValid()) { 287 if (value.isValid()) {
289 newAdaptor->setProperty(property, value); 288 newAdaptor->setProperty(property, value);
@@ -303,12 +302,16 @@ KAsync::Job<qint64> Pipeline::modifiedEntity(void const *command, size_t size)
303 302
304 // Add metadata buffer 303 // Add metadata buffer
305 flatbuffers::FlatBufferBuilder metadataFbb; 304 flatbuffers::FlatBufferBuilder metadataFbb;
306 auto metadataBuilder = MetadataBuilder(metadataFbb); 305 {
307 metadataBuilder.add_revision(newRevision); 306 auto modifiedProperties = BufferUtils::toVector(metadataFbb, changeset);
308 metadataBuilder.add_operation(Operation_Modification); 307 auto metadataBuilder = MetadataBuilder(metadataFbb);
309 metadataBuilder.add_replayToSource(replayToSource); 308 metadataBuilder.add_revision(newRevision);
310 auto metadataBuffer = metadataBuilder.Finish(); 309 metadataBuilder.add_operation(Operation_Modification);
311 FinishMetadataBuffer(metadataFbb, metadataBuffer); 310 metadataBuilder.add_replayToSource(replayToSource);
311 metadataBuilder.add_modifiedProperties(modifiedProperties);
312 auto metadataBuffer = metadataBuilder.Finish();
313 FinishMetadataBuffer(metadataFbb, metadataBuffer);
314 }
312 315
313 flatbuffers::FlatBufferBuilder fbb; 316 flatbuffers::FlatBufferBuilder fbb;
314 adaptorFactory->createBuffer(newAdaptor, fbb, metadataFbb.GetBufferPointer(), metadataFbb.GetSize()); 317 adaptorFactory->createBuffer(newAdaptor, fbb, metadataFbb.GetBufferPointer(), metadataFbb.GetSize());