Table of Contents

Method EmbedAsync

Namespace
MailFathom.Application.Emails.Embeddings.Vectorization
Assembly
MailFathom.Application.dll

EmbedAsync(StoredEmailId, RegisteredEmbeddingProfile, CancellationToken)

Embeds whatever of one message is not yet embedded under one generation.

public Task<StoredEmailEmbeddingRun> EmbedAsync(StoredEmailId storedEmailId, RegisteredEmbeddingProfile profile, CancellationToken cancellationToken)

Parameters

storedEmailId StoredEmailId

The message to bring up to date.

profile RegisteredEmbeddingProfile

The generation the vectors belong to, which the caller decides and this never reads.

cancellationToken CancellationToken

Cancels the turn between calls and between commits.

Returns

Task<StoredEmailEmbeddingRun>

How the turn ended, and how many passages it committed vectors for.

Remarks

The generation is a parameter rather than something read here, because the live path and a reindex write into different ones at the same moment: mail arriving is embedded into the generation serving searches, and the sweep fills the one being built. A generator that resolved it itself could only ever serve one of the two.

Exceptions

ArgumentNullException

Thrown when profile is null.

PersistenceConcurrencyConflictException

Thrown when a competing writer wins a race the bounded retries could not resolve. Vectors already committed stay durable and the passages they cover are no longer outstanding.

OperationCanceledException

Thrown when the caller cancels or the host is shutting down. Committed vectors stay durable.

InvalidOperationException

Thrown when no message is stored under storedEmailId, so the mailbox whose spend this turn would be charged against cannot be established. The caller holds an identifier it read from this deployment, so what this reports is a message erased underneath the turn rather than an argument a caller can correct. The ordinary form of that race does not reach it: a message already gone has nothing outstanding, which ends the turn as whole before a mailbox is ever asked for, and only one erased between that answer and the account lookup behind it arrives here.