fetch

package
v0.0.0-...-d3fcdae Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthHeaders

type AuthHeaders map[string]map[string]string

AuthHeaders is a map from target URI to headers to be applied for the request

func NewAuthHeadersFromQualifier

func NewAuthHeadersFromQualifier(value string) (*AuthHeaders, error)

NewAuthHeadersFromQualifier creates an AuthHeaders from the qualifier payload

func (AuthHeaders) ApplyHeaders

func (ah AuthHeaders) ApplyHeaders(uri string, req *http.Request)

ApplyHeaders mutates a http.Request to apply headers requested by the client.

type Fetcher

type Fetcher interface {
	// The same as a Remote Asset API FetchBlob request
	FetchBlob(context.Context, *remoteasset.FetchBlobRequest) (*remoteasset.FetchBlobResponse, error)

	// The same as a Remote Asset API FetchDirectory request
	FetchDirectory(context.Context, *remoteasset.FetchDirectoryRequest) (*remoteasset.FetchDirectoryResponse, error)

	// Check for unsupported Qualifiers, returning a set of the _unsupported_ qualifiers
	CheckQualifiers(qualifier.Set) qualifier.Set
}

Fetcher is an abstraction around a Remote Asset API Fetch Server to allow for more consistent Qualifier usage.

func NewCachingFetcher

func NewCachingFetcher(fetcher Fetcher, assetStore storage.AssetStore) Fetcher

NewCachingFetcher creates a decorator for remoteasset.FetchServer implementations to avoid having to fetch the blob remotely multiple times

func NewErrorFetcher

func NewErrorFetcher(err *protostatus.Status) Fetcher

NewErrorFetcher creates a Remote Asset API Fetch service which simply returns a set gRPC status

func NewHTTPFetcher

func NewHTTPFetcher(httpClient *http.Client,
	contentAddressableStorage blobstore.BlobAccess,
	allowUpdatesForInstances map[bb_digest.InstanceName]bool,
) Fetcher

NewHTTPFetcher creates a remoteasset FetchServer compatible service for handling requests which involve downloading assets over HTTP and storing them into a CAS.

func NewLoggingFetcher

func NewLoggingFetcher(fetcher Fetcher) Fetcher

NewLoggingFetcher creates a fetcher which logs requests and results

func NewMetricsFetcher

func NewMetricsFetcher(fetcher Fetcher, clock clock.Clock, name string) Fetcher

NewMetricsFetcher creates a fetcher which logs metrics to prometheus

func NewRemoteExecutionFetcher

func NewRemoteExecutionFetcher(contentAddressableStorage blobstore.BlobAccess, client grpc.ClientConnInterface, maximumMessageSizeBytes int) Fetcher

NewRemoteExecutionFetcher creates a new Fetcher that is capable of itself fetching resources from other places (as defined in the qualifier_translator).

func NewValidatingFetcher

func NewValidatingFetcher(fetcher Fetcher) Fetcher

NewValidatingFetcher creates a fetcher that validates Fetch* requests are valid, before passing on to a backend

Jump to

Keyboard shortcuts

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