Class WorkLeaseHolder
- Namespace
- MailFathom.Application.Coordination
- Assembly
- MailFathom.Application.dll
Names the hold a lease is taken under, so a later write can be refused when the lease has moved on.
public sealed record WorkLeaseHolder : IEquatable<WorkLeaseHolder>
- Inheritance
-
WorkLeaseHolder
- Implements
- Inherited Members
Remarks
It identifies one hold rather than one process, for the reason a job's lease owner identifies one attempt. Renewal and release are conditional on this value still matching the row, so a replica whose lease was reclaimed and which then releases late finds the scope held by whoever replaced it and writes nothing. A value that named only the process would let a replica that lost its hold and took it back release a hold it no longer had — and would make a restart under the same name indistinguishable from the hold it is replacing.
The text is MailFathom's own — a generated identity for the hold — and never anything from a message. A hold taken by a build that stamps one carries that build ahead of the generated part, separated by BuildSeparator, which is the one thing anything reads out of the value rather than comparing it whole. It is written into the holder rather than into a column of its own because a column would outlive the hold it described: an older build's takeover rewrites the holder with one of its own and leaves every column it does not know exactly as it found it, so the newer build's value would go on standing beside the older build's hold. Carrying it here makes the two inseparable — a hold either names a build or is a hold some other build took.
Fields
- BuildSeparator
What separates the build a hold was taken by from the generated identity of the hold.
- MaximumLength
The greatest length a holder may have, which bounds the column it is stored in.
Properties
- Value
Gets the text a stored lease is compared against.
Methods
- Create(string)
Creates a holder for one hold.
- ForBuild(string)
Creates a holder for a new hold, naming the build taking it.
- NewHold()
Creates a holder for a new hold, unique across every process that shares the database.
- ToString()
Returns a string that represents the current object.