Snapshot Sequence
- Definition
- An ordered list of all complete system states
How does it work?
Like event sourcing, this structure captures the history of a system. But rather than storing changes, snapshot sequence stores complete states. But as the state of a database or filesystem is formed by its entire contents, a naive implementation would quickly become very large. A smarter implementation creates each state as a set of hierarchical references to the underlaying data.
The term "snapshot" is well-known, but the data structure of linked snapshots doesn't have a name as far as I can tell, so I just named it "Snapshot sequence" myself.
It can be sufficient to only keep the previous complete state, or a few previous states.
Examples
- Git stores its data as shapshots
- React stores its data as a series of snapshots
When should you use it?
- When you need to access a previous state very quickly.
Problems
- It can be very hard to find an efficient implementation of a snapshot