[metadata] Add a hook point for custom metadata (#32650)

Aim here is to allow adding custom metadata types to the internal build.
<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->

---------

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
pull/32732/head
Craig Tiller 2 years ago committed by GitHub
parent 175ccc3a90
commit 7e341a545a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      BUILD
  2. 4
      build_autogenerated.yaml
  3. 2
      gRPC-C++.podspec
  4. 2
      gRPC-Core.podspec
  5. 1
      grpc.gemspec
  6. 1
      package.xml
  7. 30
      src/core/lib/transport/custom_metadata.h
  8. 4
      src/core/lib/transport/metadata_batch.h
  9. 1
      tools/doxygen/Doxyfile.c++.internal
  10. 1
      tools/doxygen/Doxyfile.core.internal

@ -1444,6 +1444,7 @@ grpc_cc_library(
"config",
"config_vars",
"cpp_impl_of",
"custom_metadata",
"debug_location",
"exec_ctx",
"gpr",
@ -1536,6 +1537,13 @@ 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 = [

@ -1066,6 +1066,7 @@ libs:
- src/core/lib/transport/batch_builder.h
- src/core/lib/transport/bdp_estimator.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/handshaker.h
- src/core/lib/transport/handshaker_factory.h
@ -2380,6 +2381,7 @@ libs:
- src/core/lib/transport/batch_builder.h
- src/core/lib/transport/bdp_estimator.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/handshaker.h
- src/core/lib/transport/handshaker_factory.h
@ -3843,6 +3845,7 @@ libs:
- src/core/lib/surface/validate_metadata.h
- src/core/lib/transport/batch_builder.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/handshaker.h
- src/core/lib/transport/handshaker_factory.h
@ -7632,6 +7635,7 @@ targets:
- src/core/lib/surface/validate_metadata.h
- src/core/lib/transport/batch_builder.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/handshaker_factory.h
- src/core/lib/transport/handshaker_registry.h

2
gRPC-C++.podspec generated

@ -1033,6 +1033,7 @@ Pod::Spec.new do |s|
'src/core/lib/transport/batch_builder.h',
'src/core/lib/transport/bdp_estimator.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/handshaker.h',
'src/core/lib/transport/handshaker_factory.h',
@ -1970,6 +1971,7 @@ Pod::Spec.new do |s|
'src/core/lib/transport/batch_builder.h',
'src/core/lib/transport/bdp_estimator.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/handshaker.h',
'src/core/lib/transport/handshaker_factory.h',

2
gRPC-Core.podspec generated

@ -1716,6 +1716,7 @@ Pod::Spec.new do |s|
'src/core/lib/transport/bdp_estimator.h',
'src/core/lib/transport/connectivity_state.cc',
'src/core/lib/transport/connectivity_state.h',
'src/core/lib/transport/custom_metadata.h',
'src/core/lib/transport/error_utils.cc',
'src/core/lib/transport/error_utils.h',
'src/core/lib/transport/handshaker.cc',
@ -2660,6 +2661,7 @@ Pod::Spec.new do |s|
'src/core/lib/transport/batch_builder.h',
'src/core/lib/transport/bdp_estimator.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/handshaker.h',
'src/core/lib/transport/handshaker_factory.h',

1
grpc.gemspec generated

@ -1623,6 +1623,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/transport/bdp_estimator.h )
s.files += %w( src/core/lib/transport/connectivity_state.cc )
s.files += %w( src/core/lib/transport/connectivity_state.h )
s.files += %w( src/core/lib/transport/custom_metadata.h )
s.files += %w( src/core/lib/transport/error_utils.cc )
s.files += %w( src/core/lib/transport/error_utils.h )
s.files += %w( src/core/lib/transport/handshaker.cc )

1
package.xml generated

@ -1605,6 +1605,7 @@
<file baseinstalldir="/" name="src/core/lib/transport/bdp_estimator.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/connectivity_state.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/connectivity_state.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/custom_metadata.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/error_utils.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/error_utils.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/handshaker.cc" role="src" />

@ -0,0 +1,30 @@
// 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_CUSTOM_METADATA_H
#define GRPC_SRC_CORE_LIB_TRANSPORT_CUSTOM_METADATA_H
// This file defines two macros: GRPC_CUSTOM_CLIENT_METADATA and
// GRPC_CUSTOM_SERVER_METADATA.
// Each of these is a comma-prefixed and comma-separated list of metadata types
// that will be added to ClientMetadata and ServerMetadata respectively.
// (note: for now both are added to both).
// Different sites with internal grpc-core extensions can substitute this file
// and define their own versions of these macros to extend the metadata system
// with fast metadata types of their own.
#define GRPC_CUSTOM_CLIENT_METADATA
#define GRPC_CUSTOM_SERVER_METADATA
#endif // GRPC_SRC_CORE_LIB_TRANSPORT_CUSTOM_METADATA_H

@ -45,6 +45,7 @@
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/slice/slice.h"
#include "src/core/lib/transport/custom_metadata.h"
#include "src/core/lib/transport/parsed_metadata.h"
namespace grpc_core {
@ -1388,7 +1389,8 @@ using grpc_metadata_batch_base = grpc_core::MetadataMap<
grpc_core::GrpcStreamNetworkState, grpc_core::PeerString,
grpc_core::GrpcStatusContext, grpc_core::GrpcStatusFromWire,
grpc_core::GrpcCallWasCancelled, grpc_core::WaitForReady,
grpc_core::GrpcTrailersOnly>;
grpc_core::GrpcTrailersOnly GRPC_CUSTOM_CLIENT_METADATA
GRPC_CUSTOM_SERVER_METADATA>;
struct grpc_metadata_batch : public grpc_metadata_batch_base {
using grpc_metadata_batch_base::grpc_metadata_batch_base;

@ -2618,6 +2618,7 @@ src/core/lib/transport/bdp_estimator.cc \
src/core/lib/transport/bdp_estimator.h \
src/core/lib/transport/connectivity_state.cc \
src/core/lib/transport/connectivity_state.h \
src/core/lib/transport/custom_metadata.h \
src/core/lib/transport/error_utils.cc \
src/core/lib/transport/error_utils.h \
src/core/lib/transport/handshaker.cc \

@ -2401,6 +2401,7 @@ src/core/lib/transport/bdp_estimator.cc \
src/core/lib/transport/bdp_estimator.h \
src/core/lib/transport/connectivity_state.cc \
src/core/lib/transport/connectivity_state.h \
src/core/lib/transport/custom_metadata.h \
src/core/lib/transport/error_utils.cc \
src/core/lib/transport/error_utils.h \
src/core/lib/transport/handshaker.cc \

Loading…
Cancel
Save