Public Member Functions | |
None | abort (self, grpc.StatusCode code, str details='', MetadataType trailing_metadata=tuple()) |
None | add_done_callback (self, DoneCallbackType callback) |
Mapping[str, Iterable[bytes]] | auth_context (self) |
bool | cancelled (self) |
def | code (self) |
def | details (self) |
None | disable_next_message_compression (self) |
bool | done (self) |
Optional[Metadata] | invocation_metadata (self) |
str | peer (self) |
Optional[Iterable[bytes]] | peer_identities (self) |
Optional[str] | peer_identity_key (self) |
RequestType | read (self) |
None | send_initial_metadata (self, MetadataType initial_metadata) |
None | set_code (self, grpc.StatusCode code) |
None | set_compression (self, grpc.Compression compression) |
None | set_details (self, str details) |
None | set_trailing_metadata (self, MetadataType trailing_metadata) |
float | time_remaining (self) |
def | trailing_metadata (self) |
None | write (self, ResponseType message) |
A context object passed to method implementations.
Definition at line 138 of file _base_server.py.
None grpc.aio._base_server.ServicerContext.abort | ( | self, | |
grpc.StatusCode | code, | ||
str | details = '' , |
||
MetadataType | trailing_metadata = tuple() |
||
) |
Raises an exception to terminate the RPC with a non-OK status. The code and details passed as arguments will supercede any existing ones. Args: code: A StatusCode object to be sent to the client. It must not be StatusCode.OK. details: A UTF-8-encodable string to be sent to the client upon termination of the RPC. trailing_metadata: A sequence of tuple represents the trailing :term:`metadata`. Raises: Exception: An exception is always raised to signal the abortion the RPC to the gRPC runtime.
Definition at line 177 of file _base_server.py.
None grpc.aio._base_server.ServicerContext.add_done_callback | ( | self, | |
DoneCallbackType | callback | ||
) |
Registers a callback to be called on RPC termination. This is an EXPERIMENTAL API. Args: callback: A callable object will be called with the servicer context object as its only argument.
Definition at line 343 of file _base_server.py.
Mapping[str, Iterable[bytes]] grpc.aio._base_server.ServicerContext.auth_context | ( | self | ) |
Gets the auth context for the call. Returns: A map of strings to an iterable of bytes for each auth property.
Definition at line 297 of file _base_server.py.
bool grpc.aio._base_server.ServicerContext.cancelled | ( | self | ) |
Return True if the RPC is cancelled. The RPC is cancelled when the cancellation was requested with cancel(). This is an EXPERIMENTAL API. Returns: A bool indicates whether the RPC is cancelled or not.
Definition at line 353 of file _base_server.py.
def grpc.aio._base_server.ServicerContext.code | ( | self | ) |
Accesses the value to be used as status code upon RPC completion. This is an EXPERIMENTAL API. Returns: The StatusCode value for the RPC.
Definition at line 323 of file _base_server.py.
def grpc.aio._base_server.ServicerContext.details | ( | self | ) |
Accesses the value to be used as detail string upon RPC completion. This is an EXPERIMENTAL API. Returns: The details string of the RPC.
Definition at line 333 of file _base_server.py.
None grpc.aio._base_server.ServicerContext.disable_next_message_compression | ( | self | ) |
Disables compression for the next response message. This is an EXPERIMENTAL method. This method will override any compression configuration set during server creation or set on the call.
Definition at line 254 of file _base_server.py.
bool grpc.aio._base_server.ServicerContext.done | ( | self | ) |
Return True if the RPC is done. An RPC is done if the RPC is completed, cancelled or aborted. This is an EXPERIMENTAL API. Returns: A bool indicates if the RPC is done.
Definition at line 364 of file _base_server.py.
Optional[Metadata] grpc.aio._base_server.ServicerContext.invocation_metadata | ( | self | ) |
Accesses the metadata sent by the client. Returns: The invocation :term:`metadata`.
Definition at line 212 of file _base_server.py.
str grpc.aio._base_server.ServicerContext.peer | ( | self | ) |
Identifies the peer that invoked the RPC being serviced. Returns: A string identifying the peer that invoked the RPC being serviced. The string format is determined by gRPC runtime.
Definition at line 264 of file _base_server.py.
Optional[Iterable[bytes]] grpc.aio._base_server.ServicerContext.peer_identities | ( | self | ) |
Gets one or more peer identity(s). Equivalent to servicer_context.auth_context().get(servicer_context.peer_identity_key()) Returns: An iterable of the identities, or None if the call is not authenticated. Each identity is returned as a raw bytes type.
Definition at line 273 of file _base_server.py.
Optional[str] grpc.aio._base_server.ServicerContext.peer_identity_key | ( | self | ) |
The auth property used to identify the peer. For example, "x509_common_name" or "x509_subject_alternative_name" are used to identify an SSL peer. Returns: The auth property (string) that indicates the peer identity, or None if the call is not authenticated.
Definition at line 285 of file _base_server.py.
RequestType grpc.aio._base_server.ServicerContext.read | ( | self | ) |
A context object passed to method implementations.
Reads one message from the RPC. Only one read operation is allowed simultaneously. Returns: A response message of the RPC. Raises: An RpcError exception if the read failed.
Definition at line 142 of file _base_server.py.
None grpc.aio._base_server.ServicerContext.send_initial_metadata | ( | self, | |
MetadataType | initial_metadata | ||
) |
Sends the initial metadata value to the client. This method need not be called by implementations if they have no metadata to add to what the gRPC runtime will transmit. Args: initial_metadata: The initial :term:`metadata`.
Definition at line 165 of file _base_server.py.
None grpc.aio._base_server.ServicerContext.set_code | ( | self, | |
grpc.StatusCode | code | ||
) |
Sets the value to be used as status code upon RPC completion. This method need not be called by method implementations if they wish the gRPC runtime to determine the status code of the RPC. Args: code: A StatusCode object to be sent to the client.
Definition at line 220 of file _base_server.py.
None grpc.aio._base_server.ServicerContext.set_compression | ( | self, | |
grpc.Compression | compression | ||
) |
Set the compression algorithm to be used for the entire call. This is an EXPERIMENTAL method. Args: compression: An element of grpc.compression, e.g. grpc.compression.Gzip.
Definition at line 243 of file _base_server.py.
None grpc.aio._base_server.ServicerContext.set_details | ( | self, | |
str | details | ||
) |
Sets the value to be used the as detail string upon RPC completion. This method need not be called by method implementations if they have no details to transmit. Args: details: A UTF-8-encodable string to be sent to the client upon termination of the RPC.
Definition at line 231 of file _base_server.py.
None grpc.aio._base_server.ServicerContext.set_trailing_metadata | ( | self, | |
MetadataType | trailing_metadata | ||
) |
Sends the trailing metadata for the RPC. This method need not be called by implementations if they have no metadata to add to what the gRPC runtime will transmit. Args: trailing_metadata: The trailing :term:`metadata`.
Definition at line 201 of file _base_server.py.
float grpc.aio._base_server.ServicerContext.time_remaining | ( | self | ) |
Describes the length of allowed time remaining for the RPC. Returns: A nonnegative float indicating the length of allowed time in seconds remaining for the RPC to complete before it is considered to have timed out, or None if no deadline was specified for the RPC.
Definition at line 304 of file _base_server.py.
def grpc.aio._base_server.ServicerContext.trailing_metadata | ( | self | ) |
Access value to be used as trailing metadata upon RPC completion. This is an EXPERIMENTAL API. Returns: The trailing :term:`metadata` for the RPC.
Definition at line 313 of file _base_server.py.
None grpc.aio._base_server.ServicerContext.write | ( | self, | |
ResponseType | message | ||
) |
Writes one message to the RPC. Only one write operation is allowed simultaneously. Raises: An RpcError exception if the write failed.
Definition at line 155 of file _base_server.py.