// SelectTarget selects the store that can pass all filters and has the minimal resource score.
SelectTarget selects the store that can pass all filters and has the minimal resource score.
// SelectTarget selects the store that can pass all filters and has the minimal resource score .
func (s *LabelSelector) SelectTarget(opt opt.Options, stores []*core.StoreInfo,filters ...Filter) *core.StoreInfo {
	filters = append(filters, s.filters...)
	var result *core.StoreInfo
	for _, store := range stores {
		if Target(opt, store, filters) {
			fmt.Printf("LabelSelector-SelectTarget: filter store %d\n", store.GetID())
			continue
		}
		if result == nil ||
			result.ResourceScore(s.kind, opt.GetHighSpaceRatio(), opt.GetLowSpaceRatio(), 0) >
				store.ResourceScore(s.kind, opt.GetHighSpaceRatio(), opt.GetLowSpaceRatio(), 0) {
			result = store
		}
	}
	return result
}
func ( s * LabelSelector ) SelectTarget ( opt opt . Options , stores [ ] * core . StoreInfo , filters ... Filter ) * core . StoreInfo { filters = append ( filters , s . filters ... ) var result * core . StoreInfo for _ , store := range stores { if Target ( opt , store , filters ) { fmt . Printf ( " \n " , store . GetID ( ) ) continue } if result == nil || result . ResourceScore ( s . kind , opt . GetHighSpaceRatio ( ) , opt . GetLowSpaceRatio ( ) , 0 ) > store . ResourceScore ( s . kind , opt . GetHighSpaceRatio ( ) , opt . GetLowSpaceRatio ( ) , 0 ) { result = store } } return result }
SelectTarget selects the store that can pass all filters and has the minimal resource score.
SelectTarget selects the store that can pass all filters and has the minimal resource score .