service

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Stat_Unknow    string = "unknow"    //健康
	Stat_healthy   string = "healthy"   //健康
	Stat_unhealthy string = "unhealthy" //出现异常
	Stat_death     string = "death"     //请求不通
)

Variables

This section is empty.

Functions

func WriteServicesWithFile

func WriteServicesWithFile(serviceLists ...*Services) error

WriteServicesWithFile write services config file

Types

type Endpoint

type Endpoint struct {
	Name     string `yaml:"name"`
	Protocol string `yaml:"protocol"`
	Port     string `yaml:"port"`
}

Endpoint endpoint

type Health

type Health struct {
	Name         string `yaml:"name"`
	Model        string `yaml:"model"`
	Address      string `yaml:"address"`
	TimeInterval int    `yaml:"time_interval"`
	MaxErrorsNum int    `yaml:"max_errors_num"`
}

Health ServiceHealth

type HealthStatus

type HealthStatus struct {
	Name           string
	Status         string
	ErrorNumber    int
	ErrorDuration  time.Duration
	StartErrorTime time.Time
	Info           string
}

HealthStatus health status

type Service

type Service struct {
	Name            string      `yaml:"name"`
	Endpoints       []*Endpoint `yaml:"endpoints,omitempty"`
	ServiceHealth   *Health     `yaml:"health"`
	OnlyHealthCheck bool        `yaml:"only_health_check"`
	IsInitStart     bool        `yaml:"is_init_start"`
	Disable         bool        `yaml:"disable"`
	After           []string    `yaml:"after"`
	Requires        []string    `yaml:"requires"`
	Type            string      `yaml:"type,omitempty"`
	PreStart        string      `yaml:"pre_start,omitempty"`
	Start           string      `yaml:"start"`
	Stop            string      `yaml:"stop,omitempty"`
	RestartPolicy   string      `yaml:"restart_policy,omitempty"`
	RestartSec      string      `yaml:"restart_sec,omitempty"`
}

Service Service

func LoadServicesFromLocal

func LoadServicesFromLocal(serviceListFile string) []*Service

LoadServicesFromLocal load all service config from config file

func (*Service) Equal

func (s *Service) Equal(e *Service) bool

Equal equal

type Services

type Services struct {
	Version  string     `yaml:"version"`
	Services []*Service `yaml:"services"`
	FromFile string     `yaml:"-"`
}

Services default config of all services

func LoadServicesWithFileFromLocal

func LoadServicesWithFileFromLocal(serviceListFile string) []*Services

LoadServicesWithFileFromLocal load service with file

Jump to

Keyboard shortcuts

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