Skip to main content

Module store

Module store 

Source
Expand description

Persistence contract for framework state that must survive restarts.

In 0.1 the risk primitives (SessionPnl, CircuitBreaker in rustrade-risk) live entirely in memory, so a crash mid-session resets the daily drawdown cap and the loss-streak breaker. A StateStore lets the framework snapshot that state and restore it on the next boot.

The trait is deliberately payload-agnostic: it stores opaque, versioned serde_json::Value blobs keyed by a string. The framework (the rustrade facade) owns the snapshot schema and the key layout; a backend only has to persist bytes durably. This keeps rustrade-core free of any real I/O — concrete durable backends (a JSON file, sqlite, Postgres, Redis, …) live in downstream crates and only need to depend on this trait.

Structs§

InMemoryStore
Non-durable StateStore backed by an in-memory map.

Traits§

StateStore
A durable key/value store for framework state snapshots.