Go to the documentation of this file.
19 #ifndef GRPCPP_SERVER_BUILDER_IMPL_H
20 #define GRPCPP_SERVER_BUILDER_IMPL_H
52 class AsyncGenericService;
55 class ServerBuilderPluginTest;
59 class ExternalConnectionAcceptorImpl;
62 #ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
63 namespace experimental {
65 class CallbackGenericService;
66 #ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
70 namespace experimental {
137 std::shared_ptr<grpc_impl::ServerCredentials> creds,
138 int* selected_port =
nullptr);
171 bool is_frequently_polled =
true);
196 max_receive_message_size_ = max_receive_message_size;
203 max_send_message_size_ = max_send_message_size;
256 std::unique_ptr<grpc::ServerBuilderPlugin> (*CreatePlugin)());
269 : builder_(builder) {}
272 std::vector<std::unique_ptr<
274 interceptor_creators) {
275 builder_->interceptor_creators_ = std::move(interceptor_creators);
278 #ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
295 std::unique_ptr<grpc::experimental::ExternalConnectionAcceptor>
297 std::shared_ptr<ServerCredentials> creds);
303 #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
309 grpc::CallbackGenericService* service);
321 std::shared_ptr<grpc_impl::ServerCredentials>
creds;
336 std::vector<Port>
ports() {
return ports_; }
340 std::vector<NamedService*> service_refs;
341 for (
auto& ptr : services_) {
342 service_refs.push_back(ptr.get());
348 std::vector<grpc::ServerBuilderOption*>
options() {
349 std::vector<grpc::ServerBuilderOption*> option_refs;
350 for (
auto& ptr : options_) {
351 option_refs.push_back(ptr.get());
357 friend class ::grpc::testing::ServerBuilderPluginTest;
359 struct SyncServerSettings {
361 : num_cqs(1), min_pollers(1), max_pollers(2), cq_timeout_msec(10000) {}
378 int max_receive_message_size_;
379 int max_send_message_size_;
380 std::vector<std::unique_ptr<grpc::ServerBuilderOption>> options_;
381 std::vector<std::unique_ptr<NamedService>> services_;
382 std::vector<Port> ports_;
384 SyncServerSettings sync_server_settings_;
387 std::vector<grpc_impl::ServerCompletionQueue*> cqs_;
389 std::shared_ptr<grpc_impl::ServerCredentials> creds_;
390 std::vector<std::unique_ptr<grpc::ServerBuilderPlugin>> plugins_;
393 #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
394 grpc::CallbackGenericService* callback_generic_service_{
nullptr};
403 } maybe_default_compression_level_;
407 } maybe_default_compression_algorithm_;
408 uint32_t enabled_compression_algorithms_bitset_;
410 std::unique_ptr<grpc::experimental::ServerInterceptorFactoryInterface>>
411 interceptor_creators_;
412 std::vector<std::shared_ptr<grpc::internal::ExternalConnectionAcceptorImpl>>
418 #endif // GRPCPP_SERVER_BUILDER_IMPL_H
ServerBuilder & SetCompressionAlgorithmSupportStatus(grpc_compression_algorithm algorithm, bool enabled)
Set the support status for compression algorithms.
HostString host
Definition: server_builder_impl.h:331
A builder class for the creation and startup of grpc::Server instances.
Definition: server_builder_impl.h:94
static void InternalAddPluginFactory(std::unique_ptr< grpc::ServerBuilderPlugin >(*CreatePlugin)())
For internal use only: Register a ServerBuilderPlugin factory function.
std::vector< NamedService * > services()
Experimental, to be deprecated.
Definition: server_builder_impl.h:339
This header provides an object that reads bytes directly from a grpc::ByteBuffer, via the ZeroCopyInp...
Definition: alarm.h:24
struct grpc_resource_quota grpc_resource_quota
Definition: grpc_types.h:694
::grpc_impl::ServerCredentials ServerCredentials
Definition: server_credentials.h:30
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:250
::grpc_impl::CompletionQueue CompletionQueue
Definition: completion_queue.h:26
grpc_compression_algorithm
The various compression algorithms supported by gRPC (not sorted by compression level)
Definition: compression_types.h:57
ServerBuilder & RegisterAsyncGenericService(grpc::AsyncGenericService *service)
Register a generic service.
Maximum number of polling threads.
Definition: server_builder_impl.h:240
std::unique_ptr< grpc::experimental::ExternalConnectionAcceptor > AddExternalConnectionAcceptor(ExternalConnectionType type, std::shared_ptr< ServerCredentials > creds)
Register an acceptor to handle the externally accepted connection in grpc server.
Definition: server_builder_impl.h:327
Desriptor of an RPC service and its various RPC methods.
Definition: service_type.h:60
Number of completion queues.
Definition: server_builder_impl.h:238
ServerBuilder & AddListeningPort(const grpc::string &addr_uri, std::shared_ptr< grpc_impl::ServerCredentials > creds, int *selected_port=nullptr)
Enlists an endpoint addr (port with an optional IP address) to bind the grpc::Server object to be cre...
::grpc_impl::Server Server
Definition: server.h:26
void SetInterceptorCreators(std::vector< std::unique_ptr< grpc::experimental::ServerInterceptorFactoryInterface >> interceptor_creators)
Definition: server_builder_impl.h:271
NamedService(const grpc::string &h, grpc::Service *s)
Definition: server_builder_impl.h:329
SyncServerOption
Options for synchronous servers.
Definition: server_builder_impl.h:237
std::shared_ptr< grpc_impl::ServerCredentials > creds
Definition: server_builder_impl.h:321
ServerBuilder & RegisterCallbackGenericService(grpc::experimental::CallbackGenericService *service)
Register a generic service that uses the callback API.
std::vector< grpc::ServerBuilderOption * > options()
Experimental, to be deprecated.
Definition: server_builder_impl.h:348
Minimum number of polling threads.
Definition: server_builder_impl.h:239
ResourceQuota represents a bound on memory and thread usage by the gRPC library.
Definition: resource_quota_impl.h:34
ByteBuffer read_buffer
Definition: server_builder_impl.h:80
Definition: server_builder_impl.h:77
int * selected_port
Definition: server_builder_impl.h:322
grpc::Service * service
Definition: server_builder_impl.h:332
int fd
Definition: server_builder_impl.h:79
NOTE: class experimental_type is not part of the public API of this class.
Definition: server_builder_impl.h:266
A sequence of bytes.
Definition: byte_buffer.h:67
Experimental, to be deprecated.
Definition: server_builder_impl.h:319
std::unique_ptr< grpc_impl::ServerCompletionQueue > AddCompletionQueue(bool is_frequently_polled=true)
Add a completion queue for handling asynchronous services.
bool is_set
Definition: server_builder_impl.h:401
ServerBuilder & SetMaxReceiveMessageSize(int max_receive_message_size)
Set max receive message size in bytes.
Definition: server_builder_impl.h:195
ServerBuilder & SetDefaultCompressionLevel(grpc_compression_level level)
The default compression level to use for all channel calls in the absence of a call-specific level.
grpc::string addr
Definition: server_builder_impl.h:320
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_impl.h:402
Definition: async_generic_service.h:77
Definition: server_builder_impl.h:75
ServerBuilder & SetMaxMessageSize(int max_message_size)
Definition: server_builder_impl.h:208
ServerBuilder & SetDefaultCompressionAlgorithm(grpc_compression_algorithm algorithm)
The default compression algorithm to use for all channel calls in the absence of a call-specific leve...
std::unique_ptr< ServerBuilderOption > MakeChannelArgumentOption(const grpc::string &name, const grpc::string &value)
experimental_type(grpc_impl::ServerBuilder *builder)
Definition: server_builder_impl.h:268
NamedService(grpc::Service *s)
Definition: server_builder_impl.h:328
Definition: server_interceptor.h:47
std::vector< Port > ports()
Experimental, to be deprecated.
Definition: server_builder_impl.h:336
Completion queue timeout in milliseconds.
Definition: server_builder_impl.h:241
ServerBuilder & SetMaxSendMessageSize(int max_send_message_size)
Set max send message size in bytes.
Definition: server_builder_impl.h:202
ExternalConnectionType
Definition: server_builder_impl.h:287
grpc_workaround_list
Definition: workaround_list.h:26
grpc_compression_level
Compression levels allow a party with knowledge of its peer's accepted encodings to request compressi...
Definition: compression_types.h:71
virtual ~ExternalConnectionAcceptor()
Definition: server_builder_impl.h:82
ServerBuilder & SetSyncServerOption(SyncServerOption option, int value)
Only useful if this is a Synchronous server.
std::string string
Definition: config.h:35
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm_impl.h:33
virtual void HandleNewConnection(NewConnectionParameters *p)=0
ServerBuilder & RegisterService(grpc::Service *service)
Register a service.
int listener_fd
Definition: server_builder_impl.h:78
ServerBuilder & SetOption(std::unique_ptr< grpc::ServerBuilderOption > option)
ServerBuilder & EnableWorkaround(grpc_workaround_list id)
Enable a server workaround.
::grpc_impl::ServerCompletionQueue ServerCompletionQueue
Definition: completion_queue.h:27
std::unique_ptr< grpc::string > HostString
Experimental, to be deprecated.
Definition: server_builder_impl.h:326
experimental_type experimental()
NOTE: The function experimental() is not stable public API.
Definition: server_builder_impl.h:315
ServerBuilder & SetResourceQuota(const grpc_impl::ResourceQuota &resource_quota)
Set the attached buffer pool for this server.
grpc_compression_algorithm algorithm
Definition: server_builder_impl.h:406
virtual std::unique_ptr< grpc::Server > BuildAndStart()
Return a running server which is ready for processing calls.
::grpc_impl::ResourceQuota ResourceQuota
Definition: resource_quota.h:26