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

fix(examples): Adjust and add examples #1968

Merged
merged 12 commits into from
Jan 29, 2024
Merged

fix(examples): Adjust and add examples #1968

merged 12 commits into from
Jan 29, 2024

Conversation

ramfox
Copy link
Contributor

@ramfox ramfox commented Jan 23, 2024

Description

Fixes incorrect information in our iroh/examples

Also adds an example that shows the most basic way to use iroh to fetch content.

related to #1929

Notes & open questions

Unfortunately, we don't seem to have very simple APIs for fetching (that isn't just exporting the content to an external path). Working through this.

Also adds:

  • BlobDownloadProgress - this takes a stream of DownloadProgress and puts it into a form that will poll the stream by calling finish
  • adjusts the blob_download0 function to not eat certain errors

Change checklist

  • Self-review.
  • Documentation updates if relevant.

@ramfox ramfox added the c-iroh label Jan 23, 2024
@ramfox ramfox self-assigned this Jan 23, 2024
@ramfox ramfox marked this pull request as ready for review January 26, 2024 00:50
iroh/src/node.rs Outdated Show resolved Hide resolved
iroh/src/node.rs Outdated Show resolved Hide resolved
}
}
drop(temp_pin);
progress.send(DownloadProgress::AllDone).await?;
anyhow::Ok(())
let _ = progress.send(DownloadProgress::AllDone).await;
});
Copy link
Contributor

Choose a reason for hiding this comment

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

we should also return the errors from the closure and check for errors here, currently this function will exit with Ok even though it failed

Copy link
Contributor Author

@ramfox ramfox Jan 29, 2024

Choose a reason for hiding this comment

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

I figured that we weren't awaiting the closure because the intended use case was to return once the download process was set up and expect users to listen for errors on the progress stream.

I refactored so that this was closer to the other methods that rely on progress streams for communciation.

Let me know if i'm missing something!

Copy link
Contributor

@dignifiedquire dignifiedquire left a comment

Choose a reason for hiding this comment

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

lgtm

@ramfox ramfox added this pull request to the merge queue Jan 29, 2024
Merged via the queue into main with commit 9f10152 Jan 29, 2024
18 checks passed
@ramfox ramfox deleted the adjust_examples branch January 29, 2024 20:30
fubuloubu pushed a commit to ApeWorX/iroh that referenced this pull request Feb 21, 2024
## Description

Fixes incorrect information in our `iroh/examples`

Also adds an example that shows the most basic way to use iroh to fetch
content.

related to n0-computer#1929 

## Notes & open questions

Unfortunately, we don't seem to have very simple APIs for fetching (that
isn't just exporting the content to an external path). Working through
this.

Also adds:
- `BlobDownloadProgress` - this takes a stream of `DownloadProgress` and
puts it into a form that will poll the stream by calling `finish`
- adjusts the `blob_download0` function to not eat certain errors

## Change checklist

- [x] Self-review.
- [x] Documentation updates if relevant.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants