downloader

package
v0.0.0-...-1c8973f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2019 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseDownloader

type BaseDownloader struct {
	// contains filtered or unexported fields
}

BaseDownloader holds all download related info

func (*BaseDownloader) GetEndTime

func (bd *BaseDownloader) GetEndTime() string

func (*BaseDownloader) GetFiles

func (bd *BaseDownloader) GetFiles() map[string]string

func (*BaseDownloader) GetID

func (bd *BaseDownloader) GetID() string

func (*BaseDownloader) GetStartTime

func (bd *BaseDownloader) GetStartTime() string

func (*BaseDownloader) GetStatus

func (bd *BaseDownloader) GetStatus() string

func (*BaseDownloader) GetType

func (bd *BaseDownloader) GetType() string

type Concurrent

type Concurrent struct {
	BaseDownloader
	// contains filtered or unexported fields
}

func (*Concurrent) Download

func (c *Concurrent) Download() error

type Downloader

type Downloader interface {
	Download() error
	GetID() string
	GetStartTime() string
	GetEndTime() string
	GetStatus() string
	GetType() string
	GetFiles() map[string]string
}

Downloader is the interface for all download types

func NewConcurrent

func NewConcurrent(urls []string) (Downloader, error)

func NewSerial

func NewSerial(urls []string) (Downloader, error)

NewSerial returns an instance of Serial downloader

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager keeps track of all downloads

func NewManager

func NewManager() *Manager

NewManager inits a Manager

func (*Manager) GetStatus

func (mgr *Manager) GetStatus(id string) (*models.StatusResponse, error)

GetStatus returns status of a particular download request

func (*Manager) NewDownload

func (mgr *Manager) NewDownload(request models.DownloadRequest) (Downloader, error)

NewDownload returns appropriate Downloader, based on the type of download request

type Serial

type Serial struct {
	BaseDownloader
}

Serial implements Downloader interface and is composed of BaseDownloader

func (*Serial) Download

func (s *Serial) Download() error

Download the files serially

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL