discovery

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//Running 节点运行中状态
	Running = eocontext.Running
	//Down 节点不可用状态
	Down = eocontext.Down
	//Leave 节点离开状态
	Leave = eocontext.Leave
)

Variables

View Source
var (
	ErrDiscoveryDown = errors.New("discovery down")
)

Functions

func CheckSkill

func CheckSkill(skill string) bool

CheckSkill 检查目标技能是否符合

func NewNode

func NewNode(INode INode, label Attrs) eocontext.INode

Types

type Attrs

type Attrs = eocontext.Attrs

Attrs 属性集合

type IApp

type IApp interface {
	Nodes() []eocontext.INode
	Close()
}

type IAppAgent added in v0.12.5

type IAppAgent interface {
	Agent() IApp
	// contains filtered or unexported methods
}

type IAppContainer

type IAppContainer interface {
	INodes
	Set(id string, info []NodeInfo) (app IAppAgent)
	Reset(info map[string][]NodeInfo)
	GetApp(id string) (IAppAgent, bool)
	Keys() []string
}

func NewAppContainer added in v0.12.5

func NewAppContainer() IAppContainer

type IDiscovery

type IDiscovery interface {
	GetApp(config string) (IApp, error)
}

IDiscovery 服务发现接口

type IHealthChecker

type IHealthChecker interface {
	Check(nodes INodes)
	Reset(conf interface{}) error
	Stop()
}

IHealthChecker 健康检查接口

type INode

type INode interface {
	IP() string
	ID() string
	Addr() string
	Port() int
	Status() NodeStatus
	Last() time.Time
	Up()
	Down()
	Leave()
}

type INodes added in v0.12.5

type INodes interface {
	Get(ip string, port int) INode
	All() []INode
	SetHealthCheck(isHealthCheck bool)
}

type Node added in v0.12.5

type Node struct {
	INode
	// contains filtered or unexported fields
}

func (*Node) GetAttrByName added in v0.12.5

func (n *Node) GetAttrByName(name string) (string, bool)

func (*Node) GetAttrs added in v0.12.5

func (n *Node) GetAttrs() eocontext.Attrs

type NodeInfo added in v0.12.5

type NodeInfo struct {
	Ip     string
	Port   int
	Labels map[string]string
}

type NodeStatus

type NodeStatus = eocontext.NodeStatus

NodeStatus 节点状态类型

Jump to

Keyboard shortcuts

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