envs

package
v2.0.0-...-6548848 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2020 License: Apache-2.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 BaseEnvironment

type BaseEnvironment struct {
	Environment
	Type              string
	RootDirectory     string                 `json:"root"`
	ConsoleBuffer     apufferi.Cache         `json:"-"`
	WSManager         utils.WebSocketManager `json:"-"`
	Wait              *sync.WaitGroup        `json:"-"`
	ExecutionFunction ExecutionFunction      `json:"-"`
	WaitFunction      func() (err error)     `json:"-"`
}

func (*BaseEnvironment) AddListener

func (e *BaseEnvironment) AddListener(ws *websocket.Conn)

func (*BaseEnvironment) CreateWrapper

func (e *BaseEnvironment) CreateWrapper() io.Writer

func (*BaseEnvironment) Delete

func (e *BaseEnvironment) Delete() (err error)

func (*BaseEnvironment) DisplayToConsole

func (e *BaseEnvironment) DisplayToConsole(daemon bool, msg string, data ...interface{})

func (*BaseEnvironment) Execute

func (e *BaseEnvironment) Execute(cmd string, args []string, env map[string]string, callback func(graceful bool)) (stdOut []byte, err error)

func (*BaseEnvironment) ExecuteAsync

func (e *BaseEnvironment) ExecuteAsync(cmd string, args []string, env map[string]string, callback func(graceful bool)) (err error)

func (*BaseEnvironment) GetBase

func (e *BaseEnvironment) GetBase() *BaseEnvironment

func (*BaseEnvironment) GetConsole

func (e *BaseEnvironment) GetConsole() (console []string, epoch int64)

func (*BaseEnvironment) GetConsoleFrom

func (e *BaseEnvironment) GetConsoleFrom(time int64) (console []string, epoch int64)

func (*BaseEnvironment) GetRootDirectory

func (e *BaseEnvironment) GetRootDirectory() string

func (*BaseEnvironment) Update

func (e *BaseEnvironment) Update() error

func (*BaseEnvironment) WaitForMainProcess

func (e *BaseEnvironment) WaitForMainProcess() (err error)

type Environment

type Environment interface {
	//Executes a command within the environment.
	Execute(cmd string, args []string, env map[string]string, callback func(graceful bool)) (stdOut []byte, err error)

	//Executes a command within the environment and immediately return
	ExecuteAsync(cmd string, args []string, env map[string]string, callback func(graceful bool)) (err error)

	//Sends a string to the StdIn of the main program process
	ExecuteInMainProcess(cmd string) (err error)

	//Kills the main process, but leaves the environment running.
	Kill() (err error)

	//Creates the environment setting needed to run programs.
	Create() (err error)

	//Deletes the environment.
	Delete() (err error)

	Update() (err error)

	IsRunning() (isRunning bool, err error)

	WaitForMainProcess() (err error)

	WaitForMainProcessFor(timeout int) (err error)

	GetRootDirectory() string

	GetConsole() (console []string, epoch int64)

	GetConsoleFrom(time int64) (console []string, epoch int64)

	AddListener(ws *websocket.Conn)

	GetStats() (*pufferd.ServerStats, error)

	DisplayToConsole(prefix bool, msg string, data ...interface{})

	SendCode(code int) error

	GetBase() *BaseEnvironment
}

type EnvironmentFactory

type EnvironmentFactory interface {
	Create(id string) Environment

	Key() string
}

type ExecutionFunction

type ExecutionFunction func(cmd string, args []string, env map[string]string, callback func(graceful bool)) (err error)

Jump to

Keyboard shortcuts

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