diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-06-03 12:41:07 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-06-03 12:41:07 +0200 |
commit | 77562cdae63e0ec7b09e8ece6af97165ba9e48dd (patch) | |
tree | b24d23335fd856881b7284532e7d4d36caa5ca13 /common/synchronizer.cpp | |
parent | 6569a6dceec10c77578184ce68c26e20ba27fa39 (diff) | |
download | sink-77562cdae63e0ec7b09e8ece6af97165ba9e48dd.tar.gz sink-77562cdae63e0ec7b09e8ece6af97165ba9e48dd.zip |
A way to retrieve the last revision during changereplay.
Diffstat (limited to 'common/synchronizer.cpp')
-rw-r--r-- | common/synchronizer.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp index 4bd8a5b..1bac5d9 100644 --- a/common/synchronizer.cpp +++ b/common/synchronizer.cpp | |||
@@ -119,8 +119,8 @@ void Synchronizer::scanForRemovals(const QByteArray &bufferType, const std::func | |||
119 | { | 119 | { |
120 | entryGenerator([this, bufferType, &exists](const QByteArray &key) { | 120 | entryGenerator([this, bufferType, &exists](const QByteArray &key) { |
121 | auto sinkId = Sink::Storage::uidFromKey(key); | 121 | auto sinkId = Sink::Storage::uidFromKey(key); |
122 | Trace() << "Checking for removal " << key; | ||
123 | const auto remoteId = syncStore().resolveLocalId(bufferType, sinkId); | 122 | const auto remoteId = syncStore().resolveLocalId(bufferType, sinkId); |
123 | Trace() << "Checking for removal " << key << remoteId; | ||
124 | // If we have no remoteId, the entity hasn't been replayed to the source yet | 124 | // If we have no remoteId, the entity hasn't been replayed to the source yet |
125 | if (!remoteId.isEmpty()) { | 125 | if (!remoteId.isEmpty()) { |
126 | if (!exists(remoteId)) { | 126 | if (!exists(remoteId)) { |
@@ -144,7 +144,8 @@ void Synchronizer::createOrModify(const QByteArray &bufferType, const QByteArray | |||
144 | createEntity( | 144 | createEntity( |
145 | sinkId, bufferType, entity, *adaptorFactory, [this](const QByteArray &buffer) { enqueueCommand(Sink::Commands::CreateEntityCommand, buffer); }); | 145 | sinkId, bufferType, entity, *adaptorFactory, [this](const QByteArray &buffer) { enqueueCommand(Sink::Commands::CreateEntityCommand, buffer); }); |
146 | } else { // modification | 146 | } else { // modification |
147 | if (auto current = store().getLatest(mainDatabase, sinkId, *adaptorFactory)) { | 147 | qint64 retrievedRevision = 0; |
148 | if (auto current = store().getLatest(mainDatabase, sinkId, *adaptorFactory, retrievedRevision)) { | ||
148 | bool changed = false; | 149 | bool changed = false; |
149 | for (const auto &property : entity.changedProperties()) { | 150 | for (const auto &property : entity.changedProperties()) { |
150 | if (entity.getProperty(property) != current->getProperty(property)) { | 151 | if (entity.getProperty(property) != current->getProperty(property)) { |