cluster

package
v0.0.0-...-ff803ae Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRpcClient

func GetRpcClient(nodeId int, serviceMethod string, clientList []*rpc.Client) (error, int)

func GetRpcServer

func GetRpcServer() *rpc.Server

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 (cls *Cluster) GetNodeIdByService(serviceName string, rpcClientList []*rpc.Client) (error, int)

func (*Cluster) GetRpcClient

func (cls *Cluster) GetRpcClient(nodeId int) *rpc.Client

func (*Cluster) GetServiceCfg

func (cls *Cluster) GetServiceCfg(serviceName string) interface{}

func (*Cluster) Init

func (cls *Cluster) Init(localNodeId int) error

func (*Cluster) InitCfg

func (cls *Cluster) InitCfg(localNodeId int) error

func (*Cluster) IsConfigService

func (cls *Cluster) IsConfigService(serviceName string) bool

func (*Cluster) IsNodeConnected

func (cls *Cluster) IsNodeConnected(nodeId int) bool

func (*Cluster) ReadClusterConfig

func (cls *Cluster) ReadClusterConfig(filepath string) (*NodeInfoList, error)

func (*Cluster) Start

func (cls *Cluster) Start()

func (*Cluster) Stop

func (cls *Cluster) Stop()

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 NodeInfo

type NodeInfo struct {
	NodeId      int
	NodeName    string
	Private     bool
	ListenAddr  string
	ServiceList []string
}

type NodeInfoList

type NodeInfoList struct {
	NodeList []NodeInfo
}

type NodeRpcInfo

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

type OperType

type OperType int

Jump to

Keyboard shortcuts

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