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

Public Member Functions

def __enter__ (self)
 
def __exit__ (self, exc_type, exc_val, exc_tb)
 
def __init__ (self, time, state)
 
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=False)
 
def take_stream_stream (self, method_descriptor)
 
def take_stream_unary (self, method_descriptor)
 
def take_unary_stream (self, method_descriptor)
 
def take_unary_unary (self, method_descriptor)
 
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)
 

Private Attributes

 _state
 
 _time
 

Detailed Description

Definition at line 23 of file testing/grpc_testing/_channel/_channel.py.

Constructor & Destructor Documentation

◆ __init__()

def grpc_testing._channel._channel.TestingChannel.__init__ (   self,
  time,
  state 
)

Definition at line 25 of file testing/grpc_testing/_channel/_channel.py.

Member Function Documentation

◆ __enter__()

def grpc_testing._channel._channel.TestingChannel.__enter__ (   self)
Enters the runtime context related to the channel object.

Reimplemented from grpc::Channel.

Definition at line 64 of file testing/grpc_testing/_channel/_channel.py.

◆ __exit__()

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

Reimplemented from grpc::Channel.

Definition at line 67 of file testing/grpc_testing/_channel/_channel.py.

◆ _close()

def grpc_testing._channel._channel.TestingChannel._close (   self)
private

Definition at line 59 of file testing/grpc_testing/_channel/_channel.py.

◆ close()

def grpc_testing._channel._channel.TestingChannel.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 71 of file testing/grpc_testing/_channel/_channel.py.

◆ stream_stream()

def grpc_testing._channel._channel.TestingChannel.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 53 of file testing/grpc_testing/_channel/_channel.py.

◆ stream_unary()

def grpc_testing._channel._channel.TestingChannel.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 47 of file testing/grpc_testing/_channel/_channel.py.

◆ subscribe()

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

Definition at line 29 of file testing/grpc_testing/_channel/_channel.py.

◆ take_stream_stream()

def grpc_testing._channel._channel.TestingChannel.take_stream_stream (   self,
  method_descriptor 
)
Draws an RPC currently being made by the system under test.

If the given descriptor does not identify any RPC currently being made
by the system under test, this method blocks until the system under
test invokes such an RPC.

Args:
  method_descriptor: A descriptor.MethodDescriptor describing a
    stream-stream RPC method.

Returns:
  A (invocation_metadata, stream_stream_channel_rpc) tuple of the RPC's
    invocation metadata and a StreamStreamChannelRpc with which to
    "play server" for the RPC.

Reimplemented from grpc_testing.Channel.

Definition at line 83 of file testing/grpc_testing/_channel/_channel.py.

◆ take_stream_unary()

def grpc_testing._channel._channel.TestingChannel.take_stream_unary (   self,
  method_descriptor 
)
Draws an RPC currently being made by the system under test.

If the given descriptor does not identify any RPC currently being made
by the system under test, this method blocks until the system under
test invokes such an RPC.

Args:
  method_descriptor: A descriptor.MethodDescriptor describing a
    stream-unary RPC method.

Returns:
  A (invocation_metadata, stream_unary_channel_rpc) tuple of the RPC's
    invocation metadata and a StreamUnaryChannelRpc with which to "play
    server" for the RPC.

Reimplemented from grpc_testing.Channel.

Definition at line 80 of file testing/grpc_testing/_channel/_channel.py.

◆ take_unary_stream()

def grpc_testing._channel._channel.TestingChannel.take_unary_stream (   self,
  method_descriptor 
)
Draws an RPC currently being made by the system under test.

If the given descriptor does not identify any RPC currently being made
by the system under test, this method blocks until the system under
test invokes such an RPC.

Args:
  method_descriptor: A descriptor.MethodDescriptor describing a
    unary-stream RPC method.

Returns:
  A (invocation_metadata, request, unary_stream_channel_rpc) tuple of
    the RPC's invocation metadata, its request, and a
    UnaryStreamChannelRpc with which to "play server" for the RPC.

Reimplemented from grpc_testing.Channel.

Definition at line 77 of file testing/grpc_testing/_channel/_channel.py.

◆ take_unary_unary()

def grpc_testing._channel._channel.TestingChannel.take_unary_unary (   self,
  method_descriptor 
)
Draws an RPC currently being made by the system under test.

If the given descriptor does not identify any RPC currently being made
by the system under test, this method blocks until the system under
test invokes such an RPC.

Args:
  method_descriptor: A descriptor.MethodDescriptor describing a
    unary-unary RPC method.

Returns:
  A (invocation_metadata, request, unary_unary_channel_rpc) tuple of
    the RPC's invocation metadata, its request, and a
    UnaryUnaryChannelRpc with which to "play server" for the RPC.

Reimplemented from grpc_testing.Channel.

Definition at line 74 of file testing/grpc_testing/_channel/_channel.py.

◆ unary_stream()

def grpc_testing._channel._channel.TestingChannel.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 41 of file testing/grpc_testing/_channel/_channel.py.

◆ unary_unary()

def grpc_testing._channel._channel.TestingChannel.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 35 of file testing/grpc_testing/_channel/_channel.py.

◆ unsubscribe()

def grpc_testing._channel._channel.TestingChannel.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 32 of file testing/grpc_testing/_channel/_channel.py.

Member Data Documentation

◆ _state

grpc_testing._channel._channel.TestingChannel._state
private

Definition at line 27 of file testing/grpc_testing/_channel/_channel.py.

◆ _time

grpc_testing._channel._channel.TestingChannel._time
private

Definition at line 26 of file testing/grpc_testing/_channel/_channel.py.


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


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