Class MailboxDrainPass
- Namespace
- MailFathom.Application.Synchronization.Drain
- Assembly
- MailFathom.Application.dll
Empties the source server of one held account, message by message, of what MailFathom verifiably holds.
public sealed class MailboxDrainPass
- Inheritance
-
MailboxDrainPass
- Inherited Members
Remarks
The mode's point of no return, and the whole of what makes it safe is the gate in front of it: a message leaves its source only once its row is committed with the occurrence about to be expunged, its payload is stored, and those stored bytes have been read back and matched against the length and digest recorded for them. ADR 0017 already makes a committed row point at a readable object as a design property; for the only copy of somebody's mail it is verified rather than trusted, once per message, before the one act that cannot be taken back.
It runs at the end of an account's synchronization run, under the lease that run already holds, over the account's one write connection. Nothing here runs on a client, MCP, or rule request, so the source server's speed decides how soon the source is emptied and never how long anybody waits — and a failing or unreachable source defers the drain alone, which the next ordinary run attempts again, without failing the run or putting the account into backoff.
A pass is bounded and never a retry loop. It takes the oldest messages in hand once, issues what it can, and ends; the next run takes the next batch. Both commands it issues are idempotent against the UIDs they name, and the occurrence is cleared only once the source has answered — so a process that died in between leaves the occurrence standing, the next pass issues the commands again, and synchronization meeting that UID recognizes the row it already has rather than storing the message twice. See ADR 0034.
Constructors
- MailboxDrainPass(IMailAccountCustodyStore, IMailboxDrainStore, IMailboxMutationRecordStore, IEmailContentStore, IEmailContentRepairRequestStore, IMailboxWriteSessionFactory, IMailFolderResolutionStore, IMailTransportSecurityPolicyReader, IMailFolderMappingReader, OptimisticConcurrencyRetryPolicy, MailboxSynchronizationOptions, TimeProvider)
Initializes a new instance of the MailboxDrainPass class.
Methods
- DrainAsync(MailAccountId, CancellationToken)
Takes one bounded pass over what a held account's source still holds.
- ReadStandingAsync(MailAccountId, CancellationToken)
Reads how far one held account's source has been emptied.