-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
cleanup references to Picker
through dopts
#397
Conversation
I am not sure what you want exactly (can you elaborate?). But since picker On Sun, Oct 11, 2015 at 11:52 AM, Michal Witkowski <notifications@github.com
|
For reference: https://github.com/mwitkow-io/grpc-proxy/blob/master/proxy.go#L187 I can't rely on getting the Basically the problem I'm facing is there is no way of getting a |
Exposing transport. CientTransport to Picker is not the way to go. Pick On Sun, Oct 11, 2015 at 12:22 PM, Michal Witkowski <notifications@github.com
|
I actually would really like to piggy-back on the The problem is that there is currently no way to get a Either one of the two would be immensely helpful:
This means that the |
@iamqizhao, can you PTAL at the issue? I'd really love to get this in so that the gRPC proxy doesn't need a patched gRPC client. |
This won't be merged. Exposing Picker to users is not right way to proceed because calling Picker.Pick(...) will change the internal state of Picker. It works in your case because your use case skips the grpc.ClientConn layer which calls Picker.Pick(...). Your current code messes up the layering of gRPC. I have not got time to figure out a desirable solution for you. But the first glance lets me think you should make a transport Picker by yourself, which is expected for proxy-type use cases. |
@iamqizhao I think there is a slight misunderstanding here. In my implementation, I'm not skipping the As to the |
I said you skip grpc .ClientConn because your code mostly on ClientTransport directly. In general, transport is the private package of gRPC-Go and should be used by users directly. Some special applications might need to operate on transport directly such as grpc proxy. For these applications, the developers should make their own upper layer control logic (counterpart of ClientConn). In principle, grpc.ClientConn is the entity to manage the underlying transport. You should either take it all or none. Trying to break it into pieces and taking advantage of part of them will make gRPC extremely hard to grow and maintain. Your proposal is problematic because: In terms of code duplication, I do not think it is a problem because this is dedicated for a special use case and is not unknown how much is duped when the code becomes stable. It is perfectly fine you can make it in your own repo and share it with other users with similar use cases. I ever thought to have a contrib directory in grpc-go repo for outside contributions and decided to give up due to the potential code quality and maintenance issues. |
s/should be used/should NOT be used/ |
We can keep discussion here. Let me close this PR now to avoid confusing other people. |
I see that |
While working on a Reverse Proxy for gRPC (https://github.com/mwitkow-io/grpc-proxy) I stumbled with the problem of getting a new
ClientTransport
and a newClientStream
in raw form.That's because the Reverse Proxy skips framing and only operates on metadata of the call.
One of the ways to do it was to expose the
Picker
as an interface ofClientConn
, which this CL is.Alternatively, a
NewTransport
method could be added toClientConn
that hides the Picker completely.