// FilterSource implements the Filter.
FilterSource implements the Filter.
// FilterSource implements the Filter .
func (f *usageFilter) Source(opt opt.Options, store *core.StoreInfo) bool {
	cpuUsage := store.GetCpuUsage()
	memAvailable := store.GetMemAvailable()
	for key, value := range f.usageCondition {
		switch {
			case key == "maxCpuUsage" :
				if cpuUsage > value.(float64) {
					return true
				}
			case key == "minMemAvailable" :
				if memAvailable < value.(uint64) {
					return true
				}
		}
	}
	return false
}
func ( f * usageFilter ) Source ( opt opt . Options , store * core . StoreInfo ) bool { cpuUsage := store . GetCpuUsage ( ) memAvailable := store . GetMemAvailable ( ) for key , value := range f . usageCondition { switch { case key == " " : if cpuUsage > value . ( float64 ) { return true } case key == " " : if memAvailable < value . ( uint64 ) { return true } } } return false }
FilterSource implements the Filter.
FilterSource implements the Filter .
//fmt.Printf("store: %d - cpuUsage: %.1f - memAvailable: %d\n", store.GetID(), cpuUsage, memAvailable) //fmt.Printf("usageCondition - cpuUsage: %.1f\n", value.(float64)) //fmt.Printf("[usage filter] filt source - store %d\n", store.GetID()) //fmt.Printf("usageCondition - memAvailable: %d\n", value.(uint64)) //fmt.Printf("[usage filter] filt source - store %d\n", store.GetID()) //fmt.Printf("[usage filter] pass source - store %d\n", store.GetID())