code: func (m *Potassium) SelectMemoryNodes(nodesInfo []types.NodeInfo, quota float64, memory int64) ([]types.NodeInfo, int, error) {
  	log.Debugf("[SelectMemoryNodes] nodesInfo: %v, cpu: %f, memory: %d", nodesInfo, quota, memory)
  	if memory <= 0 {
  		return nil, 0, types.ErrNegativeMemory
  	}
  
  	nodesInfoLength := len(nodesInfo)
  
  	// 筛选出能满足 CPU 需求的
  	sort.Slice(nodesInfo, func(i, j int) bool { return len(nodesInfo[i].CPUMap) < len(nodesInfo[j].CPUMap) })
  	p := sort.Search(nodesInfoLength, func(i int) bool { return float64(len(nodesInfo[i].CPUMap)) >= quota })
  	// p 最大也就是 nodesInfoLength - 1
  	if p == nodesInfoLength {
  		return nil, 0, types.ErrInsufficientCPU
  	}
  	nodesInfoLength -= p
  	nodesInfo = nodesInfo[p:]
  
  	// 计算是否有足够的内存满足需求
  	sort.Slice(nodesInfo, func(i, j int) bool { return nodesInfo[i].MemCap < nodesInfo[j].MemCap })
  	p = sort.Search(nodesInfoLength, func(i int) bool { return nodesInfo[i].MemCap >= memory })
  	if p == nodesInfoLength {
  		return nil, 0, types.ErrInsufficientMEM
  	}
  	nodesInfoLength -= p
  	nodesInfo = nodesInfo[p:]
  
  	// 这里 memCap 一定是大于 memory 的所以不用判断 cap 内容
  	volTotal := 0
  	for i, nodeInfo := range nodesInfo {
  		capacity := int(nodeInfo.MemCap / memory)
  		volTotal += capacity
  		nodesInfo[i].Capacity = capacity
  	}
  	return nodesInfo, volTotal, nil
  }
docs: // SelectMemoryNodes filter nodes with enough memory