Table of Contents

Class MailFlagChangeRecorder

Namespace
MailFathom.Application.Mail.Mutations.Authoring
Assembly
MailFathom.Application.dll

Writes down the flag and keyword changes a caller asks for, as the mutation records every requester uses.

public sealed class MailFlagChangeRecorder
Inheritance
MailFlagChangeRecorder
Inherited Members

Remarks

This is the join between a caller and a mailbox, and it is deliberately the whole of it. Nothing here issues an IMAP command or holds a type that could: the account's own convergence pass carries each record to a completed or a dead-lettered ending exactly as it carries a change a rule authored, which is what keeps ADR 0007's separation a property of the types rather than a rule somebody has to notice. What this adds is the grant, the visibility rule, the identity, and one record per value asked for.

The grant is asked for here rather than only at the transport, so an entrypoint added later cannot change somebody's mailbox by arriving another way. It is asked before the email is looked up, because whether a caller may write at all is not a question about which email it named.

Which mail may be written is the same question as which mail may be read, answered by the same resolver: an account this deployment no longer serves and a folder an operator withheld from tools are both mail no tool may reach, and a surface that could write what it may not read would be the way round that withholding. A fourth case joins them and is the one a read does not share: a local copy retained after MailFathom deleted the message, which a listing serves because the mail is readable while the UID it carries names an occurrence the server expunged. All four produce one answer, because telling them apart would let a caller learn which identifiers exist by asking about them.

The records for one call are opened in one commit, so a call either writes down everything it asked for or nothing. A partially recorded triage is the outcome worth avoiding: a caller told its call failed while one of the three values is already on its way to the server has no way to find out which.

Constructors

MailFlagChangeRecorder(AccessAuthorization, MailboxScopeResolver, IAuthoredMailboxTargetReader, IMailboxMutationRecordStore, OptimisticConcurrencyRetryPolicy)

Initializes the use case over the grant it asks first and the record it writes.

Methods

RecordAsync(AuthoredMailFlagChange, MailboxMutationRequester, CancellationToken)

Writes down every value one change asks for, against the email it names.