runners

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DockerRunning added in v0.1.1

func DockerRunning(ctx context.Context) bool

func Forward added in v0.0.87

func Forward(reader io.Reader, writers ...io.Writer)

func ForwardLogs

func ForwardLogs(r io.ReadCloser, ws ...io.Writer)

func RequireExec added in v0.0.75

func RequireExec(bins ...string) ([]string, bool)

Types

type CPU added in v0.0.71

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

type Command added in v0.0.87

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

func NewCommand added in v0.0.90

func NewCommand(args ...string) *Command

func (*Command) AsSlice added in v0.0.87

func (c *Command) AsSlice() []string

func (*Command) Envs added in v0.0.87

func (c *Command) Envs() []string

func (*Command) Level added in v0.0.90

func (c *Command) Level(loglevel wool.Loglevel) *Command

func (*Command) LogLevel added in v0.0.87

func (c *Command) LogLevel() wool.Loglevel

func (*Command) WithEnvs added in v0.0.90

func (c *Command) WithEnvs(envs []string) *Command

type ContainerInstance

type ContainerInstance struct {
	ID    string
	Name  string
	Image string
	Host  string
	Port  int
}

type CreateDockerInput

type CreateDockerInput struct {
	DockerImage
	ApplicationEndpointInstance *network.ApplicationEndpointInstance
}

type Docker added in v0.0.87

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

func NewDocker added in v0.0.87

func NewDocker(ctx context.Context, opts ...DockerOption) (*Docker, error)

NewDocker creates a new docker runner

func (*Docker) GetImage added in v0.0.87

func (docker *Docker) GetImage(ctx context.Context, image DockerImage) error

func (*Docker) ImageExists added in v0.0.87

func (docker *Docker) ImageExists(ctx context.Context, image DockerImage) (bool, error)

func (*Docker) Init added in v0.0.87

func (docker *Docker) Init(ctx context.Context, image DockerImage) error

func (*Docker) Run added in v0.0.87

func (docker *Docker) Run(ctx context.Context, cmds ...*Command) error

func (*Docker) Start added in v0.0.87

func (docker *Docker) Start(ctx context.Context, cmd *Command) error

func (*Docker) Stop added in v0.0.91

func (docker *Docker) Stop() error

func (*Docker) WithPorts added in v0.0.91

func (docker *Docker) WithPorts(port DockerPort)

type DockerContainerInstance added in v0.0.87

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

type DockerImage

type DockerImage struct {
	Name string
	Tag  string
}

func (*DockerImage) Image

func (image *DockerImage) Image() string

type DockerOption

type DockerOption func(option *DockerRunOption)

func WithWorkspace added in v0.0.87

func WithWorkspace(location string) DockerOption

type DockerOptionOld added in v0.0.87

type DockerOptionOld func(option *Option)

func WithCmd

func WithCmd(cmd ...string) DockerOptionOld

func WithEnvironmentVariable

func WithEnvironmentVariable(key, value string) DockerOptionOld

func WithVolume

func WithVolume(source, target string) DockerOptionOld

type DockerPort added in v0.0.91

type DockerPort struct {
	Host      string
	Container string
}

type DockerRunOption added in v0.0.87

type DockerRunOption struct {
	Location string
}

type DockerRunner

type DockerRunner struct {
	Containers []*ContainerInstance
	// contains filtered or unexported fields
}

func NewDockerRunner

func NewDockerRunner(ctx context.Context) (*DockerRunner, error)

NewDockerRunner creates a new docker runner

func (*DockerRunner) ContainerReady

func (r *DockerRunner) ContainerReady(ctx context.Context, name string) (bool, error)

func (*DockerRunner) CreateContainer

func (r *DockerRunner) CreateContainer(ctx context.Context, input CreateDockerInput, opts ...DockerOptionOld) error

func (*DockerRunner) EnsureImage

func (r *DockerRunner) EnsureImage(ctx context.Context, imageName string) error

func (*DockerRunner) Start

func (r *DockerRunner) Start(ctx context.Context) error

func (*DockerRunner) StartContainer

func (r *DockerRunner) StartContainer(ctx context.Context, c *ContainerInstance) error

func (*DockerRunner) Stop

func (r *DockerRunner) Stop(ctx context.Context) error

type Event added in v0.0.71

type Event struct {
	// Err is the state of error of the service
	Err error

	// Status is the state of the service
	ProcessState

	// CPU
	*observabilityv0.CPU

	// Memory
	*observabilityv0.Memory
}

Event represents data of a **running** service Generic so most fields will be nil

type Memory added in v0.0.71

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

type Option

type Option struct {
	Cmd     []string
	Volumes []VolumeMount
	Envs    []string
}

type ProcessState added in v0.0.71

type ProcessState int
const (
	Unknown  ProcessState = iota
	NotFound ProcessState = iota
	Running
	InterruptibleSleep
	UninterruptibleSleep
	Stopped
	Zombie
	Dead
	TracingStop
	Idle
	Parked
	Waking
)

func (ProcessState) String added in v0.0.71

func (ps ProcessState) String() string

type Runner

type Runner struct {
	Name  string
	Bin   string
	Args  []string
	Dir   string
	Debug bool
	Envs  []string
}

func (*Runner) IP added in v0.0.85

func (*Runner) Run

func (r *Runner) Run(ctx context.Context) error

func (*Runner) Start added in v0.0.85

func (r *Runner) Start(ctx context.Context) (*WrappedCmdOutput, error)

type RunnerEvent added in v0.0.75

type RunnerEvent struct {
	Err     error
	Message string
}

type Tracked added in v0.0.71

type Tracked interface {
	GetState(ctx context.Context) (ProcessState, error)
	GetCPU(ctx context.Context) (*CPU, error)
	GetMemory(ctx context.Context) (*Memory, error)
}

type TrackedProcess added in v0.0.71

type TrackedProcess struct {
	PID    int
	Killed bool
}

func (*TrackedProcess) GetCPU added in v0.0.71

func (p *TrackedProcess) GetCPU(ctx context.Context) (*CPU, error)

func (*TrackedProcess) GetMemory added in v0.0.71

func (p *TrackedProcess) GetMemory(ctx context.Context) (*Memory, error)

func (*TrackedProcess) GetState added in v0.0.71

func (p *TrackedProcess) GetState(ctx context.Context) (ProcessState, error)

type VolumeMount

type VolumeMount struct {
	Source string
	Target string
}

type WrappedCmd added in v0.0.75

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

func NewWrappedCmd added in v0.0.75

func NewWrappedCmd(cmd *exec.Cmd, writer io.Writer) (*WrappedCmd, error)

func (*WrappedCmd) Run added in v0.0.85

func (run *WrappedCmd) Run() error

func (*WrappedCmd) Start added in v0.0.75

func (run *WrappedCmd) Start(ctx context.Context) (*WrappedCmdOutput, error)

type WrappedCmdOutput added in v0.0.75

type WrappedCmdOutput struct {
	PID    int
	Events chan RunnerEvent
}

Jump to

Keyboard shortcuts

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