diff options
Diffstat (limited to 'common/changereplay.cpp')
-rw-r--r-- | common/changereplay.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/common/changereplay.cpp b/common/changereplay.cpp index 0adbd78..d7f46dc 100644 --- a/common/changereplay.cpp +++ b/common/changereplay.cpp | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "log.h" | 23 | #include "log.h" |
24 | #include "definitions.h" | 24 | #include "definitions.h" |
25 | #include "bufferutils.h" | 25 | #include "bufferutils.h" |
26 | #include "storage/key.h" | ||
26 | 27 | ||
27 | #include <QTimer> | 28 | #include <QTimer> |
28 | 29 | ||
@@ -113,10 +114,13 @@ KAsync::Job<void> ChangeReplay::replayNextRevision() | |||
113 | if (uid.isEmpty() || type.isEmpty()) { | 114 | if (uid.isEmpty() || type.isEmpty()) { |
114 | SinkErrorCtx(mLogCtx) << "Failed to read uid or type for revison: " << revision << uid << type; | 115 | SinkErrorCtx(mLogCtx) << "Failed to read uid or type for revison: " << revision << uid << type; |
115 | } else { | 116 | } else { |
116 | const auto key = DataStore::assembleKey(uid, revision); | 117 | // TODO: should not use internal representations |
118 | const auto key = Storage::Key(Storage::Identifier::fromDisplayByteArray(uid), revision); | ||
119 | const auto internalKey = key.toInternalByteArray(); | ||
120 | const auto displayKey = key.toDisplayByteArray(); | ||
117 | QByteArray entityBuffer; | 121 | QByteArray entityBuffer; |
118 | DataStore::mainDatabase(mMainStoreTransaction, type) | 122 | DataStore::mainDatabase(mMainStoreTransaction, type) |
119 | .scan(key, | 123 | .scan(internalKey, |
120 | [&entityBuffer](const QByteArray &key, const QByteArray &value) -> bool { | 124 | [&entityBuffer](const QByteArray &key, const QByteArray &value) -> bool { |
121 | entityBuffer = value; | 125 | entityBuffer = value; |
122 | return false; | 126 | return false; |
@@ -126,9 +130,9 @@ KAsync::Job<void> ChangeReplay::replayNextRevision() | |||
126 | if (entityBuffer.isEmpty()) { | 130 | if (entityBuffer.isEmpty()) { |
127 | SinkErrorCtx(mLogCtx) << "Failed to replay change " << key; | 131 | SinkErrorCtx(mLogCtx) << "Failed to replay change " << key; |
128 | } else { | 132 | } else { |
129 | if (canReplay(type, key, entityBuffer)) { | 133 | if (canReplay(type, displayKey, entityBuffer)) { |
130 | SinkTraceCtx(mLogCtx) << "Replaying " << key; | 134 | SinkTraceCtx(mLogCtx) << "Replaying " << displayKey; |
131 | replayJob = replay(type, key, entityBuffer); | 135 | replayJob = replay(type, displayKey, entityBuffer); |
132 | //Set the last revision we tried to replay | 136 | //Set the last revision we tried to replay |
133 | *lastReplayedRevision = revision; | 137 | *lastReplayedRevision = revision; |
134 | //Execute replay job and commit | 138 | //Execute replay job and commit |