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;
69 virtual std::unique_ptr<Server> BuildAndStart();
93 std::shared_ptr<ServerCredentials> creds,
94 int* selected_port =
nullptr);
126 std::unique_ptr<ServerCompletionQueue> AddCompletionQueue(
127 bool is_frequently_polled =
true);
150 max_receive_message_size_ = max_receive_message_size;
157 max_send_message_size_ = max_send_message_size;
163 return SetMaxReceiveMessageSize(max_message_size);
187 ServerBuilder& SetOption(std::unique_ptr<ServerBuilderOption> option);
208 static void InternalAddPluginFactory(
209 std::unique_ptr<ServerBuilderPlugin> (*CreatePlugin)());
225 std::unique_ptr<experimental::ServerInterceptorFactoryInterface>>
226 interceptor_creators) {
227 builder_->interceptor_creators_ = std::move(interceptor_creators);
243 std::shared_ptr<ServerCredentials>
creds;
258 std::vector<Port>
ports() {
return ports_; }
262 std::vector<NamedService*> service_refs;
263 for (
auto& ptr : services_) {
264 service_refs.push_back(ptr.get());
271 std::vector<ServerBuilderOption*> option_refs;
272 for (
auto& ptr : options_) {
273 option_refs.push_back(ptr.get());
279 friend class ::grpc::testing::ServerBuilderPluginTest;
281 struct SyncServerSettings {
283 : num_cqs(1), min_pollers(1), max_pollers(2), cq_timeout_msec(10000) {}
300 int max_receive_message_size_;
301 int max_send_message_size_;
302 std::vector<std::unique_ptr<ServerBuilderOption>> options_;
303 std::vector<std::unique_ptr<NamedService>> services_;
304 std::vector<Port> ports_;
306 SyncServerSettings sync_server_settings_;
309 std::vector<ServerCompletionQueue*> cqs_;
311 std::shared_ptr<ServerCredentials> creds_;
312 std::vector<std::unique_ptr<ServerBuilderPlugin>> plugins_;
318 } maybe_default_compression_level_;
322 } maybe_default_compression_algorithm_;
323 uint32_t enabled_compression_algorithms_bitset_;
324 std::vector<std::unique_ptr<experimental::ServerInterceptorFactoryInterface>>
325 interceptor_creators_;
330 #endif // GRPCPP_SERVER_BUILDER_H ServerBuilder & SetMaxMessageSize(int max_message_size)
Definition: server_builder.h:162
int * selected_port
Definition: server_builder.h:244
std::vector< NamedService * > services()
Experimental, to be deprecated.
Definition: server_builder.h:261
Maximum number of polling threads.
Definition: server_builder.h:193
std::string string
Definition: config.h:35
std::shared_ptr< ServerCredentials > creds
Definition: server_builder.h:243
experimental_type experimental()
NOTE: The function experimental() is not stable public API.
Definition: server_builder.h:237
std::unique_ptr< grpc::string > HostString
Experimental, to be deprecated.
Definition: server_builder.h:248
std::unique_ptr< ServerBuilderOption > MakeChannelArgumentOption(const grpc::string &name, const grpc::string &value)
Experimental, to be deprecated.
Definition: server_builder.h:241
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:316
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:65
HostString host
Definition: server_builder.h:253
NOTE: class experimental_type is not part of the public API of this class.
Definition: server_builder.h:219
ServerBuilder & SetMaxSendMessageSize(int max_send_message_size)
Set max send message size in bytes.
Definition: server_builder.h:156
Number of completion queues.
Definition: server_builder.h:191
std::vector< Port > ports()
Experimental, to be deprecated.
Definition: server_builder.h:258
void SetInterceptorCreators(std::vector< std::unique_ptr< experimental::ServerInterceptorFactoryInterface >> interceptor_creators)
Definition: server_builder.h:223
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:221
grpc_workaround_list
Definition: workaround_list.h:26
NamedService(Service *s)
Definition: server_builder.h:250
ServerBuilder & SetMaxReceiveMessageSize(int max_receive_message_size)
Set max receive message size in bytes.
Definition: server_builder.h:149
grpc_compression_level level
Definition: server_builder.h:317
SyncServerOption
Options for synchronous servers.
Definition: server_builder.h:190
grpc::string addr
Definition: server_builder.h:242
struct grpc_resource_quota grpc_resource_quota
Definition: grpc_types.h:640
Definition: server_builder.h:249
NamedService(const grpc::string &h, Service *s)
Definition: server_builder.h:251
Minimum number of polling threads.
Definition: server_builder.h:192
Service * service
Definition: server_builder.h:254
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:203
std::vector< ServerBuilderOption * > options()
Experimental, to be deprecated.
Definition: server_builder.h:270
A builder class for the creation and startup of grpc::Server instances.
Definition: server_builder.h:53
grpc_compression_algorithm algorithm
Definition: server_builder.h:321