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 operations describe one restartable walk: where the last run stopped, how much is left, 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.
- CountEmailsAwaitingExtractionAsync(CancellationToken)
Counts the stored emails this walk still owes work on, under the configuration it is walking for.
- CountEmailsWithStaleDerivedDataAsync(SensitiveContentDerivationStamp, CancellationToken)
Counts the stored emails whose derived text was written under a different sensitive-content configuration.
- 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.