pub struct ModelDownloader { /* private fields */ }Expand description
Model downloader service
Implementations§
Source§impl ModelDownloader
impl ModelDownloader
pub fn new(storage: Arc<ModelStorage>) -> Self
Sourcepub async fn download_model(
&self,
model_info: ModelInfo,
source: DownloadSource,
existing_download_id: Option<String>,
hf_token: Option<String>,
) -> Result<String>
pub async fn download_model( &self, model_info: ModelInfo, source: DownloadSource, existing_download_id: Option<String>, hf_token: Option<String>, ) -> Result<String>
Download a model from the specified source
If existing_download_id is provided, uses that for progress tracking instead of creating a new one
If hf_token is provided, it will be used for HuggingFace authentication
Sourcepub async fn save_model_metadata(
&self,
model_info: &ModelInfo,
source: &DownloadSource,
) -> Result<()>
pub async fn save_model_metadata( &self, model_info: &ModelInfo, source: &DownloadSource, ) -> Result<()>
Save model metadata after successful download
Sourcepub fn progress_tracker(&self) -> &Arc<ProgressTracker>
pub fn progress_tracker(&self) -> &Arc<ProgressTracker>
Get reference to progress tracker
Sourcepub async fn cancel_download(&self, download_id: &str) -> bool
pub async fn cancel_download(&self, download_id: &str) -> bool
Cancel an ongoing download
Auto Trait Implementations§
impl Freeze for ModelDownloader
impl !RefUnwindSafe for ModelDownloader
impl Send for ModelDownloader
impl Sync for ModelDownloader
impl Unpin for ModelDownloader
impl UnsafeUnpin for ModelDownloader
impl !UnwindSafe for ModelDownloader
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