Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: make export a seperate operation from download #2113

Merged
merged 5 commits into from
Mar 22, 2024

Conversation

Frando
Copy link
Member

@Frando Frando commented Mar 22, 2024

Description

This changes two things about how we expose Iroh in the RPC API:

  • Add iroh.blobs.export() / BlobExportRequest to export a blob from the internal blob store to the local filesystem. We prominently missed this in our API.
  • Add 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.
  • Remove the out: DownloadLocation field from BlobDownloadRequest and thus the functionality to automatically export a blob after the download finishes. Instead, users may call iroh.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

  • Self-review.
  • Documentation updates if relevant.
  • Tests if relevant.

@Frando Frando force-pushed the refactor/no-export-on-download branch from f4c9dfe to 7927f0b Compare March 22, 2024 11:41
iroh/src/rpc_protocol.rs Outdated Show resolved Hide resolved
iroh/src/client/blobs.rs Show resolved Hide resolved
false => ExportMode::Copy,
};
tracing::info!("exporting to {} -> {}", path.display(), absolute.display());
let stream = iroh.blobs.export(hash, absolute, recursive, mode).await?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this time, but this is not a generic HashSeq export but an export that will only work for a specific type of HashSeq, a collection.

@Frando Frando force-pushed the refactor/no-export-on-download branch from 2397231 to 8e5180a Compare March 22, 2024 12:51
@Frando Frando added this pull request to the merge queue Mar 22, 2024
Merged via the queue into main with commit 488be5b Mar 22, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants