diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-06-26 10:24:58 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-06-26 10:24:58 +0200 |
commit | da4b74e593f1b1262e83824cc499bd855f1b4e3e (patch) | |
tree | 95b56aa073a85022c4218375e1c788894f01c2b6 /common/entitybuffer.h | |
parent | 121c3bc96a273790414ae114082053cb649fc49a (diff) | |
download | sink-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.h')
-rw-r--r-- | common/entitybuffer.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/common/entitybuffer.h b/common/entitybuffer.h index d73a138..31e6aed 100644 --- a/common/entitybuffer.h +++ b/common/entitybuffer.h | |||
@@ -25,9 +25,9 @@ public: | |||
25 | * Note that @param data will need to remain valid and the data is not copied. | 25 | * Note that @param data will need to remain valid and the data is not copied. |
26 | */ | 26 | */ |
27 | EntityBuffer(const QByteArray &data); | 27 | EntityBuffer(const QByteArray &data); |
28 | const uint8_t *resourceBuffer(); | 28 | const uint8_t *resourceBuffer() const; |
29 | const uint8_t *metadataBuffer(); | 29 | const uint8_t *metadataBuffer() const; |
30 | const uint8_t *localBuffer(); | 30 | const uint8_t *localBuffer() const; |
31 | const Entity &entity() const; | 31 | const Entity &entity() const; |
32 | bool isValid() const; | 32 | bool isValid() const; |
33 | 33 | ||