Class MailRuleActionRecorder
- Namespace
- MailFathom.Application.Rules.Actions
- Assembly
- MailFathom.Application.dll
Writes down the changes one email's matching rules ask for, as the mutation records every requester uses.
public sealed class MailRuleActionRecorder
- Inheritance
-
MailRuleActionRecorder
- Inherited Members
Remarks
This is the join between a rule and a mailbox, and it is deliberately the whole of it. Nothing here issues an IMAP command: it opens a durable record per action, and the account's own convergence pass carries each record to a completed or a dead-lettered ending exactly as it carries a change somebody authored by hand. What this adds is the identity, the order, and the refusal of an action whose account or destination has stopped permitting it.
What an account permits is read here as well as when the rule set is read, and the second reading is not redundant: the two configuration sections reload independently, so narrowing what an account permits leaves a rule set nobody edited in force. Without this, a revoked permission would take effect at the next edit of the rules rather than at the next pass, which for a deletion is the wrong way round.
The records join the caller's session, so a batch's evaluations and the requests they produced commit together. A crash between them is therefore impossible in the direction that matters: an email is never recorded as evaluated while the change its rules asked for was lost, and a rolled-back batch is evaluated again and asks again under the same identity.
Where a destination is is not resolved here. The answers are handed in, already resolved, because resolving one can reach the mail server and nothing may do that while the batch's transaction is open. A rule is one author of a filing mutation among others, and the folder it files into is found the same way for all of them.
Constructors
- MailRuleActionRecorder(IMailboxMutationRecordStore, IAuthoredDeleteEmailDispositionReader, IMailRuleActionPermissionReader)
Initializes the recorder from the record it writes and the decisions it has to read.
Methods
- RecordAsync(IPersistenceSession, StoredEmailId, EmailOccurrenceId, MailRuleActionPlan, MailRuleSetRevision, MailboxDestinations, CancellationToken)
Opens one mutation record per action the plan honors, in the order the changes are applied.