MCPcopy Create free account
hub / github.com/apache/kvrocks-controller / addCluster

Method addCluster

controller/controller.go:184–198  ·  view source on GitHub ↗
(namespace, clusterName string)

Source from the content-addressed store, hash-verified

182}
183
184func (c *Controller) addCluster(namespace, clusterName string) {
185 key := c.buildClusterKey(namespace, clusterName)
186 if cluster, err := c.getCluster(namespace, clusterName); err == nil && cluster != nil {
187 return
188 }
189
190 cluster := NewClusterChecker(c.clusterStore, namespace, clusterName).
191 WithPingInterval(time.Duration(c.config.FailOver.PingIntervalSeconds) * time.Second).
192 WithMaxFailureCount(c.config.FailOver.MaxPingCount)
193 cluster.Start()
194
195 c.mu.Lock()
196 c.clusters[key] = cluster
197 c.mu.Unlock()
198}
199
200func (c *Controller) getCluster(namespace, clusterName string) (*ClusterChecker, error) {
201 key := c.buildClusterKey(namespace, clusterName)

Callers 2

resumeMethod · 0.95
leaderEventLoopMethod · 0.95

Calls 6

buildClusterKeyMethod · 0.95
getClusterMethod · 0.95
NewClusterCheckerFunction · 0.85
WithMaxFailureCountMethod · 0.80
WithPingIntervalMethod · 0.80
StartMethod · 0.45

Tested by

no test coverage detected