pub trait HttpIdempotencyRepository: Send + Sync {
// Required methods
fn get(
&self,
tenant: &str,
key: &str,
expired_before: DateTime<Utc>,
) -> Result<Option<HttpIdempotencyRecord>, CommerceError>;
fn put(&self, record: &HttpIdempotencyRecord) -> Result<bool, CommerceError>;
fn purge_expired(
&self,
expired_before: DateTime<Utc>,
) -> Result<u64, CommerceError>;
}Expand description
Repository over the http_idempotency_keys table.
Required Methods§
Sourcefn get(
&self,
tenant: &str,
key: &str,
expired_before: DateTime<Utc>,
) -> Result<Option<HttpIdempotencyRecord>, CommerceError>
fn get( &self, tenant: &str, key: &str, expired_before: DateTime<Utc>, ) -> Result<Option<HttpIdempotencyRecord>, CommerceError>
Fetch the entry for (tenant, key).
Rows created strictly before expired_before are treated as expired:
they are deleted (lazy cleanup) and None is returned.
Sourcefn put(&self, record: &HttpIdempotencyRecord) -> Result<bool, CommerceError>
fn put(&self, record: &HttpIdempotencyRecord) -> Result<bool, CommerceError>
Insert a new entry. Returns false (without overwriting) when an entry
for (tenant, key) already exists — first write wins across replicas.
Sourcefn purge_expired(
&self,
expired_before: DateTime<Utc>,
) -> Result<u64, CommerceError>
fn purge_expired( &self, expired_before: DateTime<Utc>, ) -> Result<u64, CommerceError>
Delete all entries created strictly before expired_before, returning
the number of rows removed.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".