docker: github.com/docker/docker/container/stream Index | Files

package stream

import "github.com/docker/docker/container/stream"

Index

Package Files

attach.go streams.go

type AttachConfig Uses

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 Uses

type Config struct {
    // 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 Uses

func NewConfig() *Config

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

func (*Config) AttachStreams Uses

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

AttachStreams attaches the container's streams to the AttachConfig

func (*Config) CloseStreams Uses

func (c *Config) CloseStreams() error

CloseStreams ensures that the configured streams are properly closed.

func (*Config) CopyStreams Uses

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 Uses

func (c *Config) CopyToPipe(iop *cio.DirectIO)

CopyToPipe connects streamconfig with a libcontainerd.IOPipe

func (*Config) NewInputPipes Uses

func (c *Config) NewInputPipes()

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

func (*Config) NewNopInputPipe Uses

func (c *Config) NewNopInputPipe()

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

func (*Config) Stderr Uses

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

Stderr returns the standard error in the configuration.

func (*Config) StderrPipe Uses

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 Uses

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

Stdin returns the standard input in the configuration.

func (*Config) StdinPipe Uses

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

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

func (*Config) Stdout Uses

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

Stdout returns the standard output in the configuration.

func (*Config) StdoutPipe Uses

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.

func (*Config) Wait Uses

func (c *Config) Wait(ctx context.Context)

Wait for the stream to close Wait supports timeouts via the context to unblock and forcefully close the io streams

Package stream imports 14 packages (graph) and is imported by 357 packages. Updated 2020-04-28. Refresh now. Tools for package owners.