2015-08-13 17:05:54 +00:00
|
|
|
package scheduler
|
|
|
|
|
2015-08-13 17:13:11 +00:00
|
|
|
// Context is used to track contextual information used for placement
|
|
|
|
type Context interface {
|
2015-08-13 18:33:58 +00:00
|
|
|
// State is used to inspect the current global state
|
|
|
|
State() State
|
2015-08-13 17:13:11 +00:00
|
|
|
}
|
|
|
|
|
2015-08-13 17:05:54 +00:00
|
|
|
// EvalContext is a Context used during an Evaluation
|
|
|
|
type EvalContext struct {
|
2015-08-13 18:33:58 +00:00
|
|
|
state State
|
2015-08-13 17:05:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewEvalContext constructs a new EvalContext
|
2015-08-13 18:33:58 +00:00
|
|
|
func NewEvalContext(s State) *EvalContext {
|
2015-08-13 17:05:54 +00:00
|
|
|
ctx := &EvalContext{}
|
|
|
|
return ctx
|
|
|
|
}
|
2015-08-13 18:33:58 +00:00
|
|
|
|
|
|
|
func (e *EvalContext) State() State {
|
|
|
|
return e.state
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EvalContext) SetState(s State) {
|
|
|
|
e.state = s
|
|
|
|
}
|