Class MailboxExportExpirySweep
- Namespace
- MailFathom.Application.Mail.Export
- Assembly
- MailFathom.Application.dll
Deletes the archives whose retention period has run out, one bounded pass at a time.
public sealed class MailboxExportExpirySweep
- Inheritance
-
MailboxExportExpirySweep
- Inherited Members
Remarks
Expiry is read from what each export recorded when it finished rather than from a timer held in one process, which is what makes it survive a restart and a replica ending: a deployment that was down for a day deletes on its next pass every archive that came due while it was.
The pass is one run for the whole deployment, so it runs only under the lease on its own scope, as ADR 0031 decides. A replica refused the lease deletes nothing and asks again on its next interval.
The record is written before the object is deleted, which is the ordering every deletion path here uses: a record saying the archive is gone while the object is still there leaves an orphan the reclamation removes, and the opposite order would leave a record offering a download of bytes that are not there.
Constructors
- MailboxExportExpirySweep(AccessAuthorization, IMailboxExportStore, IMailboxExportArchiveStore, IMailboxExportAuditor, IWorkLeaseRunner, TimeProvider)
Initializes the sweep.
Fields
- MaximumArchivesPerRun
How many archives one pass deletes at most.
Methods
- RunAsync(CancellationToken)
Runs one bounded pass if this replica takes the sweep's lease.