| 77 | // populate options. |
| 78 | template <typename T, typename... Args> |
| 79 | Status MakeServer(const Location& location, std::unique_ptr<FlightServerBase>* server, |
| 80 | std::unique_ptr<FlightClient>* client, |
| 81 | std::function<Status(FlightServerOptions*)> make_server_options, |
| 82 | std::function<Status(FlightClientOptions*)> make_client_options, |
| 83 | Args&&... server_args) { |
| 84 | *server = std::make_unique<T>(std::forward<Args>(server_args)...); |
| 85 | FlightServerOptions server_options(location); |
| 86 | RETURN_NOT_OK(make_server_options(&server_options)); |
| 87 | RETURN_NOT_OK((*server)->Init(server_options)); |
| 88 | std::string uri = |
| 89 | location.scheme() + "://127.0.0.1:" + std::to_string((*server)->port()); |
| 90 | ARROW_ASSIGN_OR_RAISE(auto real_location, Location::Parse(uri)); |
| 91 | FlightClientOptions client_options = FlightClientOptions::Defaults(); |
| 92 | RETURN_NOT_OK(make_client_options(&client_options)); |
| 93 | return FlightClient::Connect(real_location, client_options).Value(client); |
| 94 | } |
| 95 | |
| 96 | // Helper to initialize a server and matching client with callbacks to |
| 97 | // populate options. |