Method RecordAccountSpendAsync
- Namespace
- MailFathom.Application.Emails.AttachmentText.Limits
- Assembly
- MailFathom.Application.dll
RecordAccountSpendAsync(IPersistenceSession, AttachmentDerivationStep, MailAccountId, long, CancellationToken)
Charges what reading one mailbox's message consumed to every user that mailbox is assigned to.
public Task RecordAccountSpendAsync(IPersistenceSession session, AttachmentDerivationStep derivationStep, MailAccountId account, long unitCount, CancellationToken cancellationToken)
Parameters
sessionIPersistenceSessionThe session committing the readings that work produced.
derivationStepAttachmentDerivationStepThe step the units belong to.
accountMailAccountIdThe mailbox whose mail was read.
unitCountlongWhat the work consumed, in that step's own unit.
cancellationTokenCancellationTokenPropagates caller cancellation.
Returns
- Task
A task that completes when every charge has been issued inside the caller's transaction.
Remarks
Charged to whoever is assigned at the moment the reading happens, and never recharged when an assignment changes: consumption is a record of an event rather than a running apportionment. The deployment's own figure is charged once by the same write, so a mailbox assigned to nobody still moves it and a mailbox three people share moves it by what was read rather than by three times it.
A deployment with no ceiling is charged exactly as one with a ceiling is. The count is what an operator watches to decide whether to declare a ceiling at all, so leaving it unwritten would make the figure appear only once it was already too late to be useful.
Exceptions
- ArgumentNullException
Thrown when
sessionis null.- ArgumentOutOfRangeException
Thrown when the count is negative.