Method PrepareCopiesAsync
- Namespace
- MailFathom.Application.Mail.Mutations
- Assembly
- MailFathom.Application.dll
PrepareCopiesAsync(MailAccountId, IReadOnlyCollection<StoredEmailId>, CancellationToken)
Places the payload of every copy a batch asks for, before the transaction that commits them opens.
public Task<PreparedLocalCopies> PrepareCopiesAsync(MailAccountId account, IReadOnlyCollection<StoredEmailId> sources, CancellationToken cancellationToken)
Parameters
accountMailAccountIdThe account the batch acts on.
sourcesIReadOnlyCollection<StoredEmailId>The message each planned copy duplicates, one entry per copy, which may name one message twice.
cancellationTokenCancellationTokenPropagates caller cancellation.
Returns
- Task<PreparedLocalCopies>
The placed copies, or none at all where the account's source is the truth about its mailbox.
Remarks
The phase is read here as well as inside the transaction, and the two readings do different work: this one decides whether anything is worth placing, and the one inside decides what is committed. An account that stops being held in between has copies placed for it that nothing commits, which is the orphaned object the content reclamation pass takes; the reverse ordering would be a copy the transaction cannot make.
A restoring account places one for the same reason a held one does: its stored mail is still what the local change commits against, so a copy there is a second stored message rather than a command for the source. Asking only for Held would leave the transaction with nothing to commit and a rule's copy answering SourceContentMissing for the whole restore.
Exceptions
- ArgumentNullException
Thrown when
sourcesis null.