pub struct ResourceManager {
pub config: ProductionConfig,
/* private fields */
}Expand description
Production resource manager for enforcing limits and monitoring
Fields§
§config: ProductionConfigImplementations§
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 UnsafeUnpin 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
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.