• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1gRPC AsyncIO API
2================
3
4.. module:: grpc.experimental.aio
5
6Overview
7--------
8
9gRPC AsyncIO API is the **new version** of gRPC Python whose architecture is
10tailored to AsyncIO. Underlying, it utilizes the same C-extension, gRPC C-Core,
11as existing stack, and it replaces all gRPC IO operations with methods provided
12by the AsyncIO library.
13
14This stack currently is under active development. Feel free to offer
15suggestions by opening issues on our GitHub repo `grpc/grpc <https://github.com/grpc/grpc>`_.
16
17The design doc can be found here as `gRFC <https://github.com/grpc/proposal/pull/155>`_.
18
19
20Caveats
21-------
22
23gRPC Async API objects may only be used on the thread on which they were
24created. AsyncIO doesn't provide thread safety for most of its APIs.
25
26
27Blocking Code in AsyncIO
28------------------------
29
30Making blocking function calls in coroutines or in the thread running event
31loop will block the event loop, potentially starving all RPCs in the process.
32Refer to the Python language documentation on AsyncIO for more details (`running-blocking-code <https://docs.python.org/3/library/asyncio-dev.html#running-blocking-code>`_).
33
34
35Module Contents
36---------------
37
38
39Create Channel
40^^^^^^^^^^^^^^
41
42Channels are the abstraction of clients, where most of networking logic
43happens, for example, managing one or more underlying connections, name
44resolution, load balancing, flow control, etc.. If you are using ProtoBuf,
45Channel objects works best when further encapsulate into stub objects, then the
46application can invoke remote functions as if they are local functions.
47
48.. autofunction:: insecure_channel
49.. autofunction:: secure_channel
50
51
52Channel Object
53^^^^^^^^^^^^^^
54
55.. autoclass:: Channel
56
57
58Create Server
59^^^^^^^^^^^^^
60
61.. autofunction:: server
62
63
64Server Object
65^^^^^^^^^^^^^
66
67.. autoclass:: Server
68
69
70gRPC Exceptions
71^^^^^^^^^^^^^^^
72
73.. autoexception:: BaseError
74.. autoexception:: UsageError
75.. autoexception:: AbortError
76.. autoexception:: InternalError
77.. autoexception:: AioRpcError
78
79
80Shared Context
81^^^^^^^^^^^^^^^^^^^^
82
83.. autoclass:: RpcContext
84
85
86Client-Side Context
87^^^^^^^^^^^^^^^^^^^^^^^
88
89.. autoclass:: Call
90.. autoclass:: UnaryUnaryCall
91.. autoclass:: UnaryStreamCall
92.. autoclass:: StreamUnaryCall
93.. autoclass:: StreamStreamCall
94
95
96Server-Side Context
97^^^^^^^^^^^^^^^^^^^^^^^
98
99.. autoclass:: ServicerContext
100
101
102Client-Side Interceptor
103^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
104
105.. autoclass:: ClientCallDetails
106.. autoclass:: InterceptedUnaryUnaryCall
107.. autoclass:: UnaryUnaryClientInterceptor
108
109.. Service-Side Context
110.. ^^^^^^^^^^^^^^^^^^^^
111
112.. .. autoclass:: ServicerContext
113
114
115Multi-Callable Interfaces
116^^^^^^^^^^^^^^^^^^^^^^^^^
117
118.. autoclass:: UnaryUnaryMultiCallable
119.. autoclass:: UnaryStreamMultiCallable()
120.. autoclass:: StreamUnaryMultiCallable()
121.. autoclass:: StreamStreamMultiCallable()
122