Class StoredContentCeiling
- Namespace
- MailFathom.Application.EmailContent.Storage
- Assembly
- MailFathom.Application.dll
Bounds how much local storage the stored mail content of the whole deployment may occupy.
public sealed class StoredContentCeiling
- Inheritance
-
StoredContentCeiling
- Inherited Members
Remarks
The ceiling is one answer for one content store, so it is a single process-wide instance rather than a value each run reads for itself. That is what makes it a ceiling at all: several folder work units run at the same moment by default, 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 this instance before a payload is fetched and kept only for what was actually stored. A claim nothing wrote — an abandoned fetch, a message that had left the folder, a rolled-back commit — is released with its scope, so the level tracks what storage holds rather than what runs intended to put there.
The level is an estimate maintained between measurements rather than a reading taken per message, because measuring costs a query and the whole purpose of a ceiling is to be approached rarely. Observe(long, long) replaces it with a fresh measurement and carries forward whatever was claimed while that measurement was being taken, so a run starting mid-write neither loses those bytes nor counts them twice.
Constructors
- StoredContentCeiling(long?)
Initializes the ceiling for the process.
Properties
- ClaimMark
Gets the mark to capture before taking a measurement, so what is claimed during it is not lost.
- IsConfigured
Gets whether a ceiling is configured at all.
- OccupiedBytes
Gets how much local storage the stored content is currently believed to occupy.
Methods
- Observe(long, long)
Adopts a fresh measurement of what storage holds.
- TryClaim(long)
Claims room for one payload, or reports that the ceiling has none.