Table of Contents

Class StoredContentCeiling

Namespace
MailFathom.Application.EmailContent.Storage
Assembly
MailFathom.Application.dll

Bounds how much local storage stored mail content may occupy, for the deployment and for each user.

public sealed class StoredContentCeiling
Inheritance
StoredContentCeiling
Inherited Members

Remarks

The ceilings are one answer for one content store, and one deployment may run several replicas writing into it, so the reservation a claim holds lives in that store rather than in this process. That is what makes them ceilings at all: several folder runs write at the same moment — in one process and, above one replica, in several — and runs that each measured the same occupancy before any of them wrote would each conclude they had room and overshoot the configured limit between them by however much they were allowed to fetch.

A claim is therefore made against IStoredContentClaimStore before a payload is fetched and given back once the payload has either reached storage or been abandoned. A claim nothing wrote — an abandoned fetch, a message that had left the folder, a rolled-back commit — is released with its scope, and one whose holder stopped answering expires, so what binds tracks what storage holds or is about to rather than what runs intended to put there.

Nothing is remembered between claims, which is what makes this scoped rather than process-wide: the occupancy and the outstanding claims are read inside the statement that takes the claim, so there is no level to carry forward and no measurement to grow stale. A deployment that declared neither ceiling takes no claim and reaches no database at all, which is what keeps the cost of a bound on the deployments that asked for one.

The two ceilings are counted in different quantities, and that is deliberate rather than an inconsistency. The deployment's is what the operator's disk fills with, which only the database can report; a user's is the payload the accounts assigned to them hold, which is the only figure attributable to one person at all — a catalogue answers for a table and never for a share of one. So the same payload counts once against a physical figure and once against a logical one, and the two are never expected to agree.

A claim names the account and no user, because the mail is one copy however many users are assigned the mailbox. Which per-user ceilings it is charged to follows from the assignments at the moment of the claim, and a mailbox shared by two people counts in full against both — so a user whose own mailboxes have reached their ceiling holds the shared one back for everybody assigned to it, which is the trade-off ADR 0014 states rather than an oversight here.

Constructors

StoredContentCeiling(IStoredContentClaimStore, long?, long?)

Initializes the ceilings this deployment declared.

Fields

ClaimLifetime

How long a claim binds before it expires unreleased.

Properties

IsConfigured

Gets whether a deployment-wide ceiling is configured at all.

IsConfiguredPerUser

Gets whether a per-user ceiling is configured at all.

Methods

TryClaimAsync(MailAccountId, long, CancellationToken)

Claims room for one payload of one account, or reports which ceiling has none.