Interface IMailboxMutationRecordStore
- Namespace
- MailFathom.Application.Mail.Mutations
- Assembly
- MailFathom.Application.dll
Keeps the durable record of every change MailFathom asked a mail server to make.
public interface IMailboxMutationRecordStore
Remarks
The idempotency identity is the email occurrence, the requester, and the mutation together, and it is enforced by a unique constraint rather than by this contract declining to write. Two callers asking for the same change at the same moment both reach the database, and one of them loses there; a check-then-insert would let both through the window between the two statements, which is the window the crash-safety of everything above depends on being closed.
Writes take the caller's session because a mutation record is written alongside whatever else the caller is committing. Reads take none, because a read joins no transaction.
Methods
- AdvanceAsync(IPersistenceSession, MailboxMutationRecordId, MailboxMutationStage, RemoteEmailPlacement?, CancellationToken)
Moves the record to a later stage, recording the placement where the server named one.
- CountAttemptAsync(IPersistenceSession, MailboxMutationRecordId, CancellationToken)
Counts one attempt against the record before that attempt is made.
- OpenAsync(IPersistenceSession, MailboxMutationRequest, CancellationToken)
Writes the intent down, or reads back the record that already holds this idempotency identity.
- ReadLifecycleCountsAsync(MailAccountId, CancellationToken)
Counts one account's uncompleted mutations by kind and by where in its lifecycle each one stands.
- ReadOutstandingAsync(MailAccountId, int, CancellationToken)
Reads the mutations of one account that have not completed, with the folder binding each was recorded against.
- RecordFailureAsync(IPersistenceSession, MailboxMutationRecordId, MailFathomErrorCode, CancellationToken)
Records the failure the last attempt ended in, without moving the stage.
- RecordPlacementIssuedAsync(IPersistenceSession, MailboxMutationRecordId, bool, CancellationToken)
Moves the record to PlacementIssued and states what the command will leave behind.