grpcio-fips 1.44.0__4-cp38-cp38-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. grpc/__init__.py +2190 -0
  2. grpc/_auth.py +58 -0
  3. grpc/_channel.py +1581 -0
  4. grpc/_common.py +168 -0
  5. grpc/_compression.py +55 -0
  6. grpc/_cython/__init__.py +13 -0
  7. grpc/_cython/_credentials/roots.pem +4337 -0
  8. grpc/_cython/_cygrpc/__init__.py +13 -0
  9. grpc/_cython/ayx-crypto-library.dll +0 -0
  10. grpc/_cython/cygrpc.cp38-win_amd64.pyd +0 -0
  11. grpc/_cython/libcrypto-3-x64.dll +0 -0
  12. grpc/_cython/libssl-3-x64.dll +0 -0
  13. grpc/_grpcio_metadata.py +1 -0
  14. grpc/_interceptor.py +562 -0
  15. grpc/_plugin_wrapping.py +113 -0
  16. grpc/_runtime_protos.py +155 -0
  17. grpc/_server.py +1003 -0
  18. grpc/_simple_stubs.py +486 -0
  19. grpc/_utilities.py +168 -0
  20. grpc/aio/__init__.py +95 -0
  21. grpc/aio/_base_call.py +248 -0
  22. grpc/aio/_base_channel.py +352 -0
  23. grpc/aio/_base_server.py +373 -0
  24. grpc/aio/_call.py +648 -0
  25. grpc/aio/_channel.py +484 -0
  26. grpc/aio/_interceptor.py +1004 -0
  27. grpc/aio/_metadata.py +120 -0
  28. grpc/aio/_server.py +210 -0
  29. grpc/aio/_typing.py +35 -0
  30. grpc/aio/_utils.py +22 -0
  31. grpc/beta/__init__.py +13 -0
  32. grpc/beta/_client_adaptations.py +706 -0
  33. grpc/beta/_metadata.py +52 -0
  34. grpc/beta/_server_adaptations.py +385 -0
  35. grpc/beta/implementations.py +311 -0
  36. grpc/beta/interfaces.py +164 -0
  37. grpc/beta/utilities.py +149 -0
  38. grpc/experimental/__init__.py +128 -0
  39. grpc/experimental/aio/__init__.py +16 -0
  40. grpc/experimental/gevent.py +27 -0
  41. grpc/experimental/session_cache.py +45 -0
  42. grpc/framework/__init__.py +13 -0
  43. grpc/framework/common/__init__.py +13 -0
  44. grpc/framework/common/cardinality.py +26 -0
  45. grpc/framework/common/style.py +24 -0
  46. grpc/framework/foundation/__init__.py +13 -0
  47. grpc/framework/foundation/abandonment.py +22 -0
  48. grpc/framework/foundation/callable_util.py +96 -0
  49. grpc/framework/foundation/future.py +221 -0
  50. grpc/framework/foundation/logging_pool.py +71 -0
  51. grpc/framework/foundation/stream.py +45 -0
  52. grpc/framework/foundation/stream_util.py +148 -0
  53. grpc/framework/interfaces/__init__.py +13 -0
  54. grpc/framework/interfaces/base/__init__.py +13 -0
  55. grpc/framework/interfaces/base/base.py +327 -0
  56. grpc/framework/interfaces/base/utilities.py +71 -0
  57. grpc/framework/interfaces/face/__init__.py +13 -0
  58. grpc/framework/interfaces/face/face.py +1050 -0
  59. grpc/framework/interfaces/face/utilities.py +168 -0
  60. grpcio_fips-1.44.0.dist-info/LICENSE +242 -0
  61. grpcio_fips-1.44.0.dist-info/METADATA +143 -0
  62. grpcio_fips-1.44.0.dist-info/RECORD +64 -0
  63. grpcio_fips-1.44.0.dist-info/WHEEL +5 -0
  64. grpcio_fips-1.44.0.dist-info/top_level.txt +1 -0
grpc/aio/__init__.py ADDED
@@ -0,0 +1,95 @@
1
+ # Copyright 2019 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
+ """gRPC's Asynchronous Python API.
15
+
16
+ gRPC Async API objects may only be used on the thread on which they were
17
+ created. AsyncIO doesn't provide thread safety for most of its APIs.
18
+ """
19
+
20
+ from typing import Any, Optional, Sequence, Tuple
21
+
22
+ import grpc
23
+ from grpc._cython.cygrpc import AbortError
24
+ from grpc._cython.cygrpc import BaseError
25
+ from grpc._cython.cygrpc import EOF
26
+ from grpc._cython.cygrpc import InternalError
27
+ from grpc._cython.cygrpc import UsageError
28
+ from grpc._cython.cygrpc import init_grpc_aio
29
+ from grpc._cython.cygrpc import shutdown_grpc_aio
30
+
31
+ from ._base_call import Call
32
+ from ._base_call import RpcContext
33
+ from ._base_call import StreamStreamCall
34
+ from ._base_call import StreamUnaryCall
35
+ from ._base_call import UnaryStreamCall
36
+ from ._base_call import UnaryUnaryCall
37
+ from ._base_channel import Channel
38
+ from ._base_channel import StreamStreamMultiCallable
39
+ from ._base_channel import StreamUnaryMultiCallable
40
+ from ._base_channel import UnaryStreamMultiCallable
41
+ from ._base_channel import UnaryUnaryMultiCallable
42
+ from ._base_server import Server
43
+ from ._base_server import ServicerContext
44
+ from ._call import AioRpcError
45
+ from ._channel import insecure_channel
46
+ from ._channel import secure_channel
47
+ from ._interceptor import ClientCallDetails
48
+ from ._interceptor import ClientInterceptor
49
+ from ._interceptor import InterceptedUnaryUnaryCall
50
+ from ._interceptor import ServerInterceptor
51
+ from ._interceptor import StreamStreamClientInterceptor
52
+ from ._interceptor import StreamUnaryClientInterceptor
53
+ from ._interceptor import UnaryStreamClientInterceptor
54
+ from ._interceptor import UnaryUnaryClientInterceptor
55
+ from ._metadata import Metadata
56
+ from ._server import server
57
+ from ._typing import ChannelArgumentType
58
+
59
+ ################################### __all__ #################################
60
+
61
+ __all__ = (
62
+ 'init_grpc_aio',
63
+ 'shutdown_grpc_aio',
64
+ 'AioRpcError',
65
+ 'RpcContext',
66
+ 'Call',
67
+ 'UnaryUnaryCall',
68
+ 'UnaryStreamCall',
69
+ 'StreamUnaryCall',
70
+ 'StreamStreamCall',
71
+ 'Channel',
72
+ 'UnaryUnaryMultiCallable',
73
+ 'UnaryStreamMultiCallable',
74
+ 'StreamUnaryMultiCallable',
75
+ 'StreamStreamMultiCallable',
76
+ 'ClientCallDetails',
77
+ 'ClientInterceptor',
78
+ 'UnaryStreamClientInterceptor',
79
+ 'UnaryUnaryClientInterceptor',
80
+ 'StreamUnaryClientInterceptor',
81
+ 'StreamStreamClientInterceptor',
82
+ 'InterceptedUnaryUnaryCall',
83
+ 'ServerInterceptor',
84
+ 'insecure_channel',
85
+ 'server',
86
+ 'Server',
87
+ 'ServicerContext',
88
+ 'EOF',
89
+ 'secure_channel',
90
+ 'AbortError',
91
+ 'BaseError',
92
+ 'UsageError',
93
+ 'InternalError',
94
+ 'Metadata',
95
+ )
grpc/aio/_base_call.py ADDED
@@ -0,0 +1,248 @@
1
+ # Copyright 2019 The 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
+ """Abstract base classes for client-side Call objects.
15
+
16
+ Call objects represents the RPC itself, and offer methods to access / modify
17
+ its information. They also offer methods to manipulate the life-cycle of the
18
+ RPC, e.g. cancellation.
19
+ """
20
+
21
+ from abc import ABCMeta
22
+ from abc import abstractmethod
23
+ from typing import AsyncIterable, Awaitable, Generic, Optional, Union
24
+
25
+ import grpc
26
+
27
+ from ._metadata import Metadata
28
+ from ._typing import DoneCallbackType
29
+ from ._typing import EOFType
30
+ from ._typing import RequestType
31
+ from ._typing import ResponseType
32
+
33
+ __all__ = 'RpcContext', 'Call', 'UnaryUnaryCall', 'UnaryStreamCall'
34
+
35
+
36
+ class RpcContext(metaclass=ABCMeta):
37
+ """Provides RPC-related information and action."""
38
+
39
+ @abstractmethod
40
+ def cancelled(self) -> bool:
41
+ """Return True if the RPC is cancelled.
42
+
43
+ The RPC is cancelled when the cancellation was requested with cancel().
44
+
45
+ Returns:
46
+ A bool indicates whether the RPC is cancelled or not.
47
+ """
48
+
49
+ @abstractmethod
50
+ def done(self) -> bool:
51
+ """Return True if the RPC is done.
52
+
53
+ An RPC is done if the RPC is completed, cancelled or aborted.
54
+
55
+ Returns:
56
+ A bool indicates if the RPC is done.
57
+ """
58
+
59
+ @abstractmethod
60
+ def time_remaining(self) -> Optional[float]:
61
+ """Describes the length of allowed time remaining for the RPC.
62
+
63
+ Returns:
64
+ A nonnegative float indicating the length of allowed time in seconds
65
+ remaining for the RPC to complete before it is considered to have
66
+ timed out, or None if no deadline was specified for the RPC.
67
+ """
68
+
69
+ @abstractmethod
70
+ def cancel(self) -> bool:
71
+ """Cancels the RPC.
72
+
73
+ Idempotent and has no effect if the RPC has already terminated.
74
+
75
+ Returns:
76
+ A bool indicates if the cancellation is performed or not.
77
+ """
78
+
79
+ @abstractmethod
80
+ def add_done_callback(self, callback: DoneCallbackType) -> None:
81
+ """Registers a callback to be called on RPC termination.
82
+
83
+ Args:
84
+ callback: A callable object will be called with the call object as
85
+ its only argument.
86
+ """
87
+
88
+
89
+ class Call(RpcContext, metaclass=ABCMeta):
90
+ """The abstract base class of an RPC on the client-side."""
91
+
92
+ @abstractmethod
93
+ async def initial_metadata(self) -> Metadata:
94
+ """Accesses the initial metadata sent by the server.
95
+
96
+ Returns:
97
+ The initial :term:`metadata`.
98
+ """
99
+
100
+ @abstractmethod
101
+ async def trailing_metadata(self) -> Metadata:
102
+ """Accesses the trailing metadata sent by the server.
103
+
104
+ Returns:
105
+ The trailing :term:`metadata`.
106
+ """
107
+
108
+ @abstractmethod
109
+ async def code(self) -> grpc.StatusCode:
110
+ """Accesses the status code sent by the server.
111
+
112
+ Returns:
113
+ The StatusCode value for the RPC.
114
+ """
115
+
116
+ @abstractmethod
117
+ async def details(self) -> str:
118
+ """Accesses the details sent by the server.
119
+
120
+ Returns:
121
+ The details string of the RPC.
122
+ """
123
+
124
+ @abstractmethod
125
+ async def wait_for_connection(self) -> None:
126
+ """Waits until connected to peer and raises aio.AioRpcError if failed.
127
+
128
+ This is an EXPERIMENTAL method.
129
+
130
+ This method ensures the RPC has been successfully connected. Otherwise,
131
+ an AioRpcError will be raised to explain the reason of the connection
132
+ failure.
133
+
134
+ This method is recommended for building retry mechanisms.
135
+ """
136
+
137
+
138
+ class UnaryUnaryCall(Generic[RequestType, ResponseType],
139
+ Call,
140
+ metaclass=ABCMeta):
141
+ """The abstract base class of an unary-unary RPC on the client-side."""
142
+
143
+ @abstractmethod
144
+ def __await__(self) -> Awaitable[ResponseType]:
145
+ """Await the response message to be ready.
146
+
147
+ Returns:
148
+ The response message of the RPC.
149
+ """
150
+
151
+
152
+ class UnaryStreamCall(Generic[RequestType, ResponseType],
153
+ Call,
154
+ metaclass=ABCMeta):
155
+
156
+ @abstractmethod
157
+ def __aiter__(self) -> AsyncIterable[ResponseType]:
158
+ """Returns the async iterable representation that yields messages.
159
+
160
+ Under the hood, it is calling the "read" method.
161
+
162
+ Returns:
163
+ An async iterable object that yields messages.
164
+ """
165
+
166
+ @abstractmethod
167
+ async def read(self) -> Union[EOFType, ResponseType]:
168
+ """Reads one message from the stream.
169
+
170
+ Read operations must be serialized when called from multiple
171
+ coroutines.
172
+
173
+ Returns:
174
+ A response message, or an `grpc.aio.EOF` to indicate the end of the
175
+ stream.
176
+ """
177
+
178
+
179
+ class StreamUnaryCall(Generic[RequestType, ResponseType],
180
+ Call,
181
+ metaclass=ABCMeta):
182
+
183
+ @abstractmethod
184
+ async def write(self, request: RequestType) -> None:
185
+ """Writes one message to the stream.
186
+
187
+ Raises:
188
+ An RpcError exception if the write failed.
189
+ """
190
+
191
+ @abstractmethod
192
+ async def done_writing(self) -> None:
193
+ """Notifies server that the client is done sending messages.
194
+
195
+ After done_writing is called, any additional invocation to the write
196
+ function will fail. This function is idempotent.
197
+ """
198
+
199
+ @abstractmethod
200
+ def __await__(self) -> Awaitable[ResponseType]:
201
+ """Await the response message to be ready.
202
+
203
+ Returns:
204
+ The response message of the stream.
205
+ """
206
+
207
+
208
+ class StreamStreamCall(Generic[RequestType, ResponseType],
209
+ Call,
210
+ metaclass=ABCMeta):
211
+
212
+ @abstractmethod
213
+ def __aiter__(self) -> AsyncIterable[ResponseType]:
214
+ """Returns the async iterable representation that yields messages.
215
+
216
+ Under the hood, it is calling the "read" method.
217
+
218
+ Returns:
219
+ An async iterable object that yields messages.
220
+ """
221
+
222
+ @abstractmethod
223
+ async def read(self) -> Union[EOFType, ResponseType]:
224
+ """Reads one message from the stream.
225
+
226
+ Read operations must be serialized when called from multiple
227
+ coroutines.
228
+
229
+ Returns:
230
+ A response message, or an `grpc.aio.EOF` to indicate the end of the
231
+ stream.
232
+ """
233
+
234
+ @abstractmethod
235
+ async def write(self, request: RequestType) -> None:
236
+ """Writes one message to the stream.
237
+
238
+ Raises:
239
+ An RpcError exception if the write failed.
240
+ """
241
+
242
+ @abstractmethod
243
+ async def done_writing(self) -> None:
244
+ """Notifies server that the client is done sending messages.
245
+
246
+ After done_writing is called, any additional invocation to the write
247
+ function will fail. This function is idempotent.
248
+ """
@@ -0,0 +1,352 @@
1
+ # Copyright 2020 The 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
+ """Abstract base classes for Channel objects and Multicallable objects."""
15
+
16
+ import abc
17
+ from typing import Any, Optional
18
+
19
+ import grpc
20
+
21
+ from . import _base_call
22
+ from ._typing import DeserializingFunction
23
+ from ._typing import MetadataType
24
+ from ._typing import RequestIterableType
25
+ from ._typing import SerializingFunction
26
+
27
+
28
+ class UnaryUnaryMultiCallable(abc.ABC):
29
+ """Enables asynchronous invocation of a unary-call RPC."""
30
+
31
+ @abc.abstractmethod
32
+ def __call__(
33
+ self,
34
+ request: Any,
35
+ *,
36
+ timeout: Optional[float] = None,
37
+ metadata: Optional[MetadataType] = None,
38
+ credentials: Optional[grpc.CallCredentials] = None,
39
+ wait_for_ready: Optional[bool] = None,
40
+ compression: Optional[grpc.Compression] = None
41
+ ) -> _base_call.UnaryUnaryCall:
42
+ """Asynchronously invokes the underlying RPC.
43
+
44
+ Args:
45
+ request: The request value for the RPC.
46
+ timeout: An optional duration of time in seconds to allow
47
+ for the RPC.
48
+ metadata: Optional :term:`metadata` to be transmitted to the
49
+ service-side of the RPC.
50
+ credentials: An optional CallCredentials for the RPC. Only valid for
51
+ secure Channel.
52
+ wait_for_ready: This is an EXPERIMENTAL argument. An optional
53
+ flag to enable :term:`wait_for_ready` mechanism.
54
+ compression: An element of grpc.compression, e.g.
55
+ grpc.compression.Gzip. This is an EXPERIMENTAL option.
56
+
57
+ Returns:
58
+ A UnaryUnaryCall object.
59
+
60
+ Raises:
61
+ RpcError: Indicates that the RPC terminated with non-OK status. The
62
+ raised RpcError will also be a Call for the RPC affording the RPC's
63
+ metadata, status code, and details.
64
+ """
65
+
66
+
67
+ class UnaryStreamMultiCallable(abc.ABC):
68
+ """Enables asynchronous invocation of a server-streaming RPC."""
69
+
70
+ @abc.abstractmethod
71
+ def __call__(
72
+ self,
73
+ request: Any,
74
+ *,
75
+ timeout: Optional[float] = None,
76
+ metadata: Optional[MetadataType] = None,
77
+ credentials: Optional[grpc.CallCredentials] = None,
78
+ wait_for_ready: Optional[bool] = None,
79
+ compression: Optional[grpc.Compression] = None
80
+ ) -> _base_call.UnaryStreamCall:
81
+ """Asynchronously invokes the underlying RPC.
82
+
83
+ Args:
84
+ request: The request value for the RPC.
85
+ timeout: An optional duration of time in seconds to allow
86
+ for the RPC.
87
+ metadata: Optional :term:`metadata` to be transmitted to the
88
+ service-side of the RPC.
89
+ credentials: An optional CallCredentials for the RPC. Only valid for
90
+ secure Channel.
91
+ wait_for_ready: This is an EXPERIMENTAL argument. An optional
92
+ flag to enable :term:`wait_for_ready` mechanism.
93
+ compression: An element of grpc.compression, e.g.
94
+ grpc.compression.Gzip. This is an EXPERIMENTAL option.
95
+
96
+ Returns:
97
+ A UnaryStreamCall object.
98
+
99
+ Raises:
100
+ RpcError: Indicates that the RPC terminated with non-OK status. The
101
+ raised RpcError will also be a Call for the RPC affording the RPC's
102
+ metadata, status code, and details.
103
+ """
104
+
105
+
106
+ class StreamUnaryMultiCallable(abc.ABC):
107
+ """Enables asynchronous invocation of a client-streaming RPC."""
108
+
109
+ @abc.abstractmethod
110
+ def __call__(
111
+ self,
112
+ request_iterator: Optional[RequestIterableType] = None,
113
+ timeout: Optional[float] = None,
114
+ metadata: Optional[MetadataType] = None,
115
+ credentials: Optional[grpc.CallCredentials] = None,
116
+ wait_for_ready: Optional[bool] = None,
117
+ compression: Optional[grpc.Compression] = None
118
+ ) -> _base_call.StreamUnaryCall:
119
+ """Asynchronously invokes the underlying RPC.
120
+
121
+ Args:
122
+ request_iterator: An optional async iterable or iterable of request
123
+ messages for the RPC.
124
+ timeout: An optional duration of time in seconds to allow
125
+ for the RPC.
126
+ metadata: Optional :term:`metadata` to be transmitted to the
127
+ service-side of the RPC.
128
+ credentials: An optional CallCredentials for the RPC. Only valid for
129
+ secure Channel.
130
+ wait_for_ready: This is an EXPERIMENTAL argument. An optional
131
+ flag to enable :term:`wait_for_ready` mechanism.
132
+ compression: An element of grpc.compression, e.g.
133
+ grpc.compression.Gzip. This is an EXPERIMENTAL option.
134
+
135
+ Returns:
136
+ A StreamUnaryCall object.
137
+
138
+ Raises:
139
+ RpcError: Indicates that the RPC terminated with non-OK status. The
140
+ raised RpcError will also be a Call for the RPC affording the RPC's
141
+ metadata, status code, and details.
142
+ """
143
+
144
+
145
+ class StreamStreamMultiCallable(abc.ABC):
146
+ """Enables asynchronous invocation of a bidirectional-streaming RPC."""
147
+
148
+ @abc.abstractmethod
149
+ def __call__(
150
+ self,
151
+ request_iterator: Optional[RequestIterableType] = None,
152
+ timeout: Optional[float] = None,
153
+ metadata: Optional[MetadataType] = None,
154
+ credentials: Optional[grpc.CallCredentials] = None,
155
+ wait_for_ready: Optional[bool] = None,
156
+ compression: Optional[grpc.Compression] = None
157
+ ) -> _base_call.StreamStreamCall:
158
+ """Asynchronously invokes the underlying RPC.
159
+
160
+ Args:
161
+ request_iterator: An optional async iterable or iterable of request
162
+ messages for the RPC.
163
+ timeout: An optional duration of time in seconds to allow
164
+ for the RPC.
165
+ metadata: Optional :term:`metadata` to be transmitted to the
166
+ service-side of the RPC.
167
+ credentials: An optional CallCredentials for the RPC. Only valid for
168
+ secure Channel.
169
+ wait_for_ready: This is an EXPERIMENTAL argument. An optional
170
+ flag to enable :term:`wait_for_ready` mechanism.
171
+ compression: An element of grpc.compression, e.g.
172
+ grpc.compression.Gzip. This is an EXPERIMENTAL option.
173
+
174
+ Returns:
175
+ A StreamStreamCall object.
176
+
177
+ Raises:
178
+ RpcError: Indicates that the RPC terminated with non-OK status. The
179
+ raised RpcError will also be a Call for the RPC affording the RPC's
180
+ metadata, status code, and details.
181
+ """
182
+
183
+
184
+ class Channel(abc.ABC):
185
+ """Enables asynchronous RPC invocation as a client.
186
+
187
+ Channel objects implement the Asynchronous Context Manager (aka. async
188
+ with) type, although they are not supportted to be entered and exited
189
+ multiple times.
190
+ """
191
+
192
+ @abc.abstractmethod
193
+ async def __aenter__(self):
194
+ """Starts an asynchronous context manager.
195
+
196
+ Returns:
197
+ Channel the channel that was instantiated.
198
+ """
199
+
200
+ @abc.abstractmethod
201
+ async def __aexit__(self, exc_type, exc_val, exc_tb):
202
+ """Finishes the asynchronous context manager by closing the channel.
203
+
204
+ Still active RPCs will be cancelled.
205
+ """
206
+
207
+ @abc.abstractmethod
208
+ async def close(self, grace: Optional[float] = None):
209
+ """Closes this Channel and releases all resources held by it.
210
+
211
+ This method immediately stops the channel from executing new RPCs in
212
+ all cases.
213
+
214
+ If a grace period is specified, this method wait until all active
215
+ RPCs are finshed, once the grace period is reached the ones that haven't
216
+ been terminated are cancelled. If a grace period is not specified
217
+ (by passing None for grace), all existing RPCs are cancelled immediately.
218
+
219
+ This method is idempotent.
220
+ """
221
+
222
+ @abc.abstractmethod
223
+ def get_state(self,
224
+ try_to_connect: bool = False) -> grpc.ChannelConnectivity:
225
+ """Checks the connectivity state of a channel.
226
+
227
+ This is an EXPERIMENTAL API.
228
+
229
+ If the channel reaches a stable connectivity state, it is guaranteed
230
+ that the return value of this function will eventually converge to that
231
+ state.
232
+
233
+ Args:
234
+ try_to_connect: a bool indicate whether the Channel should try to
235
+ connect to peer or not.
236
+
237
+ Returns: A ChannelConnectivity object.
238
+ """
239
+
240
+ @abc.abstractmethod
241
+ async def wait_for_state_change(
242
+ self,
243
+ last_observed_state: grpc.ChannelConnectivity,
244
+ ) -> None:
245
+ """Waits for a change in connectivity state.
246
+
247
+ This is an EXPERIMENTAL API.
248
+
249
+ The function blocks until there is a change in the channel connectivity
250
+ state from the "last_observed_state". If the state is already
251
+ different, this function will return immediately.
252
+
253
+ There is an inherent race between the invocation of
254
+ "Channel.wait_for_state_change" and "Channel.get_state". The state can
255
+ change arbitrary many times during the race, so there is no way to
256
+ observe every state transition.
257
+
258
+ If there is a need to put a timeout for this function, please refer to
259
+ "asyncio.wait_for".
260
+
261
+ Args:
262
+ last_observed_state: A grpc.ChannelConnectivity object representing
263
+ the last known state.
264
+ """
265
+
266
+ @abc.abstractmethod
267
+ async def channel_ready(self) -> None:
268
+ """Creates a coroutine that blocks until the Channel is READY."""
269
+
270
+ @abc.abstractmethod
271
+ def unary_unary(
272
+ self,
273
+ method: str,
274
+ request_serializer: Optional[SerializingFunction] = None,
275
+ response_deserializer: Optional[DeserializingFunction] = None
276
+ ) -> UnaryUnaryMultiCallable:
277
+ """Creates a UnaryUnaryMultiCallable for a unary-unary method.
278
+
279
+ Args:
280
+ method: The name of the RPC method.
281
+ request_serializer: Optional :term:`serializer` for serializing the request
282
+ message. Request goes unserialized in case None is passed.
283
+ response_deserializer: Optional :term:`deserializer` for deserializing the
284
+ response message. Response goes undeserialized in case None
285
+ is passed.
286
+
287
+ Returns:
288
+ A UnaryUnaryMultiCallable value for the named unary-unary method.
289
+ """
290
+
291
+ @abc.abstractmethod
292
+ def unary_stream(
293
+ self,
294
+ method: str,
295
+ request_serializer: Optional[SerializingFunction] = None,
296
+ response_deserializer: Optional[DeserializingFunction] = None
297
+ ) -> UnaryStreamMultiCallable:
298
+ """Creates a UnaryStreamMultiCallable for a unary-stream method.
299
+
300
+ Args:
301
+ method: The name of the RPC method.
302
+ request_serializer: Optional :term:`serializer` for serializing the request
303
+ message. Request goes unserialized in case None is passed.
304
+ response_deserializer: Optional :term:`deserializer` for deserializing the
305
+ response message. Response goes undeserialized in case None
306
+ is passed.
307
+
308
+ Returns:
309
+ A UnarySteramMultiCallable value for the named unary-stream method.
310
+ """
311
+
312
+ @abc.abstractmethod
313
+ def stream_unary(
314
+ self,
315
+ method: str,
316
+ request_serializer: Optional[SerializingFunction] = None,
317
+ response_deserializer: Optional[DeserializingFunction] = None
318
+ ) -> StreamUnaryMultiCallable:
319
+ """Creates a StreamUnaryMultiCallable for a stream-unary method.
320
+
321
+ Args:
322
+ method: The name of the RPC method.
323
+ request_serializer: Optional :term:`serializer` for serializing the request
324
+ message. Request goes unserialized in case None is passed.
325
+ response_deserializer: Optional :term:`deserializer` for deserializing the
326
+ response message. Response goes undeserialized in case None
327
+ is passed.
328
+
329
+ Returns:
330
+ A StreamUnaryMultiCallable value for the named stream-unary method.
331
+ """
332
+
333
+ @abc.abstractmethod
334
+ def stream_stream(
335
+ self,
336
+ method: str,
337
+ request_serializer: Optional[SerializingFunction] = None,
338
+ response_deserializer: Optional[DeserializingFunction] = None
339
+ ) -> StreamStreamMultiCallable:
340
+ """Creates a StreamStreamMultiCallable for a stream-stream method.
341
+
342
+ Args:
343
+ method: The name of the RPC method.
344
+ request_serializer: Optional :term:`serializer` for serializing the request
345
+ message. Request goes unserialized in case None is passed.
346
+ response_deserializer: Optional :term:`deserializer` for deserializing the
347
+ response message. Response goes undeserialized in case None
348
+ is passed.
349
+
350
+ Returns:
351
+ A StreamStreamMultiCallable value for the named stream-stream method.
352
+ """