discovery

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 6 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 检查目标技能是否符合

Types

type Attrs

type Attrs = eocontext.Attrs

Attrs 属性集合

type IApp

type IApp interface {
	IAttributes
	ID() string
	Nodes() []INode
	Reset(nodes Nodes)
	NodeError(id string) error
	Close() error
}

IApp app接口

func NewApp

func NewApp(checker IHealthChecker, container IAppContainer, attrs Attrs, nodes Nodes) IApp

NewApp 创建服务发现app

type IAppContainer

type IAppContainer interface {
	Remove(id string) error
}

IAppContainer app容器接口

type IAttributes

type IAttributes = eocontext.IAttributes

IAttributes 属性接口

type IDiscovery

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

IDiscovery 服务发现接口

type IHealthChecker

type IHealthChecker interface {
	AddToCheck(node INode) error
	Stop() error
}

IHealthChecker 健康检查接口

type IHealthCheckerFactory

type IHealthCheckerFactory interface {
	IHealthChecker
	Agent() (IHealthChecker, error)
	Reset(conf interface{}) error
}

IHealthCheckerFactory 健康检查工厂类接口

type INode

type INode = eocontext.INode

INode 节点接口

func NewNode

func NewNode(labels map[string]string, id string, ip string, port int) INode

NewNode 创建新节点

type INodesData

type INodesData interface {
	Get(name string) (map[string]INode, bool)
	Set(name string, nodes map[string]INode)
	Del(name string) (map[string]INode, bool)
}

func NewNodesData

func NewNodesData() INodesData

type IServices

type IServices interface {
	Set(serviceName string, id string, app IApp) error
	Remove(id string) (string, int)
	Update(serviceName string, nodes Nodes) error
	AppKeys() []string
}

IServices 服务app集合接口

func NewServices

func NewServices() IServices

NewServices 创建服务发现的服务app集合

type NodeStatus

type NodeStatus = eocontext.NodeStatus

NodeStatus 节点状态类型

type Nodes

type Nodes map[string]INode

type NodesData

type NodesData struct {
	eosc.Untyped[string, map[string]INode]
}

Jump to

Keyboard shortcuts

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