pub struct RateLimiter { /* private fields */ }Expand description
Rate limiter for role system operations.
Implementations§
Source§impl RateLimiter
impl RateLimiter
Sourcepub fn new(
global_config: RateLimitConfig,
subject_config: RateLimitConfig,
) -> Self
pub fn new( global_config: RateLimitConfig, subject_config: RateLimitConfig, ) -> Self
Create a new rate limiter.
Sourcepub fn check_permission_rate_limit(&mut self, subject_id: &str) -> Result<()>
pub fn check_permission_rate_limit(&mut self, subject_id: &str) -> Result<()>
Check and record a permission check operation.
Sourcepub fn check_role_assignment_rate_limit(
&mut self,
subject_id: &str,
) -> Result<()>
pub fn check_role_assignment_rate_limit( &mut self, subject_id: &str, ) -> Result<()>
Check rate limit for role assignment operations.
Sourcepub fn usage_stats(&self) -> RateLimitStats
pub fn usage_stats(&self) -> RateLimitStats
Get current usage statistics.
Sourcepub fn reset_subject(&self, subject_id: &str)
pub fn reset_subject(&self, subject_id: &str)
Reset rate limiting windows for a subject.
Sourcepub fn cleanup_expired(&self)
pub fn cleanup_expired(&self)
Cleanup expired windows.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RateLimiter
impl !RefUnwindSafe for RateLimiter
impl Send for RateLimiter
impl Sync for RateLimiter
impl Unpin for RateLimiter
impl UnwindSafe for RateLimiter
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