diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-10-06 16:19:51 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-10-10 10:40:01 +0200 |
commit | f689ad1021a7805f6f8b6a81f534b4cb9ca91f51 (patch) | |
tree | c18d746b775279f143c8d8052924bb4d83fbb91f /common/pipeline.cpp | |
parent | c3f6e72c2d46906a4699127b558ca248729ce577 (diff) | |
download | sink-f689ad1021a7805f6f8b6a81f534b4cb9ca91f51.tar.gz sink-f689ad1021a7805f6f8b6a81f534b4cb9ca91f51.zip |
Change replay
So far only includes modifications and additions,
removals are not yet stored as separate revisions.
Diffstat (limited to 'common/pipeline.cpp')
-rw-r--r-- | common/pipeline.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/common/pipeline.cpp b/common/pipeline.cpp index c108540..6c75bde 100644 --- a/common/pipeline.cpp +++ b/common/pipeline.cpp | |||
@@ -220,6 +220,7 @@ KAsync::Job<qint64> Pipeline::modifiedEntity(void const *command, size_t size) | |||
220 | } | 220 | } |
221 | } | 221 | } |
222 | 222 | ||
223 | //TODO use only readPropertyMapper and writePropertyMapper | ||
223 | auto adaptorFactory = d->adaptorFactory.value(bufferType); | 224 | auto adaptorFactory = d->adaptorFactory.value(bufferType); |
224 | if (!adaptorFactory) { | 225 | if (!adaptorFactory) { |
225 | Warning() << "no adaptor factory for type " << bufferType; | 226 | Warning() << "no adaptor factory for type " << bufferType; |
@@ -255,6 +256,7 @@ KAsync::Job<qint64> Pipeline::modifiedEntity(void const *command, size_t size) | |||
255 | 256 | ||
256 | //Apply diff | 257 | //Apply diff |
257 | //FIXME only apply the properties that are available in the buffer | 258 | //FIXME only apply the properties that are available in the buffer |
259 | Trace() << "Applying changed properties: " << diff->availableProperties(); | ||
258 | for (const auto &property : diff->availableProperties()) { | 260 | for (const auto &property : diff->availableProperties()) { |
259 | newObject->setProperty(property, diff->getProperty(property)); | 261 | newObject->setProperty(property, diff->getProperty(property)); |
260 | } | 262 | } |
@@ -277,7 +279,6 @@ KAsync::Job<qint64> Pipeline::modifiedEntity(void const *command, size_t size) | |||
277 | flatbuffers::FlatBufferBuilder fbb; | 279 | flatbuffers::FlatBufferBuilder fbb; |
278 | adaptorFactory->createBuffer(*newObject, fbb, metadataFbb.GetBufferPointer(), metadataFbb.GetSize()); | 280 | adaptorFactory->createBuffer(*newObject, fbb, metadataFbb.GetBufferPointer(), metadataFbb.GetSize()); |
279 | 281 | ||
280 | //TODO don't overwrite the old entry, but instead store a new revision | ||
281 | d->transaction.openDatabase(bufferType + ".main").write(Akonadi2::Storage::assembleKey(key, newRevision), QByteArray::fromRawData(reinterpret_cast<char const *>(fbb.GetBufferPointer()), fbb.GetSize())); | 282 | d->transaction.openDatabase(bufferType + ".main").write(Akonadi2::Storage::assembleKey(key, newRevision), QByteArray::fromRawData(reinterpret_cast<char const *>(fbb.GetBufferPointer()), fbb.GetSize())); |
282 | Akonadi2::Storage::setMaxRevision(d->transaction, newRevision); | 283 | Akonadi2::Storage::setMaxRevision(d->transaction, newRevision); |
283 | Akonadi2::Storage::recordRevision(d->transaction, newRevision, key, bufferType); | 284 | Akonadi2::Storage::recordRevision(d->transaction, newRevision, key, bufferType); |