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

Method RemoveCluster

store/store.go:253–272  ·  view source on GitHub ↗
(ctx context.Context, ns, cluster string)

Source from the content-addressed store, hash-verified

251}
252
253func (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
274func (s *ClusterStore) CheckNewNodes(ctx context.Context, nodes []string) error {
275 newNodes := make(map[string]bool, 0)

Callers 1

TestClusterStoreFunction · 0.95

Calls 5

getLockMethod · 0.95
existsClusterMethod · 0.95
EmitEventMethod · 0.95
buildClusterKeyFunction · 0.85
DeleteMethod · 0.65

Tested by 1

TestClusterStoreFunction · 0.76