Documentation ¶
Index ¶
- Constants
- 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
- 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
- type DynamicDiscoveryClient
- 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
- 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
- type FunSetNodeInfo
- type IServiceDiscovery
- type NodeInfo
- type NodeInfoList
- type NodeRpcInfo
- type NodeStatus
- type OperType
- type SetupServiceFun
Constants ¶
View Source
const AddSubServiceDiscover = DynamicDiscoveryMasterName + ".RPC_AddSubServiceDiscover"
View Source
const DynamicDiscoveryClientName = "DiscoveryClient"
View Source
const DynamicDiscoveryMasterName = "DiscoveryMaster"
View Source
const RegServiceDiscover = DynamicDiscoveryMasterName + ".RPC_RegServiceDiscover"
View Source
const SubServiceDiscover = DynamicDiscoveryClientName + ".RPC_SubServiceDiscover"
Variables ¶
This section is empty.
Functions ¶
func GetRpcClient ¶
func GetRpcServer ¶
func HasService ¶
func SetConfigDir ¶
func SetConfigDir(cfgDir string)
func SetServiceDiscovery ¶
func SetServiceDiscovery(serviceDiscovery IServiceDiscovery)
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
func GetCluster ¶
func GetCluster() *Cluster
func (*Cluster) DiscardNode ¶
func (*Cluster) FetchAllNodeId ¶
func (*Cluster) FindRpcHandler ¶
func (cls *Cluster) FindRpcHandler(serviceName string) rpc.IRpcHandler
func (*Cluster) GetDiscoveryNodeList ¶
func (*Cluster) GetGlobalCfg ¶ added in v1.17.3
func (cls *Cluster) GetGlobalCfg() interface{}
func (*Cluster) GetLocalNodeInfo ¶
func (*Cluster) GetMasterDiscoveryNodeInfo ¶
func (*Cluster) GetNodeIdByService ¶
func (*Cluster) GetServiceCfg ¶
func (*Cluster) Init ¶
func (cls *Cluster) Init(localNodeId int, setupServiceFun SetupServiceFun) error
func (*Cluster) IsConfigService ¶
func (*Cluster) IsMasterDiscoveryNode ¶
func (*Cluster) IsNodeConnected ¶
func (*Cluster) ReadClusterConfig ¶
func (cls *Cluster) ReadClusterConfig(filepath string) (*NodeInfoList, error)
func (*Cluster) RegRpcEvent ¶
func (*Cluster) SetupServiceDiscovery ¶
func (cls *Cluster) SetupServiceDiscovery(localNodeId int, setupServiceFun SetupServiceFun)
func (*Cluster) UnRegRpcEvent ¶
type ConfigDiscovery ¶
type ConfigDiscovery struct {
// contains filtered or unexported fields
}
func (*ConfigDiscovery) InitDiscovery ¶
func (discovery *ConfigDiscovery) InitDiscovery(localNodeId int, funDelNode FunDelNode, funSetNodeInfo FunSetNodeInfo) error
func (*ConfigDiscovery) OnNodeStop ¶
func (discovery *ConfigDiscovery) OnNodeStop()
type DynamicDiscoveryClient ¶
func (*DynamicDiscoveryClient) InitDiscovery ¶
func (dc *DynamicDiscoveryClient) InitDiscovery(localNodeId int, funDelNode FunDelNode, funSetNodeInfo FunSetNodeInfo) error
func (*DynamicDiscoveryClient) OnInit ¶
func (dc *DynamicDiscoveryClient) OnInit() error
func (*DynamicDiscoveryClient) OnNodeConnected ¶
func (dc *DynamicDiscoveryClient) OnNodeConnected(nodeId int)
func (*DynamicDiscoveryClient) OnNodeDisconnect ¶
func (dc *DynamicDiscoveryClient) OnNodeDisconnect(nodeId int)
func (*DynamicDiscoveryClient) OnNodeStop ¶
func (dc *DynamicDiscoveryClient) OnNodeStop()
func (*DynamicDiscoveryClient) OnStart ¶
func (dc *DynamicDiscoveryClient) OnStart()
func (*DynamicDiscoveryClient) RPC_SubServiceDiscover ¶
func (dc *DynamicDiscoveryClient) RPC_SubServiceDiscover(req *rpc.SubscribeDiscoverNotify) error
订阅发现的服务通知
type DynamicDiscoveryMaster ¶
func (*DynamicDiscoveryMaster) OnInit ¶
func (ds *DynamicDiscoveryMaster) OnInit() error
func (*DynamicDiscoveryMaster) OnNodeConnected ¶
func (ds *DynamicDiscoveryMaster) OnNodeConnected(nodeId int)
func (*DynamicDiscoveryMaster) OnNodeDisconnect ¶
func (ds *DynamicDiscoveryMaster) OnNodeDisconnect(nodeId int)
func (*DynamicDiscoveryMaster) OnStart ¶
func (ds *DynamicDiscoveryMaster) OnStart()
func (*DynamicDiscoveryMaster) RPC_RegServiceDiscover ¶
func (ds *DynamicDiscoveryMaster) RPC_RegServiceDiscover(req *rpc.ServiceDiscoverReq, res *rpc.Empty) error
收到注册过来的结点
func (*DynamicDiscoveryMaster) RpcCastGo ¶
func (ds *DynamicDiscoveryMaster) RpcCastGo(serviceMethod string, args interface{})
type FunDelNode ¶
type FunSetNodeInfo ¶
type FunSetNodeInfo func(nodeInfo *NodeInfo)
type IServiceDiscovery ¶
type IServiceDiscovery interface { InitDiscovery(localNodeId int, funDelNode FunDelNode, funSetNodeInfo FunSetNodeInfo) error OnNodeStop() }
type NodeInfo ¶
type NodeInfo struct { NodeId int NodeName string Private bool ListenAddr string MaxRpcParamLen uint32 //最大Rpc参数长度 ServiceList []string //所有的服务列表 PublicServiceList []string //对外公开的服务列表 DiscoveryService []string //筛选发现的服务,如果不配置,不进行筛选 NeighborService []string // contains filtered or unexported fields }
type NodeInfoList ¶
type NodeRpcInfo ¶
type NodeRpcInfo struct {
// contains filtered or unexported fields
}
type NodeStatus ¶
type NodeStatus int
const ( Normal NodeStatus = 0 //正常 Discard NodeStatus = 1 //丢弃 )
type SetupServiceFun ¶
Click to show internal directories.
Click to hide internal directories.