pub struct ResourceManager { /* private fields */ }Expand description
Production-grade resource manager for RS2 streaming library
Implementations§
Source§impl ResourceManager
impl ResourceManager
Sourcepub fn with_config(config: ResourceConfig) -> Self
pub fn with_config(config: ResourceConfig) -> Self
Create a new resource manager with custom configuration
Sourcepub async fn track_memory_allocation(
&self,
bytes: u64,
) -> Result<(), ResourceError>
pub async fn track_memory_allocation( &self, bytes: u64, ) -> Result<(), ResourceError>
Track memory allocation
Sourcepub async fn track_memory_deallocation(&self, bytes: u64)
pub async fn track_memory_deallocation(&self, bytes: u64)
Track memory deallocation
Sourcepub async fn track_key_creation(&self) -> Result<(), ResourceError>
pub async fn track_key_creation(&self) -> Result<(), ResourceError>
Track key creation
Sourcepub async fn track_key_removal(&self)
pub async fn track_key_removal(&self)
Track key removal
Sourcepub async fn track_buffer_overflow(&self) -> Result<(), ResourceError>
pub async fn track_buffer_overflow(&self) -> Result<(), ResourceError>
Track buffer overflow
Sourcepub async fn get_metrics(&self) -> ResourceMetrics
pub async fn get_metrics(&self) -> ResourceMetrics
Get current resource metrics
Sourcepub async fn is_circuit_open(&self) -> bool
pub async fn is_circuit_open(&self) -> bool
Check if circuit breaker is open
Sourcepub async fn reset_circuit_breaker(&self)
pub async fn reset_circuit_breaker(&self)
Reset circuit breaker to half-open state
Sourcepub async fn close_circuit_breaker(&self)
pub async fn close_circuit_breaker(&self)
Close circuit breaker
Sourcepub async fn periodic_cleanup(&self)
pub async fn periodic_cleanup(&self)
Perform periodic cleanup
Sourcepub async fn track_resource(&self, resource_id: String, size_bytes: u64)
pub async fn track_resource(&self, resource_id: String, size_bytes: u64)
Track a specific resource
Sourcepub async fn untrack_resource(&self, resource_id: &str) -> Option<u64>
pub async fn untrack_resource(&self, resource_id: &str) -> Option<u64>
Untrack a specific resource
Sourcepub async fn get_memory_pressure(&self) -> u8
pub async fn get_memory_pressure(&self) -> u8
Get memory pressure level (0-100)
Sourcepub async fn is_under_memory_pressure(&self) -> bool
pub async fn is_under_memory_pressure(&self) -> bool
Check if system is under memory pressure
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