GRPC C++  1.39.1
resolver_registry.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_REGISTRY_H
20 #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_REGISTRY_H
21 
23 
28 
29 namespace grpc_core {
30 
32  public:
36  class Builder {
37  public:
39  static void InitRegistry();
40  static void ShutdownRegistry();
41 
44  static void SetDefaultPrefix(const char* default_prefix);
45 
49  static void RegisterResolverFactory(
50  std::unique_ptr<ResolverFactory> factory);
51  };
52 
54  static bool IsValidTarget(absl::string_view target);
55 
70  const char* target, const grpc_channel_args* args,
71  grpc_pollset_set* pollset_set,
72  std::shared_ptr<WorkSerializer> work_serializer,
73  std::unique_ptr<Resolver::ResultHandler> result_handler);
74 
76  static std::string GetDefaultAuthority(absl::string_view target);
77 
80  const char* target);
81 
84  static ResolverFactory* LookupResolverFactory(const char* scheme);
85 };
86 
87 } // namespace grpc_core
88 
89 #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_REGISTRY_H */
Definition: resolver_factory.h:49
Methods used to create and populate the ResolverRegistry.
Definition: resolver_registry.h:36
static void InitRegistry()
Global initialization and shutdown hooks.
Definition: resolver_registry.cc:118
static void SetDefaultPrefix(const char *default_prefix)
Sets the default URI prefix to default_prefix.
Definition: resolver_registry.cc:127
static void RegisterResolverFactory(std::unique_ptr< ResolverFactory > factory)
Registers a resolver factory.
Definition: resolver_registry.cc:132
static void ShutdownRegistry()
Definition: resolver_registry.cc:122
Definition: resolver_registry.h:31
static OrphanablePtr< Resolver > CreateResolver(const char *target, const grpc_channel_args *args, grpc_pollset_set *pollset_set, std::shared_ptr< WorkSerializer > work_serializer, std::unique_ptr< Resolver::ResultHandler > result_handler)
Creates a resolver given target.
Definition: resolver_registry.cc:155
static grpc_core::UniquePtr< char > AddDefaultPrefixIfNeeded(const char *target)
Returns target with the default prefix prepended, if needed.
Definition: resolver_registry.cc:186
static ResolverFactory * LookupResolverFactory(const char *scheme)
Returns the resolver factory for scheme.
Definition: resolver_registry.cc:142
static bool IsValidTarget(absl::string_view target)
Checks whether the user input target is valid to create a resolver.
Definition: resolver_registry.cc:147
static std::string GetDefaultAuthority(absl::string_view target)
Returns the default authority to pass from a client for target.
Definition: resolver_registry.cc:175
Round Robin Policy.
Definition: backend_metric.cc:26
std::unique_ptr< T, DefaultDeleteChar > UniquePtr
Definition: memory.h:47
std::unique_ptr< T, Deleter > OrphanablePtr
Definition: orphanable.h:67
struct grpc_pollset_set grpc_pollset_set
Definition: pollset_set.h:31
An array of arguments that can be passed around.
Definition: grpc_types.h:132