Class MailRuleSetEvaluator
- Namespace
- MailFathom.Application.Rules
- Assembly
- MailFathom.Application.dll
Runs a rule set over one email in declared order, bounding each condition and classifying every failure.
public sealed class MailRuleSetEvaluator
- Inheritance
-
MailRuleSetEvaluator
- Inherited Members
Remarks
What the matching rules ask the mailbox for is composed here as well, because composing it needs the matched rules in declared order and this is the only place that order and those rules are held together. A rule that failed asked for nothing, since it did not match.
A rule scoped to accounts this email does not belong to is passed over rather than evaluated, and leaves no evaluation behind: it did not decline to match, it was not one of this account's rules. That also means it cannot end the pass, whatever it declares, so narrowing a stopping rule to one account is a statement about that account alone. A rule the walk's reach does not hold is passed over on exactly the same terms, so the history stays a record of decisions rather than of rules that were never asked.
The one place totality is applied. The expression evaluator underneath raises failures rather than returning them, so every way a condition can fail to answer is caught here and recorded as a rule that failed with a reason. A rule that failed did not match, so the pass carries on to the rules below it: a single unlucky email must not stop a rule set that works from being applied.
The timeout is applied per rule rather than per pass, because it exists to bound one condition rather than to bound how much work an email is worth. It reaches the fact resolution as well as the expression, which is what makes it the enforceable half of the cost bound: the shape of an expression is already limited when the configuration is read, and what nothing can read from the text is how long a stored-content read will take.
Constructors
- MailRuleSetEvaluator(TimeProvider)
Initializes the evaluator.
Methods
- EvaluateAsync(MailRuleSet, MailRuleFacts, MailRuleReach, CancellationToken)
Evaluates every rule of the set against one email until a matching rule ends the pass.