#snapshot #state #capturing #offset #spacetime-db #snapshot-repository #restoring

spacetimedb-snapshot

Low-level interfaces for capturing and restoring snapshots of database states

1 unstable release

0.10.0 Jun 13, 2024

#1043 in Database interfaces

Download history 105/week @ 2024-06-10

105 downloads per month
Used in 4 crates (via spacetimedb-core)

Custom license

32KB
455 lines

This crate implements capturing and restoring snapshots in SpacetimeDB.

A snapshot is an on-disk view of the committed state of a database at a particular transaction offset. Snapshots exist as an optimization over replaying the commitlog; when restoring to the most recent transaction, rather than replaying the commitlog from 0, we can reload the most recent snapshot, then replay only the suffix of the commitlog.

This crate is responsible for:

This crate is not responsible for:

  • Determining when to capture snapshots.
  • Deciding which snapshot to restore from after a restart.
  • Replaying the suffix of the commitlog after restoring a snapshot.
  • Transforming a ReconstructedSnapshot into a live Spacetime datastore.

Dependencies

~10–17MB
~208K SLoC