Documentation ¶
Overview ¶
Package http provides all HTTP-related operations
Index ¶
- func DownloadTemp(downloader aptly.Downloader, url string) (*os.File, error)
- func DownloadTempWithChecksum(downloader aptly.Downloader, url string, expected utils.ChecksumInfo, ...) (*os.File, error)
- func DownloadTryCompression(downloader aptly.Downloader, url string, ...) (io.Reader, *os.File, error)
- func NewDownloader(threads int, downLimit int64, progress aptly.Progress) aptly.Downloader
- type FakeDownloader
- func (f *FakeDownloader) AnyExpectResponse(url string, response string) *FakeDownloader
- func (f *FakeDownloader) Download(url string, filename string, result chan<- error)
- func (f *FakeDownloader) DownloadWithChecksum(url string, filename string, result chan<- error, expected utils.ChecksumInfo, ...)
- func (f *FakeDownloader) Empty() bool
- func (f *FakeDownloader) ExpectError(url string, err error) *FakeDownloader
- func (f *FakeDownloader) ExpectResponse(url string, response string) *FakeDownloader
- func (f *FakeDownloader) GetProgress() aptly.Progress
- func (f *FakeDownloader) Pause()
- func (f *FakeDownloader) Resume()
- func (f *FakeDownloader) Shutdown()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadTemp ¶
DownloadTemp starts new download to temporary file and returns File
Temporary file would be already removed, so no need to cleanup
func DownloadTempWithChecksum ¶
func DownloadTempWithChecksum(downloader aptly.Downloader, url string, expected utils.ChecksumInfo, ignoreMismatch bool) (*os.File, error)
DownloadTempWithChecksum is a DownloadTemp with checksum verification
Temporary file would be already removed, so no need to cleanup
func DownloadTryCompression ¶
func DownloadTryCompression(downloader aptly.Downloader, url string, expectedChecksums map[string]utils.ChecksumInfo, ignoreMismatch bool) (io.Reader, *os.File, error)
DownloadTryCompression tries to download from URL .bz2, .gz and raw extension until it finds existing file.
func NewDownloader ¶
NewDownloader creates new instance of Downloader which specified number of threads and download limit in bytes/sec
Types ¶
type FakeDownloader ¶
type FakeDownloader struct {
// contains filtered or unexported fields
}
FakeDownloader is like Downloader, but it used in tests to stub out results
func NewFakeDownloader ¶
func NewFakeDownloader() *FakeDownloader
NewFakeDownloader creates new expected downloader
func (*FakeDownloader) AnyExpectResponse ¶
func (f *FakeDownloader) AnyExpectResponse(url string, response string) *FakeDownloader
AnyExpectResponse installs expectation on upcoming download with response in any order (url should be unique)
func (*FakeDownloader) Download ¶
func (f *FakeDownloader) Download(url string, filename string, result chan<- error)
Download performs fake download by matching against first expectation in the queue
func (*FakeDownloader) DownloadWithChecksum ¶
func (f *FakeDownloader) DownloadWithChecksum(url string, filename string, result chan<- error, expected utils.ChecksumInfo, ignoreMismatch bool)
DownloadWithChecksum performs fake download by matching against first expectation in the queue or any expectation, with cheksum verification
func (*FakeDownloader) Empty ¶
func (f *FakeDownloader) Empty() bool
Empty verifies that are planned downloads have happened
func (*FakeDownloader) ExpectError ¶
func (f *FakeDownloader) ExpectError(url string, err error) *FakeDownloader
ExpectError installs expectation on upcoming download with error
func (*FakeDownloader) ExpectResponse ¶
func (f *FakeDownloader) ExpectResponse(url string, response string) *FakeDownloader
ExpectResponse installs expectation on upcoming download with response
func (*FakeDownloader) GetProgress ¶
func (f *FakeDownloader) GetProgress() aptly.Progress
GetProgress returns Progress object