Table of Contents

Method ReconcileAsync

Namespace
MailFathom.Application.Synchronization.Reconciliation
Assembly
MailFathom.Application.dll

ReconcileAsync(IMailboxSession, MailAccountId, MailFolderResolution, ImapUidValidity, ulong?, CancellationToken)

Reconciles one bounded window of the folder the supplied session has open.

public Task<MailboxReconciliationResult> ReconcileAsync(IMailboxSession mailboxSession, MailAccountId accountId, MailFolderResolution folder, ImapUidValidity uidValidity, ulong? reconciledThroughModSeq, CancellationToken cancellationToken)

Parameters

mailboxSession IMailboxSession

The open read-only session, whose folder and UIDVALIDITY the window is chosen for.

accountId MailAccountId

The account being reconciled.

folder MailFolderResolution

The alias binding being reconciled.

uidValidity ImapUidValidity

The UIDVALIDITY the session reports for the open folder.

reconciledThroughModSeq ulong?

The modification sequence a previous pass covered the whole folder through, or null when there is none to reconcile from.

cancellationToken CancellationToken

Cancels the pass between the remote read and the local write.

Returns

Task<MailboxReconciliationResult>

What this window found, and whether occurrences remain to be reconciled in a later run.

Remarks

A folder whose UIDVALIDITY has changed reconciles nothing rather than deleting anything. The window is selected under the UIDVALIDITY the session reports, so occurrences stored under the previous one are simply not in it: the renumbering is left to the existing invalidation rule, and no mass local deletion can follow from it.

A modification sequence is reported back only when this window emptied the folder's queue. Until then the pass is partway through the folder, and a sequence recorded now would assert that everything older than it has been accounted for — including the occurrences this window never reached, which would then never be asked about.

Exceptions

ArgumentNullException

Thrown when mailboxSession or folder is null.

MailboxUnavailableException

Thrown when the mail server did not serve the read within its configured resilience budget.

MailboxFolderRecreatedException

Thrown when a recovered connection reselected the folder with a different UIDVALIDITY.

PersistenceConcurrencyConflictException

Thrown when a competing writer wins a race the bounded retries could not resolve. Nothing this window found is then committed, and the next run selects the same occurrences because none of them was observed.