func (c *crush) removePeer(peerId uint64, metadata map[string]string) {
	dc := metadata[serfMDKeyDataCenter]
	rack := metadata[serfMDKeyRack]

	m1, ok := c.allDataCenters.Load(dc)
	if !ok {
		return
	}

	dcMap := m1.(*sync.Map)
	m2, ok := dcMap.Load(rack)
	if !ok {
		return
	}

	rackMap := m2.(*sync.Map)
	rackMap.Delete(peerId)

	if isSyncMapEmpty(rackMap) {
		dcMap.Delete(rack)
	}

	if isSyncMapEmpty(dcMap) {
		c.allDataCenters.Delete(dc)
	}
}
// this is called by the gossip component repeatedly but never concurrently
this is called by the gossip component repeatedly but never concurrently
// this is called by the gossip component repeatedly but never concurrently
func (c *crush) removePeer(peerId uint64, metadata map[string]string) {
	dc := metadata[serfMDKeyDataCenter]
	rack := metadata[serfMDKeyRack]
	m1, ok := c.allDataCenters.Load(dc)
	if !ok {
		return
	}
	dcMap := m1.(*sync.Map)
	m2, ok := dcMap.Load(rack)
	if !ok {
		return
	}
	rackMap := m2.(*sync.Map)
	rackMap.Delete(peerId)
	if isSyncMapEmpty(rackMap) {
		dcMap.Delete(rack)
	}
	if isSyncMapEmpty(dcMap) {
		c.allDataCenters.Delete(dc)
	}
}
func ( c * crush ) removePeer ( peerId uint64 , metadata map [ string ] string ) { dc := metadata [ serfMDKeyDataCenter ] rack := metadata [ serfMDKeyRack ] m1 , ok := c . allDataCenters . Load ( dc ) if ! ok { return } dcMap := m1 . ( * sync . Map ) m2 , ok := dcMap . Load ( rack ) if ! ok { return } rackMap := m2 . ( * sync . Map ) rackMap . Delete ( peerId ) if isSyncMapEmpty ( rackMap ) { dcMap . Delete ( rack ) } if isSyncMapEmpty ( dcMap ) { c . allDataCenters . Delete ( dc ) } }
this is called by the gossip component repeatedly but never concurrently
this is called by the gossip component repeatedly but never concurrently