-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(grpc): server codegen using protobuf rust #2359
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
Conversation
53919c3 to
f99dd76
Compare
f99dd76 to
2bac02c
Compare
14e9aba to
422f9dd
Compare
LucioFranco
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I just have a few comments left inline.
| # Avoid unbound variable errors on MacOS with bash version < 4.4. | ||
| # See: https://stackoverflow.com/a/61551944 | ||
| flags+=( ${TLS_ARRAY[@]+"${TLS_ARRAY[@]}"} ) | ||
| interop/bin/client_"${OS}"_amd64"${EXT}" "${flags[@]}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also make it so we can mix and match codecs here with the client?
| R"rs( | ||
| $trait_doc$ | ||
| #[async_trait] | ||
| pub trait $server_trait$ : std::marker::Send + std::marker::Sync + 'static { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| pub trait $server_trait$ : std::marker::Send + std::marker::Sync + 'static { | |
| pub trait $server_trait$: std::marker::Send + std::marker::Sync + 'static { |
Is this space needed? When we use quote we need this for its interpolation but I don't think the c++ stuff needs that?
| static void GenerateMethods(Printer &printer, const Service &service, | ||
| const GrpcOpts &opts) { | ||
| static const std::string unary_format = R"rs( | ||
| #[allow(non_camel_case_types)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we have this with the other codegen, why do we need this here?
This change adds server code generation using Protobuf Rust. To test the generated code, a Go client and a Tonic client using Prost are used to run interop tests against the Tonic server implemented with Protobuf Rust.
Note: The generated code uses
generate_default_stubs = true, consistent with other gRPC implementations. This avoids breaking builds when a new method is added to the.protofile. In practice, this means that the server trait does not include associated types for response streams.