Constructor MailDraftAttachments
- Namespace
- MailFathom.Application.Mail.Delivery.Drafts
- Assembly
- MailFathom.Application.dll
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.
public MailDraftAttachments(MailDraftDirectory directory, IMailDraftStore drafts, OptimisticConcurrencyRetryPolicy retryPolicy, OutgoingEmailBounds bounds, AccessAuthorization authorization, TimeProvider timeProvider)
Parameters
directoryMailDraftDirectoryResolves an identifier into a draft the caller's own user holds.
draftsIMailDraftStoreHolds the durable account of every draft and everything staged against one.
retryPolicyOptimisticConcurrencyRetryPolicyCommits the row and the octets together.
boundsOutgoingEmailBoundsStates how many files a message may carry and how large one may be.
authorizationAccessAuthorizationAnswers whether the caller that reached this holds the grant that lets it draft.
timeProviderTimeProviderStamps when the upload was taken in.
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.