|
|
3 days ago | |
|---|---|---|
| .. | ||
| src | 3 days ago | |
| tests | 4 days ago | |
| Cargo.toml | 4 months ago | |
| README.md | 4 days ago | |
Storage abstraction for the kuatia ledger.
Defines the Store trait (composed of seven sub-traits), provides an
in-memory implementation for tests, and exports a store_tests! conformance
macro that any backend can use to validate its implementation.
| Trait | Purpose |
|---|---|
AccountStore |
Account creation and version reads |
PostingStore |
Posting reads and the live balance |
TransferStore |
Committed transfer reads and queries |
CommitStore |
The atomic commit boundary: commit_envelope / commit_transition (ADR-0023) |
EventStore |
Append-only ledger event log (idempotent on a per-transfer dedup key) |
BookStore |
Book (transfer policy scope) persistence |
BalanceProjectionStore |
Append-only balance cache points (ADR-0019) |
Every posting and account-version write goes through CommitStore, which
applies a whole transfer or a whole transition in one transaction and re-checks
double-spend, freeze/close, and the overdraft floor inside it. A backend has no
other way to change a posting, so no caller can leave half a transfer applied.
Store is a blanket trait: any type implementing the sub-traits is a Store.
use kuatia_storage::mem_store::InMemoryStore;
async fn new_store() -> InMemoryStore { InMemoryStore::new() }
kuatia_storage::store_tests!(new_store);
This generates a test for every Store method, run against any backend.