service

package
v2.1.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2021 License: MIT Imports: 11 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 Plugin

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

func (*Plugin) Init

func (service *Plugin) Init(cfg config.Configurer, log logger.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, l logger.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"`
	ProcessNum      int           `mapstructure:"process_num"`
	ExecTimeout     time.Duration `mapstructure:"exec_timeout"`
	RemainAfterExit bool          `mapstructure:"remain_after_exit"`
	RestartSec      uint64        `mapstructure:"restart_sec"`
}

Service represents particular service configuration

Jump to

Keyboard shortcuts

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