Table of Contents

Method SubmitAsync

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

SubmitAsync(IPersistenceSession, MailboxMutationRequest, MailboxDestination?, DateTimeOffset?, CancellationToken)

Records or commits one change, inside the caller's transaction.

public Task<SubmittedMailboxChange> SubmitAsync(IPersistenceSession session, MailboxMutationRequest request, MailboxDestination? destination, DateTimeOffset? heldUntil, CancellationToken cancellationToken)

Parameters

session IPersistenceSession

The transaction the change commits in.

request MailboxMutationRequest

The change asked for.

destination MailboxDestination

Where a relocation or a copy files the message, resolved before the transaction opened; null for every other change.

heldUntil DateTimeOffset?

How long a written record waits before a convergence pass may take it in hand.

cancellationToken CancellationToken

Cancels the write.

Returns

Task<SubmittedMailboxChange>

The record written, the local change committed, or why neither happened.

Remarks

A local change is announced only once the caller's transaction has committed, which is why this returns what to announce and Announce(AppliedMailboxChange) publishes it: a signal raised inside a transaction that then rolls back would send a client to read a change that never happened.

Exceptions

ArgumentNullException

Thrown when session or request is null.

SubmitAsync(IPersistenceSession, MailboxMutationRequest, MailboxDestination?, DateTimeOffset?, PreparedLocalCopy?, CancellationToken)

Records or commits one change, inside the caller's transaction, with the copy a held account would need.

public Task<SubmittedMailboxChange> SubmitAsync(IPersistenceSession session, MailboxMutationRequest request, MailboxDestination? destination, DateTimeOffset? heldUntil, PreparedLocalCopy? preparedCopy, CancellationToken cancellationToken)

Parameters

session IPersistenceSession

The transaction the change commits in.

request MailboxMutationRequest

The change asked for.

destination MailboxDestination

Where a relocation or a copy files the message, resolved before the transaction opened; null for every other change.

heldUntil DateTimeOffset?

How long a written record waits before a convergence pass may take it in hand.

preparedCopy PreparedLocalCopy

The payload a held copy was placed with, from PrepareCopiesAsync(MailAccountId, IReadOnlyCollection<StoredEmailId>, CancellationToken); null for every other change and for an account that is not held.

cancellationToken CancellationToken

Cancels the write.

Returns

Task<SubmittedMailboxChange>

The record written, the local change committed, or why neither happened.

Remarks

A caller hands the copy in rather than the submission placing one, because placing a payload must not happen with a transaction open across it and this is called inside one. Handing in nothing is what a caller that could not place one has, and a copy then answers SourceContentMissing rather than committing a row naming a payload that was never placed.

Exceptions

ArgumentNullException

Thrown when session or request is null.