Method ExpungeDrainedAsync
- Namespace
- MailFathom.Application.Mail.Mutations
- Assembly
- MailFathom.Application.dll
ExpungeDrainedAsync(ImapUidValidity, IReadOnlyCollection<ImapUid>, CancellationToken)
Removes from this session's folder exactly the messages a drain selected, and no others.
Task ExpungeDrainedAsync(ImapUidValidity uidValidity, IReadOnlyCollection<ImapUid> uids, CancellationToken cancellationToken)
Parameters
uidValidityImapUidValidityThe UIDVALIDITY the selected occurrences name, which must still be the folder's.
uidsIReadOnlyCollection<ImapUid>The UIDs to remove, which the drain gate selected from what MailFathom durably holds.
cancellationTokenCancellationTokenCancels the removal.
Returns
- Task
A task that completes when the folder no longer holds those messages.
Remarks
The fourth reopening of this surface, and the one act here nobody authored message by message: an administrator switched the account into holding its own mailbox, and this empties the source of what MailFathom verifiably holds. It is reached only from that mode's background pass, and every UID it names passed a gate that read the stored payload back against its recorded length and digest first.
It is UID STORE +FLAGS adding \Deleted over exactly these UIDs, followed by UID EXPUNGE
naming exactly these UIDs. A bare EXPUNGE is never issued, so a message another client flagged
\Deleted and MailFathom never stored is not swept along with the batch, and a server without
UID EXPUNGE is refused rather than served. The UIDVALIDITY is compared as the folder reports it now,
because a folder recreated since the batch was selected renumbered every message in it and these UIDs would
name somebody else's mail.
Both commands are idempotent against the UIDs they name, so a batch whose answer never arrived is issued again by the next pass rather than being settled from what the mailbox shows. A UID the folder no longer holds is not an error: what was asked for is already true. See ADR 0034.
Exceptions
- ArgumentNullException
Thrown when
uidsis null.- ArgumentException
Thrown when
uidsis empty.- MailboxMutationUnsupportedException
Thrown when the server advertises no
UIDPLUS, so no message-scoped expunge exists.- MailboxUnavailableException
Thrown when the mail server did not serve the removal within its configured resilience budget.
- MailboxFolderRecreatedException
Thrown when the folder no longer reports the UIDVALIDITY the occurrences name.