Class ThreadStateDerivationPass
- Namespace
- MailFathom.Application.Emails.ThreadStates
- Assembly
- MailFathom.Application.dll
Derives where the account's conversations stand, once each time one of them changes, and writes it down.
public sealed class ThreadStateDerivationPass
- Inheritance
-
ThreadStateDerivationPass
- Inherited Members
Remarks
Behind the cut and behind the enrichment beside it, because a statement cites messages and a conversation derived from before its newest message was settled would be describing an exchange this deployment had not finished storing. Everything the earlier stages settle is settled by the time this runs.
A step of the account's synchronization run rather than a schedule of its own, for the reason every other pass is: 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 conversation leaves the selection by having a state recorded against the shape it currently has, so an interrupted pass repeats nothing and skips nothing, and what one pass's bound leaves behind is the next run's. That is also the whole of how an existing mailbox is filled in, and the whole of how a state is kept current: a conversation that gains a reply no longer matches the state stored against it, so the next pass reaches it again.
Derivations are made one after another and the first withheld one ends the pass, for the reason enrichment's are: a derivation is a provider call, the endpoint's concurrency limiter admits a few invocations at a time, and every reason a derivation is withheld outlives one conversation.
Constructors
- ThreadStateDerivationPass(IStoredThreadStateStore, IThreadStateDeriver, IMailAccountLanguages, SensitiveContentEgressGuard, OptimisticConcurrencyRetryPolicy, TimeProvider)
Initializes the pass from the state it walks and the derivation it asks.
Fields
- MaximumCharactersPerMessage
How much of one message travels with the batch.
- MaximumMessagesPerThread
How many messages of a conversation one derivation takes in before it is recorded as too large instead.
- MaximumThreadsPerPass
How many conversations one pass derives a state for.
Methods
- RunAsync(MailAccountId, CancellationToken)
Takes one bounded pass over the account's conversations awaiting a state.