Table of Contents

Class MailChunkingPass

Namespace
MailFathom.Application.Emails.Chunking
Assembly
MailFathom.Application.dll

Cuts the passages of the account's mail the earlier stages have finished with, and offers each message for embedding.

public sealed class MailChunkingPass
Inheritance
MailChunkingPass
Inherited Members

Remarks

This is the fourth stage of the arrival pipeline, and it is a stage of its own precisely because of what runs in front of it. Classification decides whether a message is derived from at all, the owner's rules may move it into a folder mapped differently from the one it arrived in, and both of those happen after the transaction that stored the message committed. Cutting inside that transaction would therefore write passages from a message's placement before the two stages allowed to change it had run — and passages are not undone by the message moving afterwards.

Running after the rule pass is not the whole of that, and the selection carries the rest: a rule declares a move rather than performing one, and the account's next run is what carries it to the mail server, so a message this pass meets may be one still on its way out of the folder it is sitting in. Such a message is passed over and cut once it has arrived where the rule sent it. StoredEmailChunkingStore.Selecting states which records hold a cut back and which have stopped mattering.

A step of the account's synchronization run rather than a schedule of its own, for the reason the classification and rule passes are: that run already has per-account isolation, a slot count, a jittered backoff, and a failure path that defers the account instead of the process, and only one pass per account is ever in flight because of it.

It needs no cursor. A message leaves the selection by being cut, so an interrupted pass repeats nothing and skips nothing, and what one pass's batch budget leaves behind is the next run's — or the StoredEmailEmbeddingBackfill sweep's, which selects on the same condition and is what reaches mail the account run never gets to.

Constructors

MailChunkingPass(IStoredEmailChunkingStore, IEmailEmbeddingBacklog, IDerivedWorkGateTelemetry, OptimisticConcurrencyRetryPolicy)

Initializes the pass from the state it walks and the backlog it hands messages to.

Methods

RunAsync(MailAccountId, CancellationToken)

Takes one bounded pass over the account's mail awaiting the cut.