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

WIP: Have http and tchannel transports optionally take in a net.Listener #897

Closed
wants to merge 2 commits into from

Conversation

bufdev
Copy link
Contributor

@bufdev bufdev commented Apr 7, 2017

This is just a concept, feel free to reject. This is re: #866, I would also add this to grpc if we thought this was the way to go.

Note this is technically a breaking change because Serve(net.Listener) error is added to tchannel.Channel. I don't know if this is OK, but if not, I can make a ChannelExtended interface or such that includes this method, and we can change this in 2.0.

@mention-bot
Copy link

@peter-edge, thanks for your PR! By analyzing the history of the files in this pull request, we identified @kriskowal to be a potential reviewer.

@bufdev bufdev changed the title Have http and tchannel transports optionally take in a net.Listener WIP: Have http and tchannel transports optionally take in a net.Listener Apr 10, 2017
@bufdev
Copy link
Contributor Author

bufdev commented Apr 10, 2017

Putting a hold on this - I'm having some issues with TChannel when I pass in a listener to the Channel instead of an address, I've been playing with it for way too long locally.

@kriskowal
Copy link
Contributor

@peter-edge I think adding ListenerChannel as an option would be a fine solution.

Note that only tchannel.ChannelTransport uses the WithChannel option. You have more control over the underlying channel for tchannel.Transport.

You can use a private interface or even bind directly to the tchannel Channel internally, since that channel is not exposed to or provided by the user.

@bufdev
Copy link
Contributor Author

bufdev commented Apr 11, 2017 via email

@kriskowal
Copy link
Contributor

There are currently two TChannel transport implementations, but they share the same options and config type for the sake of using the same package and names.

  • ChannelTransport was the first implementation, and it supports threading an existing TChannel Channel (the interface we expose). This implementation is friendly to gradual migration to YARPC, where you can use an existing channel using TChannel RPC features for some registered handlers and configured callers. We renamed it from Transport to ChannelTransport before we cut 1.0 because we had to ship with TChannel support, but didn’t manage to ship YARPC’s load balancer abstraction to TChannel until last quarter.

  • Transport is the new implementation that supports peer choosers. It does not support threading a Channel because we had to subvert the TChannel subchannel handler to take over the load balancing concern and accept requests for any service name.

Consequently, although you can provide a WithChannel and ServiceName option to both NewTransport and NewChannelTransport, only the latter uses them.

What this implies for this change:

In this change you’re breaking backward compatibility by adding a Serve method to the Channel interface. We use that interface in two different ways. One is as an option for NewChannelTransport. The other is for a private property of Transport. You could introduce a private listenChannel interface that would not interfere with the old ChannelTransport options.

@bufdev
Copy link
Contributor Author

bufdev commented May 11, 2017

Closing this for now, may revisit at another time

@bufdev bufdev closed this May 11, 2017
@bufdev bufdev deleted the listener branch June 7, 2017 13:11
@bufdev bufdev restored the listener branch June 7, 2017 13:11
@bufdev bufdev deleted the listener branch July 3, 2017 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants