service

package module
v4.7.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 17 Imported by: 2

README

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 Configurer

type Configurer interface {
	// UnmarshalKey takes a single key and unmarshal it into a Struct.
	UnmarshalKey(name string, out any) error
	// Has checks if config section exists.
	Has(name string) bool
}

type Env

type Env map[string]string

Env variables type alias

type Logger

type Logger interface {
	NamedLogger(name string) *zap.Logger
}

type Plugin

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

func (*Plugin) Init

func (p *Plugin) Init(cfg Configurer, log Logger) error

func (*Plugin) Name

func (p *Plugin) Name() string

Name contains service name.

func (*Plugin) RPC

func (p *Plugin) RPC() any

func (*Plugin) Reset

func (p *Plugin) Reset() error

func (*Plugin) Serve

func (p *Plugin) Serve() chan error

func (*Plugin) Stop

func (p *Plugin) Stop(context.Context) error

func (*Plugin) Weight added in v4.1.8

func (p *Plugin) Weight() uint

func (*Plugin) Workers

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

type Process

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

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

func NewServiceProcess

func NewServiceProcess(service *Service, name string, l *zap.Logger) *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"`
	UseServiceName  bool          `mapstructure:"service_name_in_log"`
	ProcessNum      int           `mapstructure:"process_num"`
	ExecTimeout     time.Duration `mapstructure:"exec_timeout"`
	RemainAfterExit bool          `mapstructure:"remain_after_exit"`
	RestartSec      uint64        `mapstructure:"restart_sec"`
	TimeoutStopSec  uint64        `mapstructure:"timeout_stop_sec"`
	Env             Env           `mapstructure:"env"`
	User            string        `mapstructure:"user"`
}

Service represents particular service configuration

Jump to

Keyboard shortcuts

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