Skip to main content

Crate ff_backend_sqlite

Crate ff_backend_sqlite 

Source
Expand description

EngineBackend implementation backed by SQLite — dev-only per RFC-023.

§Phase 1a scope

This crate is the RFC-023 Phase 1a scaffold: construction semantics (FF_DEV_MODE=1 guard, per-path registry, connection pool, WARN banner), the SQLite transient-busy error classifier skeleton, and an EngineBackend impl whose data-plane methods return EngineError::Unavailable. Phase 1b lands the hand-ported SQLite-dialect migrations; Phase 2+ replaces the Unavailable stubs with real bodies paralleling ff-backend-postgres.

§Production guard

SqliteBackend::new refuses to construct without FF_DEV_MODE=1 in the process environment. The refusal is on the TYPE (RFC-023 §3.3 A3 / §4.5) so every path — embedded library consumers, ff_server::start_sqlite_branch, and ff_sdk::FlowFabricWorker::connect_with — pays the guard.

No ferriskey dep — this crate’s transport is sqlx.

Re-exports§

pub use errors::MAX_ATTEMPTS;
pub use retry::IsRetryableBusy;
pub use retry::retry_serializable;

Modules§

queries
SQLite dialect-forked query modules per RFC-023 §4.1.
retry
SERIALIZABLE retry helper for SQLite per RFC-023 §4.3.

Structs§

SqliteBackend
RFC-023 SQLite dev-only backend.
SqliteScannerConfig
Subset of EngineConfig’s interval knobs that the SQLite reconcilers honour. Only budget_reset_interval is wired today; kept as a struct (not a bare Duration) so additional cadences are additive, matching [ff_backend_postgres::PostgresScannerConfig].
SqliteScannerHandle
Spawned scanner supervisor. Holding this handle keeps the reconciler tasks alive; drop-on-backend or explicit shutdown drains them. Returned by [spawn_scanners]; stored inside SqliteBackendInner so EngineBackend::shutdown_prepare can drain on server shutdown.

Functions§

is_retryable_sqlite_busy
Return true when the sqlx error is a transient busy-contention fault that is safe to retry. Mirrors the shape of PG’s is_retryable_serialization classifier.