package cio

import "github.com/containerd/containerd/cio"

Index

Types

type Attach

type Attach func(*FIFOSet) (IO, error)

Attach allows callers to reattach to running tasks

There should only be one reader for a task's IO set because fifo's can only be read from one reader or the output will be sent only to the first reads

func WithAttach

func WithAttach(stdin io.Reader, stdout, stderr io.Writer) Attach

WithAttach attaches the existing io for a task to the provided io.Reader/Writers

type Config

type Config struct {
	// Terminal is true if one has been allocated
	Terminal bool
	// Stdin path
	Stdin string
	// Stdout path
	Stdout string
	// Stderr path
	Stderr string
}

Config holds the io configurations.

type Creation

type Creation func(id string) (IO, error)

Creation creates new IO sets for a task

func NewIO

func NewIO(stdin io.Reader, stdout, stderr io.Writer) Creation

NewIO returns an Creation that will provide IO sets without a terminal

func NewIOWithTerminal

func NewIOWithTerminal(stdin io.Reader, stdout, stderr io.Writer, terminal bool) Creation

NewIOWithTerminal creates a new io set with the provied io.Reader/Writers for use with a terminal

type FIFOSet

type FIFOSet struct {
	// Dir is the directory holding the task fifos
	Dir string
	// In, Out, and Err fifo paths
	In, Out, Err string
	// Terminal returns true if a terminal is being used for the task
	Terminal bool
}

FIFOSet is a set of fifos for use with tasks

func NewFifos

func NewFifos(id string) (*FIFOSet, error)

NewFifos returns a new set of fifos for the task

type IO

type IO interface {
	// Config returns the IO configuration.
	Config() Config
	// Cancel aborts all current io operations
	Cancel()
	// Wait blocks until all io copy operations have completed
	Wait()
	// Close cleans up all open io resources
	Close() error
}

IO holds the io information for a task or process

func NullIO

func NullIO(id string) (IO, error)

NullIO redirects the container's IO into /dev/null

func Stdio

func Stdio(id string) (IO, error)

Stdio returns an IO set to be used for a task that outputs the container's IO as the current processes Stdio

func StdioTerminal

func StdioTerminal(id string) (IO, error)

StdioTerminal will setup the IO for the task to use a terminal

Source Files

io.go io_windows.go

Version
v1.0.1
Published
Jan 17, 2018
Platform
windows/amd64
Imports
9 packages
Last checked
8 minutes ago

Tools for package owners.