Class MailDraftAttachments
- Namespace
- MailFathom.Application.Mail.Delivery.Drafts
- Assembly
- MailFathom.Application.dll
Takes files onto a draft and back off it, which is how an author attaches anything at all.
public sealed class MailDraftAttachments
- Inheritance
-
MailDraftAttachments
- Inherited Members
Remarks
A file is staged against the draft rather than sent with each edit. Composing the message is what puts the octets into it, and an author revising a subject would otherwise re-upload every file they had attached; so the upload happens once, the draft keeps what was uploaded, and every later revision is composed with it.
Cancelling an upload is one of two things, and both leave nothing behind. A request the author abandoned mid-transfer commits nothing at all, because the row and the octets are one transaction that never ran; a file already taken in is removed by naming it, and its octets go with the row. Neither leaves a payload this deployment holds for a message nobody is writing.
The bounds are the operator's numbers rather than the transport's, and they are asked here so that every boundary that ever stages a file meets them: how many files a message may carry and how large one may be are what OutgoingEmailBounds already states for a composed message, and a file this refuses is one no composition of that draft could have carried anyway. What the composed size turns out to be is asked again at composition, because transfer encoding is what decides it.
Every act here is admitted under MailDraftsWrite, because attaching a file is writing the draft. Which draft the caller may reach is MailDraftDirectory's answer rather than this one's, for the reason that class gives.
Constructors
- MailDraftAttachments(MailDraftDirectory, IMailDraftStore, OptimisticConcurrencyRetryPolicy, OutgoingEmailBounds, AccessAuthorization, TimeProvider)
Takes files onto a draft and back off it, which is how an author attaches anything at all.
Methods
- StageAsync(MailDraftId, AuthoredEmailAttachment, CancellationToken)
Stages one file against a draft the caller's user is writing.
- UnstageAsync(MailDraftId, MailDraftAttachmentId, CancellationToken)
Takes one staged file back off a draft the caller's user is writing.