Expand description
§attuned-store
Storage traits and in-memory backend for Attuned.
This crate provides:
StateStoretrait defining the storage contractMemoryStorein-memory implementation for single-process apps
§Example
use attuned_store::{StateStore, MemoryStore, MemoryStoreConfig};
use attuned_core::{StateSnapshot, Source};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let store = MemoryStore::new(MemoryStoreConfig::default());
let snapshot = StateSnapshot::builder()
.user_id("user_123")
.source(Source::SelfReport)
.axis("warmth", 0.7)
.build()?;
store.upsert_latest(snapshot).await?;
let retrieved = store.get_latest("user_123").await?;
assert!(retrieved.is_some());
Ok(())
}Structs§
- Memory
Store - Thread-safe in-memory state store.
- Memory
Store Config - Configuration for the in-memory store.
Enums§
- Store
Error - Errors that can occur during storage operations.
Traits§
- State
Store - Trait for storing and retrieving user state snapshots.