Expand description
sqlx::Error → EngineError mapping for the Postgres backend.
RFC-v0.7 Wave 0. This is a map-sketch: enough surface for
subsequent waves’ trait-method bodies to route transport faults
through EngineError::Transport { backend: "postgres", .. } plus
the two typed cases the design-question matrix already pinned:
SqlState::UniqueViolation(23505) →EngineError::Conflict— mirrors the Valkey backend’s conflict classification for duplicate-key writes (e.g. waitpoint id collision, unique index violation onff_completion_eventetc.).SqlState::SerializationFailure(40001) /DeadlockDetected(40P01) →EngineError::Contention— per Q11 (isolation level default) these are the retryable serialization faults SERIALIZABLE can raise; callers retry per RFC-010 §10.7.
Every other sqlx::Error boxes through Transport as a safe
default. Future waves refine (e.g. RowNotFound → NotFound,
connection-pool-closed → Unavailable).
Structs§
- Postgres
Transport Error - Thin newtype over
sqlx::Errorso a blanketFrom<sqlx::Error> for EngineErrordoesn’t conflict with ff-core’s own orphan rules when downstream crates add their own. Backend-internal call sites usemap_sqlx_errordirectly; this wrapper exists for future cases where we want to attach a typed source to a differentEngineErrorvariant.
Functions§
- map_
sqlx_ error - Convert a
sqlx::Errorinto anEngineError.