Expand description
The Store — public API for the storage engine.
Store is the single entry point for the rest of mcpr to interact with
persistent storage. It handles:
- Opening the database and running migrations.
- Spawning the background writer thread.
- Providing a non-blocking
record()method for the proxy hot path. - Graceful shutdown with guaranteed flush of pending events.
§Usage
ⓘ
let store = Store::open(StoreConfig {
db_path: PathBuf::from("/tmp/mcpr.db"),
mcpr_version: "0.3.0".into(),
})?;
// Hot path — non-blocking, fire-and-forget.
store.record(StoreEvent::Request(event));
// Shutdown — blocks until writer drains pending events.
store.shutdown();Structs§
- Store
- Handle to the storage engine.
- Store
Config - Configuration for opening the store.
Enums§
- Store
Error - Errors from store operations.