fetch

package
v0.0.0-...-00e3bd6 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetcher

type Fetcher struct {
	// contains filtered or unexported fields
}

Fetcher is used to make HTTP requests.

func NewFetcher

func NewFetcher(client *http.Client, workers int, rateLimit float64) *Fetcher

func (*Fetcher) Client

func (f *Fetcher) Client() *http.Client

Client returns the underlying client used to make requests.

func (*Fetcher) Do

func (f *Fetcher) Do(req *http.Request) (resp *http.Response, err error)

Do makes an HTTP request through the fetchers's client and rate limiter.

func (*Fetcher) FetchContent

func (f *Fetcher) FetchContent(ctx context.Context, url string, objpath string, hashes *HashStore, w io.Writer) (status int, headers http.Header, err error)

FetchContent fetches information about a file from url. If w is not nil, the content of the file is written to it. Otherwise, just the headers of the response are returned.

func (*Fetcher) FetchDeployHistory

func (f *Fetcher) FetchDeployHistory(ctx context.Context, url string) (stream histlog.Stream, err error)

FetchDeployHistory retrieves and parses a history log from the given server.

func (*Fetcher) Workers

func (f *Fetcher) Workers() int

type HashStore

type HashStore struct {
	// contains filtered or unexported fields
}

func (*HashStore) Check

func (h *HashStore) Check(hash string) bool

Check returns whether the given hash is in the map. If it isn't, the hash is added to the map.

type RequestResult

type RequestResult struct {
	Resp *http.Response
	Err  error
}

Jump to

Keyboard shortcuts

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