| 163 | } |
| 164 | |
| 165 | func (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 | |
| 176 | func (n *ClusterNode) GetClusterInfo(ctx context.Context) (*ClusterInfo, error) { |
| 177 | infoStr, err := n.GetClient().ClusterInfo(ctx).Result() |