-
Notifications
You must be signed in to change notification settings - Fork 999
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!: Move ConnectionId
and PendingPoint
to libp2p-swarm
#3346
Conversation
This belongs into `libp2p-core`.
ConnectionId
and PendingPoint
to `libp2p-swarmConnectionId
and PendingPoint
to libp2p-swarm
This pull request has merge conflicts. Could you please resolve them @thomaseizinger? 🙏 |
This pull request has merge conflicts. Could you please resolve them @thomaseizinger? 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to ignore comments. Good to merge from my end. Neat little step forward!
# 0.39.0 [unreleased] | ||
|
||
- Move `ConnectionId` to `libp2p-swarm`. See [PR 3221]. | ||
- Move `PendingPoint` to `libp2p-swarm` and make it crate-private. See [PR 3221]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh cool, didn't know that it is not exposed from libp2p-swarm
.
/// in test environments. There is in general no guarantee | ||
/// that all connection IDs are based on non-negative integers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the "non-negative" still up to date?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this is here, I just moved the code.
Will update as part of #3327.
pub struct ConnectionId(usize); | ||
|
||
impl ConnectionId { | ||
/// Creates a `ConnectionId` from a non-negative integer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Creates a `ConnectionId` from a non-negative integer. | |
/// Creates a [`ConnectionId`] from a non-negative integer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will go away in #3327 so I am not gonna bother :)
impl std::ops::Add<usize> for ConnectionId { | ||
type Output = Self; | ||
|
||
fn add(self, other: usize) -> Self { | ||
Self(self.0 + other) | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remind me, when do we add two ConnectionId
s? Or is this just to get the next one? In the latter case, it would not make sense to implement the public Add
trait, right? (Feel free to ignore in this pull request.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will get removed in #3327.
In this PR, I am just moving things around without touching functionality!
…ibp2p#3346) Both of these are only needed as part of `libp2p-swarm`. Them residing in `libp2p-core` is a left-over from when `libp2p-core` still contained `Pool`.
Description
Both of these are only needed as part of
libp2p-swarm
. Them residing inlibp2p-core
is a left-over from whenlibp2p-core
still containedPool
.Notes
2nd attempt of getting #3221 in.
Links to any relevant issues
Open Questions
Change checklist