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

Method CheckClusterMode

store/cluster_node.go:165–174  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

163}
164
165func (n *ClusterNode) CheckClusterMode(ctx context.Context) (int64, error) {
166 clusterInfo, err := n.GetClusterInfo(ctx)
167 if err != nil {
168 if strings.Contains(err.Error(), "cluster is not initialized") {
169 return -1, nil
170 }
171 return -1, fmt.Errorf("error while checking node cluster mode: %w", err)
172 }
173 return clusterInfo.CurrentEpoch, nil
174}
175
176func (n *ClusterNode) GetClusterInfo(ctx context.Context) (*ClusterInfo, error) {
177 infoStr, err := n.GetClient().ClusterInfo(ctx).Result()

Callers 1

TestClusterNodeFunction · 0.95

Calls 4

GetClusterInfoMethod · 0.95
ErrorMethod · 0.80
ErrorfMethod · 0.80
ContainsMethod · 0.45

Tested by 1

TestClusterNodeFunction · 0.76