Safe HaskellSafe-Infered



Filtering of jobs for the Ganeti job queue.



evaluateFilterComparator :: Ord field => Filter field -> (Comparator -> field -> FilterValue -> Maybe Bool) -> BoolSource



:: QueuedJob 
-> JobId

the watermark to compare against if the predicate references it

-> FilterPredicate 
-> Bool 

Whether a FilterPredicate is true for a job.

matches :: QueuedJob -> FilterRule -> BoolSource

Whether all predicates of the filter rule are true for the job.

applyingFilter :: Set FilterRule -> QueuedJob -> Maybe FilterRuleSource

Finds the first filter whose predicates all match the job and whose action is not Continue. This is the applying filter.

jobFiltering :: Queue -> Set FilterRule -> [JobWithStat] -> [JobWithStat]Source

Implements job filtering as specified in `doc/design-optables.rst`.

Importantly, the filter that *applies* is the first one of which all predicates match; this is implemented in applyingFilter.

The initial FilterChainState is currently not cached across selectJobsToRun invocations because the number of running jobs is typically small (< 100).