Represents a gRPC server.
More...
#include <server.h>
|
bool | RegisterService (const std::string *addr, Service *service) override |
| Register a service. More...
|
|
int | AddListeningPort (const std::string &addr, ServerCredentials *creds) override |
| Try binding the server to the given addr endpoint (port, and optionally including IP address to bind to). More...
|
|
| 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 >>(), experimental::ServerMetricRecorder *server_metric_recorder=nullptr) |
| NOTE: This is NOT a public API. More...
|
|
void | Start (ServerCompletionQueue **cqs, size_t num_cqs) override |
| Start the server. More...
|
|
grpc_server * | server () override |
|
void | set_health_check_service (std::unique_ptr< HealthCheckServiceInterface > service) |
| NOTE: This method is not part of the public API for this class. More...
|
|
ContextAllocator * | context_allocator () |
|
bool | health_check_service_disabled () const |
| NOTE: This method is not part of the public API for this class. More...
|
|
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 | RequestAsyncCall (internal::RpcServiceMethod *method, grpc::ServerContext *context, internal::ServerAsyncStreamingInterface *stream, grpc::CompletionQueue *call_cq, grpc::ServerCompletionQueue *notification_cq, void *tag) |
|
void | RequestAsyncGenericCall (GenericServerContext *context, internal::ServerAsyncStreamingInterface *stream, grpc::CompletionQueue *call_cq, grpc::ServerCompletionQueue *notification_cq, void *tag) |
|
Represents a gRPC server.
Use a grpc::ServerBuilder to create, configure, and start Server instances.
◆ ~Server()
grpc::Server::~Server |
( |
| ) |
|
|
override |
◆ Server()
NOTE: This is NOT a public API.
The server constructors are supposed to be used by ServerBuilder class only. The constructor will be made 'private' very soon.
Server constructors. To be used by ServerBuilder only.
- Parameters
-
args | The channel args |
sync_server_cqs | The completion queues to use if the server is a synchronous server (or a hybrid server). The server polls for new RPCs on these queues |
min_pollers | The minimum number of polling threads per server completion queue (in param sync_server_cqs) to use for listening to incoming requests (used only in case of sync server) |
max_pollers | The maximum number of polling threads per server completion queue (in param sync_server_cqs) to use for listening to incoming requests (used only in case of sync server) |
sync_cq_timeout_msec | The timeout to use when calling AsyncNext() on server completion queues passed via sync_server_cqs param. |
◆ AddListeningPort()
int grpc::Server::AddListeningPort |
( |
const std::string & |
addr, |
|
|
ServerCredentials * |
creds |
|
) |
| |
|
overrideprotectedvirtual |
Try binding the server to the given addr endpoint (port, and optionally including IP address to bind to).
It can be invoked multiple times. Should be used before starting the server.
- Parameters
-
addr | The address to try to bind to the server (eg, localhost:1234, 192.168.1.1:31416, [::1]:27182, etc.). |
creds | The credentials associated with the server. |
- Returns
- bound port number on success, 0 on failure.
- Warning
- It is an error to call this method on an already started server.
Implements grpc::ServerInterface.
◆ c_server()
Returns a raw pointer to the underlying grpc_server instance.
EXPERIMENTAL: for internal/test use only
◆ context_allocator()
◆ experimental()
NOTE: The function experimental() is not stable public API.
It is a view to the experimental components of this class. It may be changed or removed at any time.
◆ GetHealthCheckService()
Returns the health check service.
◆ health_check_service_disabled()
bool grpc::Server::health_check_service_disabled |
( |
| ) |
const |
|
inlineprotected |
NOTE: This method is not part of the public API for this class.
◆ InProcessChannel()
Establish a channel for in-process communication.
◆ RegisterService()
bool grpc::Server::RegisterService |
( |
const std::string * |
addr, |
|
|
Service * |
service |
|
) |
| |
|
overrideprotectedvirtual |
Register a service.
This call does not take ownership of the service. The service must exist for the lifetime of the Server instance.
Implements grpc::ServerInterface.
◆ server()
|
inlineoverrideprotectedvirtual |
◆ set_health_check_service()
NOTE: This method is not part of the public API for this class.
◆ SetGlobalCallbacks()
static void grpc::Server::SetGlobalCallbacks |
( |
GlobalCallbacks * |
callbacks | ) |
|
|
static |
Set the global callback object.
Can only be called once per application. Does not take ownership of callbacks, and expects the pointed to object to be alive until all server objects in the process have been destroyed. The same GlobalCallbacks object will be used throughout the application and is shared among all Server objects.
◆ Start()
Start the server.
- Parameters
-
cqs | Completion queues for handling asynchronous services. The caller is required to keep all completion queues live until the server is destroyed. |
num_cqs | How many completion queues does cqs hold. |
Implements grpc::ServerInterface.
◆ Wait()
void grpc::Server::Wait |
( |
| ) |
|
|
overridevirtual |
Block until the server shuts down.
- Warning
- The server must be either shutting down or some other thread must call Shutdown for this function to ever return.
Implements grpc::ServerInterface.
◆ AsyncGenericService
◆ ServerBuilder
◆ ServerInitializer
The documentation for this class was generated from the following file: