Method RepointAtObjectAsync
- Namespace
- MailFathom.Application.EmailContent.Move
- Assembly
- MailFathom.Application.dll
RepointAtObjectAsync(EmailContentKind, Guid, string, DateTimeOffset, CancellationToken)
Points one row at the verified object, leaving the payload the database was holding exactly where it is.
Task<bool> RepointAtObjectAsync(EmailContentKind kind, Guid payloadId, string objectLocator, DateTimeOffset verifiedAt, CancellationToken cancellationToken)
Parameters
kindEmailContentKindThe payload kind, which decides the table.
payloadIdGuidThe identity of the row to repoint.
objectLocatorstringThe whole key the verified object was written under.
verifiedAtDateTimeOffsetWhen the object was read back and found to be the payload the row describes.
cancellationTokenCancellationTokenPropagates caller cancellation.
Returns
Remarks
One statement, conditional on the row still being database-backed, which is what makes it safe to issue outside any transaction the move opened: a re-synchronization that rewrote the payload while the object was being written wins, and this answers false rather than pointing a newer row at an older message.
The payload column is deliberately left as it is. The row is now read from its object and the bytes beside
it are a retained duplicate, held so that a read still works while a deployment is trusting its bucket for the
first time —
ADR 0017 § 6.
Freeing it is an operator's own act through IRetainedContentReleaseStore, because it is the one
irreversible step in the whole move and must not be a consequence of a background pass.
The verification instant is what the safety interval is later measured from, so it is written here rather than derived from anything: it says how long this deployment has been reading that object, which is a different question from how old the mail is. The recorded length and digest stay exactly as they were, so the object remains checkable against the row that names it after the retained copy has gone.