Documentation
¶
Index ¶
- func NewLoggerStream(logger LogInterface, prefix string) io.WriteCloser
- func ParseEnvironmentFile(fileName string) (map[string]string, error)
- func ParseEnvironmentStream(stream io.Reader) map[string]string
- type EventHandler
- type Executable
- type Instance
- type LogInterface
- type Pool
- func (p *Pool) Add(sv Supervisor)
- func (p *Pool) Done() <-chan struct{}
- func (p *Pool) Instances() []Instance
- func (p *Pool) OnFinished(ctx context.Context, sv Instance)
- func (p *Pool) OnSpawned(ctx context.Context, sv Instance)
- func (p *Pool) OnStarted(ctx context.Context, sv Instance)
- func (p *Pool) OnStopped(ctx context.Context, sv Instance, err error)
- func (p *Pool) Start(ctx context.Context, sv Supervisor) Instance
- func (p *Pool) StartAll(ctx context.Context)
- func (p *Pool) Stop(in Instance)
- func (p *Pool) StopAll()
- func (p *Pool) Supervisors() []Supervisor
- func (p *Pool) Terminate()
- func (p *Pool) Watch(handler EventHandler)
- type Supervisor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLoggerStream ¶
func NewLoggerStream(logger LogInterface, prefix string) io.WriteCloser
func ParseEnvironmentFile ¶ added in v0.1.14
Types ¶
type EventHandler ¶
type Executable ¶
type Executable struct {
Name string `yaml:"label,omitempty"` // Human-readable label for process. If not set - command used
Command string `yaml:"command"` // Executable
Args []string `yaml:"args,omitempty"` // Arguments to command
Environment map[string]string `yaml:"environment,omitempty"` // Additional environment variables
EnvFiles []string `yaml:"envFiles"` // Additional environment variables from files (not found files ignored). Format key=value
WorkDir string `yaml:"workdir,omitempty"` // Working directory. If not set - current dir used
StopTimeout time.Duration `yaml:"stop_timeout,omitempty"` // Timeout before terminate process
RestartTimeout time.Duration `yaml:"restart_delay,omitempty"` // Restart delay
Restart int `yaml:"restart,omitempty"` // How much restart allowed. -1 infinite
LogFile string `yaml:"logFile,omitempty"` // if empty - only to log. If not absolute - relative to workdir
RawOutput bool `yaml:"raw,omitempty"` // print stdout as-is without prefixes
// contains filtered or unexported fields
}
Executable - basic information about process.
func (*Executable) Arg ¶
func (b *Executable) Arg(arg string) *Executable
Arg adds additional positional argument
func (*Executable) Config ¶
func (exe *Executable) Config() *Executable
func (*Executable) Env ¶
func (b *Executable) Env(arg, value string) *Executable
Env adds additional environment key-value pair
func (*Executable) WithName ¶
func (b *Executable) WithName(name string) *Executable
type Instance ¶
type Instance interface {
Stop()
Config() *Executable
Supervisor() Supervisor
Pool() *Pool
}
type LogInterface ¶
type LogInterface interface {
Println(v ...interface{})
}
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func (*Pool) Add ¶
func (p *Pool) Add(sv Supervisor)
func (*Pool) Supervisors ¶
func (p *Pool) Supervisors() []Supervisor
func (*Pool) Watch ¶
func (p *Pool) Watch(handler EventHandler)
type Supervisor ¶
type Supervisor interface {
Start(ctx context.Context, pool *Pool) Instance
Config() *Executable
}
Click to show internal directories.
Click to hide internal directories.