A copyable interface to manage an internal gRPC runtime instance for asynchronous gRPC calls.
More...
|
| | Runtime () |
| |
| template<typename Stub , typename Request , typename Response > |
| Future< RpcResult< Response > > | call (const Channel &channel, std::unique_ptr<::grpc::ClientAsyncResponseReader< Response >>(Stub::*rpc)(::grpc::ClientContext *, const Request &,::grpc::CompletionQueue *), const Request &request) |
| | Sends an asynchronous gRPC call. More...
|
| |
| void | terminate () |
| | Asks the internal gRPC runtime instance to shut down the CompletionQueue, which would stop its looper thread, drain and fail all pending gRPC calls in the CompletionQueue, then asynchronously join the looper thread. More...
|
| |
| Future< Nothing > | wait () |
| |
A copyable interface to manage an internal gRPC runtime instance for asynchronous gRPC calls.
A gRPC runtime instance includes a gRPC CompletionQueue to manage outstanding requests, a looper thread to wait for any incoming responses from the CompletionQueue, and a process to handle the responses. All Runtime copies share the same gRPC runtime instance. Usually we only need a single gRPC runtime instance to handle all gRPC calls, but multiple instances can be instantiated for more parallelism or isolation. NOTE: The destruction of the internal gRPC runtime instance is a blocking operation: it waits for the managed process to terminate. The user should ensure that this only happens at shutdown.