Skip to content
10 changes: 10 additions & 0 deletions artifactory/emptymanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ type ArtifactoryServicesManager interface {
ReadRemoteFile(readPath string) (io.ReadCloser, error)
DownloadFiles(params ...services.DownloadParams) (totalDownloaded, totalFailed int, err error)
DownloadFilesWithSummary(params ...services.DownloadParams) (operationSummary *utils.OperationSummary, err error)
DirectDownloadFiles(params ...services.DirectDownloadParams) (totalDownloaded, totalFailed int, err error)
DirectDownloadFilesWithSummary(params ...services.DirectDownloadParams) (operationSummary *utils.OperationSummary, err error)
GetUnreferencedGitLfsFiles(params services.GitLfsCleanParams) (*content.ContentReader, error)
SearchFiles(params services.SearchParams) (*content.ContentReader, error)
Aql(aql string) (io.ReadCloser, error)
Expand Down Expand Up @@ -252,6 +254,14 @@ func (esm *EmptyArtifactoryServicesManager) DownloadFilesWithSummary(...services
panic("Failed: Method is not implemented")
}

func (esm *EmptyArtifactoryServicesManager) DirectDownloadFiles(...services.DirectDownloadParams) (int, int, error) {
panic("Failed: Method is not implemented")
}

func (esm *EmptyArtifactoryServicesManager) DirectDownloadFilesWithSummary(...services.DirectDownloadParams) (*utils.OperationSummary, error) {
panic("Failed: Method is not implemented")
}

func (esm *EmptyArtifactoryServicesManager) GetUnreferencedGitLfsFiles(services.GitLfsCleanParams) (*content.ContentReader, error) {
panic("Failed: Method is not implemented")
}
Expand Down
19 changes: 19 additions & 0 deletions artifactory/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,14 @@ func (sm *ArtifactoryServicesManagerImp) initDownloadService() *services.Downloa
return downloadService
}

func (sm *ArtifactoryServicesManagerImp) initDirectDownloadService() *services.DirectDownloadService {
directDownloadService := services.NewDirectDownloadService(sm.config.GetServiceDetails(), sm.client)
directDownloadService.DryRun = sm.config.IsDryRun()
directDownloadService.Threads = sm.config.GetThreads()
directDownloadService.Progress = sm.progress
return directDownloadService
}

func (sm *ArtifactoryServicesManagerImp) DownloadFiles(params ...services.DownloadParams) (totalDownloaded, totalFailed int, err error) {
downloadService := sm.initDownloadService()
summary, e := downloadService.DownloadFiles(params...)
Expand All @@ -296,6 +304,17 @@ func (sm *ArtifactoryServicesManagerImp) DownloadFilesWithSummary(params ...serv
return downloadService.DownloadFiles(params...)
}

func (sm *ArtifactoryServicesManagerImp) DirectDownloadFiles(params ...services.DirectDownloadParams) (totalDownloaded, totalFailed int, err error) {
directDownloadService := sm.initDirectDownloadService()
return directDownloadService.DirectDownloadFiles(params...)
}

func (sm *ArtifactoryServicesManagerImp) DirectDownloadFilesWithSummary(params ...services.DirectDownloadParams) (operationSummary *utils.OperationSummary, err error) {
directDownloadService := sm.initDirectDownloadService()
directDownloadService.SetSaveSummary(true)
return directDownloadService.DirectDownloadFilesWithSummary(params...)
}

func (sm *ArtifactoryServicesManagerImp) GetUnreferencedGitLfsFiles(params services.GitLfsCleanParams) (*content.ContentReader, error) {
gitLfsCleanService := services.NewGitLfsCleanService(sm.config.GetServiceDetails(), sm.client)
gitLfsCleanService.DryRun = sm.config.IsDryRun()
Expand Down
Loading
Loading