Public Member Functions | Private Attributes | List of all members
grpc._server._Server Class Reference
Inheritance diagram for grpc._server._Server:
Inheritance graph
[legend]

Public Member Functions

def __del__ (self)
 
def __init__ (self, thread_pool, generic_handlers, interceptors, options, maximum_concurrent_rpcs, compression, xds)
 
def add_generic_rpc_handlers (self, generic_rpc_handlers)
 
def add_insecure_port (self, address)
 
def add_secure_port (self, address, server_credentials)
 
def start (self)
 
def stop (self, grace)
 
def wait_for_termination (self, timeout=None)
 
- Public Member Functions inherited from grpc::Server
grpc_serverc_server ()
 
experimental_type experimental ()
 
HealthCheckServiceInterfaceGetHealthCheckService () const
 Returns the health check service. More...
 
std::shared_ptr< ChannelInProcessChannel (const ChannelArguments &args)
 Establish a channel for in-process communication. More...
 
void Wait () ABSL_LOCKS_EXCLUDED(mu_) override
 
 ~Server () ABSL_LOCKS_EXCLUDED(mu_) override
 
- Public Member Functions inherited from grpc::ServerInterface
void Shutdown ()
 
template<class T >
void Shutdown (const T &deadline)
 
 ~ServerInterface () override
 
- Public Member Functions inherited from grpc::internal::CallHook
virtual ~CallHook ()
 

Private Attributes

 _state
 

Additional Inherited Members

- Static Public Member Functions inherited from grpc::Server
static void SetGlobalCallbacks (GlobalCallbacks *callbacks)
 
- Protected Member Functions inherited from grpc::Server
int AddListeningPort (const std::string &addr, ServerCredentials *creds) override
 
ContextAllocatorcontext_allocator ()
 
bool health_check_service_disabled () const
 NOTE: This method is not part of the public API for this class. More...
 
bool RegisterService (const std::string *addr, Service *service) override
 
grpc_serverserver () override
 
 Server (ChannelArguments *args, std::shared_ptr< std::vector< std::unique_ptr< ServerCompletionQueue >>> sync_server_cqs, int min_pollers, int max_pollers, int sync_cq_timeout_msec, std::vector< std::shared_ptr< internal::ExternalConnectionAcceptorImpl >> acceptors, grpc_server_config_fetcher *server_config_fetcher=nullptr, grpc_resource_quota *server_rq=nullptr, std::vector< std::unique_ptr< experimental::ServerInterceptorFactoryInterface >> interceptor_creators=std::vector< std::unique_ptr< experimental::ServerInterceptorFactoryInterface >>())
 
void set_health_check_service (std::unique_ptr< HealthCheckServiceInterface > service)
 NOTE: This method is not part of the public API for this class. More...
 
void Start (ServerCompletionQueue **cqs, size_t num_cqs) override
 
- Protected Member Functions inherited from grpc::ServerInterface
void RequestAsyncCall (internal::RpcServiceMethod *method, grpc::ServerContext *context, internal::ServerAsyncStreamingInterface *stream, grpc::CompletionQueue *call_cq, grpc::ServerCompletionQueue *notification_cq, void *tag)
 
template<class Message >
void RequestAsyncCall (internal::RpcServiceMethod *method, grpc::ServerContext *context, internal::ServerAsyncStreamingInterface *stream, grpc::CompletionQueue *call_cq, grpc::ServerCompletionQueue *notification_cq, void *tag, Message *message)
 
void RequestAsyncGenericCall (GenericServerContext *context, internal::ServerAsyncStreamingInterface *stream, grpc::CompletionQueue *call_cq, grpc::ServerCompletionQueue *notification_cq, void *tag)
 

Detailed Description

Definition at line 952 of file grpc/_server.py.

Constructor & Destructor Documentation

◆ __init__()

def grpc._server._Server.__init__ (   self,
  thread_pool,
  generic_handlers,
  interceptors,
  options,
  maximum_concurrent_rpcs,
  compression,
  xds 
)

Definition at line 955 of file grpc/_server.py.

◆ __del__()

def grpc._server._Server.__del__ (   self)

Definition at line 992 of file grpc/_server.py.

Member Function Documentation

◆ add_generic_rpc_handlers()

def grpc._server._Server.add_generic_rpc_handlers (   self,
  generic_rpc_handlers 
)
Registers GenericRpcHandlers with this Server.

This method is only safe to call before the server is started.

Args:
  generic_rpc_handlers: An iterable of GenericRpcHandlers that will be
  used to service RPCs.

Reimplemented from grpc::Server.

Definition at line 964 of file grpc/_server.py.

◆ add_insecure_port()

def grpc._server._Server.add_insecure_port (   self,
  address 
)
Opens an insecure port for accepting RPCs.

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 gRPC runtime will choose a port.

Returns:
  An integer port on which server will accept RPC requests.

Reimplemented from grpc::Server.

Definition at line 968 of file grpc/_server.py.

◆ add_secure_port()

def grpc._server._Server.add_secure_port (   self,
  address,
  server_credentials 
)
Opens a secure port for accepting RPCs.

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 gRPC
    runtime will choose a port.
  server_credentials: A ServerCredentials object.

Returns:
  An integer port on which server will accept RPC requests.

Reimplemented from grpc::Server.

Definition at line 972 of file grpc/_server.py.

◆ start()

def grpc._server._Server.start (   self)
Starts this Server.

This method may only be called once. (i.e. it is not idempotent).

Reimplemented from grpc::Server.

Definition at line 978 of file grpc/_server.py.

◆ stop()

def grpc._server._Server.stop (   self,
  grace 
)
Stops this Server.

This method immediately stop service of new RPCs in all cases.

If a grace period is specified, this method returns immediately
and all RPCs active at the end of 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.

Returns:
  A threading.Event that will be set when this Server has completely
  stopped, i.e. when running RPCs either complete or are aborted and
  all handlers have terminated.

Reimplemented from grpc::Server.

Definition at line 989 of file grpc/_server.py.

◆ wait_for_termination()

def grpc._server._Server.wait_for_termination (   self,
  timeout = None 
)
Block current thread until 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.

Reimplemented from grpc::Server.

Definition at line 981 of file grpc/_server.py.

Member Data Documentation

◆ _state

grpc._server._Server._state
private

Definition at line 959 of file grpc/_server.py.


The documentation for this class was generated from the following file:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:32