MCPcopy Create free account
hub / github.com/apache/arrow / RunFlightGrpc

Function RunFlightGrpc

cpp/examples/arrow/flight_grpc_example.cc:78–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76};
77
78arrow::Status RunFlightGrpc() {
79 std::unique_ptr<flight::FlightServerBase> server;
80 server.reset(new SimpleFlightServer());
81
82 flight::Location bind_location;
83 ARROW_RETURN_NOT_OK(
84 flight::Location::ForGrpcTcp("0.0.0.0", FLAGS_port).Value(&bind_location));
85 flight::FlightServerOptions options(bind_location);
86
87 HelloWorldServiceImpl grpc_service;
88 int extra_port = 0;
89
90 options.builder_hook = [&](void* raw_builder) {
91 auto* builder = reinterpret_cast<grpc::ServerBuilder*>(raw_builder);
92 builder->AddListeningPort("0.0.0.0:0", grpc::InsecureServerCredentials(),
93 &extra_port);
94 builder->RegisterService(&grpc_service);
95 };
96 ARROW_RETURN_NOT_OK(server->Init(options));
97 std::cout << "Listening on ports " << FLAGS_port << " and " << extra_port << std::endl;
98 ARROW_RETURN_NOT_OK(server->SetShutdownOnSignals({SIGTERM}));
99 ARROW_RETURN_NOT_OK(server->Serve());
100
101 return arrow::Status::OK();
102}
103
104int main(int argc, char** argv) {
105 gflags::ParseCommandLineFlags(&argc, &argv, true);

Callers 1

mainFunction · 0.85

Calls 6

SetShutdownOnSignalsMethod · 0.80
ServeMethod · 0.80
OKFunction · 0.50
resetMethod · 0.45
ValueMethod · 0.45
InitMethod · 0.45

Tested by

no test coverage detected