lidavidm commented on a change in pull request #12465:
URL: https://github.com/apache/arrow/pull/12465#discussion_r818837782



##########
File path: cpp/src/arrow/flight/serialization_internal.h
##########
@@ -34,37 +35,22 @@ class Buffer;
 namespace flight {
 namespace internal {
 
-/// Internal, not user-visible type used for memory-efficient reads from gRPC
-/// stream
-struct FlightData {
-  /// Used only for puts, may be null
-  std::unique_ptr<FlightDescriptor> descriptor;
-
-  /// Non-length-prefixed Message header as described in format/Message.fbs
-  std::shared_ptr<Buffer> metadata;
-
-  /// Application-defined metadata
-  std::shared_ptr<Buffer> app_metadata;
-
-  /// Message body
-  std::shared_ptr<Buffer> body;
-
-  /// Open IPC message from the metadata and body
-  ::arrow::Result<std::unique_ptr<ipc::Message>> OpenMessage();
-};
-
 /// Write Flight message on gRPC stream with zero-copy optimizations.
 // Returns Invalid if the payload is ill-formed
-// Returns IOError if gRPC did not write the message (note this is not
-// necessarily an error - the client may simply have gone away)
-Status WritePayload(const FlightPayload& payload,
-                    grpc::ClientReaderWriter<pb::FlightData, pb::PutResult>* 
writer);
-Status WritePayload(const FlightPayload& payload,
-                    grpc::ClientReaderWriter<pb::FlightData, pb::FlightData>* 
writer);
-Status WritePayload(const FlightPayload& payload,
-                    grpc::ServerReaderWriter<pb::FlightData, pb::FlightData>* 
writer);
-Status WritePayload(const FlightPayload& payload,
-                    grpc::ServerWriter<pb::FlightData>* writer);
+// Returns true if the payload was written, false if it was not
+// (likely due to disconnect or end-of-stream, e.g. via an
+// asynchronous cancellation)
+arrow::Result<bool> WritePayload(
+    const FlightPayload& payload,
+    grpc::ClientReaderWriter<pb::FlightData, pb::PutResult>* writer);
+arrow::Result<bool> WritePayload(
+    const FlightPayload& payload,
+    grpc::ClientReaderWriter<pb::FlightData, pb::FlightData>* writer);
+arrow::Result<bool> WritePayload(
+    const FlightPayload& payload,
+    grpc::ServerReaderWriter<pb::FlightData, pb::FlightData>* writer);
+arrow::Result<bool> WritePayload(const FlightPayload& payload,
+                                 grpc::ServerWriter<pb::FlightData>* writer);

Review comment:
       Hmm, yeah, I'll give that a try. I wonder if we can separate the 
Protobuf/gRPC generated code, though, but the rest of the utilities can be 
moved.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to