code: func (m *BaseShardManager) UpdateShardStates(shardStates []ShardState) {
  	newAddrs := set.NewSet()
  	for _, state := range shardStates {
  		newAddrs.Add(state.Address)
  	}
  
  	m.rwMutex.Lock()
  	defer m.rwMutex.Unlock()
  
  	oldAddrs := set.NewSet()
  	for _, state := range m.shardStates {
  		oldAddrs.Add(state.Address)
  	}
  
  	for address := range set.Subtract(newAddrs, oldAddrs).Iter() {
  		if err := m.pool.Register("tcp", address.(string)); err != nil {
  			m.logError(err)
  		}
  	}
  
  	for address := range set.Subtract(oldAddrs, newAddrs).Iter() {
  		if err := m.pool.Unregister("tcp", address.(string)); err != nil {
  			m.logError(err)
  		}
  	}
  
  	m.shardStates = shardStates
  }
docs: // This updates the shard manager to use new shard states.