Class MailboxExportArchiveWriter
- Namespace
- MailFathom.Application.Mail.Export
- Assembly
- MailFathom.Application.dll
Produces the zip archive one export carries: a Maildir per folder, one file per message, and the keywords beside them.
public sealed class MailboxExportArchiveWriter : IAsyncDisposable
- Inheritance
-
MailboxExportArchiveWriter
- Implements
- Inherited Members
Remarks
A zip rather than the tar stream ADR 0034 first decided, because the reader is a person leaving the product and every desktop operating system opens a zip with no tooling at all. What is inside it is unchanged: the Maildir++ layout, the stored bytes exactly, the standard flags in each file name, the encoded folder names, and the keywords in a document of their own at the root.
It holds one message at a time and never a folder's contents, which is what lets a mailbox of any size be written through it. The one thing it accumulates is the keywords of the messages that carry any — most carry none — because the document naming them is one entry and an entry is written whole.
Every entry it writes is a relative path under the archive root, composed by MaildirArchiveLayout from encoded segments. None is absolute and none is a link, so no folder name a person or a server chose can place a file outside the archive when it is extracted.
Constructors
- MailboxExportArchiveWriter(Stream)
Opens an archive over the stream it is produced into.
Methods
- DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
- OpenFolder(MailboxExportFolder)
Writes the empty Maildir one folder has, so a folder holding nothing is still in the archive.
- WriteKeywordsAsync(CancellationToken)
Writes the document naming the keywords Maildir file names have no form for.
- WriteMessageAsync(string, ExportableMessage, ReadOnlyMemory<byte>, long, CancellationToken)
Writes one message into its folder's Maildir, exactly as it is stored.