xds_cluster_specifier_plugin.h
Go to the documentation of this file.
1 //
2 // Copyright 2022 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_XDS_XDS_CLUSTER_SPECIFIER_PLUGIN_H
18 #define GRPC_CORE_EXT_XDS_XDS_CLUSTER_SPECIFIER_PLUGIN_H
19 
21 
22 #include <memory>
23 #include <string>
24 
25 #include "absl/status/statusor.h"
26 #include "absl/strings/string_view.h"
27 #include "upb/def.h"
28 #include "upb/upb.h"
29 
30 namespace grpc_core {
31 
33  public:
34  virtual ~XdsClusterSpecifierPluginImpl() = default;
35 
36  // Loads the proto message into the upb symtab.
37  virtual void PopulateSymtab(upb_DefPool* symtab) const = 0;
38 
39  // Returns the LB policy config in JSON form.
41  upb_StringView serialized_plugin_config, upb_Arena* arena,
42  upb_DefPool* symtab) const = 0;
43 };
44 
47  void PopulateSymtab(upb_DefPool* symtab) const override;
48 
50  upb_StringView serialized_plugin_config, upb_Arena* arena,
51  upb_DefPool* symtab) const override;
52 };
53 
55  public:
56  static void RegisterPlugin(
57  std::unique_ptr<XdsClusterSpecifierPluginImpl> plugin,
58  absl::string_view config_proto_type_name);
59 
60  static void PopulateSymtab(upb_DefPool* symtab);
61 
63  absl::string_view config_proto_type_name);
64 
65  // Global init and shutdown.
66  static void Init();
67  static void Shutdown();
68 };
69 
70 } // namespace grpc_core
71 
72 #endif // GRPC_CORE_EXT_XDS_XDS_CLUSTER_SPECIFIER_PLUGIN_H
grpc_core::XdsRouteLookupClusterSpecifierPlugin::GenerateLoadBalancingPolicyConfig
absl::StatusOr< std::string > GenerateLoadBalancingPolicyConfig(upb_StringView serialized_plugin_config, upb_Arena *arena, upb_DefPool *symtab) const override
Definition: xds_cluster_specifier_plugin.cc:52
grpc_core::XdsClusterSpecifierPluginRegistry::Shutdown
static void Shutdown()
Definition: xds_cluster_specifier_plugin.cc:149
grpc_core::XdsClusterSpecifierPluginRegistry::RegisterPlugin
static void RegisterPlugin(std::unique_ptr< XdsClusterSpecifierPluginImpl > plugin, absl::string_view config_proto_type_name)
Definition: xds_cluster_specifier_plugin.cc:137
grpc_core
Definition: call_metric_recorder.h:31
absl::string_view
Definition: abseil-cpp/absl/strings/string_view.h:167
grpc_core::XdsRouteLookupClusterSpecifierPlugin::PopulateSymtab
void PopulateSymtab(upb_DefPool *symtab) const override
Definition: xds_cluster_specifier_plugin.cc:46
grpc_core::XdsClusterSpecifierPluginRegistry::Init
static void Init()
Definition: xds_cluster_specifier_plugin.cc:143
grpc_core::XdsClusterSpecifierPluginImpl::PopulateSymtab
virtual void PopulateSymtab(upb_DefPool *symtab) const =0
arena
grpc_core::ScopedArenaPtr arena
Definition: binder_transport_test.cc:237
grpc_core::XdsClusterSpecifierPluginRegistry::GetPluginForType
static const XdsClusterSpecifierPluginImpl * GetPluginForType(absl::string_view config_proto_type_name)
Definition: xds_cluster_specifier_plugin.cc:124
grpc_core::XdsClusterSpecifierPluginRegistry
Definition: xds_cluster_specifier_plugin.h:54
upb.h
grpc_core::XdsClusterSpecifierPluginImpl
Definition: xds_cluster_specifier_plugin.h:32
symtab
upb_symtab * symtab
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:774
upb_StringView
Definition: upb/upb/upb.h:72
def.h
grpc_core::XdsRouteLookupClusterSpecifierPlugin
Definition: xds_cluster_specifier_plugin.h:45
grpc_core::XdsClusterSpecifierPluginImpl::~XdsClusterSpecifierPluginImpl
virtual ~XdsClusterSpecifierPluginImpl()=default
absl::StatusOr< std::string >
grpc_core::XdsClusterSpecifierPluginRegistry::PopulateSymtab
static void PopulateSymtab(upb_DefPool *symtab)
Definition: xds_cluster_specifier_plugin.cc:131
upb_DefPool
Definition: upb/upb/def.c:217
grpc_core::XdsClusterSpecifierPluginImpl::GenerateLoadBalancingPolicyConfig
virtual absl::StatusOr< std::string > GenerateLoadBalancingPolicyConfig(upb_StringView serialized_plugin_config, upb_Arena *arena, upb_DefPool *symtab) const =0
upb_Arena
Definition: upb_internal.h:36
port_platform.h


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:55