19 #ifndef GRPCPP_SERVER_BUILDER_IMPL_H 20 #define GRPCPP_SERVER_BUILDER_IMPL_H 50 class AsyncGenericService;
53 class ServerBuilderPluginTest;
57 class ExternalConnectionAcceptorImpl;
60 namespace experimental {
61 class CallbackGenericService;
102 virtual std::unique_ptr<grpc::Server> BuildAndStart();
127 std::shared_ptr<grpc_impl::ServerCredentials> creds,
128 int* selected_port =
nullptr);
160 std::unique_ptr<grpc_impl::ServerCompletionQueue> AddCompletionQueue(
161 bool is_frequently_polled =
true);
186 max_receive_message_size_ = max_receive_message_size;
193 max_send_message_size_ = max_send_message_size;
199 return SetMaxReceiveMessageSize(max_message_size);
224 ServerBuilder& SetOption(std::unique_ptr<grpc::ServerBuilderOption> option);
245 static void InternalAddPluginFactory(
246 std::unique_ptr<grpc::ServerBuilderPlugin> (*CreatePlugin)());
259 : builder_(builder) {}
262 std::vector<std::unique_ptr<
264 interceptor_creators) {
265 builder_->interceptor_creators_ = std::move(interceptor_creators);
283 std::unique_ptr<grpc::experimental::ExternalConnectionAcceptor>
285 std::shared_ptr<ServerCredentials> creds);
300 std::shared_ptr<grpc_impl::ServerCredentials>
creds;
315 std::vector<Port>
ports() {
return ports_; }
319 std::vector<NamedService*> service_refs;
320 for (
auto& ptr : services_) {
321 service_refs.push_back(ptr.get());
327 std::vector<grpc::ServerBuilderOption*>
options() {
328 std::vector<grpc::ServerBuilderOption*> option_refs;
329 for (
auto& ptr : options_) {
330 option_refs.push_back(ptr.get());
336 friend class ::grpc::testing::ServerBuilderPluginTest;
338 struct SyncServerSettings {
340 : num_cqs(1), min_pollers(1), max_pollers(2), cq_timeout_msec(10000) {}
357 int max_receive_message_size_;
358 int max_send_message_size_;
359 std::vector<std::unique_ptr<grpc::ServerBuilderOption>> options_;
360 std::vector<std::unique_ptr<NamedService>> services_;
361 std::vector<Port> ports_;
363 SyncServerSettings sync_server_settings_;
366 std::vector<grpc_impl::ServerCompletionQueue*> cqs_;
368 std::shared_ptr<grpc_impl::ServerCredentials> creds_;
369 std::vector<std::unique_ptr<grpc::ServerBuilderPlugin>> plugins_;
377 } maybe_default_compression_level_;
381 } maybe_default_compression_algorithm_;
382 uint32_t enabled_compression_algorithms_bitset_;
384 std::unique_ptr<grpc::experimental::ServerInterceptorFactoryInterface>>
385 interceptor_creators_;
386 std::vector<std::shared_ptr<grpc::internal::ExternalConnectionAcceptorImpl>>
392 #endif // GRPCPP_SERVER_BUILDER_IMPL_H
ExternalConnectionType
Definition: server_builder_impl.h:275
grpc_compression_algorithm algorithm
Definition: server_builder_impl.h:380
int * selected_port
Definition: server_builder_impl.h:301
std::string string
Definition: config.h:35
Maximum number of polling threads.
Definition: server_builder_impl.h:230
std::unique_ptr< ServerBuilderOption > MakeChannelArgumentOption(const grpc::string &name, const grpc::string &value)
::grpc_impl::ServerCredentials ServerCredentials
Definition: server_credentials.h:30
::grpc_impl::Server Server
Definition: server.h:26
Desriptor of an RPC service and its various RPC methods.
Definition: service_type.h:60
::grpc_impl::ResourceQuota ResourceQuota
Definition: resource_quota.h:26
Experimental, to be deprecated.
Definition: server_builder_impl.h:298
Definition: server_builder_impl.h:67
grpc_compression_level
Compression levels allow a party with knowledge of its peer's accepted encodings to request compressi...
Definition: compression_types.h:71
std::vector< grpc::ServerBuilderOption * > options()
Experimental, to be deprecated.
Definition: server_builder_impl.h:327
Definition: async_generic_service.h:74
Definition: server_interceptor.h:47
::grpc_impl::ServerCompletionQueue ServerCompletionQueue
Definition: completion_queue.h:27
SyncServerOption
Options for synchronous servers.
Definition: server_builder_impl.h:227
::grpc_impl::CompletionQueue CompletionQueue
Definition: completion_queue.h:26
Number of completion queues.
Definition: server_builder_impl.h:228
NOTE: class experimental_type is not part of the public API of this class.
Definition: server_builder_impl.h:256
grpc_compression_algorithm
The various compression algorithms supported by gRPC (not sorted by compression level) ...
Definition: compression_types.h:57
NamedService(grpc::Service *s)
Definition: server_builder_impl.h:307
ServerBuilder & SetMaxReceiveMessageSize(int max_receive_message_size)
Set max receive message size in bytes.
Definition: server_builder_impl.h:185
This header provides an object that reads bytes directly from a grpc::ByteBuffer, via the ZeroCopyInp...
Definition: alarm.h:24
grpc_workaround_list
Definition: workaround_list.h:26
virtual ~ExternalConnectionAcceptor()
Definition: server_builder_impl.h:74
std::vector< Port > ports()
Experimental, to be deprecated.
Definition: server_builder_impl.h:315
ByteBuffer read_buffer
Definition: server_builder_impl.h:72
HostString host
Definition: server_builder_impl.h:310
grpc_compression_level level
Definition: server_builder_impl.h:376
ServerBuilder & SetMaxMessageSize(int max_message_size)
Definition: server_builder_impl.h:198
bool is_set
Definition: server_builder_impl.h:375
grpc::string addr
Definition: server_builder_impl.h:299
grpc::Service * service
Definition: server_builder_impl.h:311
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm_impl.h:33
CallbackGenericService is the base class for generic services implemented using the callback API and ...
Definition: async_generic_service.h:129
Minimum number of polling threads.
Definition: server_builder_impl.h:229
::grpc_impl::ServerBuilder ServerBuilder
Definition: server_builder.h:26
experimental_type experimental()
NOTE: The function experimental() is not stable public API.
Definition: server_builder_impl.h:294
std::unique_ptr< grpc::string > HostString
Experimental, to be deprecated.
Definition: server_builder_impl.h:305
struct grpc_resource_quota grpc_resource_quota
Definition: grpc_types.h:661
Definition: server_builder_impl.h:306
std::shared_ptr< grpc_impl::ServerCredentials > creds
Definition: server_builder_impl.h:300
ServerBuilder & SetMaxSendMessageSize(int max_send_message_size)
Set max send message size in bytes.
Definition: server_builder_impl.h:192
Definition: server_builder_impl.h:69
NamedService(const grpc::string &h, grpc::Service *s)
Definition: server_builder_impl.h:308
A sequence of bytes.
Definition: byte_buffer.h:72
A builder class for the creation and startup of grpc::Server instances.
Definition: server_builder_impl.h:86
std::vector< NamedService * > services()
Experimental, to be deprecated.
Definition: server_builder_impl.h:318
experimental_type(grpc_impl::ServerBuilder *builder)
Definition: server_builder_impl.h:258
ResourceQuota represents a bound on memory and thread usage by the gRPC library.
Definition: resource_quota_impl.h:34
void SetInterceptorCreators(std::vector< std::unique_ptr< grpc::experimental::ServerInterceptorFactoryInterface >> interceptor_creators)
Definition: server_builder_impl.h:261
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_impl.h:240