Class MailRuleConditionBounds
- Namespace
- MailFathom.Application.Rules.Conditions
- Assembly
- MailFathom.Application.dll
States what a condition may cost: how long it may be, how deeply it may nest, and how long it may run.
public sealed record MailRuleConditionBounds : IEquatable<MailRuleConditionBounds>
- Inheritance
-
MailRuleConditionBounds
- Implements
- Inherited Members
Remarks
The condition language has no cost model of its own, so the bound is assembled here out of three things that can be checked. Two of them are checked when the configuration is read, where a refusal reaches the person who typed the condition; the third is checked while it runs, because fact resolution reaches storage and no reading of the text says how long that will take.
A length and a depth limit together are what keep the parsed shape bounded. Length alone would admit a short expression nested past what any reader can follow, and depth alone would admit a flat expression of ten thousand terms.
Properties
- Default
Gets the bounds a deployment that declares none of them runs under.
- EvaluationTimeout
Gets how long one condition may take to evaluate, including resolving the facts it names.
- MaxLength
Gets the greatest number of characters a condition may be written in.
- MaxNestingDepth
Gets the greatest depth the parsed condition may nest to, counting the whole expression as one level.
Methods
- Create(int, int, TimeSpan)
Creates bounds, refusing any value that would leave a condition unbounded or unwritable.