Table of Contents

Class UnlinkedStoredFileSweep

Namespace
MailFathom.Application.StoredFiles
Assembly
MailFathom.Application.dll

Removes stored files no record links to, one bounded run at a time, on whichever replica holds the sweep.

public sealed class UnlinkedStoredFileSweep
Inheritance
UnlinkedStoredFileSweep
Inherited Members

Remarks

A file is written before the record links to it, so a failure between the two leaves a file nothing links to. The age floor is what separates that from a write whose link has not committed yet: a file younger than it is never a candidate, whatever its record says.

The sweep is one run for the whole deployment, so it runs only under the lease on its scope, as ADR 0031 decides. A replica refused the lease removes nothing and asks again on its next interval.

Constructors

UnlinkedStoredFileSweep(AccessAuthorization, IStoredFileStore, IUserRecordFileLinks, IWorkLeaseRunner, TimeProvider)

Initializes the sweep.

Fields

MaximumFilesPerRun

How many candidates one run decides about at most.

MinimumFileAge

The age below which a file is never removed, which is far longer than writing a file and linking it takes.

Methods

RunAsync(CancellationToken)

Runs one bounded sweep if this replica takes its lease.