Cesar Rodas 519edc4f62 Close double-spend races and atomicity gaps in the storage layer 3 недель назад
..
src 519edc4f62 Close double-spend races and atomicity gaps in the storage layer 3 недель назад
tests 2ff5b1c65f Make the Store the atomic invariant boundary for commits 3 недель назад
Cargo.toml e0b8bbffd2 Add accounting-mapping doc and ignore .DS_Store 3 недель назад
README.md 2ff5b1c65f Make the Store the atomic invariant boundary for commits 3 недель назад

README.md

kuatia-storage-sql

SQL-backed Store implementation for the kuatia ledger.

Uses sqlx::Any for database-agnostic queries. Enable features to select the backend:

[dependencies]
kuatia-storage-sql = { features = ["sqlite"] }   # or "postgres"

Backends

Feature Backend Status
sqlite (default) SQLite via sqlx Conformance tests pass
postgres PostgreSQL via sqlx Portable DDL/queries; needs a running instance to test

The backend is detected at migration time and the matching DDL is applied from src/migrations/{sqlite,postgres}/ (SQLite uses BLOB, PostgreSQL uses BYTEA). Applied migrations are tracked in a _migrations table, so migrate() is idempotent. Upserts use portable ON CONFLICT … DO UPDATE, and all ids are generated in Rust (no AUTOINCREMENT/SERIAL).

Usage

use kuatia_storage_sql::SqlStore;

let pool = sqlx::any::AnyPoolOptions::new()
    .connect("sqlite::memory:").await?;
let store = SqlStore::new(pool);
store.migrate().await?;

Schema

Tables: accounts, postings, transfers, transfer_accounts, sagas, events, books. Migrations run via store.migrate().