Important
Under active development. Not production-ready.
This repository provides the storage abstraction layer used by InferaDB Engine and InferaDB Control. It defines a common interface for persistent storage with pluggable backends.
| Crate | Description |
|---|---|
inferadb-common-storage |
Storage backend trait and in-memory implementation |
inferadb-common-storage-ledger |
Ledger-backed storage implementation |
cargo add inferadb-common-storage
cargo add inferadb-common-storage-ledgeruse inferadb_common_storage::{StorageBackend, MemoryBackend};
// Create an in-memory backend (useful for testing)
let backend = MemoryBackend::new();
// Basic operations
backend.set(b"key", b"value").await?;
let value = backend.get(b"key").await?;
backend.delete(b"key").await?;
// Range queries
let entries = backend.get_range(b"prefix:", b"prefix:\xff").await?;
// Transactions
let mut tx = backend.transaction();
tx.set(b"key1", b"value1");
tx.set(b"key2", b"value2");
tx.commit().await?;For production use with cryptographic auditability, use the Ledger backend:
use inferadb_common_storage_ledger::{LedgerBackend, LedgerBackendConfig};
let config = LedgerBackendConfig::builder()
.servers(["http://ledger.example.com:50051"])
.build();
let backend = LedgerBackend::new(config).await?;git clone https://github.com/inferadb/common.git
cd common
# Install development tools
mise trust && mise install
# Build
just build
# Run tests
just test
# Full check (build + clippy + test + format)
just checkJoin us on Discord for questions and discussions.
Dual-licensed under MIT or Apache 2.0.
