pub struct ModelDownloadTracker { /* private fields */ }Expand description
Tracks the status of model downloads using SQLite for persistence
Implementations§
Source§impl ModelDownloadTracker
impl ModelDownloadTracker
pub fn new() -> Self
Sourcepub fn get_status(&self, model_name: &str) -> Option<ModelStatus>
pub fn get_status(&self, model_name: &str) -> Option<ModelStatus>
Gets the status of a model from the database If the model is not in the database, it returns None
Sourcepub fn set_status_and_notify(
&self,
model_name: String,
status: ModelStatus,
provider: ModelProvider,
message: Option<String>,
)
pub fn set_status_and_notify( &self, model_name: String, status: ModelStatus, provider: ModelProvider, message: Option<String>, )
Sets the status of a model and notifies all waiting channels
Sourcepub fn set_status(
&self,
model_name: String,
status: ModelStatus,
provider: ModelProvider,
)
pub fn set_status( &self, model_name: String, status: ModelStatus, provider: ModelProvider, )
Sets the status of a model
Sourcepub fn add_waiting_channel(
&self,
model_name: &str,
tx: Sender<Result<ModelStatusUpdate, Status>>,
)
pub fn add_waiting_channel( &self, model_name: &str, tx: Sender<Result<ModelStatusUpdate, Status>>, )
Adds a channel to wait for updates on a specific model
Sourcepub fn delete_status(&self, model_name: &str)
pub fn delete_status(&self, model_name: &str)
Deletes the status of a model from the database This is used when a model is removed from the tracker
Sourcepub async fn ensure_model_downloaded(
&self,
model_name: &str,
provider: ModelProvider,
tx: &Sender<Result<ModelStatusUpdate, Status>>,
ignore_weights: bool,
) -> ModelStatus
pub async fn ensure_model_downloaded( &self, model_name: &str, provider: ModelProvider, tx: &Sender<Result<ModelStatusUpdate, Status>>, ignore_weights: bool, ) -> ModelStatus
Initiates a download for a model and streams status updates
Trait Implementations§
Source§impl Clone for ModelDownloadTracker
impl Clone for ModelDownloadTracker
Source§fn clone(&self) -> ModelDownloadTracker
fn clone(&self) -> ModelDownloadTracker
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ModelDownloadTracker
impl Debug for ModelDownloadTracker
Auto Trait Implementations§
impl Freeze for ModelDownloadTracker
impl RefUnwindSafe for ModelDownloadTracker
impl Send for ModelDownloadTracker
impl Sync for ModelDownloadTracker
impl Unpin for ModelDownloadTracker
impl UnsafeUnpin for ModelDownloadTracker
impl UnwindSafe for ModelDownloadTracker
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> 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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request