Documentation ¶
Index ¶
- func DownloadTemp(downloader Downloader, url string) (*os.File, error)
- func DownloadTryCompression(downloader Downloader, url string) (io.Reader, *os.File, error)
- func StrMapsEqual(m1, m2 map[string]string) bool
- func StrSlicesEqual(s1, s2 []string) bool
- func StringsIsSubset(subset, full []string, errorFmt string) error
- type Downloader
- type FakeDownloader
- func (f *FakeDownloader) Download(url string, filename string, result chan<- error)
- 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) Shutdown()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadTemp ¶
func DownloadTemp(downloader Downloader, url string) (*os.File, error)
DownloadTemp starts new download to temporary file and returns File
Temporary file would be already removed, so no need to cleanup
func DownloadTryCompression ¶
DownloadTryCompression tries to download from URL .bz2, .gz and raw extension until it finds existing file.
func StrMapsEqual ¶
StrMapsEqual compares two map[string]string
func StrSlicesEqual ¶
StrSlicesEqual compares two slices for equality
func StringsIsSubset ¶
StringsIsSubset checks that subset is strict subset of full, and returns error formatted with errorFmt otherwise
Types ¶
type Downloader ¶
type Downloader interface { Download(url string, destination string, result chan<- error) Shutdown() }
Downloader is parallel HTTP fetcher
func NewDownloader ¶
func NewDownloader(threads int) Downloader
NewDownloader creates new instance of Downloader which specified number of threads
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) 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) 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