Are there any documents/articles about the introdu...
# compose-desktop
s
Are there any documents/articles about the introduction of the Snapshot system architecture? I tried to read some source but some places are hard to understand and I don't really understand how it combine with state
j
cc @Chuck Jazdzewski [G]
🤞 2
c
The snapshot system is based on MVCC (https://en.wikipedia.org/wiki/Multiversion_concurrency_control) using monotonic increasing frame id as the clock and which gives a state object (the underlying implementation of the object returned by
mutableStateOf()
) snapshot isolation (https://en.wikipedia.org/wiki/Snapshot_isolation). We intentionally avoided transaction terminology to avoid name collision with database libraries like Room, for example, and snapshot do no provide durability (the D in ACID). Snapshot are atomic, (snapshot) consistent, and isolated but not durable. Whenever a object is written to it is recorded in the snapshot and when that snapshot applies all apply observers are notified that the object might have been changed. Composition installs an apply observer and, combined with a read observer, automatically subscribes to changes to state objects. Layout and draw similarly install apply observers so and are also notified when objects read during layout or draw are changed and they will invalidate the layout or render nodes that are affected.
👍 2