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

Added RoutedHost #153

Merged
merged 5 commits into from
Apr 25, 2019
Merged

Added RoutedHost #153

merged 5 commits into from
Apr 25, 2019

Conversation

alexh
Copy link
Contributor

@alexh alexh commented Apr 20, 2019

As per #150, implement RoutedHost

@alexh alexh requested a review from zixuanzh April 21, 2019 18:18

# TODO enable support for other host type
# TODO routing unimplemented
host = BasicHost(swarm_opt)
host = RoutedHost(swarm_opt, disc_opt)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should still provide the option for only starting a BasicHost. Can we only return a BasicHost if no disc_opt is passed in and a RoutedHost only when a disc_opt is introduced?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

def get_kad_network(self):
return self.kad_network

def kad_listen(self, port, interface='0.0.0.0'):
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we call these functions routed_listen instead of kad_listen since kademlia is not the only way to do routing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

@raulk
Copy link
Member

raulk commented Apr 22, 2019

Hey folks, we're moving away from the specialised host construction in go-libp2p towards a service-based host construction wired with dependency injection and IoC (inversion of control). See: libp2p/go-libp2p#467.

With the modular dialer, instead of wrapping a host within a RoutedHost, attaching a DHT to the host with a peer discovery capability would inject a component in the dialer to resolve addrs from the DHT when a dial is carried out.

@alexh
Copy link
Contributor Author

alexh commented Apr 25, 2019

Thanks for the heads up @raulk! We will add refactoring this PR using dependency injection and IoC to the roadmap. We should have this done in the next few days!

Copy link
Contributor

@zixuanzh zixuanzh left a comment

Choose a reason for hiding this comment

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

Codecov went down because initialize_default_kademlia is not called in the latest commit. Will land this PR and then open a new one to refactor dependency injection in RoutedHost. Most tests should be added if Codecov is still below expectation.

@alexh alexh merged commit fc4fc74 into master Apr 25, 2019
@ntninja ntninja mentioned this pull request Jul 26, 2019
16 tasks
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.

3 participants