Table of Contents

Method SubmitAsync

Namespace
MailFathom.Application.Rules.Evaluation
Assembly
MailFathom.Application.dll

SubmitAsync(MailAccountId, CancellationToken)

Asks for the account's rules to be run over every message stored for it.

public Task<MailRuleEvaluationRunRequest> SubmitAsync(MailAccountId accountId, CancellationToken cancellationToken)

Parameters

accountId MailAccountId

The account to run the rules over.

cancellationToken CancellationToken

Cancels the write.

Returns

Task<MailRuleEvaluationRunRequest>

The run the account now has outstanding, and whether this request is what put it there.

Remarks

Whether the account is free is decided at the write rather than by a check in front of it, because two requests arriving together must resolve to one run. The loser of that race meets the account's own key, is retried from a fresh read, and is answered with the run the winner asked for.

A scheduled run in front of the account is replaced rather than answered with, because this request reaches every rule and that one reaches only the rules declaring a schedule.

This is the operator's own request, so it asks for the grant that covers making the deployment do work — a pass over a whole mailbox changes mail on the server. SubmitScheduledAsync(MailAccountId, CancellationToken) asks for no permission and for the process itself instead, because what reaches it is this process on a rule's own declared occasion rather than a caller.

Exceptions

PersistenceConcurrencyConflictException

Thrown when two requests raced past the bounded retries.

PrincipalNotAuthorizedException

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

OperationCanceledException

Thrown when the caller cancels.