Versions in this module Expand all Collapse all v1 v1.17.5 May 22, 2022 Changes in this version + const AddSubServiceDiscover + const DynamicDiscoveryClientName + const DynamicDiscoveryMasterName + const RegServiceDiscover + const SubServiceDiscover + func GetRpcClient(nodeId int, serviceMethod string, clientList []*rpc.Client) (error, int) + func GetRpcServer() *rpc.Server + func HasService(nodeId int, serviceName string) bool + func SetConfigDir(cfgDir string) + func SetServiceDiscovery(serviceDiscovery IServiceDiscovery) + type Cluster struct + func GetCluster() *Cluster + func (cls *Cluster) DelNode(nodeId int, immediately bool) + func (cls *Cluster) DiscardNode(nodeId int) + func (cls *Cluster) FetchAllNodeId(fetchFun func(nodeId int)) + func (cls *Cluster) FindRpcHandler(serviceName string) rpc.IRpcHandler + func (cls *Cluster) GetDiscoveryNodeList() []NodeInfo + func (cls *Cluster) GetGlobalCfg() interface{} + func (cls *Cluster) GetLocalNodeInfo() *NodeInfo + func (cls *Cluster) GetMasterDiscoveryNodeInfo(nodeId int) *NodeInfo + func (cls *Cluster) GetNodeIdByService(serviceName string, rpcClientList []*rpc.Client, bAll bool) (error, int) + func (cls *Cluster) GetRpcClient(nodeId int) *rpc.Client + func (cls *Cluster) GetServiceCfg(serviceName string) interface{} + func (cls *Cluster) Init(localNodeId int, setupServiceFun SetupServiceFun) error + func (cls *Cluster) InitCfg(localNodeId int) error + func (cls *Cluster) IsConfigService(serviceName string) bool + func (cls *Cluster) IsMasterDiscoveryNode() bool + func (cls *Cluster) IsNodeConnected(nodeId int) bool + func (cls *Cluster) ReadClusterConfig(filepath string) (*NodeInfoList, error) + func (cls *Cluster) RegRpcEvent(serviceName string) + func (cls *Cluster) SetupServiceDiscovery(localNodeId int, setupServiceFun SetupServiceFun) + func (cls *Cluster) Start() + func (cls *Cluster) Stop() + func (cls *Cluster) UnRegRpcEvent(serviceName string) + type ConfigDiscovery struct + func (discovery *ConfigDiscovery) InitDiscovery(localNodeId int, funDelNode FunDelNode, funSetNodeInfo FunSetNodeInfo) error + func (discovery *ConfigDiscovery) OnNodeStop() + type DynamicDiscoveryClient struct + func (dc *DynamicDiscoveryClient) InitDiscovery(localNodeId int, funDelNode FunDelNode, funSetNodeInfo FunSetNodeInfo) error + func (dc *DynamicDiscoveryClient) OnInit() error + func (dc *DynamicDiscoveryClient) OnNodeConnected(nodeId int) + func (dc *DynamicDiscoveryClient) OnNodeDisconnect(nodeId int) + func (dc *DynamicDiscoveryClient) OnNodeStop() + func (dc *DynamicDiscoveryClient) OnStart() + func (dc *DynamicDiscoveryClient) RPC_SubServiceDiscover(req *rpc.SubscribeDiscoverNotify) error + type DynamicDiscoveryMaster struct + func (ds *DynamicDiscoveryMaster) OnInit() error + func (ds *DynamicDiscoveryMaster) OnNodeConnected(nodeId int) + func (ds *DynamicDiscoveryMaster) OnNodeDisconnect(nodeId int) + func (ds *DynamicDiscoveryMaster) OnStart() + func (ds *DynamicDiscoveryMaster) RPC_RegServiceDiscover(req *rpc.ServiceDiscoverReq, res *rpc.Empty) error + func (ds *DynamicDiscoveryMaster) RpcCastGo(serviceMethod string, args interface{}) + type FunDelNode func(nodeId int, immediately bool) + type FunSetNodeInfo func(nodeInfo *NodeInfo) + type IServiceDiscovery interface + InitDiscovery func(localNodeId int, funDelNode FunDelNode, funSetNodeInfo FunSetNodeInfo) error + OnNodeStop func() + type NodeInfo struct + DiscoveryService []string + ListenAddr string + MaxRpcParamLen uint32 + NeighborService []string + NodeId int + NodeName string + Private bool + PublicServiceList []string + ServiceList []string + type NodeInfoList struct + MasterDiscoveryNode []NodeInfo + NodeList []NodeInfo + type NodeRpcInfo struct + type NodeStatus int + const Discard + const Normal + type OperType int + type SetupServiceFun func(s ...service.IService)