Skip to main content

Module engine

Module engine 

Source
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.
StoreConfig
Configuration for opening the store.

Enums§

StoreError
Errors from store operations.