19 #ifndef GRPCPP_SERVER_BUILDER_H 20 #define GRPCPP_SERVER_BUILDER_H 40 class AsyncGenericService;
42 class CompletionQueue;
44 class ServerCompletionQueue;
45 class ServerCredentials;
49 class ServerBuilderPluginTest;
52 namespace experimental {
53 class CallbackGenericService;
73 virtual std::unique_ptr<Server> BuildAndStart();
97 std::shared_ptr<ServerCredentials> creds,
98 int* selected_port =
nullptr);
130 std::unique_ptr<ServerCompletionQueue> AddCompletionQueue(
131 bool is_frequently_polled =
true);
154 max_receive_message_size_ = max_receive_message_size;
161 max_send_message_size_ = max_send_message_size;
167 return SetMaxReceiveMessageSize(max_message_size);
191 ServerBuilder& SetOption(std::unique_ptr<ServerBuilderOption> option);
212 static void InternalAddPluginFactory(
213 std::unique_ptr<ServerBuilderPlugin> (*CreatePlugin)());
229 std::unique_ptr<experimental::ServerInterceptorFactoryInterface>>
230 interceptor_creators) {
231 builder_->interceptor_creators_ = std::move(interceptor_creators);
254 std::shared_ptr<ServerCredentials>
creds;
269 std::vector<Port>
ports() {
return ports_; }
273 std::vector<NamedService*> service_refs;
274 for (
auto& ptr : services_) {
275 service_refs.push_back(ptr.get());
282 std::vector<ServerBuilderOption*> option_refs;
283 for (
auto& ptr : options_) {
284 option_refs.push_back(ptr.get());
290 friend class ::grpc::testing::ServerBuilderPluginTest;
292 struct SyncServerSettings {
294 : num_cqs(1), min_pollers(1), max_pollers(2), cq_timeout_msec(10000) {}
311 int max_receive_message_size_;
312 int max_send_message_size_;
313 std::vector<std::unique_ptr<ServerBuilderOption>> options_;
314 std::vector<std::unique_ptr<NamedService>> services_;
315 std::vector<Port> ports_;
317 SyncServerSettings sync_server_settings_;
320 std::vector<ServerCompletionQueue*> cqs_;
322 std::shared_ptr<ServerCredentials> creds_;
323 std::vector<std::unique_ptr<ServerBuilderPlugin>> plugins_;
330 } maybe_default_compression_level_;
334 } maybe_default_compression_algorithm_;
335 uint32_t enabled_compression_algorithms_bitset_;
336 std::vector<std::unique_ptr<experimental::ServerInterceptorFactoryInterface>>
337 interceptor_creators_;
342 #endif // GRPCPP_SERVER_BUILDER_H ServerBuilder & SetMaxMessageSize(int max_message_size)
Definition: server_builder.h:166
int * selected_port
Definition: server_builder.h:255
std::vector< NamedService * > services()
Experimental, to be deprecated.
Definition: server_builder.h:272
Maximum number of polling threads.
Definition: server_builder.h:197
std::string string
Definition: config.h:35
std::shared_ptr< ServerCredentials > creds
Definition: server_builder.h:254
experimental_type experimental()
NOTE: The function experimental() is not stable public API.
Definition: server_builder.h:248
std::unique_ptr< grpc::string > HostString
Experimental, to be deprecated.
Definition: server_builder.h:259
std::unique_ptr< ServerBuilderOption > MakeChannelArgumentOption(const grpc::string &name, const grpc::string &value)
Experimental, to be deprecated.
Definition: server_builder.h:252
Desriptor of an RPC service and its various RPC methods.
Definition: service_type.h:58
ResourceQuota represents a bound on memory and thread usage by the gRPC library.
Definition: resource_quota.h:34
bool is_set
Definition: server_builder.h:328
grpc_compression_level
Compression levels allow a party with knowledge of its peer's accepted encodings to request compressi...
Definition: compression_types.h:71
Definition: async_generic_service.h:72
HostString host
Definition: server_builder.h:264
NOTE: class experimental_type is not part of the public API of this class.
Definition: server_builder.h:223
ServerBuilder & SetMaxSendMessageSize(int max_send_message_size)
Set max send message size in bytes.
Definition: server_builder.h:160
Number of completion queues.
Definition: server_builder.h:195
std::vector< Port > ports()
Experimental, to be deprecated.
Definition: server_builder.h:269
void SetInterceptorCreators(std::vector< std::unique_ptr< experimental::ServerInterceptorFactoryInterface >> interceptor_creators)
Definition: server_builder.h:227
grpc_compression_algorithm
The various compression algorithms supported by gRPC (not sorted by compression level) ...
Definition: compression_types.h:57
This header provides an object that reads bytes directly from a grpc::ByteBuffer, via the ZeroCopyInp...
Definition: alarm.h:24
experimental_type(ServerBuilder *builder)
Definition: server_builder.h:225
grpc_workaround_list
Definition: workaround_list.h:26
NamedService(Service *s)
Definition: server_builder.h:261
ServerBuilder & SetMaxReceiveMessageSize(int max_receive_message_size)
Set max receive message size in bytes.
Definition: server_builder.h:153
CallbackGenericService is the base class for generic services implemented using the callback API and ...
Definition: async_generic_service.h:125
grpc_compression_level level
Definition: server_builder.h:329
SyncServerOption
Options for synchronous servers.
Definition: server_builder.h:194
grpc::string addr
Definition: server_builder.h:253
struct grpc_resource_quota grpc_resource_quota
Definition: grpc_types.h:649
Definition: server_builder.h:260
NamedService(const grpc::string &h, Service *s)
Definition: server_builder.h:262
Minimum number of polling threads.
Definition: server_builder.h:196
Service * service
Definition: server_builder.h:265
ServerBuilder & AddChannelArgument(const grpc::string &arg, const T &value)
Add a channel argument (an escape hatch to tuning core library parameters directly) ...
Definition: server_builder.h:207
std::vector< ServerBuilderOption * > options()
Experimental, to be deprecated.
Definition: server_builder.h:281
A builder class for the creation and startup of grpc::Server instances.
Definition: server_builder.h:57
grpc_compression_algorithm algorithm
Definition: server_builder.h:333