34 #ifndef GRPCXX_SERVER_BUILDER_H
35 #define GRPCXX_SERVER_BUILDER_H
42 #include <grpc/compression.h>
46 class AsyncGenericService;
47 class AsynchronousService;
48 class CompletionQueue;
51 class ServerCompletionQueue;
52 class ServerCredentials;
53 class SynchronousService;
54 class ThreadPoolInterface;
94 max_message_size_ = max_message_size;
99 compression_options_ = options;
102 void SetOption(std::unique_ptr<ServerBuilderOption> option);
116 std::shared_ptr<ServerCredentials> creds,
117 int* selected_port =
nullptr);
130 std::shared_ptr<ServerCredentials> creds;
134 typedef std::unique_ptr<grpc::string> HostString;
136 struct NamedService {
137 explicit NamedService(T* s) : service(s) {}
139 : host(new grpc::
string(h)), service(s) {}
144 int max_message_size_;
145 grpc_compression_options compression_options_;
146 std::vector<std::unique_ptr<ServerBuilderOption>> options_;
147 std::vector<std::unique_ptr<NamedService<RpcService>>> services_;
148 std::vector<std::unique_ptr<NamedService<AsynchronousService>>>
150 std::vector<Port> ports_;
151 std::vector<ServerCompletionQueue*> cqs_;
152 std::shared_ptr<ServerCredentials> creds_;
153 AsyncGenericService* generic_service_;
154 ThreadPoolInterface* thread_pool_;
159 #endif // GRPCXX_SERVER_BUILDER_H
std::string string
Definition: config.h:112
void RegisterAsyncService(AsynchronousService *service)
Register an asynchronous service.
Definition: service_type.h:68
void AddListeningPort(const grpc::string &addr, std::shared_ptr< ServerCredentials > creds, int *selected_port=nullptr)
Tries to bind server to the given addr.
void SetMaxMessageSize(int max_message_size)
Set max message size in bytes.
Definition: server_builder.h:93
Definition: async_generic_service.h:59
Definition: service_type.h:51
std::unique_ptr< Server > BuildAndStart()
Return a running server which is ready for processing calls.
std::unique_ptr< ServerCompletionQueue > AddCompletionQueue()
Add a completion queue for handling asynchronous services Caller is required to keep this completion ...
void SetOption(std::unique_ptr< ServerBuilderOption > option)
void RegisterAsyncGenericService(AsyncGenericService *service)
Register a generic service.
void SetCompressionOptions(const grpc_compression_options &options)
Set the compression options to be used by the server.
Definition: server_builder.h:98
A builder class for the creation and startup of grpc::Server instances.
Definition: server_builder.h:57
void RegisterService(SynchronousService *service)
Register a service.