GRPC Core  9.0.0
resolver_factory.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_FACTORY_H
20 #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FACTORY_H
21 
23 
25 
31 
32 namespace grpc_core {
33 
34 struct ResolverArgs {
36  grpc_uri* uri = nullptr;
38  const grpc_channel_args* args = nullptr;
42  Combiner* combiner = nullptr;
44  std::unique_ptr<Resolver::ResultHandler> result_handler;
45 };
46 
48  public:
51  virtual bool IsValidUri(const grpc_uri* uri) const = 0;
52 
55 
59  const char* path = uri->path;
60  if (path[0] == '/') ++path;
62  }
63 
66  virtual const char* scheme() const = 0;
67 
68  virtual ~ResolverFactory() {}
69 };
70 
71 } // namespace grpc_core
72 
73 #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FACTORY_H */
Definition: combiner.h:33
Definition: resolver_factory.h:47
virtual ~ResolverFactory()
Definition: resolver_factory.h:68
virtual OrphanablePtr< Resolver > CreateResolver(ResolverArgs args) const =0
Returns a new resolver instance.
virtual bool IsValidUri(const grpc_uri *uri) const =0
Returns a bool indicating whether the input uri is valid to create a resolver.
virtual grpc_core::UniquePtr< char > GetDefaultAuthority(grpc_uri *uri) const
Returns a string representing the default authority to use for this scheme.
Definition: resolver_factory.h:58
virtual const char * scheme() const =0
Returns the URI scheme that this factory implements.
Round Robin Policy.
Definition: backend_metric.cc:24
std::unique_ptr< T, DefaultDeleteChar > UniquePtr
Definition: memory.h:45
std::unique_ptr< T, Deleter > OrphanablePtr
Definition: orphanable.h:68
struct grpc_pollset_set grpc_pollset_set
Definition: pollset_set.h:31
GPRAPI char * gpr_strdup(const char *src)
String utility functions.
Definition: string.cc:37
An array of arguments that can be passed around.
Definition: grpc_types.h:132
Definition: resolver_factory.h:34
const grpc_channel_args * args
Channel args to be included in resolver results.
Definition: resolver_factory.h:38
grpc_pollset_set * pollset_set
Used to drive I/O in the name resolution process.
Definition: resolver_factory.h:40
Combiner * combiner
The combiner under which all resolver calls will be run.
Definition: resolver_factory.h:42
grpc_uri * uri
The parsed URI to resolve.
Definition: resolver_factory.h:36
std::unique_ptr< Resolver::ResultHandler > result_handler
The result handler to be used by the resolver.
Definition: resolver_factory.h:44
Definition: uri_parser.h:26
char * path
Definition: uri_parser.h:29