ModelVerificationService

Struct ModelVerificationService 

Source
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: ModelOperationLock

Concurrency control.

Implementations§

Source§

impl ModelVerificationService

Source

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.

Source

pub async fn verify_model_integrity( &self, model_id: i64, ) -> Result<(Receiver<VerificationProgress>, JoinHandle<Result<VerificationReport, RepositoryError>>), String>

Verify the integrity of a model by computing SHA256 hashes.

Returns a channel for progress updates and a handle to the verification task.

§Arguments
  • model_id - ID of the model to verify
§Returns
  • receiver - Channel for receiving progress updates
  • handle - Join handle for the verification task
Source

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.

Source

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.

Source

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 repair
  • shard_indices - Optional list of specific shard indices to repair. If None, all unhealthy shards will be repaired.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more