Skip to content

feat(iroh): implement Discovery for Arc'ed Discovery types #3107

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

Merged
merged 3 commits into from
Jan 13, 2025

Conversation

flub
Copy link
Contributor

@flub flub commented Jan 8, 2025

Description

Nothing in the trait stops it from working for discovery structs which
are Arc'ed. Not all discovery types are in control of the users so
this is helpful.

I stumbled upon this because StaticProvider is not Clone.

Breaking Changes

Notes & open questions

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.

Copy link

github-actions bot commented Jan 8, 2025

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3107/docs/iroh/

Last updated: 2025-01-10T10:14:07Z

@flub flub force-pushed the flub/discovery-arc branch from 5af139d to bf23bbe Compare January 8, 2025 17:38
@flub flub requested a review from a team January 8, 2025 17:43
Nothing in the trait stops it from working for discovery structs which
are Arc'ed.  Not all discovery types are in control of the users so
this is helpful.

I stumbled upon this because StaticProvider is not Clone.
@flub flub force-pushed the flub/discovery-arc branch from bf23bbe to 4d28dfa Compare January 8, 2025 17:44
Copy link

github-actions bot commented Jan 8, 2025

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: 0f30e68

@@ -725,6 +728,21 @@ mod tests {
.expect("time drift")
.as_micros() as u64
}

#[tokio::test]
async fn test_arc_discovery() -> TestResult {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe use something like static_assert instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm unsure what you have in mind. Could you elaborate a bit more?

Copy link
Contributor

@dignifiedquire dignifiedquire Jan 9, 2025

Choose a reason for hiding this comment

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

using https://crates.io/crates/static_assertions you can just check for trait bounds, instead of doing this manual adding

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess that has assert_impl_all which I could use. But then, how? Adding it at build-time would just put it right below the impl... which seems a bit odd, because it's implemented right there. Plus it would add a new build-time dependency.

I can use it in the test I guess, but again a new dependency seems like a lot.

I added this test mostly to assure myself I did the right thing. But talking about it here seems to have little value? Maybe it should just be removed instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it should just be removed instead?

maybe, not sure testing this makes some sense, but also it's a static thing, so I don't think there is much value in the test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed, PTAL

@flub flub requested a review from dignifiedquire January 9, 2025 14:15
@flub flub self-assigned this Jan 9, 2025
@flub flub added this pull request to the merge queue Jan 13, 2025
Merged via the queue into main with commit f675525 Jan 13, 2025
26 checks passed
@flub flub deleted the flub/discovery-arc branch January 13, 2025 10:35
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