Skip to main content

Module persistence

Module persistence 

Available on crate feature tokio only.
Expand description

Session persistence: backend-agnostic configuration and runtime dispatch.

SessionPersistence is the configuration passed to ClientBuilder::persistence. Build it from a dedicated backend builder (FilePersistence or, with the turso feature, TursoPersistence). Each builder exposes only its own options and converts into a SessionPersistence via From.

At connect time it is turned into a Persistence, the runtime backend that the event loop of the connection calls Persistence::persist on. The storage details are not in this module but in the backend modules, which each define their config, runtime store and build. Every backend follows the same retry-safe contract. Accumulated ops are cleared from the in-memory session only after they have been durably persisted. After a failed write they remain buffered for the next attempt.

Re-exports§

pub use self::file::FilePersistence;
pub use self::turso::TursoPersistence;turso

Modules§

file 🔒
CRC-framed journal-file persistence backend.
turso 🔒 turso
Optional [turso] persistence backend.

Structs§

SessionPersistence
Configures how a client’s session is durably persisted across restarts.

Enums§

Inner 🔒
The selected backend. It is hidden to keep the variant set private. Callers only construct it via the backend builders and never match on it.
Persistence 🔒
The runtime backend a connection persists its session ops to.

Functions§

out_of_memory 🔒
Reports a failed allocation as an io::ErrorKind::OutOfMemory error.