streams

package
v0.0.0-...-ba854f2 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 7 Imported by: 5 modules, 20 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttachConfig

type AttachConfig struct {
	Detach   bool
	Terminal bool

	// CloseStdin means if the stdin of client's stream is closed by the
	// caller, the stdin of process's stream should be closed.
	CloseStdin bool

	// UseStdin/UseStdout/UseStderr can be used to check the client's stream
	// is nil or not. It is hard to check io.Write/io.ReadCloser != nil
	// directly, because they might be specific type, which means
	// (typ != nil) always is true.
	UseStdin, UseStdout, UseStderr bool

	Stdin          io.ReadCloser
	Stdout, Stderr io.Writer
}

AttachConfig is used to describe how to attach the client's stream to the process's stream.

type Pipes

type Pipes struct {
	Stdin io.WriteCloser

	Stdout io.ReadCloser

	Stderr io.ReadCloser
}

Pipes is used to present any downstream pipe, for example, containerd's cio.

type Stream

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

Stream is used to handle container IO.

func NewStream

func NewStream() *Stream

NewStream returns new streams.

func (*Stream) AddStderrWriter

func (s *Stream) AddStderrWriter(w io.WriteCloser)

AddStderrWriter adds the stderr writer.

func (*Stream) AddStdoutWriter

func (s *Stream) AddStdoutWriter(w io.WriteCloser)

AddStdoutWriter adds the stdout writer.

func (*Stream) Attach

func (s *Stream) Attach(ctx context.Context, cfg *AttachConfig) <-chan error

Attach will use stream defined by AttachConfig to attach the Stream.

func (*Stream) Close

func (s *Stream) Close() error

Close closes streams.

func (*Stream) CopyPipes

func (s *Stream) CopyPipes(p Pipes)

CopyPipes will watchs the data pipe's channel, like sticked to the pipe.

NOTE: don't assign the specific type to the Pipes because the Std* != nil always return true.

func (*Stream) NewDiscardStdinInput

func (s *Stream) NewDiscardStdinInput()

NewDiscardStdinInput creates a no-op WriteCloser for StdinPipe().

func (*Stream) NewStderrPipe

func (s *Stream) NewStderrPipe() io.ReadCloser

NewStderrPipe creates pipe and register it into Stderr.

func (*Stream) NewStdinInput

func (s *Stream) NewStdinInput()

NewStdinInput creates pipe for Stdin() and StdinPipe().

func (*Stream) NewStdoutPipe

func (s *Stream) NewStdoutPipe() io.ReadCloser

NewStdoutPipe creates pipe and register it into Stdout.

func (*Stream) Stderr

func (s *Stream) Stderr() io.WriteCloser

Stderr returns the Stderr for writer.

func (*Stream) Stdin

func (s *Stream) Stdin() io.ReadCloser

Stdin returns the Stdin for reader.

func (*Stream) StdinPipe

func (s *Stream) StdinPipe() io.WriteCloser

StdinPipe returns the Stdin for writer.

func (*Stream) Stdout

func (s *Stream) Stdout() io.WriteCloser

Stdout returns the Stdout for writer.

Jump to

Keyboard shortcuts

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