Table of Contents

Interface IEmailThreadStore

Namespace
MailFathom.Application.Emails.Threads
Assembly
MailFathom.Application.dll

The durable state one conversation is assembled out of, written in the caller's transaction.

public interface IEmailThreadStore

Remarks

Every method takes the session, because placing a message in a conversation belongs to the transaction that commits the message. A placement committed separately would leave a window in which a message is readable and belongs to nothing, and a crash inside that window would leave it there for good.

Every read is scoped to one conversation or to one account, deliberately. Assembly asks narrow questions — which conversations these identifiers name, which message in this conversation carries that identifier — so a store that handed back a whole conversation would make the cost of storing one message grow with the length of the exchange it joins.

Methods

BindIdentifiersAsync(IPersistenceSession, MailAccountId, IReadOnlyList<string>, EmailThreadId, CancellationToken)

Binds identifiers this account does not bind yet to one conversation.

FindBindingsAsync(IPersistenceSession, MailAccountId, IReadOnlyList<string>, CancellationToken)

Reads which of the given identifiers this account already binds to a conversation.

FindByMessageIdentifierAsync(IPersistenceSession, EmailThreadId, string, CancellationToken)

Reads the messages of one conversation that carry a given message identifier.

FindThreadedEmailAsync(IPersistenceSession, StoredEmailId, CancellationToken)

Reads one stored email as assembly sees it, or nothing when it is not stored.

FindUnplacedAnswersAsync(IPersistenceSession, EmailThreadId, string, CancellationToken)

Reads the messages of one conversation that answer an identifier and hang from nothing yet.

LinkAnswerAsync(IPersistenceSession, StoredEmailId, StoredEmailId, CancellationToken)

Hangs one already-stored message from the message it answers.

MergeThreadsAsync(IPersistenceSession, IReadOnlyList<EmailThreadId>, EmailThreadId, CancellationToken)

Folds conversations into one, moving their mail and their identifiers onto the survivor.

PlaceAsync(IPersistenceSession, StoredEmailId, EmailThreadId, StoredEmailId?, CancellationToken)

Records which conversation one email belongs to and which of its messages it answers.

StartThreadAsync(IPersistenceSession, MailAccountId, CancellationToken)

Starts a conversation for the account and reports its identity.