server

package
v0.0.0-...-d71130a Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewUnixListener

func NewUnixListener(v *viper.Viper) (*net.UnixListener, error)

Open and return a listening unix socket.

func Run

func Run(v *viper.Viper, l *net.UnixListener)

Run the server's accept loop, waiting for connections from l. Correct shutdown procedure is: set slots to a number such that no new processes will run wait for all running processes to finish set shittingDown to true close the listening socket

Types

type Request

type Request struct {
	Type   RequestType
	HasFds bool
	// List of Fds to be transferred by SendRequest
	Fds []int
	// Filled in on receiving side - list of fd numbers corresponding to
	// the original FD numbers above
	ReceivedFds []int
	Run         *RequestRun
	Config      *RequestConfig
}

type RequestConfig

type RequestConfig struct {
	// nil indicates lack of presence
	Parallel *int
}

type RequestRun

type RequestRun struct {
	// Full path to the binary
	Exe  string
	Args []string
	Env  []string
	Cwd  string
}

type RequestType

type RequestType int
const (
	REQUEST_RUN RequestType = iota
	REQUEST_WAIT
	REQUEST_GETPID
	REQUEST_KILL
	REQUEST_SHUTDOWN
	REQUEST_CONFIG
)

type Response

type Response struct {
	Type    ResponseType
	Message string
	Getpid  *ResponseGetpid
	Wait    *ResponseWait
}

type ResponseGetpid

type ResponseGetpid struct {
	Pid int
}

type ResponseType

type ResponseType int

The server's response. If OK or ERR, message will contain useful text.

const (
	RESPONSE_ERR ResponseType = iota
	RESPONSE_OK
	RESPONSE_GETPID
	RESPONSE_WAIT
)

type ResponseWait

type ResponseWait struct {
	ExitStatus int
}

Jump to

Keyboard shortcuts

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