Skip to main content

Crate entelix_persistence

Crate entelix_persistence 

Source
Expand description

§entelix-persistence

Postgres + Redis backends for the three storage traits owned by other crates: entelix_graph::Checkpointer, entelix_memory::Store, and the session event log (entelix_session::SessionGraph). Each backend is a *Persistence bundle — a single builder produces a (Checkpointer, Store, SessionLog) triplet sharing one connection pool / lock backend.

Distributed session locking lives behind the DistributedLock trait; with_session_lock composes lock acquisition with a caller closure (invariant 8 — durable session writes happen under a lock).

Cargo features:

  • postgres — pulls sqlx, enables the postgres module.
  • redis — pulls redis, enables the redis module.
  • test-containers — pulls testcontainers for ephemeral docker integration tests; implies both backends.

Re-exports§

pub use advisory_key::AdvisoryKey;
pub use error::PersistenceError;
pub use error::PersistenceResult;
pub use lock::DistributedLock;
pub use lock::LockGuard;
pub use lock::with_session_lock;
pub use schema_version::SessionSchemaVersion;

Modules§

advisory_key
Advisory lock key derivation.
error
Crate-internal error type. Public APIs map this back into entelix_core::Error::Persistence (or Provider) at the orchestration layer.
lock
Distributed lock primitives.
postgrespostgres
Postgres-backed persistence — Checkpointer<S>, Store<V>, SessionLog, and a DistributedLock over pg_advisory_xact_lock.
redisredis
Redis-backed persistence — Checkpointer<S>, Store<V>, SessionLog, and a DistributedLock over SET NX PX plus a Lua release script.
schema_version
Persisted-payload schema version stamps.