Documentation ¶
Index ¶
- type Downloader
- func (d *Downloader) ComputeHash(i int, partFilesHashes []string, outputPartFile *os.File) (string, error)
- func (d *Downloader) CreateBufferProgressbar(resp *http.Response, totalSize int, bar *uiprogress.Bar, ...) *StreamBuffer
- func (d *Downloader) CreateProgressbar(i int, rangeSize int, maxProgressbarNameLen int, progressbarName string, ...) *uiprogress.Bar
- func (d *Downloader) Download(appcfg *config.AppConfig) (manifest.DownloadManifest, map[string]string, string, []byte, int, int, string, ...)
- func (d *Downloader) DownloadFileChunk(client HTTPClient, start int, end int) (*http.Response, error)
- func (d *Downloader) DownloadPart(client *http.Client, i int, sem chan struct{}, progressbar *Progressbar, ...)
- func (d *Downloader) DownloadPartFiles(hashes map[string]string) (manifest.DownloadManifest, []string, int, string, string, int, string, error)
- func (d *Downloader) FetchFileInfo(client *http.Client) (int, string, string, error)
- func (d *Downloader) FilePathAndValidation(outputFile string) (string, error)
- func (d *Downloader) GetFileInfo(client *http.Client) (size int, etag string, hashType string, err error)
- func (d *Downloader) GetFileNameAndHash(hashes map[string]string) (string, string, error)
- func (d *Downloader) HandleEncryption(m *manifest.Manifest, e *encryption.Encryption, f *fileutils.Fileutils, ...) ([]byte, string, error)
- func (d *Downloader) InitDownloadAndParseHashFile(h *hasher.Hasher, shaSumsURL string) (map[string]string, error)
- func (d *Downloader) InitDownloadManifest(fileName, hash, etag, hashType string, size, rangeSize int) manifest.DownloadManifest
- func (d *Downloader) InitDownloadPart(u *utils.Utils, i int, progressbarName string) (int64, string, *os.File, string, error)
- func (d *Downloader) InitHTTPClient() (*http.Client, error)
- func (d *Downloader) InitUI() (int, atomic.Value, string)
- func (d *Downloader) InitUIAndDownloadParameters() (int, atomic.Value, string)
- func (d *Downloader) ManagePartDownload(client *http.Client, progressbar *Progressbar, partFilesHashes []string, ...)
- func (d *Downloader) ManifestObject(m *manifest.Manifest, downloadManifest manifest.DownloadManifest, ...) ([]byte, error)
- func (d *Downloader) ObtainShaSumsHashes(f *fileutils.Fileutils, shaSumsURL string) (map[string]string, error)
- func (d *Downloader) ProcessHash(f *fileutils.Fileutils, partsDir string, prefixParts string, shaSumsURL string, ...) (string, manifest.DownloadManifest, []string, int, string, string, int, string, ...)
- func (d *Downloader) ReadStreamWriteFile(streamBuffer *StreamBuffer, rangeSize int, speed atomic.Value, ...) (*os.File, int64, error)
- func (d *Downloader) RenameValidateOutputFile(f *fileutils.Fileutils, outputPartFile *os.File, outputPartFileName string, ...) (string, error)
- func (d *Downloader) SetLogger(log logger.LoggerInterface)
- func (d *Downloader) UpdateDownloadManifest(downloadManifest *manifest.DownloadManifest, i int, hash string, ...)
- func (d *Downloader) ValidateInput(urlFile string, downloadOnly bool) error
- type HTTPClient
- type Parameters
- type Progressbar
- type StreamBuffer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Downloader ¶
type Downloader struct { DBConfig *config.DBConfig Parameters *Parameters Log logger.LoggerInterface ErrCh chan error }
func NewDownloader ¶
func NewDownloader(dbcfg *config.DBConfig, log logger.LoggerInterface, errCh chan error, parameters *Parameters) *Downloader
func (*Downloader) ComputeHash ¶
func (d *Downloader) ComputeHash(i int, partFilesHashes []string, outputPartFile *os.File) (string, error)
File Hash Computation
func (*Downloader) CreateBufferProgressbar ¶
func (d *Downloader) CreateBufferProgressbar(resp *http.Response, totalSize int, bar *uiprogress.Bar, outputPartFile *os.File) *StreamBuffer
func (*Downloader) CreateProgressbar ¶
func (d *Downloader) CreateProgressbar(i int, rangeSize int, maxProgressbarNameLen int, progressbarName string, speed atomic.Value, progressBars []*uiprogress.Bar) *uiprogress.Bar
func (*Downloader) DownloadFileChunk ¶
func (d *Downloader) DownloadFileChunk(client HTTPClient, start int, end int) (*http.Response, error)
HTTP Request and Download
func (*Downloader) DownloadPart ¶
func (d *Downloader) DownloadPart(client *http.Client, i int, sem chan struct{}, progressbar *Progressbar, partFilesHashes []string, downloadManifest *manifest.DownloadManifest, wg *sync.WaitGroup)
func (*Downloader) DownloadPartFiles ¶
func (*Downloader) FetchFileInfo ¶
func (*Downloader) FilePathAndValidation ¶
func (d *Downloader) FilePathAndValidation(outputFile string) (string, error)
func (*Downloader) GetFileInfo ¶
func (*Downloader) GetFileNameAndHash ¶
func (*Downloader) HandleEncryption ¶
func (d *Downloader) HandleEncryption(m *manifest.Manifest, e *encryption.Encryption, f *fileutils.Fileutils, contentData []byte, partFilesHashes []string, fileName string, hash string) ([]byte, string, error)
func (*Downloader) InitDownloadAndParseHashFile ¶
func (*Downloader) InitDownloadManifest ¶
func (d *Downloader) InitDownloadManifest(fileName, hash, etag, hashType string, size, rangeSize int) manifest.DownloadManifest
func (*Downloader) InitDownloadPart ¶
func (d *Downloader) InitDownloadPart(u *utils.Utils, i int, progressbarName string) (int64, string, *os.File, string, error)
Setup and Initialization
func (*Downloader) InitHTTPClient ¶
func (d *Downloader) InitHTTPClient() (*http.Client, error)
func (*Downloader) InitUIAndDownloadParameters ¶
func (d *Downloader) InitUIAndDownloadParameters() (int, atomic.Value, string)
func (*Downloader) ManagePartDownload ¶
func (d *Downloader) ManagePartDownload(client *http.Client, progressbar *Progressbar, partFilesHashes []string, downloadManifest *manifest.DownloadManifest, sem chan struct{})
func (*Downloader) ManifestObject ¶
func (d *Downloader) ManifestObject(m *manifest.Manifest, downloadManifest manifest.DownloadManifest, fileName string, hash string) ([]byte, error)
func (*Downloader) ObtainShaSumsHashes ¶
func (*Downloader) ProcessHash ¶
func (*Downloader) ReadStreamWriteFile ¶
func (d *Downloader) ReadStreamWriteFile(streamBuffer *StreamBuffer, rangeSize int, speed atomic.Value, bar *uiprogress.Bar, outputPartFile *os.File, outputPartFileName string) (*os.File, int64, error)
func (*Downloader) RenameValidateOutputFile ¶
func (*Downloader) SetLogger ¶
func (d *Downloader) SetLogger(log logger.LoggerInterface)
func (*Downloader) UpdateDownloadManifest ¶
func (d *Downloader) UpdateDownloadManifest(downloadManifest *manifest.DownloadManifest, i int, hash string, timestamp int64, outputPartFileName string)
Update Download Manifest
func (*Downloader) ValidateInput ¶
func (d *Downloader) ValidateInput(urlFile string, downloadOnly bool) error
type Parameters ¶
type Parameters struct { URLFile string NumParts int MaxConcurrentConnections int PartsDir string PrefixParts string Proxy string Timestamp int64 }
func NewParameters ¶
type Progressbar ¶
type Progressbar struct { Bars []*uiprogress.Bar NameMaxLenght int Name string Rangesize int Size int Speed atomic.Value }
func NewProgressbar ¶
func NewProgressbar(rangesize int, nameMaxLenght int, name string, bars []*uiprogress.Bar, size int, speed atomic.Value) *Progressbar
type StreamBuffer ¶
type StreamBuffer struct { Buf *[]byte Reader io.Reader Writer *utils.ProgressWriter TotalBytesDownloaded int64 TotalElapsedMilliseconds int64 }
func NewStreamBuffer ¶
func NewStreamBuffer(buf *[]byte, reader io.Reader, writer *utils.ProgressWriter, totalBytesDownloaded int64, totalElapsedMilliseconds int64) *StreamBuffer
Click to show internal directories.
Click to hide internal directories.