Table of Contents

Method OpenAsync

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

OpenAsync(IPersistenceSession, MailboxMutationRequest, DateTimeOffset?, MailboxMutationLocalChange, CancellationToken)

Writes the intent down, or reads back the record that already holds this idempotency identity.

Task<MailboxMutationRecord> OpenAsync(IPersistenceSession session, MailboxMutationRequest request, DateTimeOffset? heldUntil, MailboxMutationLocalChange localChange, CancellationToken cancellationToken)

Parameters

session IPersistenceSession

The session the write joins.

request MailboxMutationRequest

The change that was asked for.

heldUntil DateTimeOffset?

The instant before which no convergence pass may take the record in hand, or null where it may be taken at once.

localChange MailboxMutationLocalChange

What the record has to do with MailFathom's own copy: nothing, the erasure a second delete of a trashed message opens on an account holding or restoring its mailbox, or the change a restoring account has already committed and is opening this record to carry to the source.

cancellationToken CancellationToken

Cancels the write or the read that follows a losing insert.

Returns

Task<MailboxMutationRecord>

The record for this request, whether this call created it or another one did.

Remarks

The record starts at Recorded with no attempt counted, so opening one performs nothing by itself.

A hold is what makes a change withdrawable for a stated stretch after it was asked for, and it belongs to the record rather than to whoever asked: a client that closes, loses its network, or is put to sleep costs the mailbox nothing, because the window elapses and the record is taken in hand exactly as it would have been. It is honoured by ReadOutstandingAsync(MailAccountId, int, CancellationToken) and lifted by ReleaseAsync(IPersistenceSession, IReadOnlyList<MailAccountId>, IReadOnlyList<MailboxMutationRecordId>, CancellationToken), and a record that already exists under this identity keeps the hold it was opened with rather than taking this call's.

What the record is for is written down with it for the same reason, and read back as LocalChange: a record outlives the phase it was opened under, and the three kinds a held account can meet are told apart by what each was opened as rather than by what the account is now. A record already existing under this identity keeps the value it was opened with rather than taking this call's, exactly as it keeps its hold, because both say what was decided when the intent became durable.

Exceptions

ArgumentNullException

Thrown when session or request is null.