1# Copyright 2015 gRPC authors. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15 16cdef _check_call_error_no_metadata(c_call_error) 17 18 19cdef _check_and_raise_call_error_no_metadata(c_call_error) 20 21 22cdef _check_call_error(c_call_error, metadata) 23 24 25cdef class _CallState: 26 27 cdef grpc_call *c_call 28 cdef set due 29 # call_tracer_capsule should have type of grpc._observability.ClientCallTracerCapsule 30 cdef object call_tracer_capsule 31 cdef void maybe_set_client_call_tracer_on_call(self, bytes method_name, bytes target) except * 32 cdef void maybe_delete_call_tracer(self) except * 33 34 35cdef class _ChannelState: 36 37 cdef bytes target 38 cdef object condition 39 cdef grpc_channel *c_channel 40 # A boolean field indicating that the channel is open (if True) or is being 41 # closed (i.e. a call to close is currently executing) or is closed (if 42 # False). 43 # TODO(https://github.com/grpc/grpc/issues/3064): Eliminate "is being closed" 44 # a state in which condition may be acquired by any thread, eliminate this 45 # field and just use the NULLness of c_channel as an indication that the 46 # channel is closed. 47 cdef object open 48 cdef object closed_reason 49 50 # A dict from _BatchOperationTag to _CallState 51 cdef dict integrated_call_states 52 cdef grpc_completion_queue *c_call_completion_queue 53 54 # A set of _CallState 55 cdef set segregated_call_states 56 57 cdef set connectivity_due 58 cdef grpc_completion_queue *c_connectivity_completion_queue 59 60 61cdef class IntegratedCall: 62 63 cdef _ChannelState _channel_state 64 cdef _CallState _call_state 65 66 67cdef class SegregatedCall: 68 69 cdef _ChannelState _channel_state 70 cdef _CallState _call_state 71 cdef grpc_completion_queue *_c_completion_queue 72 73 74cdef class Channel: 75 76 cdef _ChannelState _state 77 cdef dict _registered_call_handles 78 79 # TODO(https://github.com/grpc/grpc/issues/15662): Eliminate this. 80 cdef tuple _arguments 81 82 83cdef class CallHandle: 84 85 cdef void *c_call_handle 86 cdef object method 87