Skip to main content

hyperlane_plugin_idempotency/
enum.rs

1use super::*;
2
3/// Result of attempting to acquire or replay an `Idempotency-Key` in an [`IdempotencyStore`].
4#[derive(Clone, Debug)]
5pub enum IdempotencyLookup {
6    /// No prior entry existed; this caller acquired the exclusive `InFlight` slot.
7    Acquired,
8    /// Another request with the same key and fingerprint is currently executing (`409 Conflict`).
9    InFlight,
10    /// A prior or in-flight entry exists under the same key with a different request fingerprint (`422`).
11    FingerprintMismatch,
12    /// A completed cached response matched both key and fingerprint and is ready for zero-copy replay.
13    Replayed(Arc<StoredIdempotentResponse>),
14}
15
16/// Internal shard slot state stored inside [`InMemoryIdempotencyStore`].
17#[derive(Clone)]
18pub(crate) enum IdempotencySlotState {
19    /// Request is currently executing in a route handler.
20    InFlight,
21    /// Request finished and its response is cached for zero-copy replay.
22    Completed(Arc<StoredIdempotentResponse>),
23}