Method WriteAppendAsync
- Namespace
- MailFathom.Application.Synchronization.Restore
- Assembly
- MailFathom.Application.dll
WriteAppendAsync(IPersistenceSession, MailAccountId, MailboxRestoreAppend, CancellationToken)
Writes down that an append is about to be issued for one message.
Task<bool> WriteAppendAsync(IPersistenceSession session, MailAccountId account, MailboxRestoreAppend record, CancellationToken cancellationToken)
Parameters
sessionIPersistenceSessionThe transaction the record commits in.
accountMailAccountIdThe account whose mailbox the copy goes back into.
recordMailboxRestoreAppendThe record to write.
cancellationTokenCancellationTokenPropagates caller cancellation.
Returns
Remarks
It commits before the command goes out, which is the whole of what stops a second copy.
It resolves from a fresh read rather than inserting unconditionally, because the caller commits it under the
optimistic retry policy and that policy's contract is a write that means the same thing on a replay. A record
already standing for the message answers false: either a commit whose answer was lost in
fact landed, or a pass on another replica reached the message first, and in both readings an APPEND
from this caller would be the second one.
Exceptions
- ArgumentNullException
Thrown when
recordis null.