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: export PeerSample #3745

Merged
merged 1 commit into from
Feb 26, 2025
Merged

refactor: export PeerSample #3745

merged 1 commit into from
Feb 26, 2025

Conversation

Elvis339
Copy link
Contributor

Why this should be merged

Closes #3734

Improves modularity by refactoring and exporting PeerSample, ensuring reuse.

How this works

The PeerSample component has been refactored and exported, making it easier to import and use elsewhere.

How this was tested

Need to be documented in RELEASES.md?

  • Yes
  • No

@Elvis339 Elvis339 self-assigned this Feb 25, 2025
@Elvis339 Elvis339 requested a review from joshua-kim as a code owner February 25, 2025 17:24
@@ -197,11 +197,12 @@ func (p *Peers) Sample(limit int) []ids.NodeID {
return p.set.Sample(limit)
}

type peerSampler struct {
// PeerSampler implements NodeSampler
type PeerSampler struct {
peers *Peers
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't this need to be exported too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't having PeerSampler exported and Sample is enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed to export peers instead of adding constructor privately.

@Elvis339 Elvis339 requested a review from joshua-kim February 26, 2025 18:11
@joshua-kim joshua-kim enabled auto-merge February 26, 2025 18:22
- Export PeerSample type
- Add documentation
- Export peers field from PeerSampler
@Elvis339 Elvis339 force-pushed the add-public-nodesampler-api branch from 68781fb to 4c1da47 Compare February 26, 2025 18:29
@joshua-kim joshua-kim added this pull request to the merge queue Feb 26, 2025
Merged via the queue into master with commit 667c6b0 Feb 26, 2025
22 checks passed
@joshua-kim joshua-kim deleted the add-public-nodesampler-api branch February 26, 2025 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

network/p2p: add public NodeSampler API
4 participants