* A copyable interface to manage a connection to a gRPC server. All * `Connection` copies share the same gRPC channel which is thread safe. Note * that the actual connection is established lazily by the gRPC library at the * time an RPC is made to the channel. */
| 110 | * time an RPC is made to the channel. |
| 111 | */ |
| 112 | class Connection |
| 113 | { |
| 114 | public: |
| 115 | Connection( |
| 116 | const std::string& uri, |
| 117 | const std::shared_ptr<::grpc::ChannelCredentials>& credentials = |
| 118 | ::grpc::InsecureChannelCredentials()) |
| 119 | : channel(::grpc::CreateChannel(uri, credentials)) {} |
| 120 | |
| 121 | explicit Connection(std::shared_ptr<::grpc::Channel> _channel) |
| 122 | : channel(std::move(_channel)) {} |
| 123 | |
| 124 | const std::shared_ptr<::grpc::Channel> channel; |
| 125 | }; |
| 126 | |
| 127 | |
| 128 | /** |