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;
101 virtual std::unique_ptr<grpc::Server> BuildAndStart();
126 std::shared_ptr<grpc_impl::ServerCredentials> creds,
127 int* selected_port =
nullptr);
159 std::unique_ptr<grpc_impl::ServerCompletionQueue> AddCompletionQueue(
160 bool is_frequently_polled =
true);
185 max_receive_message_size_ = max_receive_message_size;
192 max_send_message_size_ = max_send_message_size;
198 return SetMaxReceiveMessageSize(max_message_size);
223 ServerBuilder& SetOption(std::unique_ptr<grpc::ServerBuilderOption> option);
244 static void InternalAddPluginFactory(
245 std::unique_ptr<grpc::ServerBuilderPlugin> (*CreatePlugin)());
258 : builder_(builder) {}
261 std::vector<std::unique_ptr<
263 interceptor_creators) {
264 builder_->interceptor_creators_ = std::move(interceptor_creators);
282 std::unique_ptr<grpc::experimental::ExternalConnectionAcceptor>
284 std::shared_ptr<ServerCredentials> creds);
299 std::shared_ptr<grpc_impl::ServerCredentials>
creds;
314 std::vector<Port>
ports() {
return ports_; }
318 std::vector<NamedService*> service_refs;
319 for (
auto& ptr : services_) {
320 service_refs.push_back(ptr.get());
326 std::vector<grpc::ServerBuilderOption*>
options() {
327 std::vector<grpc::ServerBuilderOption*> option_refs;
328 for (
auto& ptr : options_) {
329 option_refs.push_back(ptr.get());
335 friend class ::grpc::testing::ServerBuilderPluginTest;
337 struct SyncServerSettings {
339 : num_cqs(1), min_pollers(1), max_pollers(2), cq_timeout_msec(10000) {}
356 int max_receive_message_size_;
357 int max_send_message_size_;
358 std::vector<std::unique_ptr<grpc::ServerBuilderOption>> options_;
359 std::vector<std::unique_ptr<NamedService>> services_;
360 std::vector<Port> ports_;
362 SyncServerSettings sync_server_settings_;
365 std::vector<grpc_impl::ServerCompletionQueue*> cqs_;
367 std::shared_ptr<grpc_impl::ServerCredentials> creds_;
368 std::vector<std::unique_ptr<grpc::ServerBuilderPlugin>> plugins_;
376 } maybe_default_compression_level_;
380 } maybe_default_compression_algorithm_;
381 uint32_t enabled_compression_algorithms_bitset_;
383 std::unique_ptr<grpc::experimental::ServerInterceptorFactoryInterface>>
384 interceptor_creators_;
385 std::vector<std::shared_ptr<grpc::internal::ExternalConnectionAcceptorImpl>>
391 #endif // GRPCPP_SERVER_BUILDER_IMPL_H
ExternalConnectionType
Definition: server_builder_impl.h:274
grpc_compression_algorithm algorithm
Definition: server_builder_impl.h:379
int * selected_port
Definition: server_builder_impl.h:300
std::string string
Definition: config.h:35
Maximum number of polling threads.
Definition: server_builder_impl.h:229
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:297
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:326
Definition: async_generic_service.h:72
Definition: server_interceptor.h:45
::grpc_impl::ServerCompletionQueue ServerCompletionQueue
Definition: completion_queue.h:27
SyncServerOption
Options for synchronous servers.
Definition: server_builder_impl.h:226
::grpc_impl::CompletionQueue CompletionQueue
Definition: completion_queue.h:26
Number of completion queues.
Definition: server_builder_impl.h:227
NOTE: class experimental_type is not part of the public API of this class.
Definition: server_builder_impl.h:255
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:306
ServerBuilder & SetMaxReceiveMessageSize(int max_receive_message_size)
Set max receive message size in bytes.
Definition: server_builder_impl.h:184
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:73
std::vector< Port > ports()
Experimental, to be deprecated.
Definition: server_builder_impl.h:314
ByteBuffer read_buffer
Definition: server_builder_impl.h:71
HostString host
Definition: server_builder_impl.h:309
grpc_compression_level level
Definition: server_builder_impl.h:375
ServerBuilder & SetMaxMessageSize(int max_message_size)
Definition: server_builder_impl.h:197
bool is_set
Definition: server_builder_impl.h:374
grpc::string addr
Definition: server_builder_impl.h:298
grpc::Service * service
Definition: server_builder_impl.h:310
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:125
Minimum number of polling threads.
Definition: server_builder_impl.h:228
::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:293
std::unique_ptr< grpc::string > HostString
Experimental, to be deprecated.
Definition: server_builder_impl.h:304
struct grpc_resource_quota grpc_resource_quota
Definition: grpc_types.h:652
Definition: server_builder_impl.h:305
std::shared_ptr< grpc_impl::ServerCredentials > creds
Definition: server_builder_impl.h:299
ServerBuilder & SetMaxSendMessageSize(int max_send_message_size)
Set max send message size in bytes.
Definition: server_builder_impl.h:191
Definition: server_builder_impl.h:69
NamedService(const grpc::string &h, grpc::Service *s)
Definition: server_builder_impl.h:307
A sequence of bytes.
Definition: byte_buffer.h:65
A builder class for the creation and startup of grpc::Server instances.
Definition: server_builder_impl.h:85
std::vector< NamedService * > services()
Experimental, to be deprecated.
Definition: server_builder_impl.h:317
experimental_type(grpc_impl::ServerBuilder *builder)
Definition: server_builder_impl.h:257
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:260
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:239