Redesign the Rust crates. #567
Open
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.
This is a revamp of #483, cc @duskmoon314 @chrispsommers @antoninbas.
It makes the following high-level changes:
rust/following standard Rust/Cargo conventions.FileDescriptorSet.prostandtonicare just 2 of several alternative proto/grpc implementations in Rust, and there is also an official Googlegrpc-rustproject in the works. With the new design, we can easily add additional crates for other Rust proto/grpc implementations down the road if needed.google.rpc.Statusis now vendored in theproto/directory to simplify the build, since there was no Rust crate providing it available. I added a Github Action to ensure the file stays up-to-date (though it hasn't seen any changes in years anyway).codegen/based on (2) and (7).cargo upgrade --incompatible).Breaking changes
This PR does make some breaking changes:
p4runtime::p4runtime_{server, client}moved top4runtime_tonic::p4::v1::p4runtime_{server, client}to mirror the proto pathp4.v1.P4Runtimeof the corresponding service, following standard conventions.p4runtimewas replaced by 2 new cratesp4runtime-prostandp4runtime-tonic.@duskmoon314, please let me know if you have any concerns about the breaking changes. If so, it would be easy to add back a legacy crate
p4runtimeto provide backwards compatibility. Or, you could just point to an older version of this repository in yourCargo.toml:To check in or not to check in
With this PR, the generated code is no longer checked in. On the one hand, this has some advantages:
rust/) using a idiomatic Rust/Cargo setupOn the other hand, as @duskmoon314 explained in #483 (comment):
I addressed these points as follows:
rust/README.md(though they are admittedly not as convenient as seeing the code right on GitHub).rust/README.md. This seems to have been a misunderstanding of how this mechanism works.