reapi

package
v0.0.0-...-9994f1b Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: BSD-3-Clause Imports: 39 Imported by: 0

Documentation

Overview

Package reapi provides remote execution API.

Index

Constants

This section is empty.

Variables

View Source
var ErrBadPlatformContainerImage = errors.New("reapi: bad platform container image")

ErrBadPlatformContainerImage is an error if the request used bad platform container image.

View Source
var (
	// FileSemaphore limits concurrent file access to create BatchUpdateBlobgs to protect from runtime thread exhaustion.
	FileSemaphore = semaphore.New("reapi-cas-file", runtimex.NumCPU())
)

Functions

func MetadataFromOutgoingContext

func MetadataFromOutgoingContext(ctx context.Context) (*rpb.RequestMetadata, bool)

MetadataFromOutgoingContext returns request metadata in outgoing context.

func NewContext

func NewContext(ctx context.Context, rmd *rpb.RequestMetadata) context.Context

NewContext returns new context with request metadata.

Types

type CacheStore

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

CacheStore provides a thin wrapper around REAPI client that gets and uploads blobs and action results.

func (CacheStore) GetActionResult

func (c CacheStore) GetActionResult(ctx context.Context, d digest.Digest) (*rpb.ActionResult, error)

GetActionResult gets action result for the action identified by the digest.

func (CacheStore) GetContent

func (c CacheStore) GetContent(ctx context.Context, d digest.Digest, fname string) ([]byte, error)

GetContent gets contents for the fname identified by the digest.

func (CacheStore) HasContent

func (c CacheStore) HasContent(ctx context.Context, d digest.Digest) bool

HasContent returns whether digest is in cache store.

func (CacheStore) SetActionResult

func (c CacheStore) SetActionResult(ctx context.Context, d digest.Digest, ar *rpb.ActionResult) error

SetActionResult sets action result for the action identified by the digest. If a failing action is provided, caching will be skipped.

func (CacheStore) SetContent

func (c CacheStore) SetContent(ctx context.Context, d digest.Digest, fname string, content []byte) error

SetContent sets contents for the fname identified by the digest.

func (CacheStore) Source

func (c CacheStore) Source(_ context.Context, d digest.Digest, fname string) digest.Source

Source returns digest source for fname identified by the digest.

func (CacheStore) String

func (c CacheStore) String() string

type Client

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

Client is a remote exec API client.

func New

func New(ctx context.Context, cred cred.Cred, opt Option) (*Client, error)

New creates new remote exec API client.

func NewFromConn

func NewFromConn(ctx context.Context, opt Option, conn grpcClientConn) (*Client, error)

NewFromConn creates new remote exec API client from conn.

func (*Client) CacheStore

func (c *Client) CacheStore() CacheStore

CacheStore returns cache store of the client.

func (*Client) Close

func (c *Client) Close() error

Close closes the client.

func (*Client) ExecuteAndWait

func (c *Client) ExecuteAndWait(ctx context.Context, req *rpb.ExecuteRequest, opts ...grpc.CallOption) (string, *rpb.ExecuteResponse, error)

ExecuteAndWait executes a cmd and waits for the result.

func (*Client) FetchTree

func (c *Client) FetchTree(ctx context.Context, dirname string, d digest.Digest, ds *digest.Store) (*rpb.Directory, error)

FetchTree fetches trees at dirname identified by digest into digest store and returns its root directory.

func (*Client) FileURI

func (c *Client) FileURI(d digest.Digest) string

FileURI returns bytestream URI for digest.

func (*Client) Get

func (c *Client) Get(ctx context.Context, d digest.Digest, name string) ([]byte, error)

Get fetches the content of blob from CAS by digest. For small blobs, it uses BatchReadBlobs. For large blobs, it uses Read method of the ByteStream API

func (*Client) GetActionResult

func (c *Client) GetActionResult(ctx context.Context, d digest.Digest) (*rpb.ActionResult, error)

GetActionResult gets the action result by the digest.

func (*Client) IOMetrics

func (c *Client) IOMetrics() *iometrics.IOMetrics

IOMetrics returns an IOMetrics of the client.

func (*Client) Missing

func (c *Client) Missing(ctx context.Context, blobs []digest.Digest) ([]digest.Digest, error)

Missing returns digests of missing blobs.

func (*Client) Proto

func (c *Client) Proto(ctx context.Context, d digest.Digest, p proto.Message) error

Proto fetches contents of digest into proto message.

func (*Client) Upload

func (c *Client) Upload(ctx context.Context, ds *digest.Store, blobs []digest.Digest) (int, error)

Upload uploads blobs in digest stores.

func (*Client) UploadAll

func (c *Client) UploadAll(ctx context.Context, ds *digest.Store) (int, error)

UploadAll uploads all blobs specified in ds that are still missing in the CAS.

type Option

type Option struct {
	Prefix   string
	Address  string
	Instance string

	// use compressed blobs if server supports compressed blobs and size is bigger than this.
	// When 0 is set, blob compression is disabled.
	CompressedBlob int64

	KeepAliveParams keepalive.ClientParameters
}

Option contains options of remote exec API.

func (Option) IsValid

func (o Option) IsValid() bool

IsValid returns whether option is valid or not.

func (*Option) RegisterFlags

func (o *Option) RegisterFlags(fs *flag.FlagSet, envs map[string]string)

RegisterFlags registers flags on the option.

func (*Option) UpdateProjectID

func (o *Option) UpdateProjectID(projID string) string

UpdateProjectID updates the Option for projID and returns cloud project ID to use.

Directories

Path Synopsis
Package bytestreamio provides io interfaces on bytestream service.
Package bytestreamio provides io interfaces on bytestream service.
Package digest handles content digests of remote executon API.
Package digest handles content digests of remote executon API.
Package merkletree operates on a merkle tree for remote execution API.
Package merkletree operates on a merkle tree for remote execution API.
exporter
Package exporter is an exporter of directory tree from RBE-CAS.
Package exporter is an exporter of directory tree from RBE-CAS.
importer
Package importer is an importer of directory tree into RBE-CAS.
Package importer is an importer of directory tree into RBE-CAS.
Package proto provides protocol buffer message for reapi.
Package proto provides protocol buffer message for reapi.
Package reapitest provides fake implementation of reapi for test.
Package reapitest provides fake implementation of reapi for test.
Package retry provides retrying functionalities.
Package retry provides retrying functionalities.

Jump to

Keyboard shortcuts

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