Expand description
§Storage Backend API
This module provides 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.
Modules§
- tables
- Table names used by the storage engine.
Traits§
- Storage
Backend - This trait provides a minimal set of operations required from a database backend. Implementations should focus on providing efficient access to the underlying storage without implementing business logic.
- Storage
Locked View - Locked snapshot interface for batch read operations. Provides read-only access to a specific table with a persistent snapshot. This is optimized for scenarios where many reads are performed on the same table, such as trie traversal operations. This is currently only used in snapsync stage.
- Storage
Read View - Read-only transaction interface. Provides methods to read data from the database
- Storage
Write Batch - Write transaction interface.
Type Aliases§
- Prefix
Result - Type alias for the result of a prefix iterator.