Documentation ¶
Index ¶
- Constants
- Variables
- func New(cachedPath string, uncachedPath string, maxSizeInBytes int64, ...) *cachedDownloader
- func NoopTransform(source, destination string) (int64, error)
- func TarTransform(source string, destination string) (int64, error)
- type CacheTransformer
- type CachedDownloader
- type CachedFile
- type CachingInfoType
- type Downloader
- type FileCache
Constants ¶
View Source
const MAX_DOWNLOAD_ATTEMPTS = 3
Variables ¶
View Source
var ( EntryNotFound = errors.New("Entry Not Found") NotEnoughSpace = errors.New("No space available") )
View Source
var ErrDownloadCancelled error = errors.New("Download cancelled")
View Source
var ErrUnknownArchiveFormat = errors.New("unknown archive format")
Functions ¶
func NoopTransform ¶
Types ¶
type CacheTransformer ¶
called after a new object has entered the cache. it is assumed that `path` will be removed, if a new path is returned. a noop transformer returns the given path and its detected size.
type CachedDownloader ¶
type CachedDownloader interface {
Fetch(urlToFetch *url.URL, cacheKey string, transformer CacheTransformer, cancelChan <-chan struct{}) (io.ReadCloser, int64, error)
}
type CachedFile ¶
func NewFileCloser ¶
func NewFileCloser(file *os.File, onClose func(string)) *CachedFile
func (*CachedFile) Close ¶
func (fw *CachedFile) Close() error
type CachingInfoType ¶
func (CachingInfoType) Equal ¶
func (c CachingInfoType) Equal(other CachingInfoType) bool
type Downloader ¶
type Downloader struct {
// contains filtered or unexported fields
}
func NewDownloader ¶
func NewDownloader(timeout time.Duration, maxConcurrentDownloads int, skipSSLVerification bool) *Downloader
func (*Downloader) Download ¶
func (downloader *Downloader) Download( url *url.URL, createDestination func() (*os.File, error), cachingInfoIn CachingInfoType, cancelChan <-chan struct{}, ) (path string, cachingInfoOut CachingInfoType, err error)
type FileCache ¶
type FileCache struct {
// contains filtered or unexported fields
}
func (*FileCache) Add ¶
func (c *FileCache) Add(cacheKey, sourcePath string, size int64, cachingInfo CachingInfoType) (*CachedFile, error)
func (*FileCache) Get ¶
func (c *FileCache) Get(cacheKey string) (*CachedFile, CachingInfoType, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.