Skip to content

Latest commit

 

History

History
26 lines (24 loc) · 2.67 KB

File metadata and controls

26 lines (24 loc) · 2.67 KB

Product quantity synchronization strategy

Action Mobile A
(global quantity)
[local delta]
Mobile B
(global quantity)
[local delta]
Backend
[starting quantity, delta A, delta B, real quantity]
Real state
Initial state (27)
[0]
(27)
[0]
[27, 0, 0, 27] 27
Mobile A adds 5 items locally (27)
[-5]
(27)
[0]
[27, 0, 0, 27] 22
Mobile A sync (27)
[-5]
(27)
[0]
[27, -5, 0, 22] 22 (+)
Mobile B adds 3 items locally (27)
[-5]
(27)
[+3]
[27, -5, 0, 22] 25
Mobile B sync (27)
[-5]
(22)
[+3]
[27, -5, +3, 25] 25 (+)
Mobile A removes 14 items locally (27)
[-19]
(22)
[+3]
[27, -5, +3, 25] 11
Mobile A sync (30)
[-19]
(22)
[+3]
[27, -19, +3, 11] 11 (+)
Mobile B sync (30)
[-19]
(8)
[+3]
[27, -19, +3, 11] 11 (+)
Mobile A adds 7 items locally (30)
[-12]
(8)
[+3]
[27, -19, +3, 11] 18
Mobile A sync (failed to contact backend) (30)
[-12]
(8)
[+3]
[27, -19, +3, 11] 18 (-)
Mobile B adds 4 items and sync (30)
[-12]
(8)
[+7]
[27, -19, +7, 15] 22 (-)
Mobile A sync (34)
[-12]
(8)
[+7]
[27, -12, +7, 22] 22 (+)
Mobile B adds 9 items (34)
[-12]
(8)
[+16]
[27, -12, +7, 22] 31
Mobile B sync (backend contact success, return from backend lost) (34)
[-12]
(8)
[+16]
[27, -12, +16, 31] 31 (+)
Mobile A sync (43)
[-12]
(8)
[+16]
[27, -12, +16, 31] 31 (+)
Mobile B sync (43)
[-12]
(15)
[+16]
[27, -12, +16, 31] 31 (+)

Legend

global quantity = sum(mobile_deltas) - local_delta for given device starting quantity = const value (+) -> backend real quantity equals real state after sync (-) -> backend real quantity differs from real state after sync