Method ClaimAsync
- Namespace
- MailFathom.Application.EmailContent.Storage
- Assembly
- MailFathom.Application.dll
ClaimAsync(MailAccountId, long, StoredContentCeilings, TimeSpan, CancellationToken)
Claims room for one payload against both ceilings, or reports which of them had none.
Task<StoredContentClaimRecord> ClaimAsync(MailAccountId account, long bytes, StoredContentCeilings ceilings, TimeSpan claimLifetime, CancellationToken cancellationToken)
Parameters
accountMailAccountIdThe account whose mail the payload is.
byteslongWhat the payload is expected to occupy.
ceilingsStoredContentCeilingsWhat the deployment and any one user may occupy, where either is bounded at all.
claimLifetimeTimeSpanHow long the claim binds before it expires unreleased.
cancellationTokenCancellationTokenCancels the claim.
Returns
- Task<StoredContentClaimRecord>
The claim that was taken, or the bound that refused it.
Remarks
The per-user ceiling is answered from the accounts assigned to the users the claiming account is assigned to, which is what ADR 0014 means by counting a shared mailbox in full against each of them: the payload is admitted only while every one of those users is under the ceiling.
Exceptions
- ArgumentException
Thrown when
accountnames nothing.- ArgumentOutOfRangeException
Thrown when
bytesis not positive, or the lifetime is not.- InvalidOperationException
Thrown when the caller already holds a transaction the claim would join.