pub struct SqlxRateLimitStorage { /* private fields */ }Expand description
Shared database storage. Run SchemaMigrator::migrate before serving
requests; ordinary auth migrations do not create or claim its table.
Compare-and-swap predicates preserve quotas across independent application instances.
Implementations§
Trait Implementations§
Source§impl Clone for SqlxRateLimitStorage
impl Clone for SqlxRateLimitStorage
Source§impl Debug for SqlxRateLimitStorage
impl Debug for SqlxRateLimitStorage
Source§impl RateLimitStorage for SqlxRateLimitStorage
impl RateLimitStorage for SqlxRateLimitStorage
Source§fn observe_window(&self, window: f64)
fn observe_window(&self, window: f64)
Publish configured windows before serving requests, so persistent
storage can prune without retiring a longer-lived configured quota.
fn consume<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
rule: &'life2 EndpointRateLimit,
) -> Pin<Box<dyn Future<Output = AuthResult<RateLimitDecision>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§impl SchemaMigrator for SqlxRateLimitStorage
Installs the opt-in rate-limit table using its own migration ledger.
Migration errors are returned without serving requests on missing storage.
impl SchemaMigrator for SqlxRateLimitStorage
Installs the opt-in rate-limit table using its own migration ledger. Migration errors are returned without serving requests on missing storage.
Auto Trait Implementations§
impl !RefUnwindSafe for SqlxRateLimitStorage
impl !UnwindSafe for SqlxRateLimitStorage
impl Freeze for SqlxRateLimitStorage
impl Send for SqlxRateLimitStorage
impl Sync for SqlxRateLimitStorage
impl Unpin for SqlxRateLimitStorage
impl UnsafeUnpin for SqlxRateLimitStorage
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more