Method RestoreAsync
- Namespace
- MailFathom.Application.Synchronization.Restore
- Assembly
- MailFathom.Application.dll
RestoreAsync(MailAccountId, CancellationToken)
Takes one bounded pass at putting a restoring account's mailbox back onto its source.
public Task<MailboxRestoreReport> RestoreAsync(MailAccountId account, CancellationToken cancellationToken)
Parameters
accountMailAccountIdThe account whose mailbox is restored.
cancellationTokenCancellationTokenCancels the pass; an append already issued is cancelled with it.
Returns
- Task<MailboxRestoreReport>
What the pass did, which is Nothing for an account that is not restoring.
Remarks
A placement an earlier pass recorded and never carried is finished first, before any budget is spent. It costs nothing on an ordinary run — the pass that records a placement carries it in the same run — and doing it first is what keeps a shutdown between the two from reaching an operator as an append to establish by hand.
The state records are written before the appends because they cost no mail server round trip at all: they are rows the converger picks up on its own schedule, so spending the budget on them first is what keeps a mailbox of years from starving the half that finishes quickest.
The phase is ended at the end of the same pass rather than by a reading of its own, so an account whose last message went back is mirroring again before anybody asks. Ending it is a compare-and-set on the phase this pass decided from, so a replica that spent a run and lost its lease writes nothing over what replaced it.
Exceptions
- OperationCanceledException
Thrown when the caller cancels the pass.