Class MailboxCopyAppender
- Namespace
- MailFathom.Application.Mail.Delivery.Filing
- Assembly
- MailFathom.Application.dll
Puts one copy of a message MailFathom composed into a folder of the account it belongs to.
public sealed class MailboxCopyAppender
- Inheritance
-
MailboxCopyAppender
- Inherited Members
Remarks
Every copy this system files goes through here, whatever kind of message it is a copy of. A sent copy, a mirror of a message still waiting to go out, and a revision of a draft differ in the role their folder plays, the flags the copy carries, and the durable record each is written onto — and in nothing else, so the append itself is one call and a fourth kind of copy inherits it rather than restating it.
The order of the two writes is the whole of the safety here. An APPEND issued twice is a second
message in somebody's folder rather than a repeat of the first, and nothing that folder shows afterwards tells the
two apart. So the caller's record of the copy is made durable before the command goes out, and everything that can
fail without leaving a copy in the folder happens before that write. Opening the session does reach the server —
it connects, authenticates, and selects the folder — but none of that puts a message anywhere, which is what makes
an attempt that ended before the issued write repeatable. The two writes are the caller's because the row they
move belongs to the caller, but when each of them runs is not: they are taken as callbacks so the ordering cannot
hold on one filing path and lapse on another.
Nothing here raises for a copy that could not be filed. Past the issued write the append may already be in the folder, so every way it can end is classified into a code and returned, rather than raised into a retry that would leave the user with two copies of their own message.
Constructors
- MailboxCopyAppender(IMailboxWriteSessionFactory, MailboxDestinationResolver, IEmailContentStore, IMailTransportSecurityPolicyReader, TimeProvider)
Initializes the appender from the session it appends through and the store it reads the message from.
Methods
- AppendAsync(MailAccountId, OutgoingMailFiling, MailboxCopySource, Func<MailFolderResolution, CancellationToken, Task>, Func<AppendedMailCopy, Task>, CancellationToken)
Appends one copy, having made the caller's record of it durable first.
- FailureCodeOf(Exception)
Names the code that stands for whatever ended an attempt.