pub struct MemoryKnockStore(/* private fields */);Expand description
In-process KnockStore. Clones share one table; each call takes one
lock, so every operation is atomic.
Implementations§
Trait Implementations§
Source§impl Clone for MemoryKnockStore
impl Clone for MemoryKnockStore
Source§impl Debug for MemoryKnockStore
impl Debug for MemoryKnockStore
Source§impl Default for MemoryKnockStore
impl Default for MemoryKnockStore
Source§impl KnockStore for MemoryKnockStore
impl KnockStore for MemoryKnockStore
Source§fn queue_knock<'life0, 'life1, 'async_trait>(
&'life0 self,
knock: &'life1 PendingKnock,
cap: usize,
now: i64,
) -> Pin<Box<dyn Future<Output = Result<Queued, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn queue_knock<'life0, 'life1, 'async_trait>(
&'life0 self,
knock: &'life1 PendingKnock,
cap: usize,
now: i64,
) -> Pin<Box<dyn Future<Output = Result<Queued, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Queue
knock. Pending knocks on its resource that lapsed at now are
dropped first; the requester’s own earlier one is replaced in place;
otherwise it is refused (Queued::Full) when cap others wait.Source§fn pending_knocks<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
kind: &'life1 str,
id: &'life2 str,
now: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<PendingKnock>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn pending_knocks<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
kind: &'life1 str,
id: &'life2 str,
now: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<PendingKnock>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Unlapsed pending knocks on one resource, oldest first.
Source§fn pending_knock<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
now: i64,
) -> Pin<Box<dyn Future<Output = Result<Option<PendingKnock>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pending_knock<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
now: i64,
) -> Pin<Box<dyn Future<Output = Result<Option<PendingKnock>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
One unlapsed pending knock by id.
Source§fn drop_knock<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn drop_knock<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove a pending knock (it was answered). Idempotent.
fn put_offer<'life0, 'life1, 'async_trait>(
&'life0 self,
offer: &'life1 StoredOffer,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn redeem_offer<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
jti: &'life1 str,
redeemer: &'life2 PrincipalId,
now: i64,
) -> Pin<Box<dyn Future<Output = Result<Redeemed, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn redeem_offer<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
jti: &'life1 str,
redeemer: &'life2 PrincipalId,
now: i64,
) -> Pin<Box<dyn Future<Output = Result<Redeemed, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Redeem
jti for redeemer, atomically against max_uses (distinct
keys) and exp.fn admission<'life0, 'life1, 'async_trait>(
&'life0 self,
jti: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Admission>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn record_admission<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
jti: &'life1 str,
outcome: &'life2 Admission,
_now: i64,
) -> Pin<Box<dyn Future<Output = Result<Admission, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn record_admission<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
jti: &'life1 str,
outcome: &'life2 Admission,
_now: i64,
) -> Pin<Box<dyn Future<Output = Result<Admission, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Record
outcome for jti unless one is recorded already; returns the
outcome that stands (the earlier one on a race).Auto Trait Implementations§
impl Freeze for MemoryKnockStore
impl RefUnwindSafe for MemoryKnockStore
impl Send for MemoryKnockStore
impl Sync for MemoryKnockStore
impl Unpin for MemoryKnockStore
impl UnsafeUnpin for MemoryKnockStore
impl UnwindSafe for MemoryKnockStore
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