pub struct InMemoryIdempotencyStore { /* private fields */ }Expand description
High-concurrency 64-way sharded bounded in-memory IdempotencyStore.
Implementations§
Source§impl InMemoryIdempotencyStore
Inherent 64-way sharded storage operations for InMemoryIdempotencyStore.
impl InMemoryIdempotencyStore
Inherent 64-way sharded storage operations for InMemoryIdempotencyStore.
Sourcepub fn new(max_entries: usize, max_bytes: usize) -> Self
pub fn new(max_entries: usize, max_bytes: usize) -> Self
Creates a 64-way sharded bounded InMemoryIdempotencyStore.
§Arguments
usize- Maximum entry count across all shards.usize- Maximum byte budget across all shards.
§Returns
Self- Ready sharded store.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the live tracked entry count across all 64 shards in O(1) time without locking.
§Returns
usize- Current entry count.
Sourcepub fn total_bytes(&self) -> usize
pub fn total_bytes(&self) -> usize
Returns the estimated total memory usage across all shards in bytes.
§Returns
usize- Approximate byte footprint.
Sourcepub fn acquire_sync(
&self,
key: &str,
fingerprint: u64,
in_flight_ttl_ms: u64,
) -> IdempotencyLookup
pub fn acquire_sync( &self, key: &str, fingerprint: u64, in_flight_ttl_ms: u64, ) -> IdempotencyLookup
Sourcepub fn complete_sync(
&self,
key: String,
fingerprint: u64,
response: Arc<StoredIdempotentResponse>,
ttl_ms: u64,
)
pub fn complete_sync( &self, key: String, fingerprint: u64, response: Arc<StoredIdempotentResponse>, ttl_ms: u64, )
Synchronous commit storing a completed StoredIdempotentResponse under key.
§Arguments
String- Scoped storage key.u64- Request fingerprint.Arc<StoredIdempotentResponse>- Cached response and prebuilt replay wire bytes.u64- Replay cache TTL in milliseconds.
Sourcepub fn release_sync(&self, key: &str)
pub fn release_sync(&self, key: &str)
Synchronously releases an InFlight slot (leaving any already-completed response intact).
§Arguments
&str- Scoped storage key.
Trait Implementations§
Source§impl Clone for InMemoryIdempotencyStore
impl Clone for InMemoryIdempotencyStore
Source§impl Default for InMemoryIdempotencyStore
Default construction for InMemoryIdempotencyStore.
impl Default for InMemoryIdempotencyStore
Default construction for InMemoryIdempotencyStore.
Source§impl IdempotencyStore for InMemoryIdempotencyStore
Implements IdempotencyStore for InMemoryIdempotencyStore.
impl IdempotencyStore for InMemoryIdempotencyStore
Implements IdempotencyStore for InMemoryIdempotencyStore.
Source§fn 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>
Source§fn 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, ()>
Source§fn release_on_drop(&self, key: &str)
fn release_on_drop(&self, key: &str)
Releases an abandoned InFlight lock synchronously during RAII Drop.
§Arguments
&str- Scoped storage key.
Source§fn purge_expired(&self) -> usize
fn purge_expired(&self) -> usize
Auto Trait Implementations§
impl Forget for InMemoryIdempotencyStore
impl Freeze for InMemoryIdempotencyStorewhere
*const ArcInner<InMemoryIdempotencyStoreInner> is !null: Freeze,
PhantomData<ArcInner<InMemoryIdempotencyStoreInner>>: Freeze,
impl Move for InMemoryIdempotencyStore
impl RefUnwindSafe for InMemoryIdempotencyStorewhere
Atomic<usize>: RefUnwindSafe,
RwLock<HashMap<String, IdempotencySlot, BuildHasherDefault<XxHash3_64>>>: RefUnwindSafe,
impl Send for InMemoryIdempotencyStore
impl Sync for InMemoryIdempotencyStore
impl Unpin for InMemoryIdempotencyStore
impl UnsafeUnpin for InMemoryIdempotencyStorewhere
*const ArcInner<InMemoryIdempotencyStoreInner> is !null: UnsafeUnpin,
PhantomData<ArcInner<InMemoryIdempotencyStoreInner>>: UnsafeUnpin,
impl UnwindSafe for InMemoryIdempotencyStorewhere
Arc<InMemoryIdempotencyStoreInner>: UnwindSafe,
Blanket Implementations§
impl<T> AnySend for T
impl<T> AnySendClone for T
impl<T> AnySendSync for T
impl<T> AnySendSyncClone for T
impl<T> AnySync for T
impl<T> AnySyncClone for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more