Public Member Functions | Private Member Functions | Private Attributes | List of all members
grpc._channel.Channel Class Reference
Inheritance diagram for grpc._channel.Channel:
Inheritance graph
[legend]

Public Member Functions

def __del__ (self)
 
def __enter__ (self)
 
def __exit__ (self, exc_type, exc_val, exc_tb)
 
def __init__ (self, target, options, credentials, compression)
 
def close (self)
 
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=None)
 
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)
 
- Public Member Functions inherited from grpc::Channel
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
 
 ~Channel () override
 
- Public Member Functions inherited from grpc::ChannelInterface
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 ()
 
- Public Member Functions inherited from grpc::internal::CallHook
virtual ~CallHook ()
 

Private Member Functions

def _close (self)
 
def _close_on_fork (self)
 
def _process_python_options (self, python_options)
 
def _unsubscribe_all (self)
 

Private Attributes

 _call_state
 
 _channel
 
 _connectivity_state
 
 _single_threaded_unary_stream
 

Detailed Description

A cygrpc.Channel-backed implementation of grpc.Channel.

Definition at line 1462 of file grpc/_channel.py.

Constructor & Destructor Documentation

◆ __init__()

def grpc._channel.Channel.__init__ (   self,
  target,
  options,
  credentials,
  compression 
)
Constructor.

Args:
  target: The target to which to connect.
  options: Configuration options for the channel.
  credentials: A cygrpc.ChannelCredentials or None.
  compression: An optional value indicating the compression method to be
    used over the lifetime of the channel.

Definition at line 1465 of file grpc/_channel.py.

◆ __del__()

def grpc._channel.Channel.__del__ (   self)

Definition at line 1570 of file grpc/_channel.py.

Member Function Documentation

◆ __enter__()

def grpc._channel.Channel.__enter__ (   self)
Enters the runtime context related to the channel object.

Reimplemented from grpc::Channel.

Definition at line 1560 of file grpc/_channel.py.

◆ __exit__()

def grpc._channel.Channel.__exit__ (   self,
  exc_type,
  exc_val,
  exc_tb 
)
Exits the runtime context related to the channel object.

Reimplemented from grpc::Channel.

Definition at line 1563 of file grpc/_channel.py.

◆ _close()

def grpc._channel.Channel._close (   self)
private

Definition at line 1548 of file grpc/_channel.py.

◆ _close_on_fork()

def grpc._channel.Channel._close_on_fork (   self)
private

Definition at line 1555 of file grpc/_channel.py.

◆ _process_python_options()

def grpc._channel.Channel._process_python_options (   self,
  python_options 
)
private
Sets channel attributes according to python-only channel options.

Definition at line 1487 of file grpc/_channel.py.

◆ _unsubscribe_all()

def grpc._channel.Channel._unsubscribe_all (   self)
private

Definition at line 1542 of file grpc/_channel.py.

◆ close()

def grpc._channel.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 from grpc::Channel.

Definition at line 1567 of file grpc/_channel.py.

◆ stream_stream()

def grpc._channel.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 from grpc::Channel.

Definition at line 1534 of file grpc/_channel.py.

◆ stream_unary()

def grpc._channel.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 from grpc::Channel.

Definition at line 1526 of file grpc/_channel.py.

◆ subscribe()

def grpc._channel.Channel.subscribe (   self,
  callback,
  try_to_connect = None 
)
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 from grpc::Channel.

Definition at line 1493 of file grpc/_channel.py.

◆ unary_stream()

def grpc._channel.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 from grpc::Channel.

Definition at line 1507 of file grpc/_channel.py.

◆ unary_unary()

def grpc._channel.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 from grpc::Channel.

Definition at line 1499 of file grpc/_channel.py.

◆ unsubscribe()

def grpc._channel.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 from grpc::Channel.

Definition at line 1496 of file grpc/_channel.py.

Member Data Documentation

◆ _call_state

grpc._channel.Channel._call_state
private

Definition at line 1481 of file grpc/_channel.py.

◆ _channel

grpc._channel.Channel._channel
private

Definition at line 1478 of file grpc/_channel.py.

◆ _connectivity_state

grpc._channel.Channel._connectivity_state
private

Definition at line 1482 of file grpc/_channel.py.

◆ _single_threaded_unary_stream

grpc._channel.Channel._single_threaded_unary_stream
private

Definition at line 1476 of file grpc/_channel.py.


The documentation for this class was generated from the following file:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:31