Table of Contents

Method GetStoredEmailsAsync

Namespace
MailFathom.Application.Spam
Assembly
MailFathom.Application.dll

GetStoredEmailsAsync(MailAccountId, IReadOnlyList<MailFolderAlias>, StoredEmailId?, int, CancellationToken)

Reads one account's stored occurrences in identity order, narrowed to a set of folders.

Task<IReadOnlyList<ClassifiableEmail>> GetStoredEmailsAsync(MailAccountId accountId, IReadOnlyList<MailFolderAlias> folderAliases, StoredEmailId? resumeAfter, int batchSize, CancellationToken cancellationToken)

Parameters

accountId MailAccountId

The account whose mailbox is walked.

folderAliases IReadOnlyList<MailFolderAlias>

MailFathom's own names for the folders the walk covers.

resumeAfter StoredEmailId?

The identity the run last committed, or null to start at the beginning.

batchSize int

How many occurrences to read at most.

cancellationToken CancellationToken

Cancels the read.

Returns

Task<IReadOnlyList<ClassifiableEmail>>

The occurrences, which is empty once the walk has reached the end of the scope.

Remarks

A keyset read ordered by the stored email's identity, because that is the only ordering that is total, stable, and unaffected by anything a later write does to a row. The walk does not shrink as it progresses — a classified message is still a stored message — which is exactly why the run commits the position it reached rather than relying on the query to stop offering what it has already seen. An empty set of aliases names no mail and the answer is empty, which is what a scope narrowed to nothing means rather than a scope of everything.

Exceptions

ArgumentNullException

Thrown when folderAliases is null.