Table of Contents

Method EraseEvaluatedBeforeAsync

Namespace
MailFathom.Application.Rules.History
Assembly
MailFathom.Application.dll

EraseEvaluatedBeforeAsync(MailAccountId, DateTimeOffset, int, CancellationToken)

Erases up to a bounded number of one account's executions recorded before a given instant.

Task<int> EraseEvaluatedBeforeAsync(MailAccountId accountId, DateTimeOffset evaluatedBefore, int limit, CancellationToken cancellationToken)

Parameters

accountId MailAccountId

The account whose history is aged.

evaluatedBefore DateTimeOffset

The instant an execution must have been recorded before to be erased.

limit int

The greatest number of executions one call may erase.

cancellationToken CancellationToken

Cancels the erasure.

Returns

Task<int>

How many executions were erased, which reaching limit means more remain.

Remarks

It joins no session, because it is a set-based delete rather than a change to state a caller is composing. It is idempotent: running it twice over the same window erases nothing the second time. The actions an erased execution recorded go with it, because they hang on the execution.

The bound is what keeps an operator shortening a long retention from turning one pass into a delete that locks the table against every append behind it. What is left over is erased by the next pass, oldest first.

Exceptions

ArgumentOutOfRangeException

Thrown when limit is not positive.