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

	m1, ok := c.allDataCenters.Load(dc)
	if !ok {
		newMap := &sync.Map{}
		m1, _ = c.allDataCenters.LoadOrStore(dc, newMap)
	}

	dcMap := m1.(*sync.Map)
	m2, ok := dcMap.Load(rack)
	if !ok {
		newMap := &sync.Map{}
		m2, _ = dcMap.LoadOrStore(rack, newMap)
	}

	rackMap := m2.(*sync.Map)
	rackMap.Store(peerId, true)
}
// 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) updatePeer(peerId uint64, metadata map[string]string) {
	dc := metadata[serfMDKeyDataCenter]
	rack := metadata[serfMDKeyRack]
	m1, ok := c.allDataCenters.Load(dc)
	if !ok {
		newMap := &sync.Map{}
		m1, _ = c.allDataCenters.LoadOrStore(dc, newMap)
	}
	dcMap := m1.(*sync.Map)
	m2, ok := dcMap.Load(rack)
	if !ok {
		newMap := &sync.Map{}
		m2, _ = dcMap.LoadOrStore(rack, newMap)
	}
	rackMap := m2.(*sync.Map)
	rackMap.Store(peerId, true)
}
func ( c * crush ) updatePeer ( peerId uint64 , metadata map [ string ] string ) { dc := metadata [ serfMDKeyDataCenter ] rack := metadata [ serfMDKeyRack ] m1 , ok := c . allDataCenters . Load ( dc ) if ! ok { newMap := & sync . Map { } m1 , _ = c . allDataCenters . LoadOrStore ( dc , newMap ) } dcMap := m1 . ( * sync . Map ) m2 , ok := dcMap . Load ( rack ) if ! ok { newMap := & sync . Map { } m2 , _ = dcMap . LoadOrStore ( rack , newMap ) } rackMap := m2 . ( * sync . Map ) rackMap . Store ( peerId , true ) }
this is called by the gossip component repeatedly but never concurrently
this is called by the gossip component repeatedly but never concurrently