Method RemoveVectorsAsync
- Namespace
- MailFathom.Application.Emails.Embeddings.Generations
- Assembly
- MailFathom.Application.dll
RemoveVectorsAsync(IPersistenceSession, EmbeddingProfileId, int, CancellationToken)
Removes a bounded batch of one superseded generation's vectors.
Task<int> RemoveVectorsAsync(IPersistenceSession session, EmbeddingProfileId profileId, int batchSize, CancellationToken cancellationToken)
Parameters
sessionIPersistenceSessionThe session whose transaction this write joins.
profileIdEmbeddingProfileIdThe generation whose vectors are no longer read.
batchSizeintThe greatest number of vectors to remove in this batch.
cancellationTokenCancellationTokenPropagates caller cancellation.
Returns
- Task<int>
How many vectors this batch removed, which is zero exactly when the generation holds none.
Remarks
Bounded rather than one statement, because a generation of a large mailbox is millions of rows and a single delete would hold one transaction, one lock set, and one write-ahead burst for as long as it took. They are removed rather than kept for a rollback window: they are personal data derived from mail whose purpose ended at the switch, which is the trade ADR 0006 makes deliberately and states the cost of.
Exceptions
- ArgumentOutOfRangeException
Thrown when
batchSizeis not positive.