Method DeriveAsync
- Namespace
- MailFathom.Application.Emails.AttachmentText
- Assembly
- MailFathom.Application.dll
DeriveAsync(EmailAwaitingAttachmentText, EmailAttachmentTextRunBudget, CancellationToken)
Reads the attachments of one message.
public Task<EmailAttachmentTextDerivation> DeriveAsync(EmailAwaitingAttachmentText email, EmailAttachmentTextRunBudget runBudget, CancellationToken cancellationToken)
Parameters
emailEmailAwaitingAttachmentTextThe message whose attachments are read, and the account whose posture redacts them.
runBudgetEmailAttachmentTextRunBudgetWhat the account run has left to read, which this decrements as it reads.
cancellationTokenCancellationTokenCancels the read between attachments and inside one.
Returns
- Task<EmailAttachmentTextDerivation>
What each attachment yielded, in walk order, beside what the reading spent and whether the run budget stopped it.
Remarks
A reading always answers, and two different facts arrive as an empty attachment list. RunBudgetExhausted says the run had no octets left to finish this message, so nothing about it may be written down: it is left exactly as it was and the next run — which starts with a full budget — reads it. Without that flag an empty list means the message was decided and yielded nothing, so it is recorded as read and never offered to a parser again. Either way the two spend counts on the answer are what the reading actually cost and are charged, which is why nothing is returned as absent.
The walk reaches at most the message's count ceiling. A message declaring more parts than that has the rest neither opened nor recorded, which is the one ceiling that leaves no row behind: writing one per declared part would put the number of rows a message costs in the sender's hands, and the count stored against the message already says how many the ceiling left unread.
A message whose raw MIME is not stored, and one whose stored MIME the walk cannot open, are the two the repair path exists for, so this pass does what every other reader of stored content does with them: it records an EmailContentRepairRequest and leaves the message unsettled, which keeps it out of the stamp and in the walk. Re-reading it costs one content-store read that answers with nothing until synchronization has fetched the message again, and the request is idempotent per message, so neither repeats into anything.
A walk position the message turns out not to have is a different fact and is settled: the count on the row disagrees with the structure, which no repair changes and no repetition resolves.
Exceptions
- ArgumentNullException
Thrown when an argument is null.
- SensitiveContentScannerUnavailableException
Thrown when a switched-on scanner could not establish what the text carries, which refuses the derivation.
- OperationCanceledException
Thrown when the caller cancels.