pub trait BarnacleStore:
Clone
+ Send
+ Sync {
// Required methods
fn increment<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context: &'life1 BarnacleContext,
config: &'life2 BarnacleConfig,
) -> Pin<Box<dyn Future<Output = Result<BarnacleResult, BarnacleError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn reset<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 BarnacleContext,
) -> Pin<Box<dyn Future<Output = Result<(), BarnacleError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
Trait to abstract the rate limiter storage backend (e.g., Redis)
Required Methods§
Sourcefn increment<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context: &'life1 BarnacleContext,
config: &'life2 BarnacleConfig,
) -> Pin<Box<dyn Future<Output = Result<BarnacleResult, BarnacleError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn increment<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context: &'life1 BarnacleContext,
config: &'life2 BarnacleConfig,
) -> Pin<Box<dyn Future<Output = Result<BarnacleResult, BarnacleError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Increments the counter for the key and returns the current number of requests and remaining time until reset.
Sourcefn reset<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 BarnacleContext,
) -> Pin<Box<dyn Future<Output = Result<(), BarnacleError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn reset<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 BarnacleContext,
) -> Pin<Box<dyn Future<Output = Result<(), BarnacleError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Resets the counter for the key (e.g., after successful login).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.