A builder class for the creation and startup of grpc::Server instances.
More...
#include <server_builder.h>
|
typedef std::unique_ptr< std::string > | HostString |
| Experimental, to be deprecated. More...
|
|
A builder class for the creation and startup of grpc::Server instances.
Definition at line 86 of file grpcpp/server_builder.h.
◆ HostString
◆ SyncServerOption
Options for synchronous servers.
Enumerator |
---|
NUM_CQS | Number of completion queues.
|
MIN_POLLERS | Minimum number of polling threads.
|
MAX_POLLERS | Maximum number of polling threads.
|
CQ_TIMEOUT_MSEC | Completion queue timeout in milliseconds.
|
Definition at line 228 of file grpcpp/server_builder.h.
◆ ServerBuilder()
grpc::ServerBuilder::ServerBuilder |
( |
| ) |
|
◆ ~ServerBuilder()
grpc::ServerBuilder::~ServerBuilder |
( |
| ) |
|
|
virtual |
◆ AddChannelArgument()
Add a channel argument (an escape hatch to tuning core library parameters directly)
Definition at line 241 of file grpcpp/server_builder.h.
◆ AddCompletionQueue()
Add a completion queue for handling asynchronous services.
Best performance is typically obtained by using one thread per polling completion queue.
Caller is required to shutdown the server prior to shutting down the returned completion queue. Caller is also required to drain the completion queue after shutting it down. A typical usage scenario:
// While building the server: ServerBuilder builder; ... cq_ = builder.AddCompletionQueue(); server_ = builder.BuildAndStart();
// While shutting down the server; server_->Shutdown(); cq_->Shutdown(); // Always after the associated server's Shutdown()! // Drain the cq_ that was created void* ignored_tag; bool ignored_ok; while (cq_->Next(&ignored_tag, &ignored_ok)) { }
- Parameters
-
is_frequently_polled | This is an optional parameter to inform gRPC library about whether this completion queue would be frequently polled (i.e. by calling Next() or AsyncNext()). The default value is 'true' and is the recommended setting. Setting this to 'false' (i.e. not polling the completion queue frequently) will have a significantly negative performance impact and hence should not be used in production use cases. |
Definition at line 91 of file server_builder.cc.
◆ AddListeningPort()
Enlists an endpoint addr (port with an optional IP address) to bind the grpc::Server object to be created to.
It can be invoked multiple times.
- Parameters
-
| addr_uri | The address to try to bind to the server in URI form. If the scheme name is omitted, "dns:///" is assumed. To bind to any address, please use IPv6 any, i.e., [::]:<port>, which also accepts IPv4 connections. Valid values include dns:///localhost:1234, 192.168.1.1:31416, dns:///[::1]:27182, etc. |
| creds | The credentials associated with the server. |
[out] | selected_port | If not nullptr , gets populated with the port number bound to the grpc::Server for the corresponding endpoint after it is successfully bound by BuildAndStart(), 0 otherwise. AddListeningPort does not modify this pointer. |
Definition at line 222 of file server_builder.cc.
◆ BuildAndStart()
std::unique_ptr< grpc::Server > grpc::ServerBuilder::BuildAndStart |
( |
| ) |
|
|
virtual |
Return a running server which is ready for processing calls. Before calling, one typically needs to ensure that:
- a service is registered - so that the server knows what to serve (via RegisterService, or RegisterAsyncGenericService)
- a listening port has been added - so the server knows where to receive traffic (via AddListeningPort)
- [for async api only] completion queues have been added via AddCompletionQueue
Will return a nullptr on errors.
Definition at line 275 of file server_builder.cc.
◆ BuildChannelArgs()
◆ EnableWorkaround()
Enable a server workaround. Do not use unless you know what the workaround does. For explanation and detailed descriptions of workarounds, see doc/workarounds.md.
Definition at line 464 of file server_builder.cc.
◆ experimental()
NOTE: The function experimental() is not stable public API. It is a view to the experimental components of this class. It may be changed or removed at any time.
Definition at line 305 of file grpcpp/server_builder.h.
◆ InternalAddPluginFactory()
◆ options()
◆ ports()
std::vector<Port> grpc::ServerBuilder::ports |
( |
| ) |
|
|
inlineprotected |
◆ RegisterAsyncGenericService()
Register a generic service. Matches requests with any :authority This is mostly useful for writing generic gRPC Proxies where the exact serialization format is unknown
Definition at line 112 of file server_builder.cc.
◆ RegisterCallbackGenericService()
Register a generic service that uses the callback API. Matches requests with any :authority This is mostly useful for writing generic gRPC Proxies where the exact serialization format is unknown
Definition at line 125 of file server_builder.cc.
◆ RegisterService() [1/2]
Register a service. This call does not take ownership of the service. The service must exist for the lifetime of the Server instance returned by BuildAndStart(). Only matches requests with :authority host
Definition at line 106 of file server_builder.cc.
◆ RegisterService() [2/2]
Register a service. This call does not take ownership of the service. The service must exist for the lifetime of the Server instance returned by BuildAndStart(). Matches requests with any :authority
Definition at line 101 of file server_builder.cc.
◆ services()
std::vector<NamedService*> grpc::ServerBuilder::services |
( |
| ) |
|
|
inlineprotected |
◆ set_fetcher()
◆ SetCompressionAlgorithmSupportStatus()
Set the support status for compression algorithms. All algorithms are enabled by default.
Incoming calls compressed with an unsupported algorithm will fail with GRPC_STATUS_UNIMPLEMENTED.
Definition at line 188 of file server_builder.cc.
◆ SetContextAllocator()
Set the allocator for creating and releasing callback server context. Takes the owndership of the allocator.
Definition at line 138 of file server_builder.cc.
◆ SetDefaultCompressionAlgorithm()
The default compression algorithm to use for all channel calls in the absence of a call-specific level. Note that it overrides any compression level set by SetDefaultCompressionLevel.
Definition at line 205 of file server_builder.cc.
◆ SetDefaultCompressionLevel()
The default compression level to use for all channel calls in the absence of a call-specific level.
Definition at line 198 of file server_builder.cc.
◆ SetMaxMessageSize()
◆ SetMaxReceiveMessageSize()
ServerBuilder& grpc::ServerBuilder::SetMaxReceiveMessageSize |
( |
int |
max_receive_message_size | ) |
|
|
inline |
Set max receive message size in bytes. The default is GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH.
Definition at line 187 of file grpcpp/server_builder.h.
◆ SetMaxSendMessageSize()
ServerBuilder& grpc::ServerBuilder::SetMaxSendMessageSize |
( |
int |
max_send_message_size | ) |
|
|
inline |
Set max send message size in bytes. The default is GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH.
Definition at line 194 of file grpcpp/server_builder.h.
◆ SetOption()
◆ SetResourceQuota()
◆ SetSyncServerOption()
◆ grpc::experimental::OrcaServerInterceptorFactory
◆ grpc::testing::ServerBuilderPluginTest
◆ acceptors_
◆ algorithm
◆ authorization_provider_
◆ callback_generic_service_
◆ context_allocator_
◆ cqs_
◆ creds_
◆ enabled_compression_algorithms_bitset_
uint32_t grpc::ServerBuilder::enabled_compression_algorithms_bitset_ |
|
private |
◆ generic_service_
◆ interceptor_creators_
◆ internal_interceptor_creators_
◆ is_set
bool grpc::ServerBuilder::is_set |
◆ level
◆ max_receive_message_size_
int grpc::ServerBuilder::max_receive_message_size_ |
|
private |
◆ max_send_message_size_
int grpc::ServerBuilder::max_send_message_size_ |
|
private |
◆ maybe_default_compression_algorithm_
struct { ... } grpc::ServerBuilder::maybe_default_compression_algorithm_ |
◆ maybe_default_compression_level_
struct { ... } grpc::ServerBuilder::maybe_default_compression_level_ |
◆ options_
◆ plugins_
◆ ports_
std::vector<Port> grpc::ServerBuilder::ports_ |
|
private |
◆ resource_quota_
◆ server_config_fetcher_
◆ services_
std::vector<std::unique_ptr<NamedService> > grpc::ServerBuilder::services_ |
|
private |
◆ sync_server_settings_
The documentation for this class was generated from the following files: