19 #ifndef GRPCXX_SERVER_BUILDER_H
20 #define GRPCXX_SERVER_BUILDER_H
40 class AsyncGenericService;
42 class CompletionQueue;
45 class ServerCompletionQueue;
46 class ServerCredentials;
50 class ServerBuilderPluginTest;
85 max_receive_message_size_ = max_receive_message_size;
91 max_send_message_size_ = max_send_message_size;
148 std::shared_ptr<ServerCredentials> creds,
149 int* selected_port =
nullptr);
174 bool is_frequently_polled =
true);
181 std::unique_ptr<ServerBuilderPlugin> (*CreatePlugin)());
189 friend class ::grpc::testing::ServerBuilderPluginTest;
193 std::shared_ptr<ServerCredentials> creds;
197 struct SyncServerSettings {
199 : num_cqs(1), min_pollers(1), max_pollers(2), cq_timeout_msec(10000) {}
216 typedef std::unique_ptr<grpc::string> HostString;
217 struct NamedService {
218 explicit NamedService(Service* s) : service(s) {}
220 : host(new grpc::
string(h)), service(s) {}
225 int max_receive_message_size_;
226 int max_send_message_size_;
227 std::vector<std::unique_ptr<ServerBuilderOption>> options_;
228 std::vector<std::unique_ptr<NamedService>> services_;
229 std::vector<Port> ports_;
231 SyncServerSettings sync_server_settings_;
234 std::vector<ServerCompletionQueue*> cqs_;
236 std::shared_ptr<ServerCredentials> creds_;
237 std::vector<std::unique_ptr<ServerBuilderPlugin>> plugins_;
239 AsyncGenericService* generic_service_;
243 } maybe_default_compression_level_;
247 } maybe_default_compression_algorithm_;
248 uint32_t enabled_compression_algorithms_bitset_;
253 #endif // GRPCXX_SERVER_BUILDER_H
ServerBuilder & SetMaxMessageSize(int max_message_size)
Definition: server_builder.h:96
ServerBuilder & SetResourceQuota(const ResourceQuota &resource_quota)
Set the attached buffer pool for this server.
ServerBuilder & RegisterAsyncGenericService(AsyncGenericService *service)
Register a generic service.
static void InternalAddPluginFactory(std::unique_ptr< ServerBuilderPlugin >(*CreatePlugin)())
For internal use only: Register a ServerBuilderPlugin factory function.
Maximum number of polling threads.
Definition: server_builder.h:63
std::string string
Definition: config.h:35
std::unique_ptr< ServerBuilderOption > MakeChannelArgumentOption(const grpc::string &name, const grpc::string &value)
ServerBuilder & SetSyncServerOption(SyncServerOption option, int value)
Only useful if this is a Synchronous server.
Desriptor of an RPC service and its various RPC methods.
Definition: service_type.h:56
ResourceQuota represents a bound on memory usage by the gRPC library.
Definition: resource_quota.h:34
bool is_set
Definition: server_builder.h:241
grpc_compression_level
Compression levels allow a party with knowledge of its peer's accepted encodings to request compressi...
Definition: compression_types.h:68
Definition: async_generic_service.h:45
ServerBuilder & SetMaxSendMessageSize(int max_send_message_size)
Set max send message size in bytes.
Definition: server_builder.h:90
ServerBuilder & SetDefaultCompressionLevel(grpc_compression_level level)
The default compression level to use for all channel calls in the absence of a call-specific level...
ServerBuilder & SetCompressionAlgorithmSupportStatus(grpc_compression_algorithm algorithm, bool enabled)
Set the support status for compression algorithms.
std::unique_ptr< Server > BuildAndStart()
Return a running server which is ready for processing calls.
Number of completion queues.
Definition: server_builder.h:61
grpc_compression_algorithm
The various compression algorithms supported by gRPC.
Definition: compression_types.h:56
ServerBuilder & SetOption(std::unique_ptr< ServerBuilderOption > option)
grpc_workaround_list
Definition: workaround_list.h:26
ServerBuilder & EnableWorkaround(grpc_workaround_list id)
Enable a server workaround.
ServerBuilder & SetMaxReceiveMessageSize(int max_receive_message_size)
Set max receive message size in bytes.
Definition: server_builder.h:84
ServerBuilder & RegisterService(Service *service)
Register a service.
grpc_compression_level level
Definition: server_builder.h:242
SyncServerOption
Options for synchronous servers.
Definition: server_builder.h:60
ServerBuilder & SetDefaultCompressionAlgorithm(grpc_compression_algorithm algorithm)
The default compression algorithm to use for all channel calls in the absence of a call-specific leve...
struct grpc_resource_quota grpc_resource_quota
Definition: grpc_types.h:563
std::unique_ptr< ServerCompletionQueue > AddCompletionQueue(bool is_frequently_polled=true)
Add a completion queue for handling asynchronous services.
Minimum number of polling threads.
Definition: server_builder.h:62
Completion queue timeout in milliseconds.
Definition: server_builder.h:64
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.h:129
ServerBuilder & AddListeningPort(const grpc::string &addr_uri, std::shared_ptr< 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...
A builder class for the creation and startup of grpc::Server instances.
Definition: server_builder.h:54
grpc_compression_algorithm algorithm
Definition: server_builder.h:246