Class MailAnsweringAuditTrail
- Namespace
- MailFathom.Infrastructure.Persistence.Answering
- Assembly
- MailFathom.Infrastructure.dll
Writes what one finished answering run read, and never lets that write cost the answer it describes.
public sealed class MailAnsweringAuditTrail : IMailAnsweringAuditTrail
- Inheritance
-
MailAnsweringAuditTrail
- Implements
- Inherited Members
Remarks
The append happens after the run has ended and after the answer has been produced. That ordering is what the guarantee rests on: by the time this runs there is nothing left to roll back, so nothing here may fail the question that produced it.
A failure is therefore swallowed, and swallowing it is only defensible because it is reported — which MailAnsweringAuditTelemetry is what does. A cancellation the caller raised is reported the same way and then travels on, because the record it left unwritten is just as missing as one a database refused and 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 somebody's request.
Constructors
- MailAnsweringAuditTrail(IMailAnsweringAuditSettingsReader, IMailAnsweringAuditEntryStore, OptimisticConcurrencyRetryPolicy, MailAnsweringAuditTelemetry)
Initializes the record from the settings that decide who owes one and the store it appends to.
Methods
- RecordAsync(MailAnsweringRunObservation, CancellationToken)
Appends the entries one finished run owes, for the accounts whose record is on.