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

Argument to NewFooClient() in generated proto code is a grpc.ClientConn struct #589

Closed
zellyn opened this issue Mar 8, 2016 · 4 comments

Comments

@zellyn
Copy link
Contributor

zellyn commented Mar 8, 2016

The argument to NewFooClient() in the generated proto code (eg. pb.NewGreeterClient(conn) here) is grpc.ClientConn, a concrete struct type, rather than an interface.

This prevents us from creating stubs against our own types. We'd like to (a) create a "client" object that has a collection of connections configured from a yaml config file, and dispatches Calls to the right connection based on service name, and (b) add interception on the client side.

@dsymonds
Copy link
Contributor

dsymonds commented Mar 8, 2016

I'm not sure that would help, without making a truly massive interface for ClientConn. That type has a good number of internals that the grpc package uses (via, say, grpc.Invoke).

What is the bigger task you are trying to achieve? There's probably a better approach. Can you describe your goal in a bit more detail?

@zellyn
Copy link
Contributor Author

zellyn commented Mar 8, 2016

Yeah, after posting that I noticed that the whole clientConn is passed to Invoke and NewClientStream 😞

(Our internal stubby-alike passes a "Channel" interface, which is much narrower, and I got the two mixed up.)

I think we've figured out workarounds for our use case, so I'll close this. Sorry for the noise.

@zellyn zellyn closed this as completed Mar 8, 2016
@iamqizhao
Copy link
Contributor

Yes, we had a lot of discussions with Go team and decided not to make ClientConn an interface (which is kinda common thing to do in other languages to support load balance channel).

I think your requirements can be addressed once we have a good client interceptor solution. You can probably summarize your requirements and put it into a comment in the designdoc of the interceptor.

@zellyn
Copy link
Contributor Author

zellyn commented Mar 23, 2016

I created a separate doc instead.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants