#snapshot #spacetime-db #state #low-level #interface #capturing

spacetimedb-snapshot

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

7 releases (unstable)

new 1.0.0-rc2 Dec 13, 2024
1.0.0-rc1 Nov 6, 2024
0.12.0 Oct 4, 2024
0.11.1 Sep 2, 2024
0.10.1 Jun 28, 2024

#2002 in Database interfaces

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

Custom license

35KB
462 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

~16–27MB
~434K SLoC