func (insInf *InstancesInfo) UseScheduler(zone string) (inss []*Instance) {
	var scheduler struct {
		zone    []string
		weights []int64
	}
	var oriWeights []int64
	for _, sch := range insInf.Scheduler {
		if sch.Src == zone {
			for zone, schWeight := range sch.Dst {
				if zins, ok := insInf.Instances[zone]; ok {
					var totalWeight int64
					for _, ins := range zins {
						var weight int64
						if weight, _ = strconv.ParseInt(ins.Metadata[MetaWeight], 10, 64); weight <= 0 {
							weight = 10
						}
						totalWeight += weight
					}
					oriWeights = append(oriWeights, totalWeight)
					inss = append(inss, zins...)
				}
				scheduler.weights = append(scheduler.weights, schWeight)
				scheduler.zone = append(scheduler.zone, zone)
			}
		}
	}
	if len(inss) == 0 {
		var ok bool
		if inss, ok = insInf.Instances[zone]; ok {
			return
		}
		for _, v := range insInf.Instances {
			inss = append(inss, v...)
		}
		return
	}
	var comMulti int64 = 1
	for _, weight := range oriWeights {
		comMulti *= weight
	}
	var fixWeight = make(map[string]int64, len(scheduler.weights))
	for i, zone := range scheduler.zone {
		fixWeight[zone] = scheduler.weights[i] * comMulti / oriWeights[i]
	}
	for _, ins := range inss {
		var weight int64
		if weight, _ = strconv.ParseInt(ins.Metadata[MetaWeight], 10, 64); weight <= 0 {
			weight = 10
		}
		if fix, ok := fixWeight[ins.Zone]; ok {
			weight = weight * fix
		}
		ins.Metadata[MetaWeight] = strconv.FormatInt(weight, 10)
	}
	return
}
UseScheduler use scheduler info on instances.
if instancesInfo contains scheduler info about zone,
return releated zone's instances weighted by scheduler.
if not,only zone instances be returned.
package naming
import (
	"context"
	"strconv"
)
const (
	MetaWeight  = "weight"
	MetaCluster = "cluster"
	MetaZone    = "zone"
	MetaColor   = "color"
)
type Instance struct {
	Region string `json:"region"`
	Zone string `json:"zone"`
	Env string `json:"env"`
	AppID string `json:"appid"`
	Hostname string `json:"hostname"`
	Addrs []string `json:"addrs"`
	Version string `json:"version"`
	LastTs int64 `json:"latest_timestamp"`
	Metadata map[string]string `json:"metadata"`
}
type Resolver interface {
	Fetch() (*InstancesInfo, bool)
	Watch() <-chan struct{}
	Close() error
}
type Registry interface {
	Register(ins *Instance) (cancel context.CancelFunc, err error)
	Close() error
}
type Builder interface {
	Build(id string) Resolver
	Scheme() string
}
type InstancesInfo struct {
	Instances map[string][]*Instance `json:"instances"`
	LastTs    int64                  `json:"latest_timestamp"`
	Scheduler []Zone                 `json:"scheduler"`
}
type Zone struct {
	Src string           `json:"src"`
	Dst map[string]int64 `json:"dst"`
}