From da4b74e593f1b1262e83824cc499bd855f1b4e3e Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 26 Jun 2018 10:24:58 +0200 Subject: Avoid overwriting local changes with remote modifications. The case we ran into is the following: * Fetching the full payload and marking all messages of a thread as read happens simultaneously. * The local modification to mark as read gets immediately overwritten when the full payload arrives. * Eventually the modification gets replayed to the server though (and the reversal isn't because coming from the source), so on next sync the situation fixes itself. To be able to improve this we try to protect local modifications in that properties that have been modified since baseRevision (which currently isn't, but should be equal to the last to the server replayed revision) are not overwritten. This conflict resolution strategy thus always prefers local modifications. baseRevision is currently set to the current maximum revision of the store at the time when the resource creates the modification. --- common/entitybuffer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'common/entitybuffer.cpp') diff --git a/common/entitybuffer.cpp b/common/entitybuffer.cpp index 32583cc..fa33dcc 100644 --- a/common/entitybuffer.cpp +++ b/common/entitybuffer.cpp @@ -32,7 +32,7 @@ const Sink::Entity &EntityBuffer::entity() const return *mEntity; } -const uint8_t *EntityBuffer::resourceBuffer() +const uint8_t *EntityBuffer::resourceBuffer() const { if (!mEntity) { qDebug() << "no buffer"; @@ -41,7 +41,7 @@ const uint8_t *EntityBuffer::resourceBuffer() return mEntity->resource()->Data(); } -const uint8_t *EntityBuffer::metadataBuffer() +const uint8_t *EntityBuffer::metadataBuffer() const { if (!mEntity) { return nullptr; @@ -49,7 +49,7 @@ const uint8_t *EntityBuffer::metadataBuffer() return mEntity->metadata()->Data(); } -const uint8_t *EntityBuffer::localBuffer() +const uint8_t *EntityBuffer::localBuffer() const { if (!mEntity) { return nullptr; -- cgit v1.2.3