refactor: make export a seperate operation from download #2113
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This changes two things about how we expose Iroh in the RPC API:
iroh.blobs.export()
/BlobExportRequest
to export a blob from the internal blob store to the local filesystem. We prominently missed this in our API.blob export
to the CLI. The CLI also keeps the "export after download" functionality, it just issues a second RPC request for the export now.out: DownloadLocation
field fromBlobDownloadRequest
and thus the functionality to automatically export a blob after the download finishes. Instead, users may calliroh.blobs.export
themselves now after the download finishes. This does not make a difference performance-wise (apart from a single RPC roundtrip), because the export operation was already running sequentially after the download before this PR.The untangling of export and download will simplify #2085 quite a bit, because at the moment the fact that the export progress events were emitted from outside the downloader introduced a complication in how we can emit progress events from the downloader (we had to remap the progress IDs to avoid conflicts). With this change, a download will only get progress event from the download itself, so this is solved much more simple.
Notes & open questions
There's no progress reporting for the CLI yet. But we also didn't have that before, so I think it's fine to do as a followup.
Change checklist