summaryrefslogtreecommitdiffstats
path: root/common/pipeline.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-12-01 11:10:37 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-12-01 11:10:37 +0100
commit44edbee0f0b2fcf13e2ee388a90a8dd1f84a329e (patch)
tree71d265b2bce5a15981976e334ed182fa6d37c45f /common/pipeline.cpp
parent377c86144221ffc5b49bdaa9b8dcc3507fe4a50f (diff)
downloadsink-44edbee0f0b2fcf13e2ee388a90a8dd1f84a329e.tar.gz
sink-44edbee0f0b2fcf13e2ee388a90a8dd1f84a329e.zip
Resolve remoteIds during sync
Remote id's need to be resolved while syncing any references. This is done by the synchronizer by consulting the rid to entity id mapping. If the referenced entity doesn't exist yet we create a local id anyways, that we then need to pick up once the actual entity arrives.
Diffstat (limited to 'common/pipeline.cpp')
-rw-r--r--common/pipeline.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/common/pipeline.cpp b/common/pipeline.cpp
index 0ce478b..16d8329 100644
--- a/common/pipeline.cpp
+++ b/common/pipeline.cpp
@@ -150,7 +150,14 @@ KAsync::Job<qint64> Pipeline::newEntity(void const *command, size_t size)
150 return KAsync::error<qint64>(0); 150 return KAsync::error<qint64>(0);
151 } 151 }
152 152
153 const auto key = QUuid::createUuid().toString().toUtf8(); 153 QByteArray key;
154 if (createEntity->entityId()) {
155 key = QByteArray(reinterpret_cast<char const*>(createEntity->entityId()->Data()), createEntity->entityId()->size());
156 }
157 if (key.isEmpty()) {
158 key = QUuid::createUuid().toString().toUtf8();
159 }
160 Q_ASSERT(!key.isEmpty());
154 const qint64 newRevision = Akonadi2::Storage::maxRevision(d->transaction) + 1; 161 const qint64 newRevision = Akonadi2::Storage::maxRevision(d->transaction) + 1;
155 162
156 //Add metadata buffer 163 //Add metadata buffer