Table of Contents

Method EraseFolderMirrorAsync

Namespace
MailFathom.Application.Folders
Assembly
MailFathom.Application.dll

EraseFolderMirrorAsync(IPersistenceSession, MailAccountId, MailFolderAlias, bool, int, CancellationToken)

Erases a bounded part of one folder's stored mail, and its checkpoint once nothing is left.

Task<MailFolderMirrorErasure> EraseFolderMirrorAsync(IPersistenceSession session, MailAccountId account, MailFolderAlias folderAlias, bool folderHoldsItsOwnMessages, int maxEmails, CancellationToken cancellationToken)

Parameters

session IPersistenceSession

The write transaction this erasure joins.

account MailAccountId

The account the folder belongs to, by its generated identifier.

folderAlias MailFolderAlias

MailFathom's own name for the folder.

folderHoldsItsOwnMessages bool

Whether the source keeps messages in this folder rather than presenting other folders' messages.

maxEmails int

The greatest number of emails this pass may erase.

cancellationToken CancellationToken

Cancels the read that selects the emails and the writes that stage their removal.

Returns

Task<MailFolderMirrorErasure>

What this pass erased, and whether the folder still holds stored mail.

Remarks

The checkpoint is cleared in the same pass that empties the folder rather than in the first one, because a checkpoint removed while mail remains would make a mirrored folder resume in front of rows this pass has not reached. Clearing it at the end is what makes a folder somebody erased mirror afresh, while a folder merely switched off keeps its checkpoint and resumes from it.

A folder playing a virtual role presents occurrences of folders the source keeps elsewhere, so erasing what MailFathom stored of one says nothing about what that server should be emptied of. The caller answers that rather than this port, because what the folder is for is the account's mapping to say and a mapping may be gone while its rows are not; a caller that cannot establish it answers false and the erasure asks the source for nothing.