diff --git a/BUILD b/BUILD
index 2a5b1cc7a3a..a8d588ffa63 100644
--- a/BUILD
+++ b/BUILD
@@ -1394,9 +1394,11 @@ grpc_cc_library(
"//src/core:lib/surface/server.h",
"//src/core:lib/surface/validate_metadata.h",
"//src/core:lib/transport/connectivity_state.h",
+ "//src/core:lib/transport/custom_metadata.h",
"//src/core:lib/transport/error_utils.h",
"//src/core:lib/transport/metadata_batch.h",
"//src/core:lib/transport/parsed_metadata.h",
+ "//src/core:lib/transport/simple_slice_based_metadata.h",
"//src/core:lib/transport/status_conversion.h",
"//src/core:lib/transport/timeout_encoding.h",
"//src/core:lib/transport/transport.h",
@@ -1445,7 +1447,6 @@ grpc_cc_library(
"config",
"config_vars",
"cpp_impl_of",
- "custom_metadata",
"debug_location",
"exec_ctx",
"gpr",
@@ -1539,13 +1540,6 @@ grpc_cc_library(
],
)
-grpc_cc_library(
- name = "custom_metadata",
- hdrs = [
- "//src/core:lib/transport/custom_metadata.h",
- ],
-)
-
grpc_cc_library(
name = "lb_load_data_store",
srcs = [
diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml
index f4dd1f21679..341ddcd2b65 100644
--- a/build_autogenerated.yaml
+++ b/build_autogenerated.yaml
@@ -1078,6 +1078,7 @@ libs:
- src/core/lib/transport/metadata_batch.h
- src/core/lib/transport/parsed_metadata.h
- src/core/lib/transport/pid_controller.h
+ - src/core/lib/transport/simple_slice_based_metadata.h
- src/core/lib/transport/status_conversion.h
- src/core/lib/transport/tcp_connect_handshaker.h
- src/core/lib/transport/timeout_encoding.h
@@ -2395,6 +2396,7 @@ libs:
- src/core/lib/transport/metadata_batch.h
- src/core/lib/transport/parsed_metadata.h
- src/core/lib/transport/pid_controller.h
+ - src/core/lib/transport/simple_slice_based_metadata.h
- src/core/lib/transport/status_conversion.h
- src/core/lib/transport/tcp_connect_handshaker.h
- src/core/lib/transport/timeout_encoding.h
@@ -3859,6 +3861,7 @@ libs:
- src/core/lib/transport/http2_errors.h
- src/core/lib/transport/metadata_batch.h
- src/core/lib/transport/parsed_metadata.h
+ - src/core/lib/transport/simple_slice_based_metadata.h
- src/core/lib/transport/status_conversion.h
- src/core/lib/transport/timeout_encoding.h
- src/core/lib/transport/transport.h
@@ -7673,6 +7676,7 @@ targets:
- src/core/lib/transport/http2_errors.h
- src/core/lib/transport/metadata_batch.h
- src/core/lib/transport/parsed_metadata.h
+ - src/core/lib/transport/simple_slice_based_metadata.h
- src/core/lib/transport/status_conversion.h
- src/core/lib/transport/timeout_encoding.h
- src/core/lib/transport/transport.h
diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec
index e5cfa4bce99..deece3ee6f6 100644
--- a/gRPC-C++.podspec
+++ b/gRPC-C++.podspec
@@ -1045,6 +1045,7 @@ Pod::Spec.new do |s|
'src/core/lib/transport/metadata_batch.h',
'src/core/lib/transport/parsed_metadata.h',
'src/core/lib/transport/pid_controller.h',
+ 'src/core/lib/transport/simple_slice_based_metadata.h',
'src/core/lib/transport/status_conversion.h',
'src/core/lib/transport/tcp_connect_handshaker.h',
'src/core/lib/transport/timeout_encoding.h',
@@ -1985,6 +1986,7 @@ Pod::Spec.new do |s|
'src/core/lib/transport/metadata_batch.h',
'src/core/lib/transport/parsed_metadata.h',
'src/core/lib/transport/pid_controller.h',
+ 'src/core/lib/transport/simple_slice_based_metadata.h',
'src/core/lib/transport/status_conversion.h',
'src/core/lib/transport/tcp_connect_handshaker.h',
'src/core/lib/transport/timeout_encoding.h',
diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec
index c35d1f9317f..df22e350a6e 100644
--- a/gRPC-Core.podspec
+++ b/gRPC-Core.podspec
@@ -1735,6 +1735,7 @@ Pod::Spec.new do |s|
'src/core/lib/transport/parsed_metadata.h',
'src/core/lib/transport/pid_controller.cc',
'src/core/lib/transport/pid_controller.h',
+ 'src/core/lib/transport/simple_slice_based_metadata.h',
'src/core/lib/transport/status_conversion.cc',
'src/core/lib/transport/status_conversion.h',
'src/core/lib/transport/tcp_connect_handshaker.cc',
@@ -2675,6 +2676,7 @@ Pod::Spec.new do |s|
'src/core/lib/transport/metadata_batch.h',
'src/core/lib/transport/parsed_metadata.h',
'src/core/lib/transport/pid_controller.h',
+ 'src/core/lib/transport/simple_slice_based_metadata.h',
'src/core/lib/transport/status_conversion.h',
'src/core/lib/transport/tcp_connect_handshaker.h',
'src/core/lib/transport/timeout_encoding.h',
diff --git a/grpc.gemspec b/grpc.gemspec
index 91a8da2964f..0bca4f77b14 100644
--- a/grpc.gemspec
+++ b/grpc.gemspec
@@ -1642,6 +1642,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/transport/parsed_metadata.h )
s.files += %w( src/core/lib/transport/pid_controller.cc )
s.files += %w( src/core/lib/transport/pid_controller.h )
+ s.files += %w( src/core/lib/transport/simple_slice_based_metadata.h )
s.files += %w( src/core/lib/transport/status_conversion.cc )
s.files += %w( src/core/lib/transport/status_conversion.h )
s.files += %w( src/core/lib/transport/tcp_connect_handshaker.cc )
diff --git a/package.xml b/package.xml
index bdf6045729d..18f013dffc6 100644
--- a/package.xml
+++ b/package.xml
@@ -1624,6 +1624,7 @@
+
diff --git a/src/core/lib/transport/metadata_batch.h b/src/core/lib/transport/metadata_batch.h
index 320e9b1b5f6..e06da76c8de 100644
--- a/src/core/lib/transport/metadata_batch.h
+++ b/src/core/lib/transport/metadata_batch.h
@@ -47,6 +47,7 @@
#include "src/core/lib/slice/slice.h"
#include "src/core/lib/transport/custom_metadata.h"
#include "src/core/lib/transport/parsed_metadata.h"
+#include "src/core/lib/transport/simple_slice_based_metadata.h"
namespace grpc_core {
@@ -229,22 +230,6 @@ struct GrpcAcceptEncodingMetadata {
}
};
-struct SimpleSliceBasedMetadata {
- using ValueType = Slice;
- using MementoType = Slice;
- static MementoType ParseMemento(Slice value, MetadataParseErrorFn) {
- return value.TakeOwned();
- }
- static ValueType MementoToValue(MementoType value) { return value; }
- static Slice Encode(const ValueType& x) { return x.Ref(); }
- static absl::string_view DisplayValue(const ValueType& value) {
- return value.as_string_view();
- }
- static absl::string_view DisplayMemento(const MementoType& value) {
- return value.as_string_view();
- }
-};
-
// user-agent metadata trait.
struct UserAgentMetadata : public SimpleSliceBasedMetadata {
static constexpr bool kRepeatable = false;
diff --git a/src/core/lib/transport/simple_slice_based_metadata.h b/src/core/lib/transport/simple_slice_based_metadata.h
new file mode 100644
index 00000000000..a4651e27930
--- /dev/null
+++ b/src/core/lib/transport/simple_slice_based_metadata.h
@@ -0,0 +1,48 @@
+// Copyright 2023 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_SRC_CORE_LIB_TRANSPORT_SIMPLE_SLICE_BASED_METADATA_H
+#define GRPC_SRC_CORE_LIB_TRANSPORT_SIMPLE_SLICE_BASED_METADATA_H
+
+#include
+
+#include "absl/strings/string_view.h"
+
+#include "src/core/lib/slice/slice.h"
+#include "src/core/lib/transport/parsed_metadata.h"
+
+namespace grpc_core {
+
+// Models grpc metadata (as per the rules for MetadataMap) for a metadata
+// element that consists of a Slice.
+// Use by deriving from this class and adding `kRepeatable` and `key()`.
+struct SimpleSliceBasedMetadata {
+ using ValueType = Slice;
+ using MementoType = Slice;
+ static MementoType ParseMemento(Slice value, MetadataParseErrorFn) {
+ return value.TakeOwned();
+ }
+ static ValueType MementoToValue(MementoType value) { return value; }
+ static Slice Encode(const ValueType& x) { return x.Ref(); }
+ static absl::string_view DisplayValue(const ValueType& value) {
+ return value.as_string_view();
+ }
+ static absl::string_view DisplayMemento(const MementoType& value) {
+ return value.as_string_view();
+ }
+};
+
+} // namespace grpc_core
+
+#endif // GRPC_SRC_CORE_LIB_TRANSPORT_SIMPLE_SLICE_BASED_METADATA_H
diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal
index db20c4ee877..ffc7d27ec22 100644
--- a/tools/doxygen/Doxyfile.c++.internal
+++ b/tools/doxygen/Doxyfile.c++.internal
@@ -2637,6 +2637,7 @@ src/core/lib/transport/parsed_metadata.cc \
src/core/lib/transport/parsed_metadata.h \
src/core/lib/transport/pid_controller.cc \
src/core/lib/transport/pid_controller.h \
+src/core/lib/transport/simple_slice_based_metadata.h \
src/core/lib/transport/status_conversion.cc \
src/core/lib/transport/status_conversion.h \
src/core/lib/transport/tcp_connect_handshaker.cc \
diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal
index c05169714cb..606d73d1a9c 100644
--- a/tools/doxygen/Doxyfile.core.internal
+++ b/tools/doxygen/Doxyfile.core.internal
@@ -2420,6 +2420,7 @@ src/core/lib/transport/parsed_metadata.cc \
src/core/lib/transport/parsed_metadata.h \
src/core/lib/transport/pid_controller.cc \
src/core/lib/transport/pid_controller.h \
+src/core/lib/transport/simple_slice_based_metadata.h \
src/core/lib/transport/status_conversion.cc \
src/core/lib/transport/status_conversion.h \
src/core/lib/transport/tcp_connect_handshaker.cc \