Interface IEmailEmbeddingBacklog
- Namespace
- MailFathom.Application.Emails.Embeddings.Generation
- Assembly
- MailFathom.Application.dll
Carries messages from the run that stored them to the worker that embeds them.
public interface IEmailEmbeddingBacklog
Remarks
The backlog is what keeps generation off the synchronization path. A message is offered only once it and its passages are durable, so the worker consumes committed state, no provider call extends an IMAP transaction, and a provider outage cannot stall a fetch. Nothing an MCP request waits on reads this.
It is bounded, and the bound is expressed rather than absorbed: an initial synchronization of a large mailbox produces work faster than any provider will accept it, so a full backlog refuses the offer instead of making the producer wait. What it refuses is not lost — the message is stored with its passages, and the backfill is what reaches mail the live path did not.
Offering one message twice is safe by construction: the work is "give every passage of this message a vector under the active profile", and a second turn at a message already current finds nothing to do.
Properties
- Depth
Gets how many messages are waiting to be embedded.
Methods
- ReadAllAsync(CancellationToken)
Reads waiting messages as they arrive, until the backlog is completed or the caller cancels.
- TryEnqueue(StoredEmailId)
Offers one durable message to the worker, refusing the offer when the backlog is full.