assetv1connect

package
v1.19.1-20230602030542... Latest Latest
Warning

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

Go to latest
Published: unknown License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FetchName is the fully-qualified name of the Fetch service.
	FetchName = "build.bazel.remote.asset.v1.Fetch"
	// PushName is the fully-qualified name of the Push service.
	PushName = "build.bazel.remote.asset.v1.Push"
)
View Source
const (
	// FetchFetchBlobProcedure is the fully-qualified name of the Fetch's FetchBlob RPC.
	FetchFetchBlobProcedure = "/build.bazel.remote.asset.v1.Fetch/FetchBlob"
	// FetchFetchDirectoryProcedure is the fully-qualified name of the Fetch's FetchDirectory RPC.
	FetchFetchDirectoryProcedure = "/build.bazel.remote.asset.v1.Fetch/FetchDirectory"
	// PushPushBlobProcedure is the fully-qualified name of the Push's PushBlob RPC.
	PushPushBlobProcedure = "/build.bazel.remote.asset.v1.Push/PushBlob"
	// PushPushDirectoryProcedure is the fully-qualified name of the Push's PushDirectory RPC.
	PushPushDirectoryProcedure = "/build.bazel.remote.asset.v1.Push/PushDirectory"
)

These constants are the fully-qualified names of the RPCs defined in this package. They're exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.

Note that these are different from the fully-qualified method names used by google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to reflection-formatted method names, remove the leading slash and convert the remaining slash to a period.

Variables

This section is empty.

Functions

func NewFetchHandler

func NewFetchHandler(svc FetchHandler, opts ...connect.HandlerOption) (string, http.Handler)

NewFetchHandler builds an HTTP handler from the service implementation. It returns the path on which to mount the handler and the handler itself.

By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf and JSON codecs. They also support gzip compression.

func NewPushHandler

func NewPushHandler(svc PushHandler, opts ...connect.HandlerOption) (string, http.Handler)

NewPushHandler builds an HTTP handler from the service implementation. It returns the path on which to mount the handler and the handler itself.

By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf and JSON codecs. They also support gzip compression.

Types

type FetchClient

type FetchClient interface {
	// Resolve or fetch referenced assets, making them available to the caller and
	// other consumers in the [ContentAddressableStorage][build.bazel.remote.execution.v2.ContentAddressableStorage].
	//
	// Servers *MAY* fetch content that they do not already have cached, for any
	// URLs they support.
	//
	// Servers *SHOULD* ensure that referenced files are present in the CAS at the
	// time of the response, and (if supported) that they will remain available
	// for a reasonable period of time. The lifetimes of the referenced blobs *SHOULD*
	// be increased if necessary and applicable.
	// In the event that a client receives a reference to content that is no
	// longer present, it *MAY* re-issue the request with
	// `oldest_content_accepted` set to a more recent timestamp than the original
	// attempt, to induce a re-fetch from origin.
	//
	// Servers *MAY* cache fetched content and reuse it for subsequent requests,
	// subject to `oldest_content_accepted`.
	//
	// Servers *MAY* support the complementary [Push][build.bazel.remote.asset.v1.Push]
	// API and allow content to be directly inserted for use in future fetch
	// responses.
	//
	// Servers *MUST* ensure Fetch'd content matches all the specified
	// qualifiers except in the case of previously Push'd resources, for which
	// the server *MAY* trust the pushing client to have set the qualifiers
	// correctly, without validation.
	//
	// Servers not implementing the complementary [Push][build.bazel.remote.asset.v1.Push]
	// API *MUST* reject requests containing qualifiers it does not support.
	//
	// Servers *MAY* transform assets as part of the fetch. For example a
	// tarball fetched by [FetchDirectory][build.bazel.remote.asset.v1.Fetch.FetchDirectory]
	// might be unpacked, or a Git repository
	// fetched by [FetchBlob][build.bazel.remote.asset.v1.Fetch.FetchBlob]
	// might be passed through `git-archive`.
	//
	// Errors handling the requested assets will be returned as gRPC Status errors
	// here; errors outside the server's control will be returned inline in the
	// `status` field of the response (see comment there for details).
	// The possible RPC errors include:
	//   - `INVALID_ARGUMENT`: One or more arguments were invalid, such as a
	//     qualifier that is not supported by the server.
	//   - `RESOURCE_EXHAUSTED`: There is insufficient quota of some resource to
	//     perform the requested operation. The client may retry after a delay.
	//   - `UNAVAILABLE`: Due to a transient condition the operation could not be
	//     completed. The client should retry.
	//   - `INTERNAL`: An internal error occurred while performing the operation.
	//     The client should retry.
	//   - `DEADLINE_EXCEEDED`: The fetch could not be completed within the given
	//     RPC deadline. The client should retry for at least as long as the value
	//     provided in `timeout` field of the request.
	//
	// In the case of unsupported qualifiers, the server *SHOULD* additionally
	// send a [BadRequest][google.rpc.BadRequest] error detail where, for each
	// unsupported qualifier, there is a `FieldViolation` with a `field` of
	// `qualifiers.name` and a `description` of `"{qualifier}" not supported`
	// indicating the name of the unsupported qualifier.
	FetchBlob(context.Context, *connect.Request[v1.FetchBlobRequest]) (*connect.Response[v1.FetchBlobResponse], error)
	FetchDirectory(context.Context, *connect.Request[v1.FetchDirectoryRequest]) (*connect.Response[v1.FetchDirectoryResponse], error)
}

FetchClient is a client for the build.bazel.remote.asset.v1.Fetch service.

func NewFetchClient

func NewFetchClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) FetchClient

NewFetchClient constructs a client for the build.bazel.remote.asset.v1.Fetch service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or connect.WithGRPCWeb() options.

The URL supplied here should be the base URL for the Connect or gRPC server (for example, http://api.acme.com or https://acme.com/grpc).

type FetchHandler

type FetchHandler interface {
	// Resolve or fetch referenced assets, making them available to the caller and
	// other consumers in the [ContentAddressableStorage][build.bazel.remote.execution.v2.ContentAddressableStorage].
	//
	// Servers *MAY* fetch content that they do not already have cached, for any
	// URLs they support.
	//
	// Servers *SHOULD* ensure that referenced files are present in the CAS at the
	// time of the response, and (if supported) that they will remain available
	// for a reasonable period of time. The lifetimes of the referenced blobs *SHOULD*
	// be increased if necessary and applicable.
	// In the event that a client receives a reference to content that is no
	// longer present, it *MAY* re-issue the request with
	// `oldest_content_accepted` set to a more recent timestamp than the original
	// attempt, to induce a re-fetch from origin.
	//
	// Servers *MAY* cache fetched content and reuse it for subsequent requests,
	// subject to `oldest_content_accepted`.
	//
	// Servers *MAY* support the complementary [Push][build.bazel.remote.asset.v1.Push]
	// API and allow content to be directly inserted for use in future fetch
	// responses.
	//
	// Servers *MUST* ensure Fetch'd content matches all the specified
	// qualifiers except in the case of previously Push'd resources, for which
	// the server *MAY* trust the pushing client to have set the qualifiers
	// correctly, without validation.
	//
	// Servers not implementing the complementary [Push][build.bazel.remote.asset.v1.Push]
	// API *MUST* reject requests containing qualifiers it does not support.
	//
	// Servers *MAY* transform assets as part of the fetch. For example a
	// tarball fetched by [FetchDirectory][build.bazel.remote.asset.v1.Fetch.FetchDirectory]
	// might be unpacked, or a Git repository
	// fetched by [FetchBlob][build.bazel.remote.asset.v1.Fetch.FetchBlob]
	// might be passed through `git-archive`.
	//
	// Errors handling the requested assets will be returned as gRPC Status errors
	// here; errors outside the server's control will be returned inline in the
	// `status` field of the response (see comment there for details).
	// The possible RPC errors include:
	//   - `INVALID_ARGUMENT`: One or more arguments were invalid, such as a
	//     qualifier that is not supported by the server.
	//   - `RESOURCE_EXHAUSTED`: There is insufficient quota of some resource to
	//     perform the requested operation. The client may retry after a delay.
	//   - `UNAVAILABLE`: Due to a transient condition the operation could not be
	//     completed. The client should retry.
	//   - `INTERNAL`: An internal error occurred while performing the operation.
	//     The client should retry.
	//   - `DEADLINE_EXCEEDED`: The fetch could not be completed within the given
	//     RPC deadline. The client should retry for at least as long as the value
	//     provided in `timeout` field of the request.
	//
	// In the case of unsupported qualifiers, the server *SHOULD* additionally
	// send a [BadRequest][google.rpc.BadRequest] error detail where, for each
	// unsupported qualifier, there is a `FieldViolation` with a `field` of
	// `qualifiers.name` and a `description` of `"{qualifier}" not supported`
	// indicating the name of the unsupported qualifier.
	FetchBlob(context.Context, *connect.Request[v1.FetchBlobRequest]) (*connect.Response[v1.FetchBlobResponse], error)
	FetchDirectory(context.Context, *connect.Request[v1.FetchDirectoryRequest]) (*connect.Response[v1.FetchDirectoryResponse], error)
}

FetchHandler is an implementation of the build.bazel.remote.asset.v1.Fetch service.

type PushClient

type PushClient interface {
	// These APIs associate the identifying information of a resource, as
	// indicated by URI and optionally Qualifiers, with content available in the
	// CAS. For example, associating a repository url and a commit id with a
	// Directory Digest.
	//
	// Servers *SHOULD* only allow trusted clients to associate content, and *MAY*
	// only allow certain URIs to be pushed.
	//
	// Clients *MUST* ensure associated content is available in CAS prior to
	// pushing.
	//
	// Clients *MUST* ensure the Qualifiers listed correctly match the contents,
	// and Servers *MAY* trust these values without validation.
	// Fetch servers *MAY* require exact match of all qualifiers when returning
	// content previously pushed, or allow fetching content with only a subset of
	// the qualifiers specified on Push.
	//
	// Clients can specify expiration information that the server *SHOULD*
	// respect. Subsequent requests can be used to alter the expiration time.
	//
	// A minimal compliant Fetch implementation may support only Push'd content
	// and return `NOT_FOUND` for any resource that was not pushed first.
	// Alternatively, a compliant implementation may choose to not support Push
	// and only return resources that can be Fetch'd from origin.
	//
	// Errors will be returned as gRPC Status errors.
	// The possible RPC errors include:
	//   - `INVALID_ARGUMENT`: One or more arguments to the RPC were invalid.
	//   - `RESOURCE_EXHAUSTED`: There is insufficient quota of some resource to
	//     perform the requested operation. The client may retry after a delay.
	//   - `UNAVAILABLE`: Due to a transient condition the operation could not be
	//     completed. The client should retry.
	//   - `INTERNAL`: An internal error occurred while performing the operation.
	//     The client should retry.
	PushBlob(context.Context, *connect.Request[v1.PushBlobRequest]) (*connect.Response[v1.PushBlobResponse], error)
	PushDirectory(context.Context, *connect.Request[v1.PushDirectoryRequest]) (*connect.Response[v1.PushDirectoryResponse], error)
}

PushClient is a client for the build.bazel.remote.asset.v1.Push service.

func NewPushClient

func NewPushClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) PushClient

NewPushClient constructs a client for the build.bazel.remote.asset.v1.Push service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or connect.WithGRPCWeb() options.

The URL supplied here should be the base URL for the Connect or gRPC server (for example, http://api.acme.com or https://acme.com/grpc).

type PushHandler

type PushHandler interface {
	// These APIs associate the identifying information of a resource, as
	// indicated by URI and optionally Qualifiers, with content available in the
	// CAS. For example, associating a repository url and a commit id with a
	// Directory Digest.
	//
	// Servers *SHOULD* only allow trusted clients to associate content, and *MAY*
	// only allow certain URIs to be pushed.
	//
	// Clients *MUST* ensure associated content is available in CAS prior to
	// pushing.
	//
	// Clients *MUST* ensure the Qualifiers listed correctly match the contents,
	// and Servers *MAY* trust these values without validation.
	// Fetch servers *MAY* require exact match of all qualifiers when returning
	// content previously pushed, or allow fetching content with only a subset of
	// the qualifiers specified on Push.
	//
	// Clients can specify expiration information that the server *SHOULD*
	// respect. Subsequent requests can be used to alter the expiration time.
	//
	// A minimal compliant Fetch implementation may support only Push'd content
	// and return `NOT_FOUND` for any resource that was not pushed first.
	// Alternatively, a compliant implementation may choose to not support Push
	// and only return resources that can be Fetch'd from origin.
	//
	// Errors will be returned as gRPC Status errors.
	// The possible RPC errors include:
	//   - `INVALID_ARGUMENT`: One or more arguments to the RPC were invalid.
	//   - `RESOURCE_EXHAUSTED`: There is insufficient quota of some resource to
	//     perform the requested operation. The client may retry after a delay.
	//   - `UNAVAILABLE`: Due to a transient condition the operation could not be
	//     completed. The client should retry.
	//   - `INTERNAL`: An internal error occurred while performing the operation.
	//     The client should retry.
	PushBlob(context.Context, *connect.Request[v1.PushBlobRequest]) (*connect.Response[v1.PushBlobResponse], error)
	PushDirectory(context.Context, *connect.Request[v1.PushDirectoryRequest]) (*connect.Response[v1.PushDirectoryResponse], error)
}

PushHandler is an implementation of the build.bazel.remote.asset.v1.Push service.

type UnimplementedFetchHandler

type UnimplementedFetchHandler struct{}

UnimplementedFetchHandler returns CodeUnimplemented from all methods.

func (UnimplementedFetchHandler) FetchBlob

func (UnimplementedFetchHandler) FetchDirectory

type UnimplementedPushHandler

type UnimplementedPushHandler struct{}

UnimplementedPushHandler returns CodeUnimplemented from all methods.

func (UnimplementedPushHandler) PushBlob

func (UnimplementedPushHandler) PushDirectory

Source Files

  • remote_asset.connect.go

Jump to

Keyboard shortcuts

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