This commit is contained in:
Hassan Abedi 2026-06-04 15:13:01 +02:00
parent 5f8c9f11ad
commit 1156c750d7

View File

@ -1,9 +1,9 @@
## Storage
This crate is the storage layer of the workspace.
It defines a backend-agnostic `Storage` trait, the row, value, and identifier types that travel through it, and adapter modules that implement the
trait over different engines.
Higher-level crates such as `query-ops` depend on this crate for both the types and the trait.
This crate is an implementation of a storage access layer.
It defines an interface for storing and retrieving data from a storage backend, in a generic way.
Higher-level crates such as `query-ops` should use this crate to access the storage.
This crates helps with decoupling the query execution logic from the underlying storage implementation.
### Public API
@ -36,7 +36,7 @@ Data types and their relationships:
### Example
The example below opens an in-memory backend, declares a relation, inserts two rows inside a single transaction, then scans the result.
The example below opens an in-memory backend, declares a relation, inserts two rows inside a single transaction, then reads the result.
```rust
use storage::value::Value;
@ -65,7 +65,7 @@ fn main() -> Result<(), StorageError> {
}
```
Swapping `MemoryStorage` for any other adapter (for example `adapters::sqlite::SqliteStorage::open(":memory:")?`) requires no other code changes.
Swapping `MemoryStorage` for any other adapter (for example `adapters::sqlite::SqliteStorage::open(":memory:")?`) needs no other code changes.
How a backend is used (logically):
@ -108,4 +108,4 @@ cargo test -p storage --all-features
rather than regression.
- **Feature gates.**
`MemoryStorage` is always available.
Every other adapter is feature-gated (`lmdb`, `redb`, `fjall`, `sqlite`, `geomerge`) so callers only pay for what they need.
Every other adapter is feature-gated (`lmdb`, `redb`, `fjall`, `sqlite`, and `geomerge`) so callers only pay for what they need.