Hi all,

I've just post an issue [ARROW-13889] on jira as below. Maybe here is the right 
place to discuss.
----
I'm trying to implement Flight RPC on RPC framework with protobuf message 
support in distributed system.

However, the flight rpc is tied to grpc.
Classes from grpc used in flight server are:
1. `grpc::ServerContext` used in grpc generated code in parameter, and used to 
generate `ServerCallContext`.
2. `grpc::Status` used in grpc generated code as return type.
3. `grpc::ServerReaderWriter` and `grpc::ServerReader` used in massive wrapped 
MessageReader/Writer classes.

1 & 2 are not coupled much with flight, while the third part is the tough work.
Shall we introduce an interface class with same semantics to allow anyone 
implement the writing process to stream, such as 
`arrow::flight::ServerReaderWriter` and `arrow::flight::ServerReader`.

So that, making a shim layer between `FlightServiceImpl` and `FlightServerBase` 
is possible to decouple flight from grpc, meanwhile taking advantage of its 
zero-copy messages.
All message converting processes can be handled in the shim layer.
For example, the function definition of `DoGet` can be `arrow::Status 
DoGet(ServerCallContext* context, const pb::Ticket* request, 
ServerWriter<pb::FlightData>* writer)`, which converts pb messages to flight's 
and call functions from actual business logic implementation from 
`FlightServerBase` as `Status DoGet(const ServerCallContext& context, const 
Ticket& request, std::unique_ptr<FlightDataStream>* stream)`.

While, the client seems more complex, since the cookie stuff and others.
If the idea above is possible, I'll have a exploration on client in depth.
----
The problem, what I'm really facing to, is that I cannot get the grpc generated 
service, which all zero copy operations are implemented, from the rpc framework 
which is wrapped from a grpc server running over TCP/TLS though.
I need to decouple how the messages and streams are comming to FlightServerBase 
functions.

As far as I've tried, in-process grpc is not an option for me to proxy traffic 
from wrapped rpc to original grpc flight server, since C++ implemention of 
in-process grpc, unlike Java, is serializing and deserializing pb messages all 
the time.

Reply via email to