hyperlane-plugin-idempotency 22.14.0

A production HTTP Idempotency-Key middleware plugin for the Hyperlane framework featuring XxHash3_64 request fingerprinting (422 mismatch), 64-way sharded bounded InMemoryIdempotencyStore + async IdempotencyStore trait, InFlight concurrent duplicate guard (409 Conflict), and zero-copy cached response replay with Idempotent-Replayed headers.
Documentation
use super::*;

/// Result of attempting to acquire or replay an `Idempotency-Key` in an [`IdempotencyStore`].
#[derive(Clone, Debug)]
pub enum IdempotencyLookup {
    /// No prior entry existed; this caller acquired the exclusive `InFlight` slot.
    Acquired,
    /// Another request with the same key and fingerprint is currently executing (`409 Conflict`).
    InFlight,
    /// A prior or in-flight entry exists under the same key with a different request fingerprint (`422`).
    FingerprintMismatch,
    /// A completed cached response matched both key and fingerprint and is ready for zero-copy replay.
    Replayed(Arc<StoredIdempotentResponse>),
}

/// Internal shard slot state stored inside [`InMemoryIdempotencyStore`].
#[derive(Clone)]
pub(crate) enum IdempotencySlotState {
    /// Request is currently executing in a route handler.
    InFlight,
    /// Request finished and its response is cached for zero-copy replay.
    Completed(Arc<StoredIdempotentResponse>),
}