MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / RemoveNode

Method RemoveNode

db/sg_replicate_cfg.go:983–994  ·  view source on GitHub ↗

RemoveNode removes a node from the cluster config, then triggers replication rebalance. Retries on CAS failure, is no-op if node doesn't exist in config

(nodeUUID string)

Source from the content-addressed store, hash-verified

981// RemoveNode removes a node from the cluster config, then triggers replication rebalance.
982// Retries on CAS failure, is no-op if node doesn't exist in config
983func (m *sgReplicateManager) RemoveNode(nodeUUID string) error {
984 removeNodeCallback := func(cluster *SGRCluster) (cancel bool, err error) {
985 _, exists := cluster.Nodes[nodeUUID]
986 if !exists {
987 return true, nil
988 }
989 delete(cluster.Nodes, nodeUUID)
990 cluster.RebalanceReplications()
991 return false, nil
992 }
993 return m.updateCluster(removeNodeCallback)
994}
995
996func (m *sgReplicateManager) getNodes() (nodes map[string]*SGNode, err error) {
997 sgrCluster, _, err := m.loadSGRCluster()

Callers 4

StopMethod · 0.95

Calls 2

updateClusterMethod · 0.95
RebalanceReplicationsMethod · 0.80