A builder class for the creation and startup of grpc::Server instances.
More...
#include <server_builder.h>
A builder class for the creation and startup of grpc::Server instances.
| grpc::ServerBuilder::ServerBuilder |
( |
| ) |
|
| std::unique_ptr<ServerCompletionQueue> grpc::ServerBuilder::AddCompletionQueue |
( |
bool |
is_frequently_polled = true | ) |
|
Add a completion queue for handling asynchronous services.
Caller is required to shutdown the server prior to shutting down the returned completion queue. 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()!
- 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. |
Tries to bind server to the given addr.
It can be invoked multiple times.
- Parameters
-
| addr | The address to try to bind to the server (eg, localhost:1234, 192.168.1.1:31416, [::1]:27182, etc.). creds The credentials associated with the server. |
| selected_port[out] | Upon success, updated to contain the port number. nullptr otherwise. |
| std::unique_ptr<Server> grpc::ServerBuilder::BuildAndStart |
( |
| ) |
|
Return a running server which is ready for processing calls.
| static void grpc::ServerBuilder::InternalAddPluginFactory |
( |
std::unique_ptr< ServerBuilderPlugin >(*)() |
CreatePlugin | ) |
|
|
static |
Register a generic service.
Matches requests with any :authority
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
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
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.
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.
The default compression level to use for all channel calls in the absence of a call-specific level.
| ServerBuilder& grpc::ServerBuilder::SetMaxMessageSize |
( |
int |
max_message_size | ) |
|
|
inline |
Set max message size in bytes.
| friend class ::grpc::testing::ServerBuilderPluginTest |
|
friend |
| bool grpc::ServerBuilder::is_set |
The documentation for this class was generated from the following file: