Documentation ¶
Overview ¶
Package tool in this file provides functions that can be embedded into a go binary such that the binary now supports the various operations the remotetool supports (e.g., show_action, upload_blob, etc). A canonical usage of this library is the remotetool binary.
Package tool provides implementation of the debugging related operations supported by go/cmd/remotetool package.
Index ¶
- Variables
- func RegisterFlags()
- func ValidateFlags()
- type Client
- func (c *Client) CheckDeterminism(ctx context.Context, actionDigest, actionRoot string, attempts int) error
- func (c *Client) DownloadAction(ctx context.Context, actionDigest, outputPath string, overwrite bool) error
- func (c *Client) DownloadActionResult(ctx context.Context, actionDigest, pathPrefix string) error
- func (c *Client) DownloadBlob(ctx context.Context, blobDigest, path string) (string, error)
- func (c *Client) DownloadDirectory(ctx context.Context, rootDigest, path string) error
- func (c *Client) ExecuteAction(ctx context.Context, actionDigest, actionRoot, outDir string, oe outerr.OutErr) (*command.Metadata, error)
- func (c *Client) ShowAction(ctx context.Context, actionDigest string) (string, error)
- func (c *Client) UploadBlob(ctx context.Context, path string) error
- func (c *Client) UploadBlobV2(ctx context.Context, path string) error
- func (c *Client) UploadDirectory(ctx context.Context, path string) (*UploadStats, error)
- type OpType
- type UploadStats
Constants ¶
This section is empty.
Variables ¶
var RemoteToolOperations = map[OpType]func(ctx context.Context, c *Client){ // contains filtered or unexported fields }
RemoteToolOperations maps each supported operation to a function that performs the operation.
var SupportedOps = []OpType{
downloadActionResult,
showAction,
downloadAction,
downloadBlob,
downloadDir,
executeAction,
checkDeterminism,
uploadBlob,
uploadDir,
}
SupportedOps denote the list of operations supported by this remotetool.
Functions ¶
func RegisterFlags ¶
func RegisterFlags()
RegisterFlags registers the flags necessary for the embedded tool to work.
func ValidateFlags ¶
func ValidateFlags()
ValidateFlags validates the command line flags associated with this embedded remote tool.
Types ¶
type Client ¶
Client is a remote execution client.
func (*Client) CheckDeterminism ¶
func (c *Client) CheckDeterminism(ctx context.Context, actionDigest, actionRoot string, attempts int) error
CheckDeterminism executes the action the given number of times and compares output digests, reporting failure if a mismatch is detected.
func (*Client) DownloadAction ¶
func (c *Client) DownloadAction(ctx context.Context, actionDigest, outputPath string, overwrite bool) error
DownloadAction parses and downloads an action to the given directory. The output directory will have the following:
- ac.textproto: the action proto file in text format.
- cmd.textproto: the command proto file in text format.
- input/: the input tree root directory with all files under it.
- input_node_properties.txtproto: all the NodeProperties defined on the input tree, as an InputSpec proto file in text format. Will be omitted if no NodeProperties are defined.
func (*Client) DownloadActionResult ¶
DownloadActionResult downloads the action result of the given action digest if it exists in the remote cache.
func (*Client) DownloadBlob ¶
DownloadBlob downloads a blob from the remote cache into the specified path. If the path is empty, it writes the contents to stdout instead.
func (*Client) DownloadDirectory ¶
DownloadDirectory downloads a an input root from the remote cache into the specified path.
func (*Client) ExecuteAction ¶
func (c *Client) ExecuteAction(ctx context.Context, actionDigest, actionRoot, outDir string, oe outerr.OutErr) (*command.Metadata, error)
ExecuteAction executes an action in a canonical structure remotely. The structure is the same as that produced by DownloadAction. top level >
> ac.textproto (Action text proto) > cmd.textproto (Command text proto) > input_node_properties.textproto (InputSpec text proto, optional) > input (Input root) > inputs...
func (*Client) ShowAction ¶
ShowAction parses and displays an action with its corresponding command.
func (*Client) UploadBlob ¶
UploadBlob uploads a blob from the specified path into the remote cache.
func (*Client) UploadBlobV2 ¶
UploadBlobV2 uploads a blob from the specified path into the remote cache using newer cas implementation.
func (*Client) UploadDirectory ¶
UploadDirectory uploads a directory from the specified path as a Merkle-tree to the remote cache.