Documentation ¶
Index ¶
- Constants
- func Register(discovery cfacade.IDiscovery)
- type Component
- type DiscoveryDefault
- func (n *DiscoveryDefault) AddMember(member cfacade.IMember)
- func (n *DiscoveryDefault) GetMember(nodeId string) (cfacade.IMember, bool)
- func (n *DiscoveryDefault) GetType(nodeId string) (nodeType string, err error)
- func (n *DiscoveryDefault) ListByType(nodeType string, filterNodeId ...string) []cfacade.IMember
- func (n *DiscoveryDefault) Load(_ cfacade.IApplication)
- func (n *DiscoveryDefault) Map() map[string]cfacade.IMember
- func (n *DiscoveryDefault) Name() string
- func (n *DiscoveryDefault) OnAddMember(listener cfacade.MemberListener)
- func (n *DiscoveryDefault) OnRemoveMember(listener cfacade.MemberListener)
- func (n *DiscoveryDefault) PreInit()
- func (n *DiscoveryDefault) Random(nodeType string) (cfacade.IMember, bool)
- func (n *DiscoveryDefault) RemoveMember(nodeId string)
- func (n *DiscoveryDefault) Stop()
- type DiscoveryNATS
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 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 (n *DiscoveryDefault) Load(_ cfacade.IApplication)
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()
Click to show internal directories.
Click to hide internal directories.