client

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRunnerClientUnimplemented = fmt.Errorf("method unimplemented")

Functions

func ApplyOptions

func ApplyOptions(rc Runner, opts ...RunnerOption) error

func ConvertToRunnerProject added in v1.4.0

func ConvertToRunnerProject(proj project.Project) *runnerv1.Project

func NewPrefixWriter added in v1.2.0

func NewPrefixWriter(w io.Writer, prefix string) io.Writer

func ResolveDirectory added in v1.2.1

func ResolveDirectory(parentDir string, fileBlock project.FileCodeBlock) string

func WithTempSettings added in v1.2.1

func WithTempSettings(rc Runner, opts []RunnerOption, cb func() error) error

Types

type LocalRunner

type LocalRunner struct {
	*RunnerSettings
	// contains filtered or unexported fields
}

func NewLocalRunner

func NewLocalRunner(opts ...RunnerOption) (*LocalRunner, error)

func (*LocalRunner) Cleanup

func (r *LocalRunner) Cleanup(ctx context.Context) error

func (*LocalRunner) Clone added in v1.2.0

func (r *LocalRunner) Clone() Runner

func (*LocalRunner) DryRunBlock

func (r *LocalRunner) DryRunBlock(ctx context.Context, fileBlock project.FileCodeBlock, w io.Writer, opts ...RunnerOption) error

func (*LocalRunner) GetEnvs added in v1.4.0

func (r *LocalRunner) GetEnvs(ctx context.Context) ([]string, error)

func (*LocalRunner) RunBlock

func (r *LocalRunner) RunBlock(ctx context.Context, fileBlock project.FileCodeBlock) error

type MultiRunner added in v1.2.0

type MultiRunner struct {
	Runner Runner

	StdoutPrefix string

	PreRunMsg  func(blocks []project.FileCodeBlock, parallel bool) string
	PostRunMsg func(block *document.CodeBlock, exitCode uint) string

	PreRunOpts []RunnerOption
}

func (MultiRunner) Cleanup added in v1.2.0

func (m MultiRunner) Cleanup(ctx context.Context) error

func (MultiRunner) RunBlocks added in v1.2.0

func (m MultiRunner) RunBlocks(ctx context.Context, blocks []project.FileCodeBlock, parallel bool) error

type RemoteRunner

type RemoteRunner struct {
	*RunnerSettings
	// contains filtered or unexported fields
}

func NewRemoteRunner

func NewRemoteRunner(ctx context.Context, addr string, opts ...RunnerOption) (*RemoteRunner, error)

func (*RemoteRunner) Cleanup

func (r *RemoteRunner) Cleanup(ctx context.Context) error

func (*RemoteRunner) Clone added in v1.2.0

func (r *RemoteRunner) Clone() Runner

func (*RemoteRunner) DryRunBlock

func (r *RemoteRunner) DryRunBlock(ctx context.Context, fileBlock project.FileCodeBlock, w io.Writer, opts ...RunnerOption) error

func (*RemoteRunner) GetEnvs added in v1.4.0

func (r *RemoteRunner) GetEnvs(ctx context.Context) ([]string, error)

func (*RemoteRunner) RunBlock

func (r *RemoteRunner) RunBlock(ctx context.Context, fileBlock project.FileCodeBlock) error

type Runner

type Runner interface {
	RunBlock(ctx context.Context, block project.FileCodeBlock) error
	DryRunBlock(ctx context.Context, block project.FileCodeBlock, w io.Writer, opts ...RunnerOption) error
	Cleanup(ctx context.Context) error

	Clone() Runner

	GetEnvs(ctx context.Context) ([]string, error)
	// contains filtered or unexported methods
}

type RunnerOption

type RunnerOption func(Runner) error

func WithCleanupSession added in v0.6.3

func WithCleanupSession(cleanup bool) RunnerOption

func WithCustomShell added in v1.2.1

func WithCustomShell(customShell string) RunnerOption

func WithDir

func WithDir(dir string) RunnerOption

func WithEnableBackgroundProcesses added in v1.0.1

func WithEnableBackgroundProcesses(enableBackground bool) RunnerOption

func WithEnvs added in v1.2.1

func WithEnvs(envs []string) RunnerOption

func WithInsecure added in v0.7.1

func WithInsecure(insecure bool) RunnerOption

func WithLogger

func WithLogger(logger *zap.Logger) RunnerOption

func WithProject added in v1.2.0

func WithProject(proj project.Project) RunnerOption

func WithSession

func WithSession(s *runner.Session) RunnerOption

func WithSessionID added in v0.6.3

func WithSessionID(id string) RunnerOption

func WithSessionStrategy added in v0.7.0

func WithSessionStrategy(strategy runnerv1.SessionStrategy) RunnerOption

func WithStderr

func WithStderr(stderr io.Writer) RunnerOption

func WithStderrTransform added in v1.2.0

func WithStderrTransform(op func(io.Writer) io.Writer) RunnerOption

func WithStdin

func WithStdin(stdin io.Reader) RunnerOption

func WithStdinTransform added in v1.2.0

func WithStdinTransform(op func(io.Reader) (io.Reader, error)) RunnerOption

func WithStdout

func WithStdout(stdout io.Writer) RunnerOption

func WithStdoutTransform added in v1.2.0

func WithStdoutTransform(op func(io.Writer) io.Writer) RunnerOption

func WithTLSDir added in v0.7.1

func WithTLSDir(tlsDir string) RunnerOption

func WithinShellMaybe

func WithinShellMaybe() RunnerOption

func WrapWithCancelReader added in v1.2.1

func WrapWithCancelReader() RunnerOption

type RunnerSettings added in v1.2.1

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

func (*RunnerSettings) Clone added in v1.2.1

func (rs *RunnerSettings) Clone() *RunnerSettings

Jump to

Keyboard shortcuts

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