cherryDiscovery

package
v1.3.14 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Name = "discovery_component"
)

Variables

This section is empty.

Functions

func Register added in v1.3.0

func Register(discovery cfacade.IDiscovery)

Types

type Component added in v1.3.0

type Component struct {
	cfacade.Component
	cfacade.IDiscovery
}

func New added in v1.3.0

func New() *Component

func (*Component) Init added in v1.3.0

func (p *Component) Init()

func (*Component) Name added in v1.3.0

func (*Component) Name() string

func (*Component) OnStop added in v1.3.0

func (p *Component) OnStop()

type DiscoveryDefault

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

DiscoveryDefault 默认方式,通过读取profile文件的节点信息

该类型发现服务仅用于开发测试使用,直接读取profile.json->node配置

func (*DiscoveryDefault) AddMember

func (n *DiscoveryDefault) AddMember(member cfacade.IMember)

func (*DiscoveryDefault) GetMember

func (n *DiscoveryDefault) GetMember(nodeId string) (cfacade.IMember, bool)

func (*DiscoveryDefault) GetType

func (n *DiscoveryDefault) GetType(nodeId string) (nodeType string, err error)

func (*DiscoveryDefault) ListByType

func (n *DiscoveryDefault) ListByType(nodeType string, filterNodeId ...string) []cfacade.IMember

func (*DiscoveryDefault) Load added in v1.3.0

func (*DiscoveryDefault) Map added in v1.3.4

func (n *DiscoveryDefault) Map() map[string]cfacade.IMember

func (*DiscoveryDefault) Name

func (n *DiscoveryDefault) Name() string

func (*DiscoveryDefault) OnAddMember

func (n *DiscoveryDefault) OnAddMember(listener cfacade.MemberListener)

func (*DiscoveryDefault) OnRemoveMember

func (n *DiscoveryDefault) OnRemoveMember(listener cfacade.MemberListener)

func (*DiscoveryDefault) PreInit added in v1.3.4

func (n *DiscoveryDefault) PreInit()

func (*DiscoveryDefault) Random added in v1.3.3

func (n *DiscoveryDefault) Random(nodeType string) (cfacade.IMember, bool)

func (*DiscoveryDefault) RemoveMember

func (n *DiscoveryDefault) RemoveMember(nodeId string)

func (*DiscoveryDefault) Stop added in v1.3.0

func (n *DiscoveryDefault) Stop()

type DiscoveryNATS added in v1.3.0

type DiscoveryNATS struct {
	DiscoveryDefault
	// contains filtered or unexported fields
}

DiscoveryNATS master节点模式(master为单节点) 先启动一个master节点 其他节点启动时Request(cherry.discovery.register),到master节点注册 master节点subscribe(cherry.discovery.register),返回已注册节点列表 master节点publish(cherry.discovery.addMember),当前已注册的节点到 所有客户端节点subscribe(cherry.discovery.addMember),接收新节点 所有节点subscribe(cherry.discovery.unregister),退出时注销节点

func (*DiscoveryNATS) Load added in v1.3.0

func (m *DiscoveryNATS) Load(app cfacade.IApplication)

func (*DiscoveryNATS) Name added in v1.3.0

func (m *DiscoveryNATS) Name() string

func (*DiscoveryNATS) Stop added in v1.3.0

func (m *DiscoveryNATS) Stop()

Jump to

Keyboard shortcuts

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