Expand description
SQLite storage adapters for codlet (RFC-011).
Each adapter is a thin wrapper around a sqlx::SqlitePool that
implements the corresponding codlet-core store trait using SQLite’s
conditional UPDATE semantics for atomic single-winner operations
(RFC-022).
§Usage
use codlet_sqlx::{SqliteStore, run_migrations};
let pool = sqlx::SqlitePool::connect("sqlite::memory:").await?;
run_migrations(&pool).await?;
let store = SqliteStore::new(pool);
// store implements CodeStore + SessionStore + FormTokenStore§Atomicity guarantee
Every one-time transition (code claim, form-token consume) uses a single
UPDATE … WHERE … AND <guard condition> followed by an affected-row count
check. SQLite’s serialised write mode ensures these are atomic under
concurrent access from multiple threads within the same process. For
multi-process deployments (rare for codlet’s target use case), WAL mode
and appropriate busy-timeout settings are recommended.
§Conformance
All three stores pass the full codlet-conformance suite, including the
concurrent-claim race test (RFC-022, RFC-023).
Re-exports§
pub use migration::run_migrations;
Modules§
- code
- SQLite implementation of
codlet_core::store::code::CodeStore. - migration
- Migration runner for codlet SQLite tables (RFC-011 §10.4).
- session
- SQLite implementation of
codlet_core::store::session::SessionStore. - token
- SQLite implementation of
codlet_core::store::token::FormTokenStore.
Structs§
- Sqlite
Store - A handle wrapping a
sqlx::SqlitePoolthat implements all three codlet store traits.