Go to the documentation of this file.
19 #ifndef GRPC_CORE_LIB_TRANSPORT_METADATA_BATCH_H
20 #define GRPC_CORE_LIB_TRANSPORT_METADATA_BATCH_H
28 #include <type_traits>
31 #include "absl/container/inlined_vector.h"
32 #include "absl/functional/function_ref.h"
33 #include "absl/meta/type_traits.h"
34 #include "absl/strings/numbers.h"
35 #include "absl/strings/string_view.h"
36 #include "absl/types/optional.h"
124 return Parse(
value.as_string_view(), on_error);
169 return "<discarded-invalid-value>";
204 return value.TakeOwned();
209 return value.as_string_view();
270 template <
typename Int>
279 template <
typename Int, Int kInval
idValue>
285 on_error(
"not an integer",
value);
327 class GrpcLbClientStats;
391 namespace metadata_detail {
413 template <
typename Trait,
typename Ignored =
void>
418 template <
typename Trait>
424 template <
typename MustBeVoid,
typename... Traits>
427 template <
typename Trait,
typename... Traits>
432 template <
typename Op>
434 -> decltype(
op->Found(Trait())) {
436 return op->Found(Trait());
442 template <
typename Trait,
typename... Traits>
445 template <
typename Op>
454 template <
typename Op>
456 -> decltype(
op->NotFound(
key)) {
457 return op->NotFound(
key);
464 template <
typename ParseMementoFn,
typename MementoToValueFn>
466 template <ParseMementoFn parse_memento, MementoToValueFn memento_to_value>
471 return memento_to_value(parse_memento(
std::move(*
value), on_error));
478 template <
typename Container>
486 template <
typename Trait>
490 ParseValueToMemento<typename Trait::MementoType, Trait::ParseMemento>(),
501 template <
typename T, T (*parse_memento)(Slice, MetadataParseErrorFn)>
514 template <
typename Container>
520 template <
typename Trait>
523 trait,
ParseValue<decltype(Trait::ParseMemento),
524 decltype(Trait::MementoToValue)>::
525 template Parse<Trait::ParseMemento, Trait::MementoToValue>(
542 template <
typename Container>
547 template <
typename Trait>
563 template <
typename Container>
570 template <
typename Trait>
572 Trait::kRepeatable ==
false &&
577 if (
value ==
nullptr)
return absl::nullopt;
578 return value->as_string_view();
581 template <
typename Trait>
583 Trait::kRepeatable ==
true &&
588 if (
value ==
nullptr)
return absl::nullopt;
590 for (
const auto&
v : *
value) {
592 auto new_segment = Trait::Encode(
v);
593 backing_->append(new_segment.begin(), new_segment.end());
598 template <
typename Trait>
600 Trait::kRepeatable ==
false &&
605 if (
value ==
nullptr)
return absl::nullopt;
623 template <
typename T>
648 return value.as_string_view();
652 template <
typename T,
typename U,
typename V>
654 V (*display_value)(U),
LogFn log_fn) {
659 template <
typename Which,
typename Ignored =
void>
662 template <
typename Which>
664 IsEncodableTrait<Which>::value,
677 template <
typename Encoder>
679 encoder->Encode(Which(),
value);
688 template <
typename Which>
690 !IsEncodableTrait<Which>::value,
703 template <
typename Encoder>
712 template <
typename Which>
714 IsEncodableTrait<Which>::value,
718 this->value.push_back(
value);
721 this->value.emplace_back(std::forward<typename Which::ValueType>(
value));
730 template <
typename Encoder>
732 for (
const auto&
v :
value) {
733 encoder->Encode(Which(),
v);
737 for (
const auto&
v :
value) {
745 template <
typename Which>
747 !IsEncodableTrait<Which>::value,
751 this->value.push_back(
value);
754 this->value.emplace_back(std::forward<typename Which::ValueType>(
value));
763 template <
typename Encoder>
766 for (
const auto&
v :
value) {
775 template <
typename Output>
780 template <
class T,
class V>
791 dst_->unknown_.Append(
key.as_string_view(),
value.Ref());
800 template <
typename Encoder>
803 template <
typename Which>
812 template <
typename Which>
825 template <
typename Which>
839 template <
typename Which>
876 template <
typename Which>
883 template <
typename Which>
983 template <
class Derived,
typename... Traits>
1010 template <
typename Encoder>
1014 encoder->Encode(unk.first, unk.second);
1023 log_fn(unk.first.as_string_view(), unk.second.as_string_view());
1038 template <
typename Which>
1048 template <
typename Which>
1057 template <
typename Which>
1060 return &
table_.template get_or_create<Value<Which>>()->
value;
1066 template <
typename Which>
1069 return absl::nullopt;
1074 template <
typename Which,
typename...
Args>
1077 table_.template set<Value<Which>>(std::forward<Args>(
args)...);
1079 template <
typename Which,
typename...
Args>
1086 template <
typename Which>
1088 table_.template clear<Value<Which>>();
1103 static_cast<const Derived*
>(
this),
buffer);
1112 template <
typename Which>
1126 template <
typename Which>
1152 m.SetOnContainer(
static_cast<Derived*
>(
this));
1159 value.TakeOwned(), on_error);
1165 Derived
Copy()
const;
1176 template <
typename Which>
1186 template <
typename Derived,
typename...
Args>
1192 template <
typename Derived,
typename... Traits>
1195 template <
typename Derived,
typename... Traits>
1202 template <
typename Derived,
typename... Traits>
1207 return static_cast<Derived&
>(*this);
1210 template <
typename Derived,
typename... Traits>
1213 template <
typename Derived,
typename... Traits>
1219 template <
typename Derived,
typename... Traits>
1226 template <
typename Derived,
typename... Traits>
1228 Derived
out(unknown_.arena());
static constexpr bool kRepeatable
grpc_compression_algorithm
static absl::string_view DebugKey()
static StaticSlice FromStaticString(const char *s)
bool IsStatusOk(const absl::Status &status)
typename std::enable_if< B, T >::type enable_if_t
#define T(upbtypeconst, upbtype, ctype, default_value)
grpc_core::ScopedArenaPtr arena
ABSL_NAMESPACE_BEGIN ABSL_MUST_USE_RESULT bool SimpleAtoi(absl::string_view str, int_type *out)
static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error)
static Slice FromCopiedString(const char *s)
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
struct Timestamp Timestamp
static const std::string & DisplayValue(const std::string &x)
static const char * DisplayValue(MementoType content_type)
static absl::string_view key()
ValueType
Type of the value held by a Value object.
const char * CompressionAlgorithmAsString(grpc_compression_algorithm algorithm)
static constexpr bool kRepeatable
static std::string DisplayValue(ValueType x)
static Slice FromInt64(int64_t i)
typename type_traits_internal::VoidTImpl< Ts... >::type void_t
static CompressionAlgorithmSet FromString(absl::string_view str)
static absl::string_view DebugKey()
static std::string DisplayValue(ValueType x)
absl::string_view string_view
@ GRPC_COMPRESS_ALGORITHMS_COUNT
static StaticSlice Encode(ValueType x)
absl::enable_if_t< std::is_same< typename Which::ValueType, Slice >::value, const Slice & > MetadataValueAsSlice(const Slice &slice)
static absl::string_view key()
static absl::string_view DebugKey()
static constexpr bool kRepeatable
static constexpr bool kRepeatable
static constexpr bool kRepeatable
static ValueType MementoToValue(MementoType content_type)
constexpr T && forward(absl::remove_reference_t< T > &t) noexcept
static const char * Lookup(std::map< std::string, std::unique_ptr< char[]>> *dummy_lh, const char *key)
static bool to_string(zval *from)
static struct async_container * container
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:39