Documentation ¶
Index ¶
- type Config
- func (c *Config) GetConfigFileDir() string
- func (c *Config) GetEntries(filterFunc func(entry *Entry) bool) []*Entry
- func (c *Config) GetEventListeners() []*Entry
- func (c *Config) GetGroups() []*Entry
- func (c *Config) GetInetHTTPServer() (*Entry, bool)
- func (c *Config) GetProgram(name string) *Entry
- func (c *Config) GetProgramNames() []string
- func (c *Config) GetPrograms() []*Entry
- func (c *Config) GetSupervisorctl() (*Entry, bool)
- func (c *Config) GetSupervisord() (*Entry, bool)
- func (c *Config) GetUnixHTTPServer() (*Entry, bool)
- func (c *Config) Load() ([]string, error)
- func (c *Config) RemoveProgram(programName string)
- func (c *Config) String() string
- type Entry
- func (c *Entry) GetBool(key string, defValue bool) bool
- func (c *Entry) GetBytes(key string, defValue int) int
- func (c *Entry) GetEnv(key string) []string
- func (c *Entry) GetEnvFromFiles(key string) []string
- func (c *Entry) GetEventListenerName() string
- func (c *Entry) GetGroupName() string
- func (c *Entry) GetInt(key string, defValue int) int
- func (c *Entry) GetProgramName() string
- func (c *Entry) GetPrograms() []string
- func (c *Entry) GetString(key string, defValue string) string
- func (c *Entry) GetStringArray(key string, sep string) []string
- func (c *Entry) GetStringExpression(key string, defValue string) string
- func (c *Entry) HasParameter(key string) bool
- func (c *Entry) IsEventListener() bool
- func (c *Entry) IsGroup() bool
- func (c *Entry) IsProgram() bool
- func (c *Entry) String() string
- type ProcessGroup
- func (pg *ProcessGroup) Add(group string, procName string)
- func (pg *ProcessGroup) Clone() *ProcessGroup
- func (pg *ProcessGroup) ForEachProcess(procFunc func(group string, procName string))
- func (pg *ProcessGroup) GetAllGroup() []string
- func (pg *ProcessGroup) GetAllProcess(group string) []string
- func (pg *ProcessGroup) GetGroup(procName string, defGroup string) string
- func (pg *ProcessGroup) InGroup(procName string, group string) bool
- func (pg *ProcessGroup) Remove(procName string)
- func (pg *ProcessGroup) String() string
- func (pg *ProcessGroup) Sub(other *ProcessGroup) (added []string, changed []string, removed []string)
- type ProcessSorter
- type ProgramByPriority
- type StringExpression
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ProgramGroup *ProcessGroup // contains filtered or unexported fields }
Config memory representation of supervisor configuration file
func (*Config) GetConfigFileDir ¶
GetConfigFileDir returns directory of supervisord configuration file
func (*Config) GetEntries ¶
GetEntries returns configuration entries by filter
func (*Config) GetEventListeners ¶
GetEventListeners returns configuration entries of event listeners
func (*Config) GetInetHTTPServer ¶
GetInetHTTPServer returns inet_http_server configuration section
func (*Config) GetProgram ¶
GetProgram returns the program configuration entry or nil
func (*Config) GetProgramNames ¶
GetProgramNames returns slice with all program names
func (*Config) GetPrograms ¶
GetPrograms returns configuration entries of all programs
func (*Config) GetSupervisorctl ¶
GetSupervisorctl returns "supervisorctl" configuration section
func (*Config) GetSupervisord ¶
GetSupervisord returns "supervisord" configuration section
func (*Config) GetUnixHTTPServer ¶
GetUnixHTTPServer returns unix_http_server configuration section
func (*Config) RemoveProgram ¶
RemoveProgram removes program entry by its name
type Entry ¶
type Entry struct { ConfigDir string Group string Name string // contains filtered or unexported fields }
Entry standards for a configuration section in supervisor configuration file
func (*Entry) GetBytes ¶
GetBytes returns value of the key as bytes setting.
logSize=1MB logSize=1GB logSize=1KB logSize=1024
func (*Entry) GetEnv ¶
GetEnv returns slice of strings with keys separated from values by single "=". An environment string example:
environment = A="env 1",B="this is a test"
func (*Entry) GetEnvFromFiles ¶
GetEnvFromFiles returns slice of strings with keys separated from values by single "=". An envFile example:
envFiles = global.env,prod.env
cat global.env varA=valueA
func (*Entry) GetEventListenerName ¶
GetEventListenerName returns event listener name
func (*Entry) GetGroupName ¶
GetGroupName returns group name if entry is a group
func (*Entry) GetProgramName ¶
GetProgramName returns program name
func (*Entry) GetPrograms ¶
GetPrograms returns slice with programs from the group
func (*Entry) GetStringArray ¶
GetStringArray gets string value and split it with "sep" to slice
func (*Entry) GetStringExpression ¶
GetStringExpression returns value of key as a string and attempts to parse it with StringExpression
func (*Entry) HasParameter ¶
HasParameter checks if key (parameter) has value
func (*Entry) IsEventListener ¶
IsEventListener returns true if this section is for event listener
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 string, procName string)
Add adds process to a group
func (*ProcessGroup) Clone ¶
func (pg *ProcessGroup) Clone() *ProcessGroup
Clone clones process group
func (*ProcessGroup) ForEachProcess ¶
func (pg *ProcessGroup) ForEachProcess(procFunc func(group string, procName string))
ForEachProcess iterates all the processes and process it with procFunc
func (*ProcessGroup) GetAllGroup ¶
func (pg *ProcessGroup) GetAllGroup() []string
GetAllGroup gets all the process groups
func (*ProcessGroup) GetAllProcess ¶
func (pg *ProcessGroup) GetAllProcess(group string) []string
GetAllProcess gets all the processes in a group
func (*ProcessGroup) GetGroup ¶
func (pg *ProcessGroup) GetGroup(procName string, defGroup string) string
GetGroup gets group name of process. If group was not found by procName, set its group to defGroup and return this defGroup
func (*ProcessGroup) InGroup ¶
func (pg *ProcessGroup) InGroup(procName string, group string) bool
InGroup checks if process belongs to a group or not
func (*ProcessGroup) Remove ¶
func (pg *ProcessGroup) Remove(procName string)
Remove removes a process from a group
func (*ProcessGroup) String ¶
func (pg *ProcessGroup) String() string
String converts process and its group mapping to human-readable string
func (*ProcessGroup) Sub ¶
func (pg *ProcessGroup) Sub(other *ProcessGroup) (added []string, changed []string, removed []string)
Sub removes all the programs listed in other ProcessGroup from this ProcessGroup
type ProcessSorter ¶
type ProcessSorter struct {
// contains filtered or unexported fields
}
ProcessSorter sort the program by its priority
func (*ProcessSorter) SortProgram ¶
func (p *ProcessSorter) SortProgram(programConfigs []*Entry) []*Entry
SortProgram sort the program and return the result
type ProgramByPriority ¶
type ProgramByPriority []*Entry
ProgramByPriority sort program by its priority
func (ProgramByPriority) Less ¶
func (p ProgramByPriority) Less(i, j int) bool
Less returns true if the priority i-th program is less than the priority of j-th program
func (ProgramByPriority) Swap ¶
func (p ProgramByPriority) Swap(i, j int)
Swap swaps program i and program j
type StringExpression ¶
type StringExpression struct {
// contains filtered or unexported fields
}
StringExpression replace the python String like "%(var)s" to string
func NewStringExpression ¶
func NewStringExpression(envs ...string) *StringExpression
NewStringExpression create a new StringExpression with the environment variables
func (*StringExpression) Add ¶
func (se *StringExpression) Add(key string, value string) *StringExpression
Add adds environment variable (key,value)