Method GetReconciliationWindowAsync
- Assembly
- MailFathom.Application.dll
GetReconciliationWindowAsync(MailAccountId, MailFolderResolutionId, ImapUidValidity, int, CancellationToken)
Reads the occurrences of one folder binding that this run should ask the server about.
Task<IReadOnlyList<StoredEmailAwaitingReconciliation>> GetReconciliationWindowAsync(MailAccountId accountId, MailFolderResolutionId folderResolutionId, ImapUidValidity uidValidity, int maxEmailCount, CancellationToken cancellationToken)
Parameters
accountIdMailAccountIdThe account the folder belongs to.
folderResolutionIdMailFolderResolutionIdThe alias binding whose occurrences are reconciled.
uidValidityImapUidValidityThe UIDVALIDITY the open session reports, which the returned occurrences must have been stored under.
maxEmailCountintThe greatest number of occurrences to return.
cancellationTokenCancellationTokenPropagates caller cancellation.
Returns
- Task<IReadOnlyList<StoredEmailAwaitingReconciliation>>
The occurrences to ask about, never more than
maxEmailCount.
Remarks
The window leads with the occurrences observed longest ago and the never-observed ones before them, but it is
not simply the first maxEmailCount of that order. Part of it is reserved for occurrences
that have been observed before, because the forward pass can store more new mail per run than one window holds:
an order that took never-observed rows first would then spend every window on newly arrived mail, and a deletion
or a flag change in the mail stored last month would never be noticed again. An implementation returns as much
of each group as exists, so a folder with only one of them still fills the window.
The UIDVALIDITY is a filter rather than a formality, and it is what keeps a server-side renumbering from emptying the local mailbox. Occurrences stored under a UIDVALIDITY the folder no longer reports name messages the current UID space says nothing about, so they are outside every window instead of being reported missing.
An occurrence already recorded as remotely deleted is likewise outside every window. The server has nothing left to say about it, and asking again would spend the window on work whose answer is already durable.