1gRPC AsyncIO API 2================ 3 4.. module:: grpc.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 API is stable. Feel free to open issues on our GitHub repo 15`grpc/grpc <https://github.com/grpc/grpc>`_ for bugs or suggestions. 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 79gRPC Metadata 80^^^^^^^^^^^^^ 81 82.. autoclass:: Metadata 83 84 85RPC Context 86^^^^^^^^^^^^^^^^^^^^ 87 88.. autoclass:: RpcContext 89 90 91Client-Side Context 92^^^^^^^^^^^^^^^^^^^^^^^ 93 94.. autoclass:: Call 95.. autoclass:: UnaryUnaryCall 96.. autoclass:: UnaryStreamCall 97.. autoclass:: StreamUnaryCall 98.. autoclass:: StreamStreamCall 99 100 101Server-Side Context 102^^^^^^^^^^^^^^^^^^^^^^^ 103 104.. autoclass:: ServicerContext 105 106 107Client-Side Interceptor 108^^^^^^^^^^^^^^^^^^^^^^^ 109 110.. autoclass:: ClientCallDetails 111.. autoclass:: InterceptedUnaryUnaryCall 112.. autoclass:: ClientInterceptor 113.. autoclass:: UnaryUnaryClientInterceptor 114.. autoclass:: UnaryStreamClientInterceptor 115.. autoclass:: StreamUnaryClientInterceptor 116.. autoclass:: StreamStreamClientInterceptor 117 118Server-Side Interceptor 119^^^^^^^^^^^^^^^^^^^^^^^ 120 121.. autoclass:: ServerInterceptor 122 123 124Multi-Callable Interfaces 125^^^^^^^^^^^^^^^^^^^^^^^^^ 126 127.. autoclass:: UnaryUnaryMultiCallable 128.. autoclass:: UnaryStreamMultiCallable() 129.. autoclass:: StreamUnaryMultiCallable() 130.. autoclass:: StreamStreamMultiCallable() 131