Table of Contents

Method ConfirmAppendAsync

Namespace
MailFathom.Application.Synchronization.Restore
Assembly
MailFathom.Application.dll

ConfirmAppendAsync(IPersistenceSession, MailboxRestoreAppend, EmailOccurrenceId, CancellationToken)

Writes the occurrence the source named onto the message and deletes the record that stood for the append.

Task<bool> ConfirmAppendAsync(IPersistenceSession session, MailboxRestoreAppend record, EmailOccurrenceId occurrence, CancellationToken cancellationToken)

Parameters

session IPersistenceSession

The transaction both writes commit in.

record MailboxRestoreAppend

The record the append was issued under.

occurrence EmailOccurrenceId

Where the copy now is: the folder it was appended into, and the identity the source named in it.

cancellationToken CancellationToken

Propagates caller cancellation.

Returns

Task<bool>

true when the message took the occurrence, and false when something else already held it.

Remarks

One transaction, because the record exists to say the outcome is unknown and the occurrence is what makes it known. A commit that wrote one without the other would either leave a settled append standing for an operator to chase or leave the message appended a second time by the next pass.

The folder is part of what is written rather than only the identity inside it, because a message somebody moved while the account was held goes back into the folder it is in now: its row bound the folder the drain took it off, and an occurrence naming that folder with this folder's UID would name somebody else's mail. A message something else already holds that occurrence — synchronization having met the copy as an arrival before this committed — keeps its record rather than losing it, because it is then a message that may be on the source twice and that is an operator's to establish.

Such a record also loses the placement recorded on it, in the same transaction. That is what moves it from the work a pass finishes on its own to the work an operator is offered: nothing else would ever carry it, and a record nothing finishes and nobody is offered holds the account in its phase for ever.

Exceptions

ArgumentNullException

Thrown when record or occurrence is null.