pub struct ModelVerificationService {
model_repo: Arc<dyn ModelRepository>,
model_files_repo: Arc<dyn ModelFilesReaderPort>,
hf_client: Arc<dyn HfClientPort>,
download_trigger: Arc<dyn DownloadTriggerPort>,
operation_lock: ModelOperationLock,
}Expand description
Model verification service.
Fields§
§model_repo: Arc<dyn ModelRepository>Repository for model metadata.
model_files_repo: Arc<dyn ModelFilesReaderPort>Repository for model file metadata.
hf_client: Arc<dyn HfClientPort>HuggingFace client for update checks.
download_trigger: Arc<dyn DownloadTriggerPort>Download trigger for repairs.
operation_lock: ModelOperationLockConcurrency control.
Implementations§
Source§impl ModelVerificationService
impl ModelVerificationService
Sourcepub fn new(
model_repo: Arc<dyn ModelRepository>,
model_files_repo: Arc<dyn ModelFilesReaderPort>,
hf_client: Arc<dyn HfClientPort>,
download_trigger: Arc<dyn DownloadTriggerPort>,
) -> Self
pub fn new( model_repo: Arc<dyn ModelRepository>, model_files_repo: Arc<dyn ModelFilesReaderPort>, hf_client: Arc<dyn HfClientPort>, download_trigger: Arc<dyn DownloadTriggerPort>, ) -> Self
Create a new verification service.
Sourcepub async fn verify_model_integrity(
&self,
model_id: i64,
) -> Result<(Receiver<VerificationProgress>, JoinHandle<Result<VerificationReport, RepositoryError>>), String>
pub async fn verify_model_integrity( &self, model_id: i64, ) -> Result<(Receiver<VerificationProgress>, JoinHandle<Result<VerificationReport, RepositoryError>>), String>
Sourceasync fn verify_shard(
file: &ModelFile,
resolved_path: &Path,
model_id: i64,
index: usize,
total_shards: usize,
tx: &Sender<VerificationProgress>,
) -> ShardHealth
async fn verify_shard( file: &ModelFile, resolved_path: &Path, model_id: i64, index: usize, total_shards: usize, tx: &Sender<VerificationProgress>, ) -> ShardHealth
Verify a single shard by computing its SHA256 and comparing with OID.
Sourcepub async fn check_for_updates(
&self,
model_id: i64,
) -> Result<UpdateCheckResult, RepositoryError>
pub async fn check_for_updates( &self, model_id: i64, ) -> Result<UpdateCheckResult, RepositoryError>
Check if updates are available for a model.
Compares local OIDs with remote OIDs from HuggingFace.
Sourcepub async fn repair_model(
&self,
model_id: i64,
shard_indices: Option<Vec<usize>>,
) -> Result<String, String>
pub async fn repair_model( &self, model_id: i64, shard_indices: Option<Vec<usize>>, ) -> Result<String, String>
Repair a model by re-downloading corrupt or missing shards.
§Arguments
model_id- ID of the model to repairshard_indices- Optional list of specific shard indices to repair. IfNone, all unhealthy shards will be repaired.
Auto Trait Implementations§
impl Freeze for ModelVerificationService
impl !RefUnwindSafe for ModelVerificationService
impl Send for ModelVerificationService
impl Sync for ModelVerificationService
impl Unpin for ModelVerificationService
impl !UnwindSafe for ModelVerificationService
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