summaryrefslogtreecommitdiff
path: root/grpc/src/core/ext/xds/xds_cluster_specifier_plugin.h
diff options
context:
space:
mode:
authorIvan Lozano <ivanlozano@google.com>2023-06-21 14:25:47 +0000
committerKrzysztof KosiƄski <krzysio@google.com>2023-10-18 19:43:01 +0000
commit86747a9b7ab4a2c0d7f62d66545c8bc7ce24f89a (patch)
tree7054d5b683ac2ae92ca5ccdd48470d32c24f516a /grpc/src/core/ext/xds/xds_cluster_specifier_plugin.h
parent9373479334615d76ed1749510322acd3cefe046b (diff)
downloadgrpcio-sys-86747a9b7ab4a2c0d7f62d66545c8bc7ce24f89a.tar.gz
Upgrade grpcio-sys to v0.12.1+1.46.5-patched
Based on aosp/2633389 Bug: 266055490 Test: mm, presubmit Change-Id: I006dce16e643dac75c6b190866746f8186ba5996
Diffstat (limited to 'grpc/src/core/ext/xds/xds_cluster_specifier_plugin.h')
-rw-r--r--grpc/src/core/ext/xds/xds_cluster_specifier_plugin.h79
1 files changed, 79 insertions, 0 deletions
diff --git a/grpc/src/core/ext/xds/xds_cluster_specifier_plugin.h b/grpc/src/core/ext/xds/xds_cluster_specifier_plugin.h
new file mode 100644
index 00000000..54513b02
--- /dev/null
+++ b/grpc/src/core/ext/xds/xds_cluster_specifier_plugin.h
@@ -0,0 +1,79 @@
+//
+// Copyright 2022 gRPC authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef GRPC_CORE_EXT_XDS_XDS_CLUSTER_SPECIFIER_PLUGIN_H
+#define GRPC_CORE_EXT_XDS_XDS_CLUSTER_SPECIFIER_PLUGIN_H
+
+#include <grpc/support/port_platform.h>
+
+#include <memory>
+#include <set>
+#include <string>
+
+#include "absl/status/statusor.h"
+#include "absl/strings/str_cat.h"
+#include "absl/strings/string_view.h"
+#include "google/protobuf/any.upb.h"
+#include "upb/def.h"
+
+#include <grpc/grpc.h>
+
+#include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/json/json.h"
+
+namespace grpc_core {
+
+class XdsClusterSpecifierPluginImpl {
+ public:
+ virtual ~XdsClusterSpecifierPluginImpl() = default;
+
+ // Loads the proto message into the upb symtab.
+ virtual void PopulateSymtab(upb_DefPool* symtab) const = 0;
+
+ // Returns the LB policy config in JSON form.
+ virtual absl::StatusOr<std::string> GenerateLoadBalancingPolicyConfig(
+ upb_StringView serialized_plugin_config, upb_Arena* arena,
+ upb_DefPool* symtab) const = 0;
+};
+
+class XdsRouteLookupClusterSpecifierPlugin
+ : public XdsClusterSpecifierPluginImpl {
+ void PopulateSymtab(upb_DefPool* symtab) const override;
+
+ absl::StatusOr<std::string> GenerateLoadBalancingPolicyConfig(
+ upb_StringView serialized_plugin_config, upb_Arena* arena,
+ upb_DefPool* symtab) const override;
+};
+
+class XdsClusterSpecifierPluginRegistry {
+ public:
+ static void RegisterPlugin(
+ std::unique_ptr<XdsClusterSpecifierPluginImpl> plugin,
+ absl::string_view config_proto_type_name);
+
+ static void PopulateSymtab(upb_DefPool* symtab);
+
+ static const XdsClusterSpecifierPluginImpl* GetPluginForType(
+ absl::string_view config_proto_type_name);
+
+ // Global init and shutdown.
+ static void Init();
+ static void Shutdown();
+};
+
+} // namespace grpc_core
+
+#endif // GRPC_CORE_EXT_XDS_XDS_CLUSTER_SPECIFIER_PLUGIN_H