pub struct ResourceManager { /* private fields */ }
Expand description
Production resource manager for enforcing limits and monitoring
Implementations§
Source§impl ResourceManager
impl ResourceManager
Sourcepub fn new(config: ProductionConfig) -> Self
pub fn new(config: ProductionConfig) -> Self
Create a new resource manager with the given configuration
Sourcepub async fn acquire_connection(&self) -> Result<ConnectionGuard<'_>>
pub async fn acquire_connection(&self) -> Result<ConnectionGuard<'_>>
Attempt to acquire a connection slot
Sourcepub async fn check_rate_limit(
&self,
peer_id: &str,
operation: &str,
) -> Result<bool>
pub async fn check_rate_limit( &self, peer_id: &str, operation: &str, ) -> Result<bool>
Check if a peer is within rate limits for the given operation
Sourcepub fn record_bandwidth(&self, bytes_sent: u64, bytes_received: u64)
pub fn record_bandwidth(&self, bytes_sent: u64, bytes_received: u64)
Record bandwidth usage
Sourcepub async fn get_metrics(&self) -> ResourceMetrics
pub async fn get_metrics(&self) -> ResourceMetrics
Get current resource metrics
Sourcepub async fn health_check(&self) -> Result<()>
pub async fn health_check(&self) -> Result<()>
Check if the system is healthy
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ResourceManager
impl !RefUnwindSafe for ResourceManager
impl Send for ResourceManager
impl Sync for ResourceManager
impl Unpin for ResourceManager
impl !UnwindSafe for ResourceManager
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