Merged in differentSwitchingMechanisms (pull request #14)

DifferentSwitchingMechanisms

Approved-by: Akash Kothawale <akothaw1@binghamton.edu>
This commit is contained in:
Pradyumna Kaushik 2018-04-17 23:44:36 +00:00
parent 1bee742588
commit 66c19b53c9
13 changed files with 172 additions and 31 deletions

View file

@ -117,9 +117,14 @@ func WithLoggingChannels(lmt chan elecLogDef.LogMessageType, msg chan string) sc
}
}
func WithSchedPolSwitchEnabled(enableSchedPolicySwitch bool) schedulerOptions {
func WithSchedPolSwitchEnabled(enableSchedPolicySwitch bool, switchingCriteria string) schedulerOptions {
return func(s ElectronScheduler) error {
s.(*BaseScheduler).schedPolSwitchEnabled = enableSchedPolicySwitch
// Checking if valid switching criteria.
if _, ok := switchBasedOn[switchingCriteria]; !ok {
return errors.New("Invalid scheduling policy switching criteria.")
}
s.(*BaseScheduler).schedPolSwitchCriteria = switchingCriteria
return nil
}
}