// RegionScoreComparer creates a StoreComparer to sort store by region
// score.
RegionScoreComparer creates a StoreComparer to sort store by region
score.
// RegionScoreComparer creates a StoreComparer to sort store by region // score .
func RegionScoreComparer(opt *config.PersistOptions) StoreComparer {
	return func(a, b *core.StoreInfo) int {
		sa := a.RegionScore(opt.GetRegionScoreFormulaVersion(), opt.GetHighSpaceRatio(), opt.GetLowSpaceRatio(), 0)
		sb := b.RegionScore(opt.GetRegionScoreFormulaVersion(), opt.GetHighSpaceRatio(), opt.GetLowSpaceRatio(), 0)
		switch {
		case sa > sb:
			return 1
		case sa < sb:
			return -1
		default:
			return 0
		}
	}
}
func RegionScoreComparer ( opt * config . PersistOptions ) StoreComparer { return func ( a , b * core . StoreInfo ) int { sa := a . RegionScore ( opt . GetRegionScoreFormulaVersion ( ) , opt . GetHighSpaceRatio ( ) , opt . GetLowSpaceRatio ( ) , 0 ) sb := b . RegionScore ( opt . GetRegionScoreFormulaVersion ( ) , opt . GetHighSpaceRatio ( ) , opt . GetLowSpaceRatio ( ) , 0 ) switch { case sa > sb : return 1 case sa < sb : return - 1 default : return 0 } } }
RegionScoreComparer creates a StoreComparer to sort store by region
score.
RegionScoreComparer creates a StoreComparer to sort store by region score .