Table of Contents

Method EraseCompletedBeforeAsync

Namespace
MailFathom.Application.Mail.Mutations.Audit
Assembly
MailFathom.Application.dll

EraseCompletedBeforeAsync(MailAccountId, DateTimeOffset, int, CancellationToken)

Erases up to a bounded number of one account's entries that ended before a given instant.

Task<int> EraseCompletedBeforeAsync(MailAccountId accountId, DateTimeOffset completedBefore, int limit, CancellationToken cancellationToken)

Parameters

accountId MailAccountId

The account whose trail is aged.

completedBefore DateTimeOffset

The instant entries must have ended before to be erased.

limit int

The greatest number of entries one call may erase.

cancellationToken CancellationToken

Cancels the erasure.

Returns

Task<int>

How many entries 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 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.