Repository navigation
Conversation
Add complete service path to service module
andersfugmann
left a comment
There was a problem hiding this comment.
Thanks. LGTM. I've have one question on naming though.
Also before we merge, could you give a simple example of all the metadata created around service endpoints for gRPC? I'd like to understand if more fields could be moved into this structure to clean up and hopefully it would also be easier to add additional fields going forward.
| | Bytes -> Bytes.create 0 | ||
| | Enum (module Enum) -> Enum.from_int_exn 0 | ||
|
|
||
| module type Metainfo = sig |
There was a problem hiding this comment.
Does metainfo have a special definition in the gRPC standard? If not, then I think it would be better to call it something like Service_info
There was a problem hiding this comment.
No it may not be a standard. I agree with Service_info 👍
|
@andersfugmann https://github.com/Nymphium/oresai/blob/main/server/protos/generated/grpc_reflection_v1_reflection.ml#L2025 |
|
Thanks for providing examples. Would it be possible to make the list of endpoints be a list of modules instead to avoid string duplication? let package_service_names =
[ (module Grpc.Reflection.V1.ServerReflection : Rpc); ... ]Should hold the same (if not more) information and avoid string duplication. Btw. Since this information is only needed for gRPC, maybe call the module |
|
@andersfugmann I've applied the changes in 4fb8d6e.
I addeed
It's difficult to achieve that in some cases. |
andersfugmann
left a comment
There was a problem hiding this comment.
Looks very good. Thanks for making the updates.
I'm not sure I follow. The service names are already collected as part of emitting the signature and implementation of all messages and services defined in the proto file. I may take a stab at implementing that, but I would prefer to the two other comments + tests addressed first. Again, Thanks for doing this work. Really appreciated! |
|
@andersfugmann I've updated the code based on your suggestions and added tests 🎍 |
|
Hi. I took a closer look at this a while ago. This should remove the need of a lot of fields currently used for gRPC. See https://github.com/andersfugmann/ocaml-protoc-plugin/tree/andersfugmann/gRPC However, I think the overall approach is wrong. All this could easilly be done outside ocaml-protoc. Since the build system already have access to all the protobuf files, I think it would scale much better if gRPC just created its own files/information as needed. This would allow gRPC maintainers to change and add fields as needed and not be tightly coupled with ocaml-protocol-plugin. wdyt? |
This PR adds
Metainfomodule to each generated files.That module has information to implement gRPC reflection API: