supervisor

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2021 License: AGPL-3.0 Imports: 10 Imported by: 1

Documentation

Overview

Package supervisor provides a generic API to watch and manage Unix processes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitFor

func WaitFor(process *Process, state State)

WaitFor blocks until the FSM transitions to the given state.

Types

type Process

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

Process represents a unix process to be supervised.

func NewProcess

func NewProcess(executable string, dir string, args []string) (*Process, error)

NewProcess returns a new process to be supervised.

func (*Process) Restart

func (p *Process) Restart()

Restart will cause a running process to restart.

func (*Process) Start

func (p *Process) Start()

Start will run the process.

func (*Process) Status

func (p *Process) Status() State

Status returns the current state of the FSM.

func (*Process) Stop

func (p *Process) Stop()

Stop will cause the process to stop.

type State

type State uint

State is a FSM state.

const (
	UNKNOWN State = iota
	RUNNING
	STOPPED
	STARTING
	STOPPING
	FAILED
	EXITED
)

States

func (State) String

func (s State) String() string

type Supervisable

type Supervisable interface {
	Start()
	Stop()
	Restart()
	Status() State
}

Supervisable is an interface that represents a process.

Jump to

Keyboard shortcuts

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