(ctx context.Context, op *ManagementOp[gallery.GalleryModel, gallery.ModelConfig], progressCb ProgressCallback)
| 45 | } |
| 46 | |
| 47 | func (m *LocalModelManager) InstallModel(ctx context.Context, op *ManagementOp[gallery.GalleryModel, gallery.ModelConfig], progressCb ProgressCallback) error { |
| 48 | switch { |
| 49 | case op.GalleryElement != nil: |
| 50 | installedModel, err := gallery.InstallModel(ctx, m.systemState, op.GalleryElement.Name, |
| 51 | op.GalleryElement, op.Req.Overrides, progressCb, m.enforcePredownloadScans) |
| 52 | if err != nil { |
| 53 | return err |
| 54 | } |
| 55 | if m.automaticallyInstallBackend && installedModel.Backend != "" { |
| 56 | xlog.Debug("Installing backend", "backend", installedModel.Backend) |
| 57 | return gallery.InstallBackendFromGallery(ctx, op.BackendGalleries, m.systemState, |
| 58 | m.modelLoader, installedModel.Backend, progressCb, false, m.requireBackendIntegrity) |
| 59 | } |
| 60 | return nil |
| 61 | case op.GalleryElementName != "": |
| 62 | return gallery.InstallModelFromGallery(ctx, op.Galleries, op.BackendGalleries, |
| 63 | m.systemState, m.modelLoader, op.GalleryElementName, op.Req, progressCb, |
| 64 | m.enforcePredownloadScans, m.automaticallyInstallBackend, m.requireBackendIntegrity) |
| 65 | default: |
| 66 | return installModelFromRemoteConfig(ctx, m.systemState, m.modelLoader, op.Req, |
| 67 | progressCb, m.enforcePredownloadScans, m.automaticallyInstallBackend, op.BackendGalleries, m.requireBackendIntegrity) |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | // LocalBackendManager handles backend install/delete on the local instance. |
| 72 | type LocalBackendManager struct { |
nothing calls this directly
no test coverage detected