Skip to main content

Module store

Module store 

Source
Expand description

SQLite-based request storage engine and query layer for mcpr.

Pure persistence logic: open the DB, write events, run read-only queries. The EventSink adapter that plugs this store into the event bus lives in crate::sinks::sqlite_sink.

§Architecture

SqliteSink ──► Store::record() ──► mpsc channel ──► Writer thread ──► SQLite (WAL)
               (non-blocking)       (10k buffer)     (batch flush)

CLI commands ──► QueryEngine ──► read-only SQLite connection

Re-exports§

pub use config::FileStoreConfig;
pub use duration::parse_duration;
pub use duration::since_to_cutoff_ms;
pub use engine::Store;
pub use engine::StoreConfig;
pub use engine::StoreError;
pub use event::RequestEvent;
pub use event::RequestStatus;
pub use event::SessionEvent;
pub use event::StoreEvent;
pub use query::QueryEngine;

Modules§

config
Store configuration — TOML section and validation.
db
SQLite connection management, WAL setup, and schema migrations.
duration
Human-friendly duration parsing for --since and --before CLI flags.
engine
The Store — public API for the storage engine.
event
Event types sent from the proxy hot path to the background storage writer.
path
Database file path resolution.
query
Query engine — read-only access to the storage database.
schema
SQL schema definitions for the mcpr storage engine.
writer
Background storage writer — dedicated OS thread with batch flushing.