liveBook · Manning

Snapshot

As explained in API Design Patterns

A snapshot is a point-in-time view of stored data that preserves the data state as of a particular instant.

A snapshot is a point-in-time view of stored data. It preserves a consistent state while a copy or export reads resources that may otherwise change concurrently. section 17.3.6 section 23.3.4

Choose the strongest consistency mechanism available:

  • Read from a specified snapshot timestamp or revision, or perform the operation inside one database transaction. section 17.3.6
  • If snapshots are unavailable, accept a time-spanning smear of data for exports or lock writes during the operation. section 17.3.6 section 23.3.4
  • Do not assume that validating a purge against a snapshot guarantees the later live deletion will affect the same resources. section 19.3.5

Exporting a changing collection

A consistent snapshot exports one stable collection state. Without one, an export may read A, then B, while concurrent actions delete A and C and create D, producing a best-effort mixture such as A, B, and D. section 23.3.4

Table 23.1 Export scenario with a smear of data (view table figure)

User action

Export action

Stored data

Exported data

Create A, B, C

 

A, B, C

 

 

Export A

A, B, C

A

Delete A

 

B, C

A

 

Export B

B, C

A, B

Create D

 

B, C, D

A, B

Delete C

 

B, D

A, B

 

Export D

B, D

A, B, D

Inspect the export timeline to see how concurrent creates and deletes produce a smear of data. section 23.3.4

How API Design Patterns covers it

How deep it goes
Explains timestamps, revision identifiers, transactions, locking, and best-effort alternatives, but does not specify storage implementation details.
Examples
Uses a changing export collection containing resources A, B, C, and D to contrast consistent snapshots with smeared results.
What it assumes
Assumes familiarity with stored resources and concurrent updates while distinguishing snapshot reads from live reads.
What you can do after
Evaluate whether an operation needs a snapshot, transaction, write lock, or explicitly best-effort consistency.
How it connects
Connects snapshots with atomicity, transactions, consistency, data export, copying, and batch deletion.

Also explained in

Compare how 11 books explain snapshot →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of API Design Patterns. The section links point to the parts of the book it draws on.