Go to the documentation of this file.
57 static std::vector<std::unique_ptr<ServerBuilderPlugin> (*)()>*
58 g_plugin_factory_list;
61 static void do_plugin_list_init(
void) {
62 g_plugin_factory_list =
63 new std::vector<std::unique_ptr<ServerBuilderPlugin> (*)()>();
67 : max_receive_message_size_(INT_MIN),
68 max_send_message_size_(INT_MIN),
72 for (
const auto&
value : *g_plugin_factory_list) {
92 bool is_frequently_polled) {
98 return std::unique_ptr<grpc::ServerCompletionQueue>(
cq);
116 "Adding multiple generic services is unsupported for now. "
117 "Dropping the service %p",
129 "Adding multiple generic services is unsupported for now. "
130 "Dropping the service %p",
139 std::unique_ptr<grpc::ContextAllocator> context_allocator) {
144 std::unique_ptr<grpc::experimental::ExternalConnectionAcceptor>
147 std::shared_ptr<ServerCredentials> creds) {
152 std::make_shared<grpc::internal::ExternalConnectionAcceptorImpl>(
153 name_prefix.append(count_str),
type, creds));
158 std::shared_ptr<experimental::AuthorizationPolicyProviderInterface>
160 builder_->authorization_provider_ =
std::move(provider);
164 std::unique_ptr<ServerBuilderOption>
option) {
223 const std::string& addr_uri, std::shared_ptr<ServerCredentials> creds,
224 int* selected_port) {
227 if (addr_uri.compare(0, uri_scheme.size(), uri_scheme) == 0) {
228 size_t pos = uri_scheme.size();
229 while (addr_uri[
pos] ==
'/') ++
pos;
263 for (
const auto& plugin :
plugins_) {
264 plugin->UpdateServerBuilder(
this);
265 plugin->UpdateChannelArguments(&
args);
279 bool has_sync_methods =
false;
281 if (
value->service->has_synchronous_methods()) {
282 has_sync_methods =
true;
287 if (!has_sync_methods) {
289 if (
value->has_sync_methods()) {
290 has_sync_methods =
true;
303 std::shared_ptr<std::vector<std::unique_ptr<grpc::ServerCompletionQueue>>>
306 std::vector<std::unique_ptr<grpc::ServerCompletionQueue>>>());
308 bool has_frequently_polled_cqs =
false;
309 for (
const auto&
cq :
cqs_) {
310 if (
cq->IsFrequentlyPolled()) {
311 has_frequently_polled_cqs =
true;
317 bool has_callback_methods =
false;
319 if (
service->service->has_callback_methods()) {
320 has_callback_methods =
true;
321 has_frequently_polled_cqs =
true;
327 has_frequently_polled_cqs =
true;
330 const bool is_hybrid_server = has_sync_methods && has_frequently_polled_cqs;
332 if (has_sync_methods) {
338 sync_server_cqs->emplace_back(
346 if (has_sync_methods) {
349 "Synchronous server. Num CQs: %d, Min pollers: %d, Max Pollers: "
350 "%d, CQ timeout (msec): %d",
356 if (has_callback_methods) {
363 creators.insert(creators.end(),
380 for (
const auto&
cq : *sync_server_cqs) {
382 has_frequently_polled_cqs =
true;
397 for (
const auto&
cq :
cqs_) {
402 if (!has_frequently_polled_cqs) {
404 "At least one of the completion queues must be frequently polled");
417 value->InitServer(initializer);
426 if (
value->service->has_generic_methods()) {
428 "Some methods were marked generic but there is no "
429 "generic service registered.");
435 bool added_port =
false;
439 if (added_port)
server->Shutdown();
443 if (
port.selected_port !=
nullptr) {
444 *
port.selected_port =
r;
448 auto cqs_data =
cqs_.empty() ? nullptr : &
cqs_[0];
452 value->Finish(initializer);
459 std::unique_ptr<ServerBuilderPlugin> (*CreatePlugin)()) {
461 (*g_plugin_factory_list).push_back(CreatePlugin);
std::unique_ptr< grpc::experimental::ExternalConnectionAcceptor > AddExternalConnectionAcceptor(ExternalConnectionType type, std::shared_ptr< ServerCredentials > creds)
SyncServerSettings sync_server_settings_
return memset(p, 0, total)
virtual std::unique_ptr< grpc::Server > BuildAndStart()
ServerBuilder & SetSyncServerOption(SyncServerOption option, int value)
Only useful if this is a Synchronous server.
#define GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH
#define GRPC_ARG_RESOURCE_QUOTA
ServerBuilder & AddChannelArgument(const std::string &arg, const T &value)
grpc_compression_level level
grpc_compression_algorithm
ResourceQuotaRefPtr resource_quota_
std::vector< std::unique_ptr< grpc::ServerBuilderOption > > options_
OPENSSL_EXPORT pem_password_cb void * u
GRPCAPI void grpc_server_register_completion_queue(grpc_server *server, grpc_completion_queue *cq, void *reserved)
std::vector< std::unique_ptr< NamedService > > services_
struct grpc::ServerBuilder::@7 maybe_default_compression_algorithm_
ServerBuilder & SetOption(std::unique_ptr< grpc::ServerBuilderOption > option)
#define GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL
#define GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET
#define GRPC_ARG_MAX_SEND_MESSAGE_LENGTH
Experimental, to be deprecated.
ServerBuilder & RegisterService(grpc::Service *service)
ResourceQuotaRefPtr resource_quota
const GRPCAPI grpc_arg_pointer_vtable * grpc_authorization_policy_provider_arg_vtable(void)
Desriptor of an RPC service and its various RPC methods.
GPRAPI void gpr_once_init(gpr_once *once, void(*init_function)(void))
ServerBuilder & RegisterAsyncGenericService(grpc::AsyncGenericService *service)
ServerBuilder & SetResourceQuota(const grpc::ResourceQuota &resource_quota)
Set the attached buffer pool for this server.
@ MAX_POLLERS
Maximum number of polling threads.
grpc::CallbackGenericService * callback_generic_service_
ServerBuilder & AddListeningPort(const std::string &addr_uri, std::shared_ptr< grpc::ServerCredentials > creds, int *selected_port=nullptr)
std::vector< Port > ports_
@ GRPC_CQ_DEFAULT_POLLING
@ MIN_POLLERS
Minimum number of polling threads.
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
void SetAuthorizationPolicyProvider(std::shared_ptr< experimental::AuthorizationPolicyProviderInterface > provider)
std::vector< std::unique_ptr< grpc::ServerBuilderPlugin > > plugins_
@ CQ_TIMEOUT_MSEC
Completion queue timeout in milliseconds.
std::shared_ptr< experimental::AuthorizationPolicyProviderInterface > authorization_provider_
A builder class for the creation and startup of grpc::Server instances.
ServerBuilder & SetDefaultCompressionAlgorithm(grpc_compression_algorithm algorithm)
const GRPCAPI grpc_arg_pointer_vtable * grpc_resource_quota_arg_vtable(void)
#define GPR_LTOA_MIN_BUFSIZE
std::vector< std::unique_ptr< grpc::experimental::ServerInterceptorFactoryInterface > > internal_interceptor_creators_
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
virtual ChannelArguments BuildChannelArgs()
Experimental API, subject to change.
grpc_server_config_fetcher * server_config_fetcher_
T ClearBit(T *i, size_t n)
def server(thread_pool, handlers=None, interceptors=None, options=None, maximum_concurrent_rpcs=None, compression=None, xds=False)
SyncServerOption
Options for synchronous servers.
grpc::AsyncGenericService * generic_service_
std::vector< grpc::ServerCompletionQueue * > cqs_
List of completion queues added via AddCompletionQueue method.
ServerBuilder & SetCompressionAlgorithmSupportStatus(grpc_compression_algorithm algorithm, bool enabled)
#define GRPC_ARG_WORKAROUND_CRONET_COMPRESSION
std::unique_ptr< grpc::ServerCompletionQueue > AddCompletionQueue(bool is_frequently_polled=true)
#define GRPC_ARG_AUTHORIZATION_POLICY_PROVIDER
std::unique_ptr< ContextAllocator > context_allocator_
int max_receive_message_size_
ServerBuilder & SetDefaultCompressionLevel(grpc_compression_level level)
int cq_timeout_msec
The timeout for server completion queue's AsyncNext call.
GRPCAPI void grpc_resource_quota_unref(grpc_resource_quota *resource_quota)
@ GRPC_COMPRESS_ALGORITHMS_COUNT
struct grpc::ServerBuilder::@6 maybe_default_compression_level_
@ GRPC_WORKAROUND_ID_CRONET_COMPRESSION
@ NUM_CQS
Number of completion queues.
std::vector< std::unique_ptr< grpc::experimental::ServerInterceptorFactoryInterface > > interceptor_creators_
grpc_resource_quota * resource_quota_
ServerBuilder & EnableWorkaround(grpc_workaround_list id)
GRPCAPI void grpc_resource_quota_ref(grpc_resource_quota *resource_quota)
int num_cqs
Number of server completion queues to create to listen to incoming RPCs.
__attribute__((deprecated("Please use GRPCProtoMethod."))) @interface ProtoMethod NSString * service
#define GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM
static void InternalAddPluginFactory(std::unique_ptr< grpc::ServerBuilderPlugin >(*CreatePlugin)())
For internal use only: Register a ServerBuilderPlugin factory function.
std::vector< std::shared_ptr< grpc::internal::ExternalConnectionAcceptorImpl > > acceptors_
ServerBuilder & RegisterCallbackGenericService(grpc::CallbackGenericService *service)
ServerBuilder & SetContextAllocator(std::unique_ptr< grpc::ContextAllocator > context_allocator)
static grpc_completion_queue * cq
int max_send_message_size_
uint32_t enabled_compression_algorithms_bitset_
int gpr_ltoa(long value, char *output)
grpc_compression_algorithm algorithm
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:16