Skip to main content

HttpIdempotencyRepository

Trait HttpIdempotencyRepository 

Source
pub trait HttpIdempotencyRepository: Send + Sync {
    // Required methods
    fn get(
        &self,
        tenant: &str,
        key: &str,
        expired_before: DateTime<Utc>,
    ) -> Result<Option<HttpIdempotencyRecord>>;
    fn put(&self, record: &HttpIdempotencyRecord) -> Result<bool>;
    fn purge_expired(&self, expired_before: DateTime<Utc>) -> Result<u64>;
}
Expand description

Repository over the http_idempotency_keys table.

Required Methods§

Source

fn get( &self, tenant: &str, key: &str, expired_before: DateTime<Utc>, ) -> Result<Option<HttpIdempotencyRecord>>

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.

Source

fn put(&self, record: &HttpIdempotencyRecord) -> Result<bool>

Insert a new entry. Returns false (without overwriting) when an entry for (tenant, key) already exists — first write wins across replicas.

Source

fn purge_expired(&self, expired_before: DateTime<Utc>) -> Result<u64>

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".

Implementors§

Source§

impl HttpIdempotencyRepository for SqliteHttpIdempotencyRepository

Available on crate feature sqlite only.