config

package
v0.0.0-...-dcf77fd Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyUpdates

func ApplyUpdates(txn *memdb.Txn, m *model.Root) error

func ExpandEnv

func ExpandEnv(m *model.Root) error

Types

type AutoStartMode

type AutoStartMode int
const (
	AutoStartModeDefault AutoStartMode = iota
	AutoStartModeAlways
	AutoStartModeNever
)

type Config

type Config struct {
	Environment  *Environment
	ProgramGroup *ProcessGroup
	// contains filtered or unexported fields
}

Config memory representations of supervisor configuration file

func NewConfig

func NewConfig() *Config

NewConfig create Config object

func (*Config) GetGrpcServer

func (c *Config) GetGrpcServer() *Server

func (*Config) GetHttpServer

func (c *Config) GetHttpServer() *Server

func (*Config) GetProcess

func (c *Config) GetProcess(name string) *Process

func (*Config) LoadPath

func (c *Config) LoadPath(configFile string) (memdb.Changes, error)

Load loads the configuration and return the loaded programs

func (*Config) LoadString

func (c *Config) LoadString(s string) (memdb.Changes, error)

func (*Config) ProcessNames

func (c *Config) ProcessNames() []string

func (*Config) Processes

func (c *Config) Processes() Processes

type Environment

type Environment struct {
	Path      string
	KeyValues env.KeyValues
}

type File

type File struct {
	Root    string
	Name    string
	Path    string
	Content string
}

type FileSystemWriter

type FileSystemWriter struct {
	RootDir string
	Files   []*File
	// contains filtered or unexported fields
}

func NewFileSystemWriter

func NewFileSystemWriter(fs afero.Fs, opts ...OptionFn) *FileSystemWriter

func (*FileSystemWriter) Commit

func (v *FileSystemWriter) Commit(root string, files []*File) (string, []*LocalFile, error)

type Group

type Group struct {
	Name     string
	Programs []string
}

type LocalFile

type LocalFile struct {
	Name     string
	FullPath string
	Hash     []byte
}

type OptionFn

type OptionFn func(v *FileSystemWriter)

func WithHasher

func WithHasher(h hash.Hash) OptionFn

type Process

type Process struct {
	Group                    string
	Name                     string
	Directory                string
	Command                  string
	Environment              map[string]string
	User                     string
	ExitCodes                []int
	Priority                 int
	RestartPause             time.Duration
	StartRetries             int
	StartSeconds             time.Duration
	Cron                     string
	AutoStart                bool
	AutoRestart              AutoStartMode
	RestartDirectoryMonitor  string
	RestartFilePattern       string
	RestartWhenBinaryChanged bool
	StopSignals              []string
	StopWaitSeconds          time.Duration
	StopAsGroup              bool
	KillAsGroup              bool
	StdoutLogFile            string
	StdoutLogfileBackups     int
	StdoutLogFileMaxBytes    int
	RedirectStderr           bool
	StderrLogFile            string
	StderrLogfileBackups     int
	StderrLogFileMaxBytes    int
	DependsOn                []string
	Labels                   map[string]string
}

func (*Process) CronSchedule

func (p *Process) CronSchedule() cron.Schedule

type ProcessByPriority

type ProcessByPriority []*Process

func (ProcessByPriority) Len

func (p ProcessByPriority) Len() int

func (ProcessByPriority) Less

func (p ProcessByPriority) Less(i, j int) bool

func (ProcessByPriority) Swap

func (p ProcessByPriority) Swap(i, j int)

type ProcessGroup

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

ProcessGroup manage the program and its group mapping

func NewProcessGroup

func NewProcessGroup() *ProcessGroup

NewProcessGroup create a ProcessGroup object

func (*ProcessGroup) Add

func (pg *ProcessGroup) Add(group, procName string)

Add add a process to a group

func (*ProcessGroup) Clone

func (pg *ProcessGroup) Clone() *ProcessGroup

Clone clone the process group

func (*ProcessGroup) ForEachProcess

func (pg *ProcessGroup) ForEachProcess(procFunc func(group, procName string))

ForEachProcess iterate all the processes and process it with procFunc

func (*ProcessGroup) GetAllGroup

func (pg *ProcessGroup) GetAllGroup() []string

GetAllGroup get all the groups

func (*ProcessGroup) GetAllProcess

func (pg *ProcessGroup) GetAllProcess(group string) []string

GetAllProcess get all the processes in a group

func (*ProcessGroup) GetGroup

func (pg *ProcessGroup) GetGroup(procName, defGroup string) string

GetGroup get the group name of process. If fail to find the group by procName, set its group to defGroup and return this defGroup

func (*ProcessGroup) InGroup

func (pg *ProcessGroup) InGroup(procName, group string) bool

InGroup check if a process belongs to a group or not

func (*ProcessGroup) Remove

func (pg *ProcessGroup) Remove(procName string)

Remove remove a process

func (*ProcessGroup) String

func (pg *ProcessGroup) String() string

String convert the process and its group mapping to human readable string

func (*ProcessGroup) Sub

func (pg *ProcessGroup) Sub(other *ProcessGroup) (added, changed, removed []string)

Sub remove all the programs in other ProcessGroup from this ProcessGroup

type ProcessSorter

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

ProcessSorter sort the program by its priority

func NewProcessSorter

func NewProcessSorter() *ProcessSorter

NewProcessSorter create a sorter

func (*ProcessSorter) Sort

func (p *ProcessSorter) Sort(processes []*Process) []*Process

Sort the processes and return the result

type Processes

type Processes []*Process

func (Processes) GetNames

func (p Processes) GetNames() []string

func (Processes) Names

func (p Processes) Names() []string

func (Processes) Sorted

func (p Processes) Sorted() Processes

type Server

type Server struct {
	Name     string
	Address  string
	Username string
	Password string
}

Jump to

Keyboard shortcuts

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