supervisor

package
v14.10.5 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// GITALY_SUPERVISOR_CRASH_THRESHOLD
	CrashThreshold int `split_words:"true" default:"5"`
	// GITALY_SUPERVISOR_CRASH_WAIT_TIME
	CrashWaitTime time.Duration `split_words:"true" default:"1m"`
	// GITALY_SUPERVISOR_CRASH_RESET_TIME
	CrashResetTime time.Duration `split_words:"true" default:"1m"`
}

Config holds configuration for the circuit breaker of the respawn loop.

func NewConfigFromEnv

func NewConfigFromEnv() (Config, error)

NewConfigFromEnv returns Config initialised from environment variables or an error.

type Event

type Event struct {
	Type  EventType
	Pid   int
	Error error
}

Event is used to notify a listener of process state changes.

type EventType

type EventType int

EventType is used to label Event instances.

const (
	// Up is a notification that the process with the accompanying PID is up.
	Up EventType = iota
	// Crash is a notification that the process has either failed to spawn or crashed.
	// In case creating the process failed, the PID will be set to `-1`.
	Crash
	// MemoryHigh is a notification that process memory for the current PID
	// exceeds the threshold.
	MemoryHigh
	// MemoryLow indicates the process memory is at or below the threshold.
	MemoryLow
	// HealthOK indicates the that the health check function returned a 'nil' error
	HealthOK
	// HealthBad indicates the that the health check function returned an error
	HealthBad
)

type Process

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

Process represents a running process.

func New

func New(config Config, name string, env []string, args []string, dir string, memoryThreshold int, events chan<- Event, healthCheck func() error) (*Process, error)

New creates a new process instance.

func (*Process) Stop

func (p *Process) Stop()

Stop terminates the process.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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