stream

package
v1.4.2-0...-705e031 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttachConfig

type AttachConfig struct {
	// Tells the attach copier that the stream's stdin is a TTY and to look for
	// escape sequences in stdin to detach from the stream.
	// When true the escape sequence is not passed to the underlying stream
	TTY bool
	// Specifies the detach keys the client will be using
	// Only useful when `TTY` is true
	DetachKeys []byte

	// CloseStdin signals that once done, stdin for the attached stream should be closed
	// For example, this would close the attached container's stdin.
	CloseStdin bool

	// UseStd* indicate whether the client has requested to be connected to the
	// given stream or not.  These flags are used instead of checking Std* != nil
	// at points before the client streams Std* are wired up.
	UseStdin, UseStdout, UseStderr bool

	// CStd* are the streams directly connected to the container
	CStdin           io.WriteCloser
	CStdout, CStderr io.ReadCloser

	// Provide client streams to wire up to
	Stdin          io.ReadCloser
	Stdout, Stderr io.Writer
}

AttachConfig is the config struct used to attach a client to a stream's stdio

type Config

type Config struct {
	sync.WaitGroup
	// contains filtered or unexported fields
}

Config holds information about I/O streams managed together.

config.StdinPipe returns a WriteCloser which can be used to feed data to the standard input of the streamConfig's active process. config.StdoutPipe and streamConfig.StderrPipe each return a ReadCloser which can be used to retrieve the standard output (and error) generated by the container's active process. The output (and error) are actually copied and delivered to all StdoutPipe and StderrPipe consumers, using a kind of "broadcaster".

func NewConfig

func NewConfig() *Config

NewConfig creates a stream config and initializes the standard err and standard out to new unbuffered broadcasters.

func (*Config) AttachStreams

func (c *Config) AttachStreams(cfg *AttachConfig)

AttachStreams attaches the container's streams to the AttachConfig

func (*Config) CloseStreams

func (c *Config) CloseStreams() error

CloseStreams ensures that the configured streams are properly closed.

func (*Config) CopyStreams

func (c *Config) CopyStreams(ctx context.Context, cfg *AttachConfig) chan error

CopyStreams starts goroutines to copy data in and out to/from the container

func (*Config) CopyToPipe

func (c *Config) CopyToPipe(iop libcontainerd.IOPipe)

CopyToPipe connects streamconfig with a libcontainerd.IOPipe

func (*Config) NewInputPipes

func (c *Config) NewInputPipes()

NewInputPipes creates new pipes for both standard inputs, Stdin and StdinPipe.

func (*Config) NewNopInputPipe

func (c *Config) NewNopInputPipe()

NewNopInputPipe creates a new input pipe that will silently drop all messages in the input.

func (*Config) Stderr

func (c *Config) Stderr() *broadcaster.Unbuffered

Stderr returns the standard error in the configuration.

func (*Config) StderrPipe

func (c *Config) StderrPipe() io.ReadCloser

StderrPipe creates a new io.ReadCloser with an empty bytes pipe. It adds this new err pipe to the Stderr broadcaster. This will block stderr if unconsumed.

func (*Config) Stdin

func (c *Config) Stdin() io.ReadCloser

Stdin returns the standard input in the configuration.

func (*Config) StdinPipe

func (c *Config) StdinPipe() io.WriteCloser

StdinPipe returns an input writer pipe as an io.WriteCloser.

func (*Config) Stdout

func (c *Config) Stdout() *broadcaster.Unbuffered

Stdout returns the standard output in the configuration.

func (*Config) StdoutPipe

func (c *Config) StdoutPipe() io.ReadCloser

StdoutPipe creates a new io.ReadCloser with an empty bytes pipe. It adds this new out pipe to the Stdout broadcaster. This will block stdout if unconsumed.

type DetachError

type DetachError struct{}

DetachError is special error which returned in case of container detach.

func (DetachError) Error

func (DetachError) Error() string

Jump to

Keyboard shortcuts

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