Skip to main content

Crate codlet_sqlx

Crate codlet_sqlx 

Source
Expand description

SQLite storage adapters for codlet (RFC-011).

SqliteStore wraps a sqlx::SqlitePool and implements all three core store traits plus the admin extension:

§Backend options

SQLx supports three SQLite connection strings:

"sqlite::memory:"          — ephemeral, in-process only (tests / local dev)
"sqlite:path/to/codlet.db" — persistent file on disk (single-server production)
"sqlite::memory:?cache=shared&uri=true" — named shared memory (advanced)

For production use a file-backed database and set WAL mode (applied automatically by run_migrations).

§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, WAL mode and an appropriate busy-timeout are recommended.

§Conformance

All 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§

admin
CodeAdminStore implementation for SqliteStore.
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§

SqliteStore
A handle wrapping a sqlx::SqlitePool that implements all three codlet store traits.