GRPC Core  18.0.0
resolver_result_parsing.h
Go to the documentation of this file.
1 //
2 // Copyright 2018 gRPC authors.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_RESULT_PARSING_H
18 #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_RESULT_PARSING_H
19 
21 
22 #include "absl/types/optional.h"
23 
31 #include "src/core/lib/iomgr/exec_ctx.h" // for grpc_millis
32 #include "src/core/lib/json/json.h"
33 
34 namespace grpc_core {
35 namespace internal {
36 
39  public:
42  std::string parsed_deprecated_lb_policy,
43  absl::optional<std::string> health_check_service_name)
44  : parsed_lb_config_(std::move(parsed_lb_config)),
45  parsed_deprecated_lb_policy_(std::move(parsed_deprecated_lb_policy)),
46  health_check_service_name_(std::move(health_check_service_name)) {}
47 
49  return parsed_lb_config_;
50  }
51 
52  const std::string& parsed_deprecated_lb_policy() const {
53  return parsed_deprecated_lb_policy_;
54  }
55 
56  const absl::optional<std::string>& health_check_service_name() const {
57  return health_check_service_name_;
58  }
59 
60  private:
62  std::string parsed_deprecated_lb_policy_;
63  absl::optional<std::string> health_check_service_name_;
64 };
65 
68  public:
70  const absl::optional<bool>& wait_for_ready)
71  : timeout_(timeout), wait_for_ready_(wait_for_ready) {}
72 
73  grpc_millis timeout() const { return timeout_; }
74 
75  absl::optional<bool> wait_for_ready() const { return wait_for_ready_; }
76 
77  private:
78  grpc_millis timeout_ = 0;
79  absl::optional<bool> wait_for_ready_;
80 };
81 
83  public:
84  std::unique_ptr<ServiceConfigParser::ParsedConfig> ParseGlobalParams(
85  const grpc_channel_args* /*args*/, const Json& json,
86  grpc_error_handle* error) override;
87 
88  std::unique_ptr<ServiceConfigParser::ParsedConfig> ParsePerMethodParams(
89  const grpc_channel_args* /*args*/, const Json& json,
90  grpc_error_handle* error) override;
91 
92  static size_t ParserIndex();
93  static void Register();
94 };
95 
96 } // namespace internal
97 } // namespace grpc_core
98 
99 #endif // GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_RESULT_PARSING_H
Definition: json.h:38
Definition: ref_counted_ptr.h:35
This is the base class that all service config parsers MUST use to store parsed service config data.
Definition: service_config_parser.h:39
This is the base class that all service config parsers should derive from.
Definition: service_config_parser.h:45
Definition: resolver_result_parsing.h:38
const absl::optional< std::string > & health_check_service_name() const
Definition: resolver_result_parsing.h:56
RefCountedPtr< LoadBalancingPolicy::Config > parsed_lb_config() const
Definition: resolver_result_parsing.h:48
const std::string & parsed_deprecated_lb_policy() const
Definition: resolver_result_parsing.h:52
ClientChannelGlobalParsedConfig(RefCountedPtr< LoadBalancingPolicy::Config > parsed_lb_config, std::string parsed_deprecated_lb_policy, absl::optional< std::string > health_check_service_name)
Definition: resolver_result_parsing.h:40
Definition: resolver_result_parsing.h:67
absl::optional< bool > wait_for_ready() const
Definition: resolver_result_parsing.h:75
grpc_millis timeout() const
Definition: resolver_result_parsing.h:73
ClientChannelMethodParsedConfig(grpc_millis timeout, const absl::optional< bool > &wait_for_ready)
Definition: resolver_result_parsing.h:69
Definition: resolver_result_parsing.h:82
static void Register()
Definition: resolver_result_parsing.cc:56
std::unique_ptr< ServiceConfigParser::ParsedConfig > ParsePerMethodParams(const grpc_channel_args *, const Json &json, grpc_error_handle *error) override
Definition: resolver_result_parsing.cc:158
std::unique_ptr< ServiceConfigParser::ParsedConfig > ParseGlobalParams(const grpc_channel_args *, const Json &json, grpc_error_handle *error) override
Definition: resolver_result_parsing.cc:91
static size_t ParserIndex()
Definition: resolver_result_parsing.cc:52
int64_t grpc_millis
Definition: exec_ctx.h:37
grpc_error_handle error
Definition: lame_client.cc:54
Round Robin Policy.
Definition: backend_metric.cc:26
An array of arguments that can be passed around.
Definition: grpc_types.h:132
Definition: error_internal.h:41