Method TryClaimAsync
- Namespace
- MailFathom.Application.EmailContent.Storage
- Assembly
- MailFathom.Application.dll
TryClaimAsync(MailAccountId, long, CancellationToken)
Claims room for one payload of one account, or reports which ceiling has none.
[SuppressMessage("Reliability", "CA2000:Dispose objects before losing scope", Justification = "Ownership of the claim passes to the caller through the granted attempt, which disposes it once the payload has reached storage or been abandoned.")]
public Task<StoredContentClaimAttempt> TryClaimAsync(MailAccountId account, long bytes, CancellationToken cancellationToken)
Parameters
accountMailAccountIdThe account whose mail the payload is.
byteslongWhat the payload is expected to occupy.
cancellationTokenCancellationTokenCancels the claim.
Returns
- Task<StoredContentClaimAttempt>
The claim, or the bound that refused it.
Remarks
Both ceilings have to admit the payload, and the store admits them together rather than one after the other: charging one and then discovering the other refuses would leave a population reserved for a payload nothing will fetch, which is precisely what an expiry is a last resort against rather than a routine outcome.
Exceptions
- ArgumentOutOfRangeException
Thrown when
bytesis not positive.- ArgumentException
Thrown when
accountnames nothing.