Opening the shutter on snapshots
summary
Claim: snapshots act like git for your variables, letting threads make isolated, ACIDlike edits (minus durability) and then merge or abort. Implementation uses per-state linked lists of records, monotonic integer IDs, linked lists and thread locals (no compiler magic). Public APIs include take/enter/apply mutable snapshots and register apply observers. Built demos: a withAnimation prototype that animates recorded targets, an undo/redo stack that stores records, and a Room/DataStore persistence prototype — all working as proofs of concept.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 1:15Snapshots as version control
- 8:11How snapshots work under the hood
- 14:34Snapshot IDs and isolation
- 19:23Sibling and nested snapshots
- 28:12State objects implementation
- 39:10Building custom state objects
- 44:51Animation with snapshots
- 48:52Undo redo with snapshots
- 50:18Adding durability to snapshots
- 52:02Conclusion and resources







