From 7601a9b2f8e34bf60b06826e9659add0212d23ad Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 6 Feb 2019 22:07:05 +0000 Subject: [PATCH] describe different persistance vs model update strategies --- doc/sync-updates.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 doc/sync-updates.md diff --git a/doc/sync-updates.md b/doc/sync-updates.md new file mode 100644 index 00000000..1d3f0410 --- /dev/null +++ b/doc/sync-updates.md @@ -0,0 +1,18 @@ +# persistance vs model update of a room + +## persist first, return update object, update model with update object + - +## update model first, return update object, persist with update object + - not all models exist at all times (timeline only when room is "open"), + so model to create timeline update object might not exist for persistence need + +## persist, update, each only based on sync data (independent of each other) + - possible inconsistency between syncing and loading from storage as they are different code paths + + storage code remains very simple and focussed + +## updating model and persisting in one go + - if updating model needs to do anything async, it needs to postpone it or the txn will be closed + +## persist first, read from storage to update model + + guaranteed consistency between what is on screen and in storage + - slower as we need to reread what was just synced every time (big accounts with frequent updates) \ No newline at end of file