Class StoredEmailEmbeddingBackfill
- Namespace
- MailFathom.Application.Emails.Embeddings.Backfill
- Assembly
- MailFathom.Application.dll
Walks the mail an instance already had, giving it the passages and the vectors the live path never produced.
public sealed class StoredEmailEmbeddingBackfill
- Inheritance
-
StoredEmailEmbeddingBackfill
- Inherited Members
Remarks
The work is bounded, idempotent, and restartable, and it is deliberately the same shape as the extraction backfill: a run processes at most a configured number of batches and then reports whether more remain, and the position each message's turn commits is what the next run resumes from. What is outstanding is decided by the absence of a vector rather than remembered anywhere, so a run interrupted between two provider calls re-embeds nothing it already paid for.
Two things are outstanding here rather than one, and the order between them is the whole point: a message stored
before chunking existed has extracted text and no passages, and nothing can be embedded until those passages are
cut. Cutting them costs a database write and no provider call, and it reads text an earlier extraction already
stored, so this reaches no mail server and cannot touch a remote \Seen flag however long it runs.
The walk repeats rather than finishing once. A message whose turn a provider refused keeps passages without vectors and the position has already stepped past it, so when the walk reaches the end it ends the sweep instead of parking there, and the next run starts again from the beginning. That is what makes the promise the live path relies on — that whatever the bounded backlog turned away and whatever a failed turn did not reach is reached later — something this actually keeps.
Constructors
- StoredEmailEmbeddingBackfill(IActiveEmbeddingProfileReader, IStoredEmailEmbeddingBackfillStore, StoredEmailEmbeddingGenerator, OptimisticConcurrencyRetryPolicy, StoredEmailEmbeddingBackfillOptions)
Initializes a new embedding backfill.
Methods
- RunAsync(CancellationToken)
Runs one bounded pass of the backfill.