grpc: detemplatize Grpc::AsyncClient.#2376
Merged
htuch merged 3 commits intoenvoyproxy:masterfrom Jan 16, 2018
Merged
Conversation
In order to support a singleton gRPC manager (managing TLS state, connection pools for the Google gRPC client, etc.), this PR removes the use of templating in Grpc::AsyncClient and its related interfaces. We initially used templates as they were an easy way to propagate type information. However, we can avoid using them by taking advantage of the Protobuf::Message superclass interface. There is some convenience in using templating for the request/stream callbacks, adapter template classes are provided to make this possible. Signed-off-by: Harvey Tuch <htuch@google.com>
htuch
commented
Jan 16, 2018
| }; | ||
|
|
||
| // Templatized variant of AsyncRequestCallbacks. | ||
| template <class ResponseType> class TypedAsyncRequestCallbacks : public AsyncRequestCallbacks { |
Member
Author
There was a problem hiding this comment.
@mattklein123 this pattern might make sense also (in a separate PR) for the filter instantiation interface. These templatized adapters allow the boiler plate around having to specify a createEmptyProto() method and then later dynamic_cast to be handled by the compiler.
Member
There was a problem hiding this comment.
That sounds great. Let's do it!
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
mattklein123
approved these changes
Jan 16, 2018
Member
mattklein123
left a comment
There was a problem hiding this comment.
This is awesome, thanks. Love the direction. Way easier to read and use.
| }; | ||
|
|
||
| // Templatized variant of AsyncRequestCallbacks. | ||
| template <class ResponseType> class TypedAsyncRequestCallbacks : public AsyncRequestCallbacks { |
Member
There was a problem hiding this comment.
That sounds great. Let's do it!
istio-merge-robot
pushed a commit
to istio/proxy
that referenced
this pull request
Jan 23, 2018
Automatic merge from submit-queue. Update envoy to 01ee725 **What this PR does / why we need it**: Update envoy to envoyproxy/envoy@01ee725 **Special notes for your reviewer**: Related Envoy changes: envoyproxy/envoy#2368 envoyproxy/envoy#2376 **Release note**: ```release-note None ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In order to support a singleton gRPC manager (managing TLS state,
connection pools for the Google gRPC client, etc.), this PR removes the
use of templating in Grpc::AsyncClient and its related interfaces.
We initially used templates as they were an easy way to propagate type
information. However, we can avoid using them by taking advantage of the
Protobuf::Message superclass interface. There is some convenience in
using templating for the request/stream callbacks, adapter template
classes are provided to make this possible.
Risk Level: Low
Testing: No new tests, this is purely refactoring.
Signed-off-by: Harvey Tuch htuch@google.com