19 #ifndef GRPCXX_SERVER_H
20 #define GRPCXX_SERVER_H
22 #include <condition_variable>
43 class AsyncGenericService;
44 class HealthCheckServiceInterface;
46 class ServerInitializer;
95 return health_check_service_.get();
108 class ShutdownRequest;
114 class SyncRequestThreadManager;
116 class UnimplementedAsyncRequestContext;
117 class UnimplementedAsyncRequest;
118 class UnimplementedAsyncResponse;
142 std::shared_ptr<std::vector<std::unique_ptr<ServerCompletionQueue>>>
144 int min_pollers,
int max_pollers,
int sync_cq_timeout_msec);
183 int max_receive_message_size()
const override {
184 return max_receive_message_size_;
187 grpc_server* server()
override {
return server_; };
191 const int max_receive_message_size_;
196 std::shared_ptr<std::vector<std::unique_ptr<ServerCompletionQueue>>>
201 std::vector<std::unique_ptr<SyncRequestThreadManager>> sync_req_mgrs_;
207 bool shutdown_notified_;
209 std::condition_variable shutdown_cv_;
211 std::shared_ptr<GlobalCallbacks> global_callbacks_;
213 std::vector<grpc::string> services_;
214 bool has_generic_service_;
219 std::unique_ptr<ServerInitializer> server_initializer_;
221 std::unique_ptr<HealthCheckServiceInterface> health_check_service_;
222 bool health_check_service_disabled_;
227 #endif // GRPCXX_SERVER_H
std::string string
Definition: config.h:35
friend class ServerInitializer
Definition: server.h:104
void Wait() override
Block until the server shuts down.
virtual void AddPort(Server *server, const grpc::string &addr, ServerCredentials *creds, int port)
Called after a server port is added.
Definition: server.h:80
Options for channel creation.
Definition: channel_arguments.h:39
Desriptor of an RPC service and its various RPC methods.
Definition: service_type.h:58
Definition: server_initializer.h:32
struct grpc_server grpc_server
A server listens to some port and responds to request calls.
Definition: grpc_types.h:66
virtual ~GlobalCallbacks()
Definition: server.h:70
Definition: async_generic_service.h:45
static void SetGlobalCallbacks(GlobalCallbacks *callbacks)
Set the global callback object.
Classes that require gRPC to be initialized should inherit from this class.
Definition: grpc_library.h:37
The gRPC server uses this interface to expose the health checking service without depending on protob...
Definition: health_check_service_interface.h:31
virtual void PreSynchronousRequest(ServerContext *context)=0
Called before application callback for each synchronous server request.
virtual void PreServerStart(Server *server)
Called before server is started.
Definition: server.h:78
Wrapper around grpc_server_credentials, a way to authenticate a server.
Definition: server_credentials.h:35
Represents a gRPC server.
Definition: server.h:52
A ServerContext allows the person implementing a service handler to:
Definition: server_context.h:96
Definition: server_interface.h:47
An abstract collection of call ops, used to generate the grpc_call_op structure to pass down to the l...
Definition: call.h:611
Global callbacks are a set of hooks that are called when server events occur.
Definition: server.h:68
Analogous to struct timespec.
Definition: gpr_types.h:47
virtual void UpdateArguments(ChannelArguments *args)
Called before server is created.
Definition: server.h:72
A specific type of completion queue used by the processing of notifications by servers.
Definition: completion_queue.h:321
virtual void PostSynchronousRequest(ServerContext *context)=0
Called after application callback for each synchronous server request.
HealthCheckServiceInterface * GetHealthCheckService() const
Returns the health check service.
Definition: server.h:94
A builder class for the creation and startup of grpc::Server instances.
Definition: server_builder.h:53
std::shared_ptr< Channel > InProcessChannel(const ChannelArguments &args)
Establish a channel for in-process communication.
Straightforward wrapping of the C call object.
Definition: call.h:683