Interface IStoredContentClaimStore
- Namespace
- MailFathom.Application.EmailContent.Storage
- Assembly
- MailFathom.Application.dll
Holds the room every replica of one deployment has claimed for payloads it is about to store.
public interface IStoredContentClaimStore
Remarks
A claim has to be visible to the other replicas before the payload it covers is fetched, which is the whole reason this is a port rather than a field. A process holding its own reservations bounds itself and nothing else: the occupancy each replica measures describes what storage held a moment ago, and the bytes the others have reserved since are exactly what a ceiling worded as the deployment's would then be overshot by.
Taking a claim is one act rather than a measurement followed by a decision, because the two cannot be separated without reopening the gap this exists to close. The implementation reads what storage occupies, adds what is claimed and unexpired, and inserts the claim, and it does all of it where a concurrent claim cannot interleave.
Every claim expires. A claim covers one message's fetch and store, so a holder that stopped answering leaves bytes reserved for at most that long rather than until an operator notices — which is what makes an expiry the release of last resort beside ReleaseAsync(Guid, CancellationToken), exactly as ADR 0031 makes it for a leased scope.
Methods
- ClaimAsync(MailAccountId, long, StoredContentCeilings, TimeSpan, CancellationToken)
Claims room for one payload against both ceilings, or reports which of them had none.
- ReleaseAsync(Guid, CancellationToken)
Gives one claim's room back, whether or not the payload it covered was ever stored.