mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-31 04:30:44 +00:00
Refactor HTTP downloader package
* Drop multi-threaded downloader. It doesn't really belong here - some places require it, some do not, but it's definitely not the right place to handle it, as it's being used only when updating mirrors * Pass expectedChecksums as pointer, so it's easy to drive `nil` value, and also downloader can fill back checksums (not implemented right now). * Break down downloader and tests into more files * Use pkg/errors instead of fmt
This commit is contained in:
+2
-11
@@ -81,18 +81,9 @@ type Progress interface {
|
||||
// Downloader is parallel HTTP fetcher
|
||||
type Downloader interface {
|
||||
// Download starts new download task
|
||||
Download(url string, destination string, result chan<- error)
|
||||
Download(url string, destination string) error
|
||||
// DownloadWithChecksum starts new download task with checksum verification
|
||||
DownloadWithChecksum(url string, destination string, result chan<- error, expected utils.ChecksumInfo, ignoreMismatch bool, maxTries int)
|
||||
// Pause pauses task processing
|
||||
Pause()
|
||||
// Resume resumes task processing
|
||||
Resume()
|
||||
// Shutdown stops downloader after current tasks are finished,
|
||||
// but doesn't process rest of queue
|
||||
Shutdown()
|
||||
// Abort stops downloader without waiting for shutdown
|
||||
Abort()
|
||||
DownloadWithChecksum(url string, destination string, expected *utils.ChecksumInfo, ignoreMismatch bool, maxTries int) error
|
||||
// GetProgress returns Progress object
|
||||
GetProgress() Progress
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user