Method ReviseAsync
- Namespace
- MailFathom.Application.Mail.Delivery.Drafts
- Assembly
- MailFathom.Application.dll
ReviseAsync(IPersistenceSession, MailDraftId, IReadOnlyList<OutgoingRecipient>, long, DateTimeOffset, CancellationToken)
Advances a draft to a new revision, before any command replacing its copy goes out.
Task<MailDraftRecord> ReviseAsync(IPersistenceSession session, MailDraftId draftId, IReadOnlyList<OutgoingRecipient> recipients, long mimeByteLength, DateTimeOffset revisedAt, CancellationToken cancellationToken)
Parameters
sessionIPersistenceSessionThe session the write joins, which is the one the new message is stored in.
draftIdMailDraftIdThe draft being revised.
recipientsIReadOnlyList<OutgoingRecipient>The people the new revision is addressed to.
mimeByteLengthlongHow many bytes the new stored message is.
revisedAtDateTimeOffsetWhen the revision was written down.
cancellationTokenCancellationTokenCancels the write.
Returns
- Task<MailDraftRecord>
The draft as the write left it, with the copy it replaces now superseded.
Remarks
It writes nothing about the mail server and issues no command. What it does is make the intent durable — this is now revision n, and the copy carrying revision n-1 is one to take back out — so a process that dies before either command still leaves the previous copy standing and nameable, which is one draft rather than none.
Exceptions
- ArgumentNullException
Thrown when
sessionorrecipientsis null.- InvalidOperationException
Thrown when no draft is held under
draftId, or when it has already been discarded.