Documentation ¶
Index ¶
- func GetRpcClient(nodeId int, serviceMethod string, clientList []*rpc.Client) (error, int)
- func GetRpcServer() *rpc.Server
- func SetConfigDir(cfgDir string)
- func SetServiceDiscovery(serviceDiscovery IServiceDiscovery)
- type Cluster
- func (cls *Cluster) FindRpcHandler(serviceName string) rpc.IRpcHandler
- func (cls *Cluster) GetNodeIdByService(serviceName string, rpcClientList []*rpc.Client) (error, int)
- func (cls *Cluster) GetRpcClient(nodeId int) *rpc.Client
- func (cls *Cluster) GetServiceCfg(serviceName string) interface{}
- func (cls *Cluster) Init(localNodeId int) error
- func (cls *Cluster) InitCfg(localNodeId int) error
- func (cls *Cluster) IsConfigService(serviceName string) bool
- func (cls *Cluster) IsNodeConnected(nodeId int) bool
- func (cls *Cluster) ReadClusterConfig(filepath string) (*NodeInfoList, error)
- func (cls *Cluster) Start()
- func (cls *Cluster) Stop()
- type ConfigDiscovery
- type FunDelNode
- type FunSetNodeInfo
- type IServiceDiscovery
- type NodeInfo
- type NodeInfoList
- type NodeRpcInfo
- type OperType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRpcClient ¶
func GetRpcServer ¶
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) FindRpcHandler ¶
func (cls *Cluster) FindRpcHandler(serviceName string) rpc.IRpcHandler
func (*Cluster) GetNodeIdByService ¶
func (*Cluster) GetServiceCfg ¶
func (*Cluster) IsConfigService ¶
func (*Cluster) IsNodeConnected ¶
func (*Cluster) ReadClusterConfig ¶
func (cls *Cluster) ReadClusterConfig(filepath string) (*NodeInfoList, error)
type ConfigDiscovery ¶
type ConfigDiscovery struct {
// contains filtered or unexported fields
}
func (*ConfigDiscovery) Init ¶
func (discovery *ConfigDiscovery) Init(localNodeId int) error
func (*ConfigDiscovery) OnNodeStop ¶
func (discovery *ConfigDiscovery) OnNodeStop()
func (*ConfigDiscovery) RegFunDelNode ¶
func (discovery *ConfigDiscovery) RegFunDelNode(funDelNode FunDelNode)
func (*ConfigDiscovery) RegFunSetNode ¶
func (discovery *ConfigDiscovery) RegFunSetNode(funSetNodeInfo FunSetNodeInfo)
type FunDelNode ¶
type FunDelNode func(nodeId int)
type FunSetNodeInfo ¶
type FunSetNodeInfo func(nodeInfo *NodeInfo)
type IServiceDiscovery ¶
type IServiceDiscovery interface { Init(localNodeId int) error OnNodeStop() RegFunDelNode(funDelNode FunDelNode) RegFunSetNode(funSetNodeInfo FunSetNodeInfo) }
type NodeInfoList ¶
type NodeInfoList struct {
NodeList []NodeInfo
}
type NodeRpcInfo ¶
type NodeRpcInfo struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.