Documentation ¶
Index ¶
- func CheckForRuntimes(ctx context.Context, requirements []*agentv0.Runtime) error
- func CheckPythonPath() (string, error)
- func ContainerName(name string) string
- func DockerEngineRunning(ctx context.Context) bool
- func Forward(ctx context.Context, reader io.Reader, writer io.Writer)
- func IsFreePort(port int) bool
- func PrintDownloadPercentage(reader io.ReadCloser, out io.Writer)
- func WaitForPortUnbound(ctx context.Context, port int) error
- type CPU
- type DockerContainerInstance
- type DockerEnvironment
- func (docker *DockerEnvironment) ContainerDeleted() (bool, error)
- func (docker *DockerEnvironment) ContainerID() (string, error)
- func (docker *DockerEnvironment) GetContainer(ctx context.Context) error
- func (docker *DockerEnvironment) GetImageIfNotPresent(ctx context.Context, imag *resources.DockerImage) error
- func (docker *DockerEnvironment) GetLogs(ctx context.Context) error
- func (docker *DockerEnvironment) ImageExists(ctx context.Context, imag *resources.DockerImage) (bool, error)
- func (docker *DockerEnvironment) Init(ctx context.Context) error
- func (docker *DockerEnvironment) IsContainerPresent(ctx context.Context) (bool, error)
- func (docker *DockerEnvironment) NewProcess(bin string, args ...string) (Proc, error)
- func (docker *DockerEnvironment) Shutdown(ctx context.Context) error
- func (docker *DockerEnvironment) Stop(ctx context.Context) error
- func (docker *DockerEnvironment) WithBinary(bin string) error
- func (docker *DockerEnvironment) WithCommand(cmd ...string)
- func (docker *DockerEnvironment) WithDir(dir string)
- func (docker *DockerEnvironment) WithEnvironmentVariables(envs ...*resources.EnvironmentVariable)
- func (docker *DockerEnvironment) WithMount(sourceDir string, targetDir string)
- func (docker *DockerEnvironment) WithOutput(w io.Writer)
- func (docker *DockerEnvironment) WithPause()
- func (docker *DockerEnvironment) WithPort(ctx context.Context, port uint16)
- func (docker *DockerEnvironment) WithPortMapping(ctx context.Context, local uint16, container uint16)
- func (docker *DockerEnvironment) WithWorkDir(dir string)
- type DockerPortMapping
- type DockerProc
- func (proc *DockerProc) FindPid(ctx context.Context) (int, error)
- func (proc *DockerProc) Match(cmd []string) bool
- func (proc *DockerProc) Run(ctx context.Context) error
- func (proc *DockerProc) Start(ctx context.Context) error
- func (proc *DockerProc) Stop(ctx context.Context) error
- func (proc *DockerProc) WithEnvironmentVariables(envs ...*resources.EnvironmentVariable)
- func (proc *DockerProc) WithOutput(output io.Writer)
- type DockerPullResponse
- type Event
- type Memory
- type NativeEnvironment
- func (native *NativeEnvironment) Init(ctx context.Context) error
- func (native *NativeEnvironment) NewProcess(bin string, args ...string) (Proc, error)
- func (native *NativeEnvironment) Shutdown(context.Context) error
- func (native *NativeEnvironment) Stop(context.Context) error
- func (native *NativeEnvironment) WithBinary(bin string) error
- func (native *NativeEnvironment) WithEnvironmentVariables(envs ...*resources.EnvironmentVariable)
- type NativeProc
- func (proc *NativeProc) Forward(_ context.Context, w io.Reader)
- func (proc *NativeProc) Run(ctx context.Context) error
- func (proc *NativeProc) Start(ctx context.Context) error
- func (proc *NativeProc) Stop(ctx context.Context) error
- func (proc *NativeProc) WithEnvironmentVariables(envs ...*resources.EnvironmentVariable)
- func (proc *NativeProc) WithOutput(output io.Writer)
- func (proc *NativeProc) WithRunningCmd(_ string)
- type Proc
- type ProcessState
- type ProgressDetail
- type RunnerEnvironment
- type Tracked
- type TrackedProcess
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckForRuntimes ¶
func CheckPythonPath ¶
func ContainerName ¶
func DockerEngineRunning ¶
func IsFreePort ¶
func PrintDownloadPercentage ¶
func PrintDownloadPercentage(reader io.ReadCloser, out io.Writer)
Types ¶
type DockerContainerInstance ¶
type DockerContainerInstance struct {
ID string
}
type DockerEnvironment ¶
type DockerEnvironment struct {
// contains filtered or unexported fields
}
func NewDockerEnvironment ¶
func NewDockerEnvironment(ctx context.Context, image *resources.DockerImage, dir string, name string) (*DockerEnvironment, error)
NewDockerEnvironment creates a new docker runner
func NewDockerHeadlessEnvironment ¶
func NewDockerHeadlessEnvironment(ctx context.Context, image *resources.DockerImage, name string) (*DockerEnvironment, error)
NewDockerHeadlessEnvironment creates a new docker runner
func (*DockerEnvironment) ContainerDeleted ¶ added in v0.1.89
func (docker *DockerEnvironment) ContainerDeleted() (bool, error)
ContainerDeleted checks if the container with ID is gone
func (*DockerEnvironment) ContainerID ¶
func (docker *DockerEnvironment) ContainerID() (string, error)
func (*DockerEnvironment) GetContainer ¶
func (docker *DockerEnvironment) GetContainer(ctx context.Context) error
func (*DockerEnvironment) GetImageIfNotPresent ¶ added in v0.1.87
func (docker *DockerEnvironment) GetImageIfNotPresent(ctx context.Context, imag *resources.DockerImage) error
func (*DockerEnvironment) GetLogs ¶ added in v0.1.89
func (docker *DockerEnvironment) GetLogs(ctx context.Context) error
func (*DockerEnvironment) ImageExists ¶
func (docker *DockerEnvironment) ImageExists(ctx context.Context, imag *resources.DockerImage) (bool, error)
func (*DockerEnvironment) IsContainerPresent ¶
func (docker *DockerEnvironment) IsContainerPresent(ctx context.Context) (bool, error)
func (*DockerEnvironment) NewProcess ¶
func (docker *DockerEnvironment) NewProcess(bin string, args ...string) (Proc, error)
func (*DockerEnvironment) Shutdown ¶
func (docker *DockerEnvironment) Shutdown(ctx context.Context) error
func (*DockerEnvironment) WithBinary ¶ added in v0.1.91
func (docker *DockerEnvironment) WithBinary(bin string) error
func (*DockerEnvironment) WithCommand ¶
func (docker *DockerEnvironment) WithCommand(cmd ...string)
func (*DockerEnvironment) WithDir ¶
func (docker *DockerEnvironment) WithDir(dir string)
func (*DockerEnvironment) WithEnvironmentVariables ¶
func (docker *DockerEnvironment) WithEnvironmentVariables(envs ...*resources.EnvironmentVariable)
func (*DockerEnvironment) WithMount ¶
func (docker *DockerEnvironment) WithMount(sourceDir string, targetDir string)
func (*DockerEnvironment) WithOutput ¶
func (docker *DockerEnvironment) WithOutput(w io.Writer)
func (*DockerEnvironment) WithPause ¶
func (docker *DockerEnvironment) WithPause()
func (*DockerEnvironment) WithPort ¶
func (docker *DockerEnvironment) WithPort(ctx context.Context, port uint16)
func (*DockerEnvironment) WithPortMapping ¶
func (docker *DockerEnvironment) WithPortMapping(ctx context.Context, local uint16, container uint16)
func (*DockerEnvironment) WithWorkDir ¶
func (docker *DockerEnvironment) WithWorkDir(dir string)
type DockerPortMapping ¶
type DockerProc ¶
type DockerProc struct {
// contains filtered or unexported fields
}
func (*DockerProc) FindPid ¶ added in v0.1.88
func (proc *DockerProc) FindPid(ctx context.Context) (int, error)
func (*DockerProc) Match ¶ added in v0.1.89
func (proc *DockerProc) Match(cmd []string) bool
func (*DockerProc) WithEnvironmentVariables ¶
func (proc *DockerProc) WithEnvironmentVariables(envs ...*resources.EnvironmentVariable)
func (*DockerProc) WithOutput ¶
func (proc *DockerProc) WithOutput(output io.Writer)
type DockerPullResponse ¶
type DockerPullResponse struct { ID string `json:"id"` Status string `json:"status"` ProgressDetail ProgressDetail `json:"progressDetail"` }
type Event ¶
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 NativeEnvironment ¶ added in v0.1.89
type NativeEnvironment struct {
// contains filtered or unexported fields
}
func NewNativeEnvironment ¶ added in v0.1.89
func NewNativeEnvironment(ctx context.Context, dir string) (*NativeEnvironment, error)
NewNativeEnvironment creates a new docker runner
func (*NativeEnvironment) Init ¶ added in v0.1.89
func (native *NativeEnvironment) Init(ctx context.Context) error
func (*NativeEnvironment) NewProcess ¶ added in v0.1.89
func (native *NativeEnvironment) NewProcess(bin string, args ...string) (Proc, error)
func (*NativeEnvironment) Shutdown ¶ added in v0.1.89
func (native *NativeEnvironment) Shutdown(context.Context) error
func (*NativeEnvironment) Stop ¶ added in v0.1.89
func (native *NativeEnvironment) Stop(context.Context) error
func (*NativeEnvironment) WithBinary ¶ added in v0.1.91
func (native *NativeEnvironment) WithBinary(bin string) error
func (*NativeEnvironment) WithEnvironmentVariables ¶ added in v0.1.89
func (native *NativeEnvironment) WithEnvironmentVariables(envs ...*resources.EnvironmentVariable)
type NativeProc ¶ added in v0.1.89
type NativeProc struct {
// contains filtered or unexported fields
}
func (*NativeProc) Forward ¶ added in v0.1.89
func (proc *NativeProc) Forward(_ context.Context, w io.Reader)
func (*NativeProc) Start ¶ added in v0.1.89
func (proc *NativeProc) Start(ctx context.Context) error
func (*NativeProc) WithEnvironmentVariables ¶ added in v0.1.89
func (proc *NativeProc) WithEnvironmentVariables(envs ...*resources.EnvironmentVariable)
func (*NativeProc) WithOutput ¶ added in v0.1.89
func (proc *NativeProc) WithOutput(output io.Writer)
func (*NativeProc) WithRunningCmd ¶ added in v0.1.89
func (proc *NativeProc) WithRunningCmd(_ string)
type Proc ¶
type Proc interface { Start(ctx context.Context) error Run(ctx context.Context) error Stop(ctx context.Context) error // WithOutput output to send the logs WithOutput(w io.Writer) // WithEnvironmentVariables adds environment variables WithEnvironmentVariables(envs ...*resources.EnvironmentVariable) }
Proc is a generic process interface Implementations: - LocalEnvironment process: obtained from a local environment - Docker process: obtained by running in a Docker environment
type ProcessState ¶
type ProcessState int
const ( Unknown ProcessState = iota NotFound ProcessState = iota Running InterruptibleSleep UninterruptibleSleep Stopped Zombie Dead TracingStop Idle Parked Waking )
func (ProcessState) String ¶
func (ps ProcessState) String() string
type ProgressDetail ¶
type RunnerEnvironment ¶
type RunnerEnvironment interface { // Init setup the environment Init(ctx context.Context) error // NewProcess creates a new process for the environment NewProcess(bin string, args ...string) (Proc, error) // Stop the environment: can potentially be restarted Stop(ctx context.Context) error // Shutdown the environment: stop and remove all resources Shutdown(ctx context.Context) error // WithBinary ensures a binary is visible in the environment WithBinary(bin string) error // WithEnvironmentVariables sets the environment variables WithEnvironmentVariables(envs ...*resources.EnvironmentVariable) }
A RunnerEnvironment controls running processes. Implementations: - local - docker - kubernetes (future)
type TrackedProcess ¶
func (*TrackedProcess) GetMemory ¶
func (p *TrackedProcess) GetMemory(ctx context.Context) (*Memory, error)
func (*TrackedProcess) GetState ¶
func (p *TrackedProcess) GetState(ctx context.Context) (ProcessState, error)
Click to show internal directories.
Click to hide internal directories.