| 296 | } // namespace |
| 297 | |
| 298 | Status ServerTransport::DoGet(const ServerCallContext& context, const Ticket& ticket, |
| 299 | ServerDataStream* stream) { |
| 300 | std::unique_ptr<FlightDataStream> data_stream; |
| 301 | RETURN_NOT_OK(base_->DoGet(context, ticket, &data_stream)); |
| 302 | |
| 303 | if (!data_stream) return Status::KeyError("No data in this flight"); |
| 304 | |
| 305 | // Write the schema as the first message in the stream |
| 306 | ARROW_ASSIGN_OR_RAISE(auto schema_payload, data_stream->GetSchemaPayload()); |
| 307 | ARROW_ASSIGN_OR_RAISE(auto success, stream->WriteData(schema_payload)); |
| 308 | // Connection terminated |
| 309 | if (!success) return Status::OK(); |
| 310 | |
| 311 | // Consume data stream and write out payloads |
| 312 | while (true) { |
| 313 | ARROW_ASSIGN_OR_RAISE(FlightPayload payload, data_stream->Next()); |
| 314 | // End of stream |
| 315 | if (payload.ipc_message.metadata == nullptr) break; |
| 316 | ARROW_ASSIGN_OR_RAISE(auto success, stream->WriteData(payload)); |
| 317 | // Connection terminated |
| 318 | if (!success) return Status::OK(); |
| 319 | } |
| 320 | RETURN_NOT_OK(stream->WritesDone()); |
| 321 | return data_stream->Close(); |
| 322 | } |
| 323 | |
| 324 | Status ServerTransport::DoPut(const ServerCallContext& context, |
| 325 | ServerDataStream* stream) { |
nothing calls this directly
no test coverage detected