Table of Contents

Interface IStoredFileStore

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

Holds the binary files users supply, wherever this deployment stores content next.

public interface IStoredFileStore

Remarks

A file is a record of its own — who it belongs to, its media type, its length, and its digest — and its octets follow ContentStorage:Backend exactly as mail content does: into the database, or into the object store before the row that points at it is written. A record that shows a file links to it by StoredFileId and never holds the octets itself.

Every act but the sweep's read names the owner beside the file, so an identifier learned elsewhere reaches nobody else's file: a file of another user reads as absent, is not held, and is not removed.

Writing a file and linking it are two acts, so a failure between them leaves a file nothing links to. That is the designed failure rather than a leak: UnlinkedStoredFileSweep removes such a file once it is older than the time any write takes to be linked.

Methods

FindUnmentionedAsync(DateTimeOffset, int, CancellationToken)

Finds files written before an instant whose identifier their owner's record does not mention.

HoldsAsync(UserId, StoredFileId, CancellationToken)

Reports whether this deployment holds one file for one user, without reading its octets.

ReadAsync(UserId, StoredFileId, CancellationToken)

Reads the octets of one file of one user.

RemoveAsync(UserId, StoredFileId, CancellationToken)

Removes one file of one user, the row with the commit and the object immediately afterwards.

WriteAsync(UserId, string, ReadOnlyMemory<byte>, CancellationToken)

Writes one file for one user, placing its octets before the row that records it.