shell

package
v0.0.0-...-88aa921 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2015 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Shell package.

Index

Constants

View Source
const (
	PROCESSKEY      string = "process"
	MAXBUFFER       int    = 8192
	DOCKER_ENDPOINT        = "unix:///var/run/docker.sock"
)

Variables

This section is empty.

Functions

func StartDocker

func StartDocker(cfg *ProcessConfig, port string) (*exec.Cmd, error)

Types

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

func (*Executor) Exec

func (e *Executor) Exec(cfg *ProcessConfig) (p *ProcessInstance)

type Forwarder

type Forwarder struct {
	// contains filtered or unexported fields
}

func (*Forwarder) Exec

func (f *Forwarder) Exec(cfg *ProcessConfig) *ProcessInstance

type ProcessActor

type ProcessActor interface {
	Exec(*ProcessConfig) *ProcessInstance
	// contains filtered or unexported methods
}

type ProcessConfig

type ProcessConfig struct {
	ServiceID   string
	IsTTY       bool
	SaveAs      string
	Envv        []string
	Mount       []string
	Command     string
	LogToStderr bool // log the command output for stderr
	LogStash    struct {
		Enable        bool          //enable log stash
		SettleTime    time.Duration //how long to wait for log stash to flush logs before exiting, ex. 1s
		IdleFlushTime time.Duration //interval log stash flushes its buffer, ex 1ms
	}
}

type ProcessInstance

type ProcessInstance struct {
	Stdin  chan byte
	Stdout chan byte
	Stderr chan byte
	Result chan Result
	// contains filtered or unexported fields
}

func (*ProcessInstance) Close

func (p *ProcessInstance) Close()

func (*ProcessInstance) Disconnect

func (p *ProcessInstance) Disconnect()

func (*ProcessInstance) ReadRequest

func (p *ProcessInstance) ReadRequest(ns *socketio.NameSpace)

func (*ProcessInstance) ReadResponse

func (p *ProcessInstance) ReadResponse(ns *socketio.NameSpace)

func (*ProcessInstance) WriteRequest

func (p *ProcessInstance) WriteRequest(ns *socketio.NameSpace)

func (*ProcessInstance) WriteResponse

func (p *ProcessInstance) WriteResponse(ns *socketio.NameSpace)

type ProcessServer

type ProcessServer struct {
	// contains filtered or unexported fields
}

func NewProcessExecutorServer

func NewProcessExecutorServer(port, dockerRegistry string) *ProcessServer

func NewProcessForwarderServer

func NewProcessForwarderServer(addr string) *ProcessServer

func (*ProcessServer) Handle

func (p *ProcessServer) Handle(pattern string, handler http.Handler) error

func (*ProcessServer) ServeHTTP

func (p *ProcessServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Result

type Result struct {
	ExitCode    int
	Error       string
	Termination Termination
}

type ShellReader

type ShellReader struct {
	// contains filtered or unexported fields
}

func (ShellReader) Read

func (r ShellReader) Read(p []byte) (n int, err error)

type ShellWriter

type ShellWriter struct {
	// contains filtered or unexported fields
}

func (ShellWriter) Write

func (w ShellWriter) Write(p []byte) (n int, err error)

type Termination

type Termination int

Describes whether a process terminated normally or abnormally

const (
	NORMAL   Termination = iota // Process terminated normally
	ABNORMAL                    // Process terminated abnormally
)

Jump to

Keyboard shortcuts

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