Skip to content

Commit 26606a7

Browse files
weber-chrisbjester
authored andcommitted
adding documentation
1 parent 67611c3 commit 26606a7

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

docs/counters/index.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,12 @@ Morango instances use **record-max counters** to keep track of the maximum versi
2222
The **database-max counter** table tracks a mapping of scope filter strings to lists of (instance ID, counter) pairs. These (instance ID, counter) pairs reflect different Morango instances that have been previously synced at some counter value.
2323

2424
Morango sends **filter-max counters** to determine what data is already shared before syncing to efficiently determine the difference in data. Filter-max counters are the highest counters associated with every instance ID for both a filter and its supersets.
25+
26+
**Example** (in pseudocode)
27+
28+
#. Instance A creates a model, e.g. exam_x. It registers it in its store: ``{ "model" : "exam_x", "counter" : 1 }``
29+
#. It then syncs this exam to instance B and registers it in its store: ``{ "model" : "exam_x", "counter" : 1, "max_counters": { "B" : 1 }}``
30+
#. After some time, instance A updates the model because the exam changed. It registers this in the store: ``{ "model" : "exam_x", "counter" : 2, "max_counters": { "B" : 1 }}``
31+
#. The next time instance A syncs with instance B, it registers that the counter of ``exam_x`` is bigger than the ``max_counter`` of instance B.
32+
#. This triggers a transfer_session in which the model ``exam_x`` is transferred to instance B and then updated in the store: ``{ "model" : "exam_x", "counter" : 2, "max_counters": { "B" : 2 }}``
33+

0 commit comments

Comments
 (0)