service

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServicePort = fmt.Errorf("service port <= 0")
)

Functions

This section is empty.

Types

type Check

type Check interface {
	Exec(reg *api.AgentServiceRegistration)
}

type CheckHttp

type CheckHttp struct {
}

type CheckWithNoServer

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

func (*CheckWithNoServer) Exec

type HealthImpl

type HealthImpl struct{}

HealthImpl 健康检查实现

func (*HealthImpl) Check

Check 实现健康检查接口,这里直接返回健康状态,这里也可以有更复杂的健康检查策略,比如根据服务器负载来返回

type Options

type Options struct {
	Name         string
	Host         string
	Port         int
	ConsulConfig *api.Config
	Check        Check
	RunType      RunType
}

func NewOptions

func NewOptions() *Options

func (*Options) CheckWithNoServer

func (o *Options) CheckWithNoServer()

type RunType

type RunType int
const (
	RunTypeNormal RunType = iota
	RunTypeSingle
)

type Service

type Service struct {
	Id string
	// contains filtered or unexported fields
}

func NewService

func NewService(options *Options) (s *Service, err error)

func (*Service) Close

func (s *Service) Close() error

Jump to

Keyboard shortcuts

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