driver

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package driver hold implementation for action drivers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainerIOStream

func ContainerIOStream(ctx context.Context, streams launchr.Streams, cio *ContainerInOut, config *ltypes.ContainerCreateOptions) error

ContainerIOStream streams in/out/err to given streams. @todo consider license reference.

func DockerDisplayJSONMessages added in v0.17.1

func DockerDisplayJSONMessages(in io.Reader, streams launchr.Streams) error

DockerDisplayJSONMessages prints docker json output to streams.

func ForwardAllSignals added in v0.17.1

func ForwardAllSignals(ctx context.Context, cli ContainerRunner, cid string, sigc <-chan os.Signal)

ForwardAllSignals forwards signals to the container

The channel you pass in must already be setup to receive any signals you want to forward.

func GetRandomName added in v0.17.1

func GetRandomName(retry int) string

GetRandomName generates a random human-friendly name.

func MonitorTtySize

func MonitorTtySize(ctx context.Context, d ContainerRunner, cli launchr.Streams, id string, isExec bool) error

MonitorTtySize updates the container tty size when the terminal tty changes size

func NotifyAllSignals added in v0.17.1

func NotifyAllSignals() chan os.Signal

NotifyAllSignals starts watching interrupt signals.

func StopCatchSignals added in v0.17.1

func StopCatchSignals(sigc chan os.Signal)

StopCatchSignals stops catching the signals and closes the specified channel.

Types

type ContainerInOut

type ContainerInOut struct {
	In  io.WriteCloser
	Out io.Reader
}

ContainerInOut stores container driver in/out streams.

func (*ContainerInOut) Close

func (h *ContainerInOut) Close() error

Close closes the hijacked connection and reader.

func (*ContainerInOut) CloseWrite

func (h *ContainerInOut) CloseWrite() error

CloseWrite closes a readWriter for writing.

type ContainerRunner

type ContainerRunner interface {
	Info(ctx context.Context) (types.SystemInfo, error)
	ImageEnsure(ctx context.Context, opts types.ImageOptions) (*types.ImageStatusResponse, error)
	ImageRemove(ctx context.Context, image string, opts types.ImageRemoveOptions) (*types.ImageRemoveResponse, error)
	CopyToContainer(ctx context.Context, cid string, path string, content io.Reader, opts types.CopyToContainerOptions) error
	CopyFromContainer(ctx context.Context, cid, srcPath string) (io.ReadCloser, types.ContainerPathStat, error)
	ContainerStatPath(ctx context.Context, cid string, path string) (types.ContainerPathStat, error)
	ContainerList(ctx context.Context, opts types.ContainerListOptions) []types.ContainerListResult
	ContainerCreate(ctx context.Context, opts types.ContainerCreateOptions) (string, error)
	ContainerStart(ctx context.Context, cid string, opts types.ContainerStartOptions) error
	ContainerWait(ctx context.Context, cid string, opts types.ContainerWaitOptions) (<-chan types.ContainerWaitResponse, <-chan error)
	ContainerAttach(ctx context.Context, cid string, opts types.ContainerAttachOptions) (*ContainerInOut, error)
	ContainerStop(ctx context.Context, cid string) error
	ContainerKill(ctx context.Context, cid, signal string) error
	ContainerRemove(ctx context.Context, cid string, opts types.ContainerRemoveOptions) error
	ContainerResize(ctx context.Context, cid string, opts types.ResizeOptions) error
	ContainerExecResize(ctx context.Context, cid string, opts types.ResizeOptions) error
	Close() error
}

ContainerRunner defines common interface for container environments.

func New

func New(t Type) (ContainerRunner, error)

New creates a new driver based on a type.

func NewDockerDriver

func NewDockerDriver() (ContainerRunner, error)

NewDockerDriver creates a docker driver.

type ContainerRunnerSELinux added in v0.16.0

type ContainerRunnerSELinux interface {
	IsSELinuxSupported(ctx context.Context) bool
}

ContainerRunnerSELinux defines a container runner with SELinux support.

type EscapeError added in v0.17.1

type EscapeError = term.EscapeError

EscapeError is an error thrown when escape sequence is input.

type Streamer

type Streamer interface {
	Stream(ctx context.Context) error
	Close() error
}

Streamer is an interface for streaming in given in/out/err.

type Type

type Type string

Type defines implemented driver types.

const (
	Docker Type = "docker" // Docker driver
)

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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