Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrFileNotFound = errors.New("file not found")
ErrFileNotFound is an error type used to signal 404 HTTP status code responses.
Functions ¶
This section is empty.
Types ¶
type ArchiveFetcher ¶
type ArchiveFetcher struct {
// contains filtered or unexported fields
}
ArchiveFetcher holds the HTTP client that reties with back off when the file server is offline.
func NewArchiveFetcher ¶
func NewArchiveFetcher(retries, maxDownloadSize, maxUntarSize int, hostnameOverwrite string) *ArchiveFetcher
NewArchiveFetcher configures the retryable HTTP client used for fetching archives.
func NewArchiveFetcherWithLogger ¶ added in v0.8.0
func NewArchiveFetcherWithLogger(retries, maxDownloadSize, maxUntarSize int, hostnameOverwrite string, logger any) *ArchiveFetcher
NewArchiveFetcherWithLogger configures the retryable HTTP client used for fetching archives and sets the logger to use.
The logger can be any type that implements the retryablehttp.Logger or retryablehttp.LeveledLogger interface. If the logger is of type logr.Logger, it will be wrapped in a retryablehttp.LeveledLogger that only logs errors.
func (*ArchiveFetcher) Fetch ¶
func (r *ArchiveFetcher) Fetch(archiveURL, digest, dir string) error
Fetch downloads, verifies and extracts the tarball content to the specified directory. If the file server responds with 5xx errors, the download operation is retried. If the file server responds with 404, the returned error is of type ErrFileNotFound. If the file server is unavailable for more than 3 minutes, the returned error contains the original status code.