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

Enables injectable GossipSub router #503

Merged

Conversation

yhassanzadeh13
Copy link
Contributor

This PR provides an alternative constructor for GossipSub, which is called NewGossipSubWithRouter. In contrast to the existing NewGossipSub constructor that builds a GossipSub instance with the default router, the NewGossipSubWithRouter alternative is capable of building a GossipSub instance with arbitrary PubsubRouter. This empowers building more application-specific routers and injecting them into GossipSub, e.g., the router with an application-specific metric collection.

Copy link
Collaborator

@vyzo vyzo left a comment

Choose a reason for hiding this comment

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

LGTM, just a naming/documentation request.

gossipsub.go Outdated
@@ -1909,6 +1917,10 @@ func (gs *GossipSubRouter) getPeers(topic string, count int, filter func(peer.ID
return peers
}

func (gs *GossipSubRouter) WithTagTracerPubsubOption() Option {
Copy link
Collaborator

Choose a reason for hiding this comment

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

document this please!
Also, lets call it WithDefaultTagTracer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

@vyzo vyzo left a comment

Choose a reason for hiding this comment

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

thank you!

@vyzo vyzo merged commit 1e16100 into libp2p:master Nov 2, 2022
lthibault pushed a commit to lthibault/go-libp2p-pubsub that referenced this pull request Nov 5, 2022
* adds with gossipsub tracker

* renames and add godoc
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.

2 participants