A simple example - act like DoPut
| 195 | |
| 196 | // A simple example - act like DoPut |
| 197 | Status TestFlightServer::RunExchangePut(std::unique_ptr<FlightMessageReader> reader, |
| 198 | std::unique_ptr<FlightMessageWriter> writer) { |
| 199 | ARROW_ASSIGN_OR_RAISE(auto schema, reader->GetSchema()); |
| 200 | if (!schema->Equals(ExampleIntSchema(), false)) { |
| 201 | return Status::Invalid("Schema is not as expected"); |
| 202 | } |
| 203 | RecordBatchVector batches; |
| 204 | RETURN_NOT_OK(ExampleIntBatches(&batches)); |
| 205 | FlightStreamChunk chunk; |
| 206 | for (const auto& batch : batches) { |
| 207 | ARROW_ASSIGN_OR_RAISE(chunk, reader->Next()); |
| 208 | if (!chunk.data) { |
| 209 | return Status::Invalid("Expected another batch"); |
| 210 | } |
| 211 | if (!batch->Equals(*chunk.data)) { |
| 212 | return Status::Invalid("Batch does not match"); |
| 213 | } |
| 214 | } |
| 215 | ARROW_ASSIGN_OR_RAISE(chunk, reader->Next()); |
| 216 | if (chunk.data || chunk.app_metadata) { |
| 217 | return Status::Invalid("Too many batches"); |
| 218 | } |
| 219 | |
| 220 | RETURN_NOT_OK(writer->WriteMetadata(Buffer::FromString("done"))); |
| 221 | return Status::OK(); |
| 222 | } |
| 223 | |
| 224 | // Read some number of record batches from the client, send a |
| 225 | // metadata message back with the count, then echo the batches back. |
nothing calls this directly
no test coverage detected