{"modulePath":"github.com/stacklok/mecatl","version":"v0.0.54","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package client\n\nPackage client implements the engine's Workspace and CommandRunner over the executor FileService and CommandService, against the trusted service or an executor. Semantics: docs/drafts/kubernetes-execution/executor-protocol.md.\n\n## Constants\n\n```go\nconst (\n\tDefaultMaxFileBytes    = 256 \u003c\u003c 20\n\tDefaultMaxOutputBytes  = 256 \u003c\u003c 20\n\tDefaultFileCallTimeout = time.Minute\n)\n```\nClient-side ceilings against a misbehaving executor.\n\n```go\nconst ChunkBytes = 3 \u003c\u003c 20\n```\nChunkBytes is the most file content sent in one write message.\n\n## Variables\n\n```go\nvar ErrLimitExceeded = errors.New(\"executor: response exceeds client limit\")\n```\nErrLimitExceeded reports a response over a client limit.\n\n```go\nvar ErrOutcomeUnknown = errors.New(\"executor: command outcome unknown\")\n```\nErrOutcomeUnknown reports a command that started but whose end, or the end of every process it started, was not confirmed. Such a command is never retried.\n\n```go\nvar ErrStorageTimeout = errors.New(\n\t\"workspace storage did not respond in time; a write may still have completed\",\n)\n```\nErrStorageTimeout reports a file call that outlived its timeout. The executor may still finish it.\n\n## Functions\n\n```go\nfunc Keepalive(interval, timeout time.Duration) grpc.DialOption\n```\nKeepalive fails calls to an executor that stops answering pings.\n\n```go\nfunc NewClient(\n\ttarget string,\n\tcreds credentials.TransportCredentials,\n\topts ...grpc.DialOption,\n) (*grpc.ClientConn, error)\n```\nNewClient creates a lazy client with gRPC retries disabled, so no call is sent twice.\n\n## Types\n\n```go\ntype Option func(*limits)\n```\nOption configures a Workspace or Runner.\n\n```go\nfunc WithFileCallTimeout(d time.Duration) Option\n```\nWithFileCallTimeout bounds one Workspace call, streams included.\n\n```go\nfunc WithMaxFileBytes(n int) Option\n```\nWithMaxFileBytes bounds one file read.\n\n```go\nfunc WithMaxOutputBytes(n int) Option\n```\nWithMaxOutputBytes bounds the output a Runner keeps.\n\n```go\ntype RequestContextFunc func(context.Context) (*executorv1.RequestContext, error)\n```\nRequestContextFunc returns the request context sent with one call. A nil func sends an empty context, which an executor ignores.\n\n```go\ntype Runner struct {\n\t// contains filtered or unexported fields\n}\n```\nRunner is a foreground tool.CommandRunner served by a CommandService. It starts each command once; conn must not enable gRPC retries.\n\n```go\nfunc NewRunner(\n\tconn grpc.ClientConnInterface,\n\troot string,\n\trc RequestContextFunc,\n\topts ...Option,\n) *Runner\n```\nNewRunner returns a Runner whose commands run in root, the server's workspace root.\n\n```go\nfunc (r *Runner) BoundWorkspaceRoot() string\n```\nBoundWorkspaceRoot returns the root commands run in.\n\n```go\nfunc (r *Runner) Run(ctx context.Context, command string) (tool.CommandResult, error)\n```\nRun implements tool.CommandRunner. Ending ctx cancels the command and still waits, up to cancelGrace, for its result.\n\n```go\ntype Workspace struct {\n\t// contains filtered or unexported fields\n}\n```\nWorkspace is a tool.Workspace served by a FileService. It sends every call once; conn must not enable gRPC retries.\n\n```go\nfunc NewWorkspace(\n\tconn grpc.ClientConnInterface,\n\troot string,\n\trc RequestContextFunc,\n\topts ...Option,\n) *Workspace\n```\nNewWorkspace returns a Workspace rooted at root, the server's workspace root.\n\n```go\nfunc (w *Workspace) AuthorityResourcePath(path string) (target, workspace string, err error)\n```\nAuthorityResourcePath implements tool.AuthorityResourceResolver.\n\n```go\nfunc (w *Workspace) CopyFile(\n\tctx context.Context,\n\tsource string,\n\tdestination string,\n) (tool.FileVersion, error)\n```\nCopyFile implements tool.WorkspaceNamespace.\n\n```go\nfunc (w *Workspace) CreateFile(\n\tctx context.Context,\n\tpath string,\n\tdata []byte,\n) (tool.FileVersion, error)\n```\nCreateFile implements tool.Workspace.\n\n```go\nfunc (w *Workspace) Glob(ctx context.Context, pattern string) ([]string, error)\n```\nGlob implements tool.Workspace.\n\n```go\nfunc (w *Workspace) Grep(ctx context.Context, pattern, pathGlob string) ([]tool.GrepMatch, error)\n```\nGrep implements tool.Workspace.\n\n```go\nfunc (w *Workspace) Read(ctx context.Context, path string) ([]byte, error)\n```\nRead implements tool.WorkspaceReader.\n\n```go\nfunc (w *Workspace) ReadDir(ctx context.Context, path string) ([]tool.FileInfo, error)\n```\nReadDir implements tool.WorkspaceNamespace.\n\n```go\nfunc (w *Workspace) ReadVersion(\n\tctx context.Context,\n\tpath string,\n) ([]byte, tool.FileVersion, error)\n```\nReadVersion implements tool.Workspace.\n\n```go\nfunc (w *Workspace) Remove(ctx context.Context, path string) error\n```\nRemove implements tool.WorkspaceNamespace.\n\n```go\nfunc (w *Workspace) Rename(ctx context.Context, oldPath, newPath string) error\n```\nRename implements tool.WorkspaceNamespace.\n\n```go\nfunc (w *Workspace) ReplaceFile(\n\tctx context.Context,\n\tpath string,\n\told tool.FileVersion,\n\tdata []byte,\n) (tool.FileVersion, error)\n```\nReplaceFile implements tool.Workspace.\n\n```go\nfunc (w *Workspace) Root() string\n```\nRoot implements tool.WorkspaceReader.\n\n```go\nfunc (w *Workspace) Stat(ctx context.Context, path string) (tool.FileInfo, error)\n```\nStat implements tool.WorkspaceReader.\n\n","path":"github.com/stacklok/mecatl/internal/executor/client","name":"client","synopsis":"Package client implements the engine's Workspace and CommandRunner over the executor FileService and CommandService, against the trusted service or an executor.","isRedistributable":true}
