Documentation ¶
Index ¶
- Constants
- Variables
- type AuthHeaders
- type AuthorizingFetcher
- type Fetcher
- func NewCachingFetcher(fetcher Fetcher, assetStore storage.AssetStore) Fetcher
- func NewErrorFetcher(err *protostatus.Status) Fetcher
- func NewHTTPFetcher(httpClient *http.Client, contentAddressableStorage blobstore.BlobAccess) Fetcher
- func NewLoggingFetcher(fetcher Fetcher) Fetcher
- func NewMetricsFetcher(fetcher Fetcher, clock clock.Clock, name string) Fetcher
- func NewRemoteExecutionFetcher(contentAddressableStorage blobstore.BlobAccess, ...) Fetcher
- func NewValidatingFetcher(fetcher Fetcher) Fetcher
Constants ¶
const ( // QualifierLegacyBazelHTTPHeaders is the qualifier older versions of bazel sends. QualifierLegacyBazelHTTPHeaders = "bazel.auth_headers" // QualifierHTTPHeaderPrefix is a qualifer to add a header to all URIs. // Qualifier will be in the form http_header:<header> QualifierHTTPHeaderPrefix = "http_header:" // QualifierHTTPHeaderURLPrefix is a qualifier to add a header to a specific URI. // Qualifier will be in the form http_header_url:<index>:<header> QualifierHTTPHeaderURLPrefix = "http_header_url:" )
Variables ¶
var DefaultFetcher = NewErrorFetcher(&protostatus.Status{Code: 12, Message: "Fetching is not configured for this server"})
DefaultFetcher returns a NotImplemented error and a message that fetching is not configured
Functions ¶
This section is empty.
Types ¶
type AuthHeaders ¶
AuthHeaders is a map from target URI to headers to be applied for the request
func NewAuthHeaders ¶
func NewAuthHeaders() *AuthHeaders
NewAuthHeaders creates an empty AuthHeaders
func NewAuthHeadersFromQualifier ¶
func NewAuthHeadersFromQualifier(value string) (*AuthHeaders, error)
NewAuthHeadersFromQualifier creates an AuthHeaders from the qualifier payload
func (AuthHeaders) AddHeader ¶
func (ah AuthHeaders) AddHeader(uri, header, value string)
AddHeader adds a header to the AuthHeaders
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 AuthorizingFetcher ¶
type AuthorizingFetcher struct { Fetcher // contains filtered or unexported fields }
AuthorizingFetcher decorates Fetcher and validates the requests against an Authorizer
func NewAuthorizingFetcher ¶
func NewAuthorizingFetcher(f Fetcher, authorizer auth.Authorizer) *AuthorizingFetcher
NewAuthorizingFetcher creates a new AuthorizingFetcher
func (*AuthorizingFetcher) FetchBlob ¶
func (af *AuthorizingFetcher) FetchBlob(ctx context.Context, req *remoteasset.FetchBlobRequest) (*remoteasset.FetchBlobResponse, error)
FetchBlob wraps FetchBlob requests, validate request against authorizer
func (*AuthorizingFetcher) FetchDirectory ¶
func (af *AuthorizingFetcher) FetchDirectory(ctx context.Context, req *remoteasset.FetchDirectoryRequest) (*remoteasset.FetchDirectoryResponse, error)
FetchDirectory wraps FetchDirectory requests, validate request against authorizer
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, ) 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 ¶
NewLoggingFetcher creates a fetcher which logs requests and results
func NewMetricsFetcher ¶
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 ¶
NewValidatingFetcher creates a fetcher that validates Fetch* requests are valid, before passing on to a backend