pub struct ProgressTracker { /* private fields */ }Expand description
Progress tracker for managing multiple downloads
Implementations§
Source§impl ProgressTracker
impl ProgressTracker
pub fn new() -> Self
Sourcepub async fn start_download(
&self,
model_id: String,
model_name: String,
total_bytes: Option<u64>,
) -> String
pub async fn start_download( &self, model_id: String, model_name: String, total_bytes: Option<u64>, ) -> String
Start tracking a new download
Sourcepub async fn update_progress(
&self,
download_id: &str,
bytes_downloaded: u64,
status: DownloadStatus,
error_message: Option<String>,
)
pub async fn update_progress( &self, download_id: &str, bytes_downloaded: u64, status: DownloadStatus, error_message: Option<String>, )
Update download progress
Sourcepub async fn update_elapsed_time(&self, download_id: &str, elapsed: Duration)
pub async fn update_elapsed_time(&self, download_id: &str, elapsed: Duration)
Update elapsed time for a download
Sourcepub async fn update_total_bytes(&self, download_id: &str, total_bytes: u64)
pub async fn update_total_bytes(&self, download_id: &str, total_bytes: u64)
Update total bytes for a download (e.g., when Content-Length is received from HTTP response)
Sourcepub async fn get_progress(&self, download_id: &str) -> Option<DownloadProgress>
pub async fn get_progress(&self, download_id: &str) -> Option<DownloadProgress>
Get current progress for a download
Sourcepub async fn get_active_downloads(&self) -> Vec<DownloadProgress>
pub async fn get_active_downloads(&self) -> Vec<DownloadProgress>
Get all active downloads
Sourcepub async fn get_all_downloads(&self) -> Vec<DownloadProgress>
pub async fn get_all_downloads(&self) -> Vec<DownloadProgress>
Get all downloads (active and completed)
Sourcepub async fn subscribe(
&self,
download_id: &str,
) -> Option<Receiver<DownloadProgress>>
pub async fn subscribe( &self, download_id: &str, ) -> Option<Receiver<DownloadProgress>>
Subscribe to progress updates for a specific download
Sourcepub async fn remove_download(&self, download_id: &str)
pub async fn remove_download(&self, download_id: &str)
Remove a download from tracking
Sourcepub async fn cancel_download(&self, download_id: &str) -> bool
pub async fn cancel_download(&self, download_id: &str) -> bool
Cancel a download
Sourcepub async fn get_statistics(&self) -> DownloadStatistics
pub async fn get_statistics(&self) -> DownloadStatistics
Get overall download statistics
Auto Trait Implementations§
impl Freeze for ProgressTracker
impl !RefUnwindSafe for ProgressTracker
impl Send for ProgressTracker
impl Sync for ProgressTracker
impl Unpin for ProgressTracker
impl UnsafeUnpin for ProgressTracker
impl !UnwindSafe for ProgressTracker
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more