Table of Contents

Method ReadCandidatesAsync

Namespace
MailFathom.Application.Synchronization.Drain
Assembly
MailFathom.Application.dll

ReadCandidatesAsync(MailAccountId, IReadOnlyCollection<MailFolderAlias>, int, CancellationToken)

Reads the oldest messages of a held account that its source still holds.

Task<IReadOnlyList<MailboxDrainCandidate>> ReadCandidatesAsync(MailAccountId account, IReadOnlyCollection<MailFolderAlias> drainableFolders, int maximumCandidates, CancellationToken cancellationToken)

Parameters

account MailAccountId

The account.

drainableFolders IReadOnlyCollection<MailFolderAlias>

The aliases whose folder the source keeps messages of its own in.

maximumCandidates int

The most messages one pass takes in hand.

cancellationToken CancellationToken

Propagates caller cancellation.

Returns

Task<IReadOnlyList<MailboxDrainCandidate>>

The candidates, oldest first, bounded by what was asked for, and none from any other folder.

Remarks

Oldest first so a mailbox of years empties from the end nobody is reading, and bounded so one pass costs a bounded number of reads whatever the mailbox holds. Every candidate carries an occurrence: a row whose occurrence was cleared has already been drained and is not asked about again.

Exceptions

ArgumentNullException

Thrown when drainableFolders is null.

ArgumentOutOfRangeException

Thrown when maximumCandidates is not positive.