pub struct DownloadManager {
max_concurrent: usize,
active_downloads: Arc<Mutex<HashSet<i64>>>,
}Expand description
Download manager coordinating downloads across workers
Fields§
§max_concurrent: usizeMaximum concurrent downloads
active_downloads: Arc<Mutex<HashSet<i64>>>Currently active download IDs
Implementations§
Source§impl DownloadManager
impl DownloadManager
Sourcepub fn max_concurrent(&self) -> usize
pub fn max_concurrent(&self) -> usize
Get the maximum concurrent downloads
Sourcepub fn set_max_concurrent(&mut self, max: usize)
pub fn set_max_concurrent(&mut self, max: usize)
Set the maximum concurrent downloads
Sourcepub fn can_start_download(&self) -> bool
pub fn can_start_download(&self) -> bool
Check if a new download can be started based on concurrent limit
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Get the number of currently active downloads
Sourcepub fn register_download(&self, download_id: i64) -> bool
pub fn register_download(&self, download_id: i64) -> bool
Register a download as active
Sourcepub fn unregister_download(&self, download_id: i64)
pub fn unregister_download(&self, download_id: i64)
Unregister a download when it completes or fails
Auto Trait Implementations§
impl Freeze for DownloadManager
impl RefUnwindSafe for DownloadManager
impl Send for DownloadManager
impl Sync for DownloadManager
impl Unpin for DownloadManager
impl UnsafeUnpin for DownloadManager
impl UnwindSafe for DownloadManager
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