Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Storage Backend API

We use a thin, minimal interface for storage backends:

  • Thin: Minimal set of operations that databases must provide
  • Simple: Avoids type-system complexity and focuses on core functionality

Rather than implementing business logic in each database backend, this API provides low-level primitives that higher-level code can build upon. This eliminates code duplication and makes adding new database backends trivial.

The API differentiates between three types of database access:

  • Read views StorageReadView: read-only views of the database, with no atomicity guarantees between operations.
  • Write batches StorageWriteBatch: write batch functionality, with atomicity guarantees at commit time.
  • Locked views StorageLockedView: read-only views of a point in time (snapshots), right now it's only used during snap-sync.