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(iroh-net)!: Do not use &NodeId in APIs as this is Copy #2363

Merged
merged 1 commit into from
Jun 14, 2024

Conversation

flub
Copy link
Contributor

@flub flub commented Jun 14, 2024

Description

Some of our APIs take NodeId by reference, some by value. NodeId
itself however is Copy and takes 32 bytes. I think it is more
consistent and rusty to pass this by value and use the Copy semantics.

Additionally this renames a few more types from PublicKey to NodeId to
keep in line with our convention of using NodeId when used as
identifier rather than cryptography. I believe rust-analyser might be
inserting PublicKey by itself which is unfortunate.

QuicMappedAddr and IpPort are also a Copy types and get the same
treatment.

Breaking Changes

  • Endpoint::conn_type_stream takes NodeId by value instead of by reference.

Notes & open questions

Change checklist

  • Self-review.
  • [ ] Documentation updates if relevant.
  • [ ] Tests if relevant.
  • All breaking changes documented.

Some of our APIs take NodeId by reference, some by value.  NodeId
itself however is Copy and takes 32 bytes.  I think it is more
consistent and rusty to pass this by value and use the Copy semantics.

Additionally this renames a few more types from PublicKey to NodeId to
keep in line with our convention of using NodeId when used as
identifier rather than cryptography.  I believe rust-analyser might be
inserting PublicKey by itself which is unfortunate.

QuicMappedAddr and IpPort are also a Copy types and get the same
treatment.
@divagant-martian divagant-martian added this pull request to the merge queue Jun 14, 2024
Merged via the queue into main with commit e9075f3 Jun 14, 2024
26 checks passed
ppodolsky pushed a commit to izihawa/iroh that referenced this pull request Jun 22, 2024
…omputer#2363)

## Description

Some of our APIs take NodeId by reference, some by value.  NodeId
itself however is Copy and takes 32 bytes.  I think it is more
consistent and rusty to pass this by value and use the Copy semantics.

Additionally this renames a few more types from PublicKey to NodeId to
keep in line with our convention of using NodeId when used as
identifier rather than cryptography.  I believe rust-analyser might be
inserting PublicKey by itself which is unfortunate.

QuicMappedAddr and IpPort are also a Copy types and get the same
treatment.

## Breaking Changes

- Endpoint::conn_type_stream takes NodeId by value instead of by
reference.

## Notes & open questions

<!-- Any notes, remarks or open questions you have to make about the PR.
-->

## Change checklist

- [x] Self-review.
- ~~[ ] Documentation updates if relevant.~~
- ~~[ ] Tests if relevant.~~
- [x] All breaking changes documented.
@flub flub deleted the flub/node-id-is-copy branch October 4, 2024 08:49
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.

3 participants