cio

package
v1.0.1-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2018 License: Apache-2.0, CC-BY-4.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 DirectIO

type DirectIO struct {
	Stdin  io.WriteCloser
	Stdout io.ReadCloser
	Stderr io.ReadCloser
	// contains filtered or unexported fields
}

DirectIO allows task IO to be handled externally by the caller

func NewDirectIO

func NewDirectIO(ctx context.Context, terminal bool) (*DirectIO, error)

NewDirectIO returns an IO implementation that exposes the pipes directly

func (*DirectIO) Cancel

func (f *DirectIO) Cancel()

Cancel stops any IO copy operations

Not applicable for DirectIO

func (*DirectIO) Close

func (f *DirectIO) Close() error

Close closes all open fds

func (*DirectIO) Config

func (f *DirectIO) Config() Config

Config returns the Config

func (*DirectIO) Delete

func (f *DirectIO) Delete() error

Delete removes the underlying directory containing fifos

func (*DirectIO) IOAttach

func (f *DirectIO) IOAttach(set *FIFOSet) (IO, error)

IOAttach returns IO avaliable for use with task attachment

func (*DirectIO) IOCreate

func (f *DirectIO) IOCreate(id string) (IO, error)

IOCreate returns IO avaliable for use with task creation

func (*DirectIO) Wait

func (f *DirectIO) Wait()

Wait on any IO copy operations

Not applicable for DirectIO

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

Jump to

Keyboard shortcuts

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