pub trait IdempotencyStore:
Send
+ Sync
+ 'static {
// Required methods
fn acquire<'a>(
&'a self,
key: &'a str,
fingerprint: u64,
in_flight_ttl_ms: u64,
) -> IdempotencyFuture<'a, IdempotencyLookup>;
fn complete<'a>(
&'a self,
key: String,
fingerprint: u64,
response: Arc<StoredIdempotentResponse>,
ttl_ms: u64,
) -> IdempotencyFuture<'a, ()>;
fn release<'a>(&'a self, key: &'a str) -> IdempotencyFuture<'a, ()>;
// Provided methods
fn release_on_drop(&self, _key: &str) { ... }
fn purge_expired(&self) -> usize { ... }
}Expand description
Pluggable asynchronous storage contract backing IdempotencyPlugin.
Required Methods§
Sourcefn acquire<'a>(
&'a self,
key: &'a str,
fingerprint: u64,
in_flight_ttl_ms: u64,
) -> IdempotencyFuture<'a, IdempotencyLookup>
fn acquire<'a>( &'a self, key: &'a str, fingerprint: u64, in_flight_ttl_ms: u64, ) -> IdempotencyFuture<'a, IdempotencyLookup>
Atomically checks an existing entry or acquires an exclusive InFlight lock for key.
§Arguments
&'a self- Store reference.&'a str- Scoped idempotency storage key.u64- Request(method, path, body)XxHash3_64fingerprint.u64- MaximumInFlightlock TTL in milliseconds.
§Returns
IdempotencyFuture<'a, IdempotencyLookup>- Acquisition, conflict, mismatch, or cached replay result.
Sourcefn complete<'a>(
&'a self,
key: String,
fingerprint: u64,
response: Arc<StoredIdempotentResponse>,
ttl_ms: u64,
) -> IdempotencyFuture<'a, ()>
fn complete<'a>( &'a self, key: String, fingerprint: u64, response: Arc<StoredIdempotentResponse>, ttl_ms: u64, ) -> IdempotencyFuture<'a, ()>
Commits a completed response for key with the given ttl_ms.
§Arguments
&'a self- Store reference.String- Scoped idempotency storage key.u64- Request(method, path, body)fingerprint.Arc<StoredIdempotentResponse>- Cached response and prebuilt replay wire buffer.u64- Replay cache TTL in milliseconds.
§Returns
IdempotencyFuture<'a, ()>- Completion future.
Provided Methods§
Sourcefn release_on_drop(&self, _key: &str)
fn release_on_drop(&self, _key: &str)
Synchronous best-effort cleanup hook invoked when IdempotencyInFlightGuard drops early.
§Arguments
&str- Scoped idempotency storage key.
Sourcefn purge_expired(&self) -> usize
fn purge_expired(&self) -> usize
Evicts expired entries and returns the count removed.
§Returns
usize- Number of expired entries evicted.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl IdempotencyStore for InMemoryIdempotencyStore
Implements IdempotencyStore for InMemoryIdempotencyStore.