Table of Contents

Method EraseAsync

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

EraseAsync(MailAccountId, MailFolderAlias, CancellationToken)

Erases one bounded pass of what is stored for a folder nothing mirrors any more.

public Task<MailFolderMirrorErasure> EraseAsync(MailAccountId account, MailFolderAlias folderAlias, CancellationToken cancellationToken)

Parameters

account MailAccountId

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

folderAlias MailFolderAlias

MailFathom's own name for the folder.

cancellationToken CancellationToken

Cancels the pass before or during its single transaction.

Returns

Task<MailFolderMirrorErasure>

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

Remarks

This is the one operation that disposes of stored mail, so it asks for the grant allocated to exactly that and nothing wider reaches it. The check is here rather than only at the route because an erasure is irreversible and an entrypoint added later must not be able to perform one by omission.

The alias need not be one a mapping still names, so whether the folder is one the source keeps messages in is answered where it can be — from the account's own mapping — and answered false where it cannot. A held account owes its source a removal record per erased row, and a record naming a folder playing a virtual role would name occurrences of messages the source keeps in other folders; an alias configuration no longer describes cannot be told apart from one, so what such an erasure leaves is mail standing on the source rather than a command against mail nobody asked about.

Exceptions

PersistenceConcurrencyConflictException

Thrown when a competing writer wins a race the bounded retries could not resolve.

PrincipalNotAuthorizedException

Thrown when the use case was reached by anything but a caller granted AdminErase.