Table of Contents

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

account MailAccountId

The account whose mail the payload is.

bytes long

What the payload is expected to occupy.

ceilings StoredContentCeilings

What the deployment and any one user may occupy, where either is bounded at all.

claimLifetime TimeSpan

How long the claim binds before it expires unreleased.

cancellationToken CancellationToken

Cancels 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 account names nothing.

ArgumentOutOfRangeException

Thrown when bytes is not positive, or the lifetime is not.

InvalidOperationException

Thrown when the caller already holds a transaction the claim would join.