Table of Contents

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

account MailAccountId

The account whose mail the payload is.

bytes long

What the payload is expected to occupy.

cancellationToken CancellationToken

Cancels 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 bytes is not positive.

ArgumentException

Thrown when account names nothing.