summaryrefslogtreecommitdiffstats
path: root/common/entitybuffer.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-06-26 10:24:58 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-06-26 10:24:58 +0200
commitda4b74e593f1b1262e83824cc499bd855f1b4e3e (patch)
tree95b56aa073a85022c4218375e1c788894f01c2b6 /common/entitybuffer.cpp
parent121c3bc96a273790414ae114082053cb649fc49a (diff)
downloadsink-da4b74e593f1b1262e83824cc499bd855f1b4e3e.tar.gz
sink-da4b74e593f1b1262e83824cc499bd855f1b4e3e.zip
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.
Diffstat (limited to 'common/entitybuffer.cpp')
-rw-r--r--common/entitybuffer.cpp6
1 files changed, 3 insertions, 3 deletions
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
32 return *mEntity; 32 return *mEntity;
33} 33}
34 34
35const uint8_t *EntityBuffer::resourceBuffer() 35const uint8_t *EntityBuffer::resourceBuffer() const
36{ 36{
37 if (!mEntity) { 37 if (!mEntity) {
38 qDebug() << "no buffer"; 38 qDebug() << "no buffer";
@@ -41,7 +41,7 @@ const uint8_t *EntityBuffer::resourceBuffer()
41 return mEntity->resource()->Data(); 41 return mEntity->resource()->Data();
42} 42}
43 43
44const uint8_t *EntityBuffer::metadataBuffer() 44const uint8_t *EntityBuffer::metadataBuffer() const
45{ 45{
46 if (!mEntity) { 46 if (!mEntity) {
47 return nullptr; 47 return nullptr;
@@ -49,7 +49,7 @@ const uint8_t *EntityBuffer::metadataBuffer()
49 return mEntity->metadata()->Data(); 49 return mEntity->metadata()->Data();
50} 50}
51 51
52const uint8_t *EntityBuffer::localBuffer() 52const uint8_t *EntityBuffer::localBuffer() const
53{ 53{
54 if (!mEntity) { 54 if (!mEntity) {
55 return nullptr; 55 return nullptr;