Channels represent a connection to an endpoint. Created by CreateChannel. More...
#include <channel.h>
Public Member Functions | |
def | __enter__ (self) |
def | __exit__ (self, exc_type, exc_val, exc_tb) |
def | close (self) |
std::string | GetLoadBalancingPolicyName () const |
Returns the LB policy name, or the empty string if not yet available. More... | |
std::string | GetServiceConfigJSON () const |
grpc_connectivity_state | GetState (bool try_to_connect) override |
def | stream_stream (self, method, request_serializer=None, response_deserializer=None) |
def | stream_unary (self, method, request_serializer=None, response_deserializer=None) |
def | subscribe (self, callback, try_to_connect=False) |
def | unary_stream (self, method, request_serializer=None, response_deserializer=None) |
def | unary_unary (self, method, request_serializer=None, response_deserializer=None) |
def | unsubscribe (self, callback) |
~Channel () override | |
![]() | |
template<typename T > | |
void | NotifyOnStateChange (grpc_connectivity_state last_observed, T deadline, grpc::CompletionQueue *cq, void *tag) |
template<typename T > | |
bool | WaitForConnected (T deadline) |
Wait for this channel to be connected. More... | |
template<typename T > | |
bool | WaitForStateChange (grpc_connectivity_state last_observed, T deadline) |
virtual | ~ChannelInterface () |
![]() | |
virtual | ~CallHook () |
Private Attributes | |
grpc_channel *const | c_channel_ |
std::atomic< CompletionQueue * > | callback_cq_ {nullptr} |
const std::string | host_ |
std::vector< std::unique_ptr< grpc::experimental::ClientInterceptorFactoryInterface > > | interceptor_creators_ |
grpc::internal::Mutex | mu_ |
Friends | |
void | experimental::ChannelResetConnectionBackoff (Channel *channel) |
std::shared_ptr< Channel > | grpc::CreateChannelInternal (const std::string &host, grpc_channel *c_channel, std::vector< std::unique_ptr< grpc::experimental::ClientInterceptorFactoryInterface >> interceptor_creators) |
template<class InputMessage , class OutputMessage > | |
class | grpc::internal::BlockingUnaryCallImpl |
class | grpc::internal::InterceptedChannel |
class | grpc::testing::ChannelTestPeer |
Channels represent a connection to an endpoint. Created by CreateChannel.
Affords RPC invocation via generic methods on client-side. Channel objects implement the Context Manager type, although they need not support being entered and exited multiple times.
Definition at line 54 of file include/grpcpp/channel.h.
|
override |
Definition at line 63 of file channel_cc.cc.
|
private |
Definition at line 53 of file channel_cc.cc.
def grpc.Channel.__enter__ | ( | self | ) |
Enters the runtime context related to the channel object.
Reimplemented in grpc._channel.Channel, grpc._interceptor._Channel, and grpc_testing._channel._channel.TestingChannel.
Definition at line 1071 of file src/python/grpcio/grpc/__init__.py.
def grpc.Channel.__exit__ | ( | self, | |
exc_type, | |||
exc_val, | |||
exc_tb | |||
) |
Exits the runtime context related to the channel object.
Reimplemented in grpc._channel.Channel, grpc._interceptor._Channel, and grpc_testing._channel._channel.TestingChannel.
Definition at line 1075 of file src/python/grpcio/grpc/__init__.py.
|
overrideprivatevirtual |
Reimplemented from grpc::ChannelInterface.
Definition at line 249 of file channel_cc.cc.
def grpc.Channel.close | ( | self | ) |
Closes this Channel and releases all resources held by it. Closing the Channel will immediately terminate all RPCs active with the Channel and it is not valid to invoke new RPCs with the Channel. This method is idempotent.
Reimplemented in grpc._channel.Channel, grpc._interceptor._Channel, and grpc_testing._channel._channel.TestingChannel.
Definition at line 1061 of file src/python/grpcio/grpc/__init__.py.
|
overrideprivatevirtual |
Implements grpc::ChannelInterface.
Definition at line 163 of file channel_cc.cc.
|
overrideprivatevirtual |
Reimplemented from grpc::ChannelInterface.
Definition at line 117 of file channel_cc.cc.
std::string grpc::Channel::GetLoadBalancingPolicyName | ( | ) | const |
Returns the LB policy name, or the empty string if not yet available.
Definition at line 97 of file channel_cc.cc.
std::string grpc::Channel::GetServiceConfigJSON | ( | ) | const |
Returns the service config in JSON form, or the empty string if not available.
Definition at line 103 of file channel_cc.cc.
|
overridevirtual |
Get the current channel state. If the channel is in IDLE and try_to_connect is set to true, try to connect.
Implements grpc::ChannelInterface.
Definition at line 180 of file channel_cc.cc.
|
overrideprivatevirtual |
Implements grpc::ChannelInterface.
Definition at line 202 of file channel_cc.cc.
|
overrideprivatevirtual |
Implements grpc::internal::CallHook.
Definition at line 169 of file channel_cc.cc.
|
overrideprivatevirtual |
Implements grpc::ChannelInterface.
Definition at line 175 of file channel_cc.cc.
def grpc.Channel.stream_stream | ( | self, | |
method, | |||
request_serializer = None , |
|||
response_deserializer = None |
|||
) |
Creates a StreamStreamMultiCallable for a stream-stream method. Args: method: The name of the RPC method. request_serializer: Optional :term:`serializer` for serializing the request message. Request goes unserialized in case None is passed. response_deserializer: Optional :term:`deserializer` for deserializing the response message. Response goes undeserialized in case None is passed. Returns: A StreamStreamMultiCallable value for the named stream-stream method.
Reimplemented in grpc._channel.Channel, grpc._interceptor._Channel, and grpc_testing._channel._channel.TestingChannel.
Definition at line 1041 of file src/python/grpcio/grpc/__init__.py.
def grpc.Channel.stream_unary | ( | self, | |
method, | |||
request_serializer = None , |
|||
response_deserializer = None |
|||
) |
Creates a StreamUnaryMultiCallable for a stream-unary method. Args: method: The name of the RPC method. request_serializer: Optional :term:`serializer` for serializing the request message. Request goes unserialized in case None is passed. response_deserializer: Optional :term:`deserializer` for deserializing the response message. Response goes undeserialized in case None is passed. Returns: A StreamUnaryMultiCallable value for the named stream-unary method.
Reimplemented in grpc._channel.Channel, grpc._interceptor._Channel, and grpc_testing._channel._channel.TestingChannel.
Definition at line 1021 of file src/python/grpcio/grpc/__init__.py.
def grpc.Channel.subscribe | ( | self, | |
callback, | |||
try_to_connect = False |
|||
) |
Subscribe to this Channel's connectivity state machine. A Channel may be in any of the states described by ChannelConnectivity. This method allows application to monitor the state transitions. The typical use case is to debug or gain better visibility into gRPC runtime's state. Args: callback: A callable to be invoked with ChannelConnectivity argument. ChannelConnectivity describes current state of the channel. The callable will be invoked immediately upon subscription and again for every change to ChannelConnectivity until it is unsubscribed or this Channel object goes out of scope. try_to_connect: A boolean indicating whether or not this Channel should attempt to connect immediately. If set to False, gRPC runtime decides when to connect.
Reimplemented in grpc._channel.Channel, grpc._interceptor._Channel, and grpc_testing._channel._channel.TestingChannel.
Definition at line 950 of file src/python/grpcio/grpc/__init__.py.
def grpc.Channel.unary_stream | ( | self, | |
method, | |||
request_serializer = None , |
|||
response_deserializer = None |
|||
) |
Creates a UnaryStreamMultiCallable for a unary-stream method. Args: method: The name of the RPC method. request_serializer: Optional :term:`serializer` for serializing the request message. Request goes unserialized in case None is passed. response_deserializer: Optional :term:`deserializer` for deserializing the response message. Response goes undeserialized in case None is passed. Returns: A UnaryStreamMultiCallable value for the name unary-stream method.
Reimplemented in grpc._channel.Channel, grpc._interceptor._Channel, and grpc_testing._channel._channel.TestingChannel.
Definition at line 1001 of file src/python/grpcio/grpc/__init__.py.
def grpc.Channel.unary_unary | ( | self, | |
method, | |||
request_serializer = None , |
|||
response_deserializer = None |
|||
) |
Creates a UnaryUnaryMultiCallable for a unary-unary method. Args: method: The name of the RPC method. request_serializer: Optional :term:`serializer` for serializing the request message. Request goes unserialized in case None is passed. response_deserializer: Optional :term:`deserializer` for deserializing the response message. Response goes undeserialized in case None is passed. Returns: A UnaryUnaryMultiCallable value for the named unary-unary method.
Reimplemented in grpc._channel.Channel, grpc._interceptor._Channel, and grpc_testing._channel._channel.TestingChannel.
Definition at line 981 of file src/python/grpcio/grpc/__init__.py.
def grpc.Channel.unsubscribe | ( | self, | |
callback | |||
) |
Unsubscribes a subscribed callback from this Channel's connectivity. Args: callback: A callable previously registered with this Channel from having been passed to its "subscribe" method.
Reimplemented in grpc._channel.Channel, grpc._interceptor._Channel, and grpc_testing._channel._channel.TestingChannel.
Definition at line 971 of file src/python/grpcio/grpc/__init__.py.
|
overrideprivatevirtual |
Implements grpc::ChannelInterface.
Definition at line 210 of file channel_cc.cc.
|
friend |
|
friend |
|
friend |
Definition at line 74 of file include/grpcpp/channel.h.
|
friend |
Definition at line 82 of file include/grpcpp/channel.h.
|
friend |
Definition at line 75 of file include/grpcpp/channel.h.
|
private |
Definition at line 108 of file include/grpcpp/channel.h.
|
private |
Definition at line 117 of file include/grpcpp/channel.h.
|
private |
Definition at line 107 of file include/grpcpp/channel.h.
|
private |
Definition at line 121 of file include/grpcpp/channel.h.
|
private |
Definition at line 111 of file include/grpcpp/channel.h.