Documentation ¶
Index ¶
- Constants
- type Cluster
- func (c *Cluster) AddExecutor(execInfo *core.ExecutorInfo) *core.Result
- func (c *Cluster) AddNodeInfo(nodeInfo *core.NodeInfo) *core.Result
- func (c *Cluster) ClusterInfo() *core.ClusterInfo
- func (c *Cluster) ElectionLeader(leaderServer string) error
- func (c *Cluster) FindExecutor(taskId string) (*core.ExecutorInfo, bool)
- func (c *Cluster) FindNode(endPoint string) (*core.NodeInfo, bool)
- func (c *Cluster) GetLeaderInfo() (string, error)
- func (c *Cluster) GetLeaderRpcClient() *client.RpcClient
- func (c *Cluster) GetLowBalanceWorker() (*core.NodeInfo, error)
- func (c *Cluster) GetRpcClient(endPoint string) *client.RpcClient
- func (c *Cluster) QueryNodeResource(endPoint string) (*core.ResourceInfo, *core.Result)
- func (c *Cluster) RemoveRpcClient(endPoint string)
- func (c *Cluster) Start() error
- func (c *Cluster) Stop() error
- type NodeOfflineHandle
- type WatchChangeHandle
- type WatchFailedHandle
Constants ¶
const (
MinQueryResourceInterval = 60
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster struct { ClusterId string Registry *registry.Registry LeaderKey string LeaderServer string Nodes map[string]*core.NodeInfo ExecutorInfos map[string]*core.ExecutorInfo Scheduler scheduler.Scheduler OnNodesChange WatchChangeHandle OnNodeOffline NodeOfflineHandle OnLeaderChange WatchChangeHandle OnLeaderChangeFailed WatchFailedHandle // contains filtered or unexported fields }
func NewCluster ¶
NewCluster new cluster and reg server
func (*Cluster) AddExecutor ¶
func (c *Cluster) AddExecutor(execInfo *core.ExecutorInfo) *core.Result
AddExecutor add executor info into executor list
func (*Cluster) AddNodeInfo ¶
AddNodeInfo add node into node list it will query remote resource
func (*Cluster) ClusterInfo ¶
func (c *Cluster) ClusterInfo() *core.ClusterInfo
ClusterInfo return ClusterInfo
func (*Cluster) ElectionLeader ¶
electionLeader election leader role to registry server
func (*Cluster) FindExecutor ¶
func (c *Cluster) FindExecutor(taskId string) (*core.ExecutorInfo, bool)
FindExecutor find executor info by task id
func (*Cluster) GetLeaderInfo ¶
GetLeaderInfo get leader info from leader key must check is locked by leader session leader changed by watchLeaderChange
func (*Cluster) GetLeaderRpcClient ¶
GetLeaderRpcClient get leader rpc client
func (*Cluster) GetLowBalanceWorker ¶
GetLowBalanceWorker get lower balance worker, if not match, it will try 3 times
func (*Cluster) GetRpcClient ¶
GetRpcClient get rpc client with endpoint
func (*Cluster) QueryNodeResource ¶
QueryNodeResource query node resource by endpoint
func (*Cluster) RemoveRpcClient ¶
RemoveRpcClient remove rpc client with endpoint
type NodeOfflineHandle ¶
type WatchChangeHandle ¶
type WatchChangeHandle func()
type WatchFailedHandle ¶
type WatchFailedHandle func()