| 251 | } |
| 252 | |
| 253 | func (s *ClusterStore) RemoveCluster(ctx context.Context, ns, cluster string) error { |
| 254 | lock := s.getLock(ns, cluster) |
| 255 | lock.Lock() |
| 256 | defer lock.Unlock() |
| 257 | |
| 258 | if exists, _ := s.existsCluster(ctx, ns, cluster); !exists { |
| 259 | return consts.ErrNotFound |
| 260 | } |
| 261 | if err := s.e.Delete(ctx, buildClusterKey(ns, cluster)); err != nil { |
| 262 | return err |
| 263 | } |
| 264 | |
| 265 | s.EmitEvent(EventPayload{ |
| 266 | Namespace: ns, |
| 267 | Cluster: cluster, |
| 268 | Type: EventCluster, |
| 269 | Command: CommandRemove, |
| 270 | }) |
| 271 | return nil |
| 272 | } |
| 273 | |
| 274 | func (s *ClusterStore) CheckNewNodes(ctx context.Context, nodes []string) error { |
| 275 | newNodes := make(map[string]bool, 0) |