Go to the documentation of this file.
19 #ifndef GRPCPP_SERVER_IMPL_H
20 #define GRPCPP_SERVER_IMPL_H
47 class AsyncGenericService;
50 class ExternalConnectionAcceptorImpl;
108 return health_check_service_.get();
125 std::vector<std::unique_ptr<
127 interceptor_creators);
183 std::shared_ptr<std::vector<std::unique_ptr<ServerCompletionQueue>>>
185 int min_pollers,
int max_pollers,
int sync_cq_timeout_msec,
187 std::shared_ptr<grpc::internal::ExternalConnectionAcceptorImpl>>
190 std::vector<std::unique_ptr<
192 interceptor_creators = std::vector<std::unique_ptr<
208 std::unique_ptr<grpc::HealthCheckServiceInterface> service) {
209 health_check_service_ = std::move(service);
214 return health_check_service_disabled_;
219 std::unique_ptr<grpc::experimental::ServerInterceptorFactoryInterface>>*
220 interceptor_creators()
override {
221 return &interceptor_creators_;
229 class CallbackRequestBase;
230 template <
class ServerContextType>
231 class CallbackRequest;
232 class UnimplementedAsyncRequest;
233 class UnimplementedAsyncResponse;
239 class SyncRequestThreadManager;
245 #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
246 void RegisterCallbackGenericService(
250 grpc::CallbackGenericService* service)
override;
252 class experimental_registration_type final
260 void RegisterCallbackGenericService(
262 server_->RegisterCallbackGenericService(service);
270 void RegisterCallbackGenericService(
276 experimental_registration_interface* experimental_registration()
override {
277 return &experimental_registration_;
286 int max_receive_message_size()
const override {
287 return max_receive_message_size_;
298 void UnrefWithPossibleNotify() ;
299 void UnrefAndWaitLocked() ;
301 std::vector<std::shared_ptr<grpc::internal::ExternalConnectionAcceptorImpl>>
310 std::unique_ptr<grpc::experimental::ServerInterceptorFactoryInterface>>
311 interceptor_creators_;
313 int max_receive_message_size_;
318 std::shared_ptr<std::vector<std::unique_ptr<ServerCompletionQueue>>>
323 std::vector<std::unique_ptr<SyncRequestThreadManager>> sync_req_mgrs_;
325 #ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
328 experimental_registration_type experimental_registration_{
this};
335 bool shutdown_notified_;
337 bool shutdown_done_ =
false;
338 std::atomic_int shutdown_refs_outstanding_{1};
342 std::shared_ptr<GlobalCallbacks> global_callbacks_;
344 std::vector<grpc::string> services_;
345 bool has_async_generic_service_ =
false;
346 bool has_callback_generic_service_ =
false;
347 bool has_callback_methods_ =
false;
352 std::unique_ptr<grpc_impl::ServerInitializer> server_initializer_;
354 std::unique_ptr<grpc::HealthCheckServiceInterface> health_check_service_;
355 bool health_check_service_disabled_;
359 #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
360 std::unique_ptr<grpc::CallbackGenericService> unimplemented_service_;
362 std::unique_ptr<grpc::experimental::CallbackGenericService>
363 unimplemented_service_;
367 std::unique_ptr<grpc::internal::MethodHandler> resource_exhausted_handler_;
370 std::unique_ptr<grpc::internal::MethodHandler> generic_handler_;
381 std::vector<CompletionQueue*> cq_list_;
386 #endif // GRPCPP_SERVER_IMPL_H
Classes that require gRPC to be initialized should inherit from this class.
Definition: grpc_library.h:38
A builder class for the creation and startup of grpc::Server instances.
Definition: server_builder_impl.h:94
grpc::HealthCheckServiceInterface * GetHealthCheckService() const
Returns the health check service.
Definition: server_impl.h:107
virtual ~GlobalCallbacks()
Definition: server_impl.h:82
This header provides an object that reads bytes directly from a grpc::ByteBuffer, via the ZeroCopyInp...
Definition: alarm.h:24
struct grpc_resource_quota grpc_resource_quota
Definition: grpc_types.h:694
::grpc_impl::HealthCheckServiceInterface HealthCheckServiceInterface
Definition: health_check_service_interface.h:29
Definition: server_initializer_impl.h:34
::grpc_impl::CompletionQueue CompletionQueue
Definition: completion_queue.h:26
Straightforward wrapping of the C call object.
Definition: call.h:38
Desriptor of an RPC service and its various RPC methods.
Definition: service_type.h:60
virtual void AddPort(Server *, const grpc::string &, grpc::ServerCredentials *, int)
Called after a server port is added.
Definition: server_impl.h:92
void Wait() override
Block until the server shuts down.
virtual void PostSynchronousRequest(grpc_impl::ServerContext *context)=0
Called after application callback for each synchronous server request.
Represents a gRPC server.
Definition: server_impl.h:64
A specific type of completion queue used by the processing of notifications by servers.
Definition: completion_queue_impl.h:424
int AddListeningPort(const grpc::string &addr, grpc::ServerCredentials *creds) override
Try binding the server to the given addr endpoint (port, and optionally including IP address to bind ...
void set_health_check_service(std::unique_ptr< grpc::HealthCheckServiceInterface > service)
NOTE: This method is not part of the public API for this class.
Definition: server_impl.h:207
A ServerContext or CallbackServerContext allows the code implementing a service handler to:
Definition: server_context_impl.h:510
The gRPC server uses this interface to expose the health checking service without depending on protob...
Definition: health_check_service_interface_impl.h:28
virtual void UpdateArguments(ChannelArguments *)
Called before server is created.
Definition: server_impl.h:84
An abstract collection of call ops, used to generate the grpc_call_op structure to pass down to the l...
Definition: call_op_set_interface.h:34
void Start(ServerCompletionQueue **cqs, size_t num_cqs) override
Start the server.
NOTE: class experimental_registration_interface is not part of the public API of this class TODO(vjpa...
Definition: server_interface.h:147
::grpc_impl::ServerContext ServerContext
Definition: server_context.h:26
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< grpc::internal::ExternalConnectionAcceptorImpl >> acceptors, grpc_resource_quota *server_rq=nullptr, std::vector< std::unique_ptr< grpc::experimental::ServerInterceptorFactoryInterface >> interceptor_creators=std::vector< std::unique_ptr< grpc::experimental::ServerInterceptorFactoryInterface >>())
NOTE: This is NOT a public API.
struct grpc_server grpc_server
A server listens to some port and responds to request calls.
Definition: grpc_types.h:65
Wrapper around grpc_server_credentials, a way to authenticate a server.
Definition: server_credentials_impl.h:40
CallbackGenericService is the base class for generic services implemented using the callback API and ...
Definition: async_generic_service.h:125
Definition: async_generic_service.h:77
Options for channel creation.
Definition: channel_arguments_impl.h:43
::grpc_impl::ServerInitializer ServerInitializer
Definition: server_initializer.h:26
std::shared_ptr< Channel > InProcessChannelWithInterceptors(const ChannelArguments &args, std::vector< std::unique_ptr< grpc::experimental::ClientInterceptorFactoryInterface >> interceptor_creators)
Establish a channel for in-process communication with client interceptors.
virtual void PreServerStart(Server *)
Called before server is started.
Definition: server_impl.h:90
Definition: server_interceptor.h:47
virtual void PreSynchronousRequest(grpc_impl::ServerContext *context)=0
Called before application callback for each synchronous server request.
NOTE: class experimental_type is not part of the public API of this class.
Definition: server_impl.h:117
bool health_check_service_disabled() const
NOTE: This method is not part of the public API for this class.
Definition: server_impl.h:213
static void SetGlobalCallbacks(GlobalCallbacks *callbacks)
Set the global callback object.
Definition: client_interceptor.h:49
std::string string
Definition: config.h:35
experimental_type experimental()
NOTE: The function experimental() is not stable public API.
Definition: server_impl.h:136
Global callbacks are a set of hooks that are called when server events occur.
Definition: server_impl.h:80
std::shared_ptr< Channel > InProcessChannel(const ChannelArguments &args)
Establish a channel for in-process communication.
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm_impl.h:33
grpc_server * c_server()
Returns a raw pointer to the underlying grpc_server instance.
Definition: server_interface.h:68
bool RegisterService(const grpc::string *host, grpc::Service *service) override
Register a service.
Analogous to struct timespec.
Definition: gpr_types.h:47
experimental_type(Server *server)
Definition: server_impl.h:119
grpc_server * server() override
Definition: server_impl.h:203