pub struct RateLimiterManager { /* private fields */ }Expand description
Rate limiter manager that handles multiple rate limiters
Implementations§
Source§impl RateLimiterManager
impl RateLimiterManager
Sourcepub fn with_graphql_rate_limit(self, config: RateLimitConfig) -> Self
pub fn with_graphql_rate_limit(self, config: RateLimitConfig) -> Self
Enable GraphQL rate limiting
Sourcepub fn with_rest_rate_limit(self, config: RateLimitConfig) -> Self
pub fn with_rest_rate_limit(self, config: RateLimitConfig) -> Self
Enable REST API rate limiting
Sourcepub fn with_blockchain_rate_limit(self, config: RateLimitConfig) -> Self
pub fn with_blockchain_rate_limit(self, config: RateLimitConfig) -> Self
Enable blockchain RPC rate limiting
Sourcepub fn with_default_limits(self) -> Self
pub fn with_default_limits(self) -> Self
Enable all rate limiters with default configs
Sourcepub async fn acquire_graphql(&self) -> Result<(), RateLimitError>
pub async fn acquire_graphql(&self) -> Result<(), RateLimitError>
Wait for permission to make a GraphQL request
Sourcepub async fn acquire_rest(&self) -> Result<(), RateLimitError>
pub async fn acquire_rest(&self) -> Result<(), RateLimitError>
Wait for permission to make a REST API request
Sourcepub async fn acquire_blockchain(&self) -> Result<(), RateLimitError>
pub async fn acquire_blockchain(&self) -> Result<(), RateLimitError>
Wait for permission to make a blockchain RPC request
Sourcepub async fn try_acquire_graphql(&self) -> bool
pub async fn try_acquire_graphql(&self) -> bool
Try to acquire permission for GraphQL without waiting
Sourcepub async fn try_acquire_rest(&self) -> bool
pub async fn try_acquire_rest(&self) -> bool
Try to acquire permission for REST API without waiting
Sourcepub async fn try_acquire_blockchain(&self) -> bool
pub async fn try_acquire_blockchain(&self) -> bool
Try to acquire permission for blockchain RPC without waiting
Trait Implementations§
Source§impl Debug for RateLimiterManager
impl Debug for RateLimiterManager
Auto Trait Implementations§
impl !RefUnwindSafe for RateLimiterManager
impl !UnwindSafe for RateLimiterManager
impl Freeze for RateLimiterManager
impl Send for RateLimiterManager
impl Sync for RateLimiterManager
impl Unpin for RateLimiterManager
impl UnsafeUnpin for RateLimiterManager
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<T> ErasedDestructor for Twhere
T: 'static,
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> 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