Documentation ¶
Overview ¶
Package scheduler contains all the logic for periodic execution of tables, including construction of a dependency graph, prioritization, etc.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Condition ¶
type Condition struct { Months Months `json:"months"` Weekdays Weekdays `json:"weekdays"` Days Days `json:"days"` Hours Hours `json:"hours"` }
A Condition is a list of various time attributes such as months, weekdays, days or month, etc. This can be expanded in the future.
func (*Condition) MarshalJSON ¶
func (*Condition) Satisfied ¶
For each of the time attributes specified in the condition, at least one must match the passed-in time value. E.g. given an argument which is Monday, 9am Condition [Monday,Tuesday], [9am, 10am] : satisfied Condition [Tuesday,Wednesday], [9am] : not satisfied
func (*Condition) UnmarshalJSON ¶
type Graph ¶
type Graph map[string]*node
A graph. Implemented as a map of nodes, keyed by string representing the name of this node. A node maintains maps of its parents and children, as well as has an integer Score which represents the "importance" of this node based on how many dependents it has.
func (Graph) ReadyItems ¶
Return a slice of items which have no parents, meaning these items are not waiting on the parents to finish executing and are ready to run.
func (Graph) Relate ¶
Add a parent-child pair to the graph. A nil parent means this child has no parent.
func (Graph) RemoveItem ¶
Remove a node given its name.
type Run ¶
A Run is a collection of tasks which is to be selectively executed. The run has a notion of "now" which is when it presumably is started.
func (*Run) SelectTasks ¶
func (r *Run) SelectTasks(tasks []Schedulable) []Schedulable
Given a list of tasks, return those whose Condition is satisfied by this Run's "Now".
type Schedulable ¶
type Schedulable interface {
Conditions() []*Condition
}
Schedulable describes something that can return a list of Conditions.