Server Reflection is a gRPC feature that allows ‘dynamic’ clients, such as command-line tools for debugging, to discover the protocol used by a gRPC server at run time. They can then use this metadata to implement things like completion and sending arbitrary commands.
However, for the proxy that implements the CloudState protocol, it goes a little further by making the proxy capable of creating an implementation based on the client services specification (user functions). For this reason I consider reflection to be two items to be implemented:
- Classic gRPC Reflection
- Dynamic implementation of gRPC services based on the client definition.
For the first item we have to consider implementing the following issue:
elixir-grpc/grpc#148
For the second item, we have to implement the following steps:
1 - Create the FileDescriptor from what arrived at EntityDiscovery
2 - Use the internal apis of the elixir protobuf library to generate the source code of the Elixir modules of these Protos.
3 - Compile these codes with Code.compile_string or compile_file
4 - Dynamically generate the module with the client's gRPC implementation, something like
defmodule Mongoose.ModuleName
use GRPC.Server, service: ServiceNameHere
// define the calling method here, this method should call a Mongoose handler, that is, it is just a facade
end
5 - Create the module with the Endpoint (or leave a pre-defined module that injects the endpoints via metaprogramming)
6 - Compile the generated module
7 - Bootstrap the entire gRPC code over your own supervision tree.
Task implementation Index:
Server Reflection is a gRPC feature that allows ‘dynamic’ clients, such as command-line tools for debugging, to discover the protocol used by a gRPC server at run time. They can then use this metadata to implement things like completion and sending arbitrary commands.
However, for the proxy that implements the CloudState protocol, it goes a little further by making the proxy capable of creating an implementation based on the client services specification (user functions). For this reason I consider reflection to be two items to be implemented:
For the first item we have to consider implementing the following issue:
elixir-grpc/grpc#148
For the second item, we have to implement the following steps:
1 - Create the FileDescriptor from what arrived at EntityDiscovery
2 - Use the internal apis of the elixir protobuf library to generate the source code of the Elixir modules of these Protos.
3 - Compile these codes with Code.compile_string or compile_file
4 - Dynamically generate the module with the client's gRPC implementation, something like
5 - Create the module with the Endpoint (or leave a pre-defined module that injects the endpoints via metaprogramming)
6 - Compile the generated module
7 - Bootstrap the entire gRPC code over your own supervision tree.
Task implementation Index: