downloader

package
v0.0.0-...-115fbbe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadAndVerifyFileSync

func DownloadAndVerifyFileSync(ctx context.Context, verifyFunc DownloadVerifier, auditor DownloadAuditor,
	identifier DownloadIdentifier, crlUrl url.URL, finalPath string, maxRetries uint,
	timeout time.Duration) (bool, error)

* Returns: Boolean of whether the data at finalPath is now valid, and any error. It is possible * that err != nil and yet finalPath is valid, so callers should rely on the boolean and merely * log the error as needed.

func DownloadFileSync

func DownloadFileSync(ctx context.Context, crlUrl url.URL,
	path string, maxRetries uint, timeout time.Duration) error

func GetSizeAndDateOfFile

func GetSizeAndDateOfFile(path string) (int64, time.Time, error)

Types

type DownloadAction

type DownloadAction int
const (
	Create   DownloadAction = 0
	Resume   DownloadAction = 1
	UpToDate DownloadAction = 2
)

type DownloadAuditor

type DownloadAuditor interface {
	FailedDownload(identifier DownloadIdentifier, crlUrl *url.URL, dlTracer *DownloadTracer, err error)
	FailedVerifyUrl(identifier DownloadIdentifier, crlUrl *url.URL, dlTracer *DownloadTracer, err error)
	FailedVerifyPath(identifier DownloadIdentifier, crlUrl *url.URL, crlPath string, err error)
}

type DownloadIdentifier

type DownloadIdentifier interface {
	ID() string
}

type DownloadTracer

type DownloadTracer struct {
	DNSDone []httptrace.DNSDoneInfo
}

func NewDownloadTracer

func NewDownloadTracer() *DownloadTracer

func (*DownloadTracer) Configure

func (da *DownloadTracer) Configure(ctx context.Context) context.Context

func (*DownloadTracer) DNSResults

func (da *DownloadTracer) DNSResults() []string

func (*DownloadTracer) Errors

func (da *DownloadTracer) Errors() []string

type DownloadVerifier

type DownloadVerifier interface {
	IsValid(path string) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL