Module turso

Module turso 

Available on crate feature turso only.
Expand description

Optional [turso] persistence backend.

Stores session state as live, queryable rows in a turso (SQLite-compatible) database rather than as a CRC-framed journal file. Each session mutation is applied as an INSERT OR REPLACE / DELETE / UPDATE, so the tables always hold the current state: load is a set of SELECTs and there is no log replay or compaction.

The caller owns the [Database] (which it may share with its own application tables) and finmqtt opens its own Connection from it, so finmqtt’s transactions never interleave with the caller’s. All table names are prefixed so they coexist with other tables, and the schema is versioned per prefix (see schema) so it can evolve over time.

§Concurrency

A table prefix identifies exactly one session: at most one live client may use a given database + prefix combination at a time. This backend performs no mutual-exclusion of its own (mirroring the file journal), so two clients sharing a prefix would silently corrupt each other’s session state. Give each client its own prefix (or database).

Re-exports§

pub use self::store::TursoStore;

Modules§

convert 🔒
Conversions between turso rows/values and finmqtt types, plus error helpers shared across the turso backend.
schema 🔒
Prefixed table names and forward schema migrations.
store 🔒
The runtime turso store: a connection plus the prepared statements that flush ops and rebuild the session.

Structs§

TursoPersistence
Configures session persistence backed by a turso database.

Enums§

Source 🔒
Where the database comes from.

Constants§

DEFAULT_TABLE_PREFIX 🔒
Default prefix applied to every table name finmqtt creates.

Functions§

open_local 🔒
Opens a local turso database file.