Skip to main content

ModelRegistrarPort

Trait ModelRegistrarPort 

Source
pub trait ModelRegistrarPort: Send + Sync {
    // Required method
    fn register_model<'life0, 'life1, 'async_trait>(
        &'life0 self,
        download: &'life1 CompletedDownload,
    ) -> Pin<Box<dyn Future<Output = Result<Model, RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Port for registering downloaded models in the database.

This trait is implemented by core services and injected into the download manager, allowing model registration without coupling to AppCore directly.

§Usage

let registrar: Arc<dyn ModelRegistrarPort> = /* ... */;
let download = CompletedDownload { ... };
let model = registrar.register_model(&download).await?;

Required Methods§

Source

fn register_model<'life0, 'life1, 'async_trait>( &'life0 self, download: &'life1 CompletedDownload, ) -> Pin<Box<dyn Future<Output = Result<Model, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Register a downloaded model in the database.

Parses GGUF metadata from the downloaded file and creates a database entry. For sharded models, the primary (first shard) path is used for registration.

§Arguments
  • download - The completed download information
§Returns

Returns the created Model on success.

Implementors§