pub trait Scheduler:
DynClone
+ Send
+ Sync {
// Required method
fn filter_matches(
&mut self,
ctx: &SchedulerContext<'_>,
rule: &str,
ruleset: &str,
matches: &mut Matches,
) -> bool;
// Provided method
fn can_stop(
&mut self,
ctx: &SchedulerContext<'_>,
rules: &[&str],
ruleset: &str,
) -> bool { ... }
}Expand description
A scheduler decides which matches to be applied for a rule.
The matches that are not chosen in this iteration will be delayed to the next iteration.
Required Methods§
Sourcefn filter_matches(
&mut self,
ctx: &SchedulerContext<'_>,
rule: &str,
ruleset: &str,
matches: &mut Matches,
) -> bool
fn filter_matches( &mut self, ctx: &SchedulerContext<'_>, rule: &str, ruleset: &str, matches: &mut Matches, ) -> bool
Filter the matches for a rule.
Chosen matches are applied (actions run, database flushed) before the
next rule’s filter_matches is called, so ctx.num_nodes() reflects
earlier decisions. Queries are still collected together before any
callback.
Return true if the scheduler’s next run of the rule should feed
filter_matches with a new iteration of matches.
Provided Methods§
Sourcefn can_stop(
&mut self,
ctx: &SchedulerContext<'_>,
rules: &[&str],
ruleset: &str,
) -> bool
fn can_stop( &mut self, ctx: &SchedulerContext<'_>, rules: &[&str], ruleset: &str, ) -> bool
Whether or not the rules can be considered as saturated once no database changes were made in the current iteration.
This is only called when the runner is otherwise saturated.
Default implementation just returns true.