Key-value storage abstraction traits for cross-platform persistence
| Tier | infrastructure |
| Role | unclassified (baselined) |
| Path | crates/infrastructure/kv-store |
| Edition | 2021 |
| Targets | infrastructure_kv_store |
| Public items | 0 across 0 modules |
| Tests | 9 |
What it is for
Key-value storage abstraction for cross-platform persistence.
This crate provides traits for key-value storage that can be implemented by different backends (IndexedDB for browser, SQLite for desktop/mobile, in-memory for testing).
# Design Principles
- Async-first: All operations are async to support browser environments
- Bytes-based: Store raw bytes, let callers handle serialization
- Minimal: Only essential operations, no query DSL
- Platform-agnostic: No platform-specific dependencies
# Example
use infrastructure_kv_store::{KeyValueStore, InMemoryStore};
async fn example() {
let store = InMemoryStore::new();
// Store some data
store.set("user:123", b"alice").await.unwrap();
// Retrieve it
let value = store.get("user:123").await.unwrap();
assert_eq!(value, Some(b"alice".to_vec()));
// List keys with prefix
let keys = store.keys("user:").await.unwrap();
assert_eq!(keys, vec"user:123");
}
Capabilities
No public items.
How to use it
From this crate's own rustdoc:
use infrastructure_kv_store::{KeyValueStore, InMemoryStore};
async fn example() {
let store = InMemoryStore::new();
// Store some data
store.set("user:123", b"alice").await.unwrap();
// Retrieve it
let value = store.get("user:123").await.unwrap();
assert_eq!(value, Some(b"alice".to_vec()));
// List keys with prefix
let keys = store.keys("user:").await.unwrap();
assert_eq!(keys, vec!["user:123"]);
}
Module structure
No public modules: the crate root is its whole surface.
Public surface
No public items.
Re-exports. Exported here, defined elsewhere.
| Export | Defined in |
|---|---|
InMemoryStore | memory::InMemoryStore |
{KeyValueStore,KeyValueStoreExt} | traits::{KeyValueStore,KeyValueStoreExt} |
{StorageError,StorageResult} | error::{StorageError,StorageResult} |
Boundary
Depends on no other workspace tier.
Shares tier infrastructure with 82 other crates: infrastructure-acquire, infrastructure-adapters-google-calendar, infrastructure-adapters-google-gmail, infrastructure-adapters-google-places, infrastructure-adapters-google-trends, infrastructure-adapters-shodan, infrastructure-adapters-yelp, infrastructure-agent, … (82 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | infrastructure |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/infrastructure/kv-store |
| Vocabulary in force (lexicon) | current |
Dependencies
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
async-trait | ^0.1 | — | no | always |
serde | ^1 | derive | no | always |
serde_json | ^1 | — | no | always |
thiserror | ^2 | — | no | always |
Development, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
tokio | ^1 | full, rt, macros | no | always |
Build. None.
Depended on by. 3 workspace crates.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR n_application_kv_store["application-kv-store"] -->|uses| SELF n_infrastructure_kv_store_indexeddb["infrastructure-kv-store-indexeddb"] -->|uses| SELF n_platform_wasm_ui["platform-wasm-ui"] -->|uses| SELF SELF["infrastructure-kv-store"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.
Targets
| Kind | Name | Source |
|---|---|---|
| lib | infrastructure_kv_store | `src/lib.rs` |
Error model
No public error type was detected: no public item declares a type named *Error, and no public signature returns one.
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | none detected |
| async runtime | none detected |
| database access | none detected |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | none detected |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.
Related capabilities
3 workspace crates depend on this one: application-kv-store, infrastructure-kv-store-indexeddb, platform-wasm-ui.
Verification
| Kind | Count |
|---|---|
| Unit tests | 9 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 1 |
What the tests establish, by name:
test_error_checks—src/error.rstest_error_creation—src/error.rstest_in_memory_store_basic—src/lib.rstest_in_memory_store_clear—src/lib.rstest_in_memory_store_exists—src/lib.rstest_in_memory_store_keys—src/lib.rstest_len_and_is_empty—src/memory.rstest_with_data—src/memory.rstest_json_extension—src/traits.rs
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 0 | 0 |
Public modules with a //! block | 0 | 0 |
Metrics
| Metric | Value |
|---|---|
| Rust source files | 4 |
| Source lines | 461 |
| Code lines | 254 |
| Public API items | 0 |
| Public modules | 0 |
| Tests | 9 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 4 |
| Workspace reverse dependencies | 3 |
pie showData
title Rust source composition
"Code" : 254
"Blank or comment" : 207
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.