Interface IStoredEmailExtractionBackfillStore
- Namespace
- MailFathom.Application.Emails.Extraction
- Assembly
- MailFathom.Application.dll
The state the extraction backfill reads and writes as it walks the emails stored before extraction existed.
public interface IStoredEmailExtractionBackfillStore
Remarks
The port is one contract rather than three because its four operations describe one restartable walk: where the last run stopped, which emails come next, what one email's re-reading produced, and how far this run has come. A caller holding only some of them could not make the walk terminate.
The resume position is what makes the walk finite. Selecting only emails that have no extraction would already be idempotent, but a message no reader can parse never gains one, so such a walk would return the same unreadable message on every run and never reach the messages behind it.
Methods
- ApplyExtractionAsync(IPersistenceSession, StoredEmailId, ExtractedEmailMetadata, CancellationToken)
Writes what re-reading one email's MIME produced onto its existing row and search document.
- FindResumePositionAsync(CancellationToken)
Reads the position the last committed batch reached, or nothing when the backfill has never run.
- GetEmailsAwaitingExtractionAsync(StoredEmailId?, int, CancellationToken)
Reads the next bounded batch of stored emails whose MIME has never been read.
- SaveResumePositionAsync(IPersistenceSession, StoredEmailId, CancellationToken)
Records how far this run has come, so an interrupted backfill resumes instead of restarting.