ruạṛ
a K��f�0 � @ s� d Z ddlZddlmZmZmZmZmZmZ ddl Z ddl mZ ddlm Z ddlmZ ddlmZ dd lmZ G d d� dej�ZG dd � d eeef ej�ZdS )z.Abstract base classes for server-side classes.� N)�Generic�Iterable�Mapping�NoReturn�Optional�Sequence� )�Metadata)�DoneCallbackType)�MetadataType)�RequestType)�ResponseTypec @ s� e Zd ZdZejeej dd�dd��Z eje ed�dd��Zeje ej ed �d d��Zejdd�d d��Zejee dd�dd��Zejdee ed�dd��Zdd� ZdS )�ServerzServes RPCs.N)�generic_rpc_handlers�returnc C s dS )z�Registers GenericRpcHandlers with this Server. This method is only safe to call before the server is started. Args: generic_rpc_handlers: A sequence of GenericRpcHandlers that will be used to service RPCs. N� )�selfr r r �y/sparta/input/_build_configuration/image_build+validate/lib/bmcenv/lib64/python3.9/site-packages/grpc/aio/_base_server.py�add_generic_rpc_handlers s zServer.add_generic_rpc_handlers)�addressr c C s dS )a Opens an insecure port for accepting RPCs. A port is a communication endpoint that used by networking protocols, like TCP and UDP. To date, we only support TCP. This method may only be called before starting the server. Args: address: The address for which to open a port. If the port is 0, or not specified in the address, then the gRPC runtime will choose a port. Returns: An integer port on which the server will accept RPC requests. Nr )r r r r r �add_insecure_port, s zServer.add_insecure_port)r �server_credentialsr c C s dS )aL Opens a secure port for accepting RPCs. A port is a communication endpoint that used by networking protocols, like TCP and UDP. To date, we only support TCP. This method may only be called before starting the server. Args: address: The address for which to open a port. if the port is 0, or not specified in the address, then the gRPC runtime will choose a port. server_credentials: A ServerCredentials object. Returns: An integer port on which the server will accept RPC requests. Nr )r r r r r r �add_secure_port= s zServer.add_secure_port�r c � s dS )zgStarts this Server. This method may only be called once. (i.e. it is not idempotent). Nr �r r r r �startR s zServer.start)�gracer c � s dS )a Stops this Server. This method immediately stops the server from servicing new RPCs in all cases. If a grace period is specified, this method waits until all active RPCs are finished or until the grace period is reached. RPCs that haven't been terminated within the grace period are aborted. If a grace period is not specified (by passing None for grace), all existing RPCs are aborted immediately and this method blocks until the last RPC handler terminates. This method is idempotent and may be called at any time. Passing a smaller grace value in a subsequent call will have the effect of stopping the Server sooner (passing None will have the effect of stopping the server immediately). Passing a larger grace value in a subsequent call will not have the effect of stopping the server later (i.e. the most restrictive grace value is used). Args: grace: A duration of time in seconds or None. Nr )r r r r r �stopY s zServer.stop)�timeoutr c � s dS )a� Continues current coroutine once the server stops. This is an EXPERIMENTAL API. The wait will not consume computational resources during blocking, and it will block until one of the two following conditions are met: 1) The server is stopped or terminated; 2) A timeout occurs if timeout is not `None`. The timeout argument works in the same way as `threading.Event.wait()`. https://docs.python.org/3/library/threading.html#threading.Event.wait Args: timeout: A floating point number specifying a timeout for the operation in seconds. Returns: A bool indicates if the operation times out. Nr )r r r r r �wait_for_terminationr s zServer.wait_for_terminationc C s dS )a& Registers GenericRpcHandlers with this Server. This method is only safe to call before the server is started. Args: service_name: The service name. method_handlers: A dictionary that maps method names to corresponding RpcMethodHandler. Nr )r �service_name�method_handlersr r r �add_registered_method_handlers� s z%Server.add_registered_method_handlers)N)�__name__� __module__�__qualname__�__doc__�abc�abstractmethodr �grpc�GenericRpcHandlerr �str�intr �ServerCredentialsr r r �floatr �boolr r"