Skip to content

Add mailbox plugin and file manager for downloads

akwizgran requested to merge 2292-mailbox-file-manager into master

This branch adds a mailbox plugin and a file manager for handling mailbox downloads. The upload parts of the file manager will be added later.

A download worker can call MailboxFileManager#createTempFileForDownload() to create a local file that can be passed to MailboxApi#getFile(). When the download finishes, the worker calls MailboxFileManager#handleDownloadedFile(). The file manager is responsible for the file from this point on.

The file manager uses the plugin to create a TransportConnectionReader for reading from the file. This is passed to the ConnectionManager. If the read succeeds then the file is deleted. The file is also deleted if the read fails, unless the app is shutting down, in which case the manager leaves the file in the download directory and tries again to process it at the next startup. This is meant to prevent files from being wrongly deleted if the read is interrupted during shutdown.

Part of #2292 (closed).

Edited by akwizgran

Merge request reports