service

package
v2.7.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const PluginName string = "service"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Services map[string]Service `mapstructure:"service"`
}

Config for the services

func (*Config) InitDefault

func (c *Config) InitDefault()

type Env

type Env map[string]string

Env variables type alias

type Plugin

type Plugin struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*Plugin) Init

func (service *Plugin) Init(cfg config.Configurer, log *zap.Logger) error

func (*Plugin) Name

func (service *Plugin) Name() string

Name contains service name.

func (*Plugin) Serve

func (service *Plugin) Serve() chan error

func (*Plugin) Stop

func (service *Plugin) Stop() error

func (*Plugin) Workers

func (service *Plugin) Workers() []process.State

type Process

type Process struct {
	sync.Mutex

	Pid int

	ExecTimeout     time.Duration
	RemainAfterExit bool
	RestartSec      uint64
	// contains filtered or unexported fields
}

Process structure contains an information about process, restart information, log, errors, etc

func NewServiceProcess

func NewServiceProcess(restartAfterExit bool, execTimeout time.Duration, restartDelay uint64, command string, env Env, l *zap.Logger, errCh chan error) *Process

NewServiceProcess constructs service process structure

func (*Process) Write

func (p *Process) Write(b []byte) (int, error)

write message to the log (stderr)

type Service

type Service struct {
	Command         string        `mapstructure:"command"`
	Output          string        `mapstructure:"log_output"`
	ProcessNum      int           `mapstructure:"process_num"`
	ExecTimeout     time.Duration `mapstructure:"exec_timeout"`
	RemainAfterExit bool          `mapstructure:"remain_after_exit"`
	RestartSec      uint64        `mapstructure:"restart_sec"`
	Env             Env           `mapstructure:"env"`
}

Service represents particular service configuration

Jump to

Keyboard shortcuts

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