channel.pxd.pxi 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. cdef _check_call_error_no_metadata(c_call_error)
  15. cdef _check_and_raise_call_error_no_metadata(c_call_error)
  16. cdef _check_call_error(c_call_error, metadata)
  17. cdef class _CallState:
  18. cdef grpc_call *c_call
  19. cdef set due
  20. cdef class _ChannelState:
  21. cdef object condition
  22. cdef grpc_channel *c_channel
  23. # A boolean field indicating that the channel is open (if True) or is being
  24. # closed (i.e. a call to close is currently executing) or is closed (if
  25. # False).
  26. # TODO(https://github.com/grpc/grpc/issues/3064): Eliminate "is being closed"
  27. # a state in which condition may be acquired by any thread, eliminate this
  28. # field and just use the NULLness of c_channel as an indication that the
  29. # channel is closed.
  30. cdef object open
  31. cdef object closed_reason
  32. # A dict from _BatchOperationTag to _CallState
  33. cdef dict integrated_call_states
  34. cdef grpc_completion_queue *c_call_completion_queue
  35. # A set of _CallState
  36. cdef set segregated_call_states
  37. cdef set connectivity_due
  38. cdef grpc_completion_queue *c_connectivity_completion_queue
  39. cdef class IntegratedCall:
  40. cdef _ChannelState _channel_state
  41. cdef _CallState _call_state
  42. cdef class SegregatedCall:
  43. cdef _ChannelState _channel_state
  44. cdef _CallState _call_state
  45. cdef grpc_completion_queue *_c_completion_queue
  46. cdef class Channel:
  47. cdef _ChannelState _state
  48. # TODO(https://github.com/grpc/grpc/issues/15662): Eliminate this.
  49. cdef tuple _arguments