Table of Contents

Class MailboxMutationAuditTrail

Namespace
MailFathom.Infrastructure.Persistence.Mutations
Assembly
MailFathom.Infrastructure.dll

Appends one finished mutation to its account's audit trail, and never lets that append cost the mutation.

public sealed class MailboxMutationAuditTrail : IMailboxMutationAuditTrail
Inheritance
MailboxMutationAuditTrail
Implements
Inherited Members

Remarks

The append is a commit of its own, made after the mutation's terminal stage is already durable. That ordering is what the guarantee rests on: by the time this runs, somebody's mailbox has already been changed and the record already says so, so nothing here can roll a change back and nothing here may fail the operation that made it.

A failure is therefore swallowed, and swallowing it is only defensible because it is reported — which MailboxMutationAuditTelemetry is what does. A cancellation the caller raised is reported the same way and then travels on, because the entry it left unwritten is just as missing as one a database refused and the stage it was owed for is terminal, so no later attempt reaches this point again.

What is deliberately not attempted is a retry loop of its own. The optimistic concurrency policy already repeats a conflicted commit, and anything beyond that would be a second retry policy wrapped around a write whose caller is finishing a mail-server operation.

Constructors

MailboxMutationAuditTrail(IMailboxMutationAuditEntryStore, OptimisticConcurrencyRetryPolicy, TimeProvider, MailboxMutationAuditTelemetry)

Initializes the trail from the store it appends to and the channels a refused append is reported on.

Methods

RecordAsync(MailboxMutationRecord, MailFolderResolution, CancellationToken)

Appends the entry one terminal mutation record states, where the account's trail is on.