pub struct InMemoryNonceStore { /* private fields */ }Expand description
In-memory nonce store. One mutex; the working set is bounded by the clock-skew window — a 5-minute skew at 10k req/s caps at ~3M entries, which is fine. Production multi-replica deployments swap in Redis.
Implementations§
Trait Implementations§
Source§impl Clone for InMemoryNonceStore
impl Clone for InMemoryNonceStore
Source§fn clone(&self) -> InMemoryNonceStore
fn clone(&self) -> InMemoryNonceStore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InMemoryNonceStore
impl Debug for InMemoryNonceStore
Source§impl Default for InMemoryNonceStore
impl Default for InMemoryNonceStore
Source§fn default() -> InMemoryNonceStore
fn default() -> InMemoryNonceStore
Returns the “default value” for a type. Read more
Source§impl NonceStore for InMemoryNonceStore
impl NonceStore for InMemoryNonceStore
Source§fn record_if_unseen<'life0, 'life1, 'async_trait>(
&'life0 self,
nonce: &'life1 str,
expires_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<bool, CoolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn record_if_unseen<'life0, 'life1, 'async_trait>(
&'life0 self,
nonce: &'life1 str,
expires_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<bool, CoolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Attempt to register
nonce as seen. Returns Ok(true) if it
is the first time we see it (caller may proceed); Ok(false)
if it was already recorded (caller should reject). Implementations
must drop entries past expires_at to keep the working set bounded.Auto Trait Implementations§
impl Freeze for InMemoryNonceStore
impl RefUnwindSafe for InMemoryNonceStore
impl Send for InMemoryNonceStore
impl Sync for InMemoryNonceStore
impl Unpin for InMemoryNonceStore
impl UnsafeUnpin for InMemoryNonceStore
impl UnwindSafe for InMemoryNonceStore
Blanket Implementations§
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