shell

package
v0.0.0-...-1c5d739 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Overview

Package shell - Run serviced shells

Index

Constants

View Source
const (
	PROCESSKEY string = "process"
)

Variables

View Source
var (

	// ErrShellDisabled - Shell disabled error message
	ErrShellDisabled = errors.New("shell has been disabled for this service")
)

Functions

func StartDocker

func StartDocker(cfg *ProcessConfig, masterAddress, workerAddress, dockerRegistry, controller string) (*exec.Cmd, error)

StartDocker - Start a docker container

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
	}
}

ProcessConfig - Configuration of process running the shell

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(masterAddress, agentAddress, dockerRegistry, controllerBinary string) *ProcessServer

NewProcessExecutorServer - Create and return a processServer instance

func NewProcessForwarderServer

func NewProcessForwarderServer(addr string) *ProcessServer

func (*ProcessServer) Handle

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

func (*ProcessServer) ServeHTTP

func (s *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

Termination - Describes whether a process terminated normally or abnormally

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

Jump to

Keyboard shortcuts

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