Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // NewSpaceAllocator space allocator constructor. //nolint:gochecknoglobals // used for unit test mock NewSpaceAllocator = spaceallocator.New // ErrNotExist not exist download info error. ErrNotExist = errors.New("download info not exist") ErrPartlyDownloaded = errors.New("file not fully downloaded") )
Functions ¶
This section is empty.
Types ¶
type AlertSender ¶
type AlertSender interface {
SendAlert(alert interface{})
}
AlertSender provides alert sender interface.
type DownloadInfo ¶
PackageInfo struct contains download info data.
type Downloader ¶
Downloader instance.
func New ¶
func New(moduleID string, cfg *config.Config, sender AlertSender, storage Storage) ( downloader *Downloader, err error, )
New creates new downloader object.
func (*Downloader) Close ¶
func (downloader *Downloader) Close() (err error)
Close closes downloader.
func (*Downloader) Download ¶
func (downloader *Downloader) Download( ctx context.Context, packageInfo PackageInfo, ) (result Result, err error)
Download downloads, decrypts and verifies package.
func (*Downloader) Release ¶
func (downloader *Downloader) Release(filePath string) error
func (*Downloader) ReleaseByType ¶
func (downloader *Downloader) ReleaseByType(targetType string) error
type PackageInfo ¶
type PackageInfo struct { URLs []string Sha256 []byte Size uint64 TargetType string TargetID string TargetVersion string }
PackageInfo struct contains package info data.
type Storage ¶
type Storage interface { GetDownloadInfo(filePath string) (DownloadInfo, error) GetDownloadInfos() ([]DownloadInfo, error) RemoveDownloadInfo(filePath string) error SetDownloadInfo(downloadInfo DownloadInfo) error }
Storage provides API to add, remove, update or access download info data.
Click to show internal directories.
Click to hide internal directories.