Documentation
¶
Overview ¶
Package cache manages downloaded files and their metadata.
Index ¶
- type DownloadOptions
- type DownloadResult
- type Entry
- type Manager
- func (m *Manager) Download(ctx context.Context, opts DownloadOptions, authToken string, ...) (*DownloadResult, error)
- func (m *Manager) GetEntry(licenseKey string, downloadID, version string) (*Entry, error)
- func (m *Manager) List() ([]*Entry, error)
- func (m *Manager) ListForLicense(licenseKey string) ([]*Entry, error)
- func (m *Manager) PurgeAll() error
- func (m *Manager) PurgeLicense(licenseKey string) error
- func (m *Manager) Verify(entry *Entry) (bool, error)
- type ProgressCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DownloadOptions ¶
type DownloadOptions struct {
LicenseKey string
DownloadID string
Version string
URL string
Filename string
SkipCacheCheck bool
// contains filtered or unexported fields
}
DownloadOptions specifies the license, product, version, URL, and cache behavior. Filename overrides Content-Disposition; an expected checksum is SHA-256 and an expected size of zero means unknown.
type DownloadResult ¶
DownloadResult contains information about a completed download.
type Entry ¶
Entry represents a cached download file.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages cache storage on disk.
func (*Manager) Download ¶
func (m *Manager) Download(ctx context.Context, opts DownloadOptions, authToken string, progress ProgressCallback) (*DownloadResult, error)
Download downloads and caches a file, optionally using an authentication token.
func (*Manager) ListForLicense ¶
ListForLicense returns all cached entries for a specific license.
func (*Manager) PurgeLicense ¶
PurgeLicense removes all cached files for a specific license.
type ProgressCallback ¶
type ProgressCallback func(current, total int64)
ProgressCallback reports bytes read and the supplied total, which can be nonpositive when the size is unknown.