class _CrossLoopUnaryUnaryCall(UnaryUnaryCall[
Constructor: _CrossLoopUnaryUnaryCall(channel, method, request, request_serializer, ...)
Provide cross-loop access to one unary gRPC call.
All direct awaiters share the submitted call. Cancellation by one direct
awaiter cancels the shared call and affects every waiter. Use
asyncio.shield when one waiter's cancellation must not cancel the
call.
| Method | __await__ |
Return an iterator that waits for the RPC result. |
| Method | __init__ |
Initialize a cross-loop unary call. |
| Method | add |
Add a function to call when the RPC is complete. |
| Method | cancel |
Request cancellation of the RPC. |
| Method | cancelled |
Return whether the RPC was cancelled. |
| Async Method | code |
Return the final gRPC status code. |
| Method | debug |
Return cached native diagnostic details when grpc provides them. |
| Async Method | details |
Return the final gRPC status details. |
| Method | done |
Return whether the RPC is complete. |
| Async Method | initial |
Return the initial RPC metadata. |
| Method | time |
Return the remaining RPC timeout in seconds. |
| Async Method | trailing |
Return the trailing RPC metadata. |
| Async Method | wait |
Wait until the native call has a connection. |
| Async Method | _await |
Wait for the result and its published terminal state. |
| Async Method | _call |
Return one value from the native call. |
| Async Method | _capture |
Finish terminal capture after native completion despite SDK close. |
| Async Method | _capture |
Cache terminal metadata and status values. |
| Async Method | _invoke |
Create and run the native call on the SDK event loop. |
| Method | _mark |
Publish native call completion before the wrapper task resumes. |
| Async Method | _public |
Return one call value to an external event loop. |
| Method | _publish |
Cache the standard local-cancellation status and wake waiters. |
| Method | _publish |
Signal the public native-RPC completion boundary once. |
| Method | _publish |
Signal that no further authoritative terminal capture is pending. |
| Async Method | _read |
Read optional synchronous or asynchronous native diagnostics. |
| Method | _submission |
Publish terminal state when submission ends before call creation. |
| Instance Variable | _address |
Undocumented |
| Instance Variable | _address |
Undocumented |
| Instance Variable | _address |
Undocumented |
| Instance Variable | _call |
Undocumented |
| Instance Variable | _call |
Undocumented |
| Instance Variable | _cancel |
Undocumented |
| Instance Variable | _channel |
Undocumented |
| Instance Variable | _compression |
Undocumented |
| Instance Variable | _credentials |
Undocumented |
| Instance Variable | _metadata |
Undocumented |
| Instance Variable | _method |
Undocumented |
| Instance Variable | _native |
Undocumented |
| Instance Variable | _native |
Undocumented |
| Instance Variable | _pending |
Undocumented |
| Instance Variable | _released |
Undocumented |
| Instance Variable | _request |
Undocumented |
| Instance Variable | _request |
Undocumented |
| Instance Variable | _response |
Undocumented |
| Instance Variable | _rpc |
Undocumented |
| Instance Variable | _started |
Undocumented |
| Instance Variable | _submitted |
Undocumented |
| Instance Variable | _terminal |
Undocumented |
| Instance Variable | _terminal |
Undocumented |
| Instance Variable | _terminal |
Undocumented |
| Instance Variable | _terminal |
Undocumented |
| Instance Variable | _timeout |
Undocumented |
| Instance Variable | _wait |
Undocumented |
Channel, method: str, request: Req, request_serializer: SerializingFunction | None, response_deserializer: DeserializingFunction | None, timeout: float | None, metadata: MetadataType | None, credentials: CallCredentials | None, wait_for_ready: bool | None, compression: Compression | None, address: str | None = None, address_resolver: Callable[ [], str] | None = None):
(source)
¶
Initialize a cross-loop unary call.
Mutable supported protobuf request values are copied before submission. Other custom request values are serialized immediately on the caller thread when a serializer is supplied. Metadata is copied to an independent gRPC metadata object. These snapshots prevent a caller from changing native-call inputs while the SDK loop is waiting to create the call. A custom request value without a serializer is assumed to be immutable or otherwise safe to share between threads.
| Parameters | |
channel:Channel | SDK channel that owns the call. |
method:str | Fully qualified gRPC method name. |
request:Req | Request value to send. |
requestSerializingFunction | None | Optional request serializer. For a custom request value, the SDK calls it synchronously on the thread that constructs the call. It must be thread-safe, loop-neutral, and return promptly. |
responseDeserializingFunction | None | Optional response deserializer. |
timeout:float | None | Optional call timeout in seconds. |
metadata:MetadataType | None | Optional call metadata. |
credentials:CallCredentials | None | Optional call credentials. |
waitbool | None | Optional gRPC wait-for-ready setting. |
compression:Compression | None | Optional gRPC compression setting. |
address:str | None | Resolved transport address. Use None to resolve the address from method. |
addressCallable[ | Optional SDK-loop callback that resolves a deferred transport address when the native call starts. |
Request cancellation of the RPC.
The method rejects cancellation after the native RPC ends. This rule also applies while the wrapper copies terminal metadata on the SDK loop.
| Returns | |
bool | True if the active submission accepted cancellation. |
Return cached native diagnostic details when grpc provides them.
Async gRPC call objects do not currently define this method, while
grpc.aio.AioRpcError does. The cross-loop wrapper exposes the
diagnostic for compatibility with callers that inspect both shapes.
| Returns | |
str | Native debug details after a failed call, or an empty string. |
Wait until the native call has a connection.
If channel close rejects a late accessor submission, wait for the authoritative call owner. Successful completion proves that a connection existed; its native error is otherwise propagated.
Wait for the result and its published terminal state.
If an external asyncio task is canceled, its shield wrapper is
canceled first. The explicit call to cancel then sends the
cancellation to an active native RPC. The method rejects cancellation
after the native result or error becomes final.
If the SDK cannot start a task, the submitted future can complete
before its completion callback publishes the call state. The terminal
wait keeps done and the result accessors consistent when this
method returns or raises that error.
| Returns | |
Res | Native RPC result. |
Finish terminal capture after native completion despite SDK close.
Runtime shutdown cancels ordinary submissions directly. After the native call ends, that cancellation must not replace its result or error. A shielded child task copies the metadata. This submission waits for the child task before it finishes.
| Parameters | |
call:UnaryUnaryCall[ | Authoritatively completed native call. |
Cache terminal metadata and status values.
| Parameters | |
call:UnaryUnaryCall[ | Completed or failed native call. |
object, pending: Awaitable[ Any] | None = None) -> str | None:
(source)
¶
Read optional synchronous or asynchronous native diagnostics.
Diagnostic accessor failures must not replace the authoritative RPC result. A pending accessor captured by the native done callback is awaited exactly once on the SDK loop.
| Parameters | |
source:object | Native call or error that exposes the accessor. |
pending:Awaitable[ | Awaitable already created by the native done callback. |
| Returns | |
str | None | Debug string, or None when it is unavailable. |
Publish terminal state when submission ends before call creation.
Cancellation or asynchronous task-creation failure can end an accepted submission before its SDK coroutine starts. No finally block can then signal the call and terminal gates.
| Parameters | |
submitted:CrossLoopAwaitable[ | Completed SDK submission. |