metadata_batch.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef GRPC_CORE_LIB_TRANSPORT_METADATA_BATCH_H
20 #define GRPC_CORE_LIB_TRANSPORT_METADATA_BATCH_H
21 
23 
24 #include <stdlib.h>
25 
26 #include <cstdint>
27 #include <string>
28 #include <type_traits>
29 #include <utility>
30 
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"
37 
39 #include <grpc/status.h>
40 #include <grpc/support/log.h>
41 
49 
50 namespace grpc_core {
51 
52 // grpc-timeout metadata trait.
53 // ValueType is defined as Timestamp - an absolute timestamp (i.e. a
54 // deadline!), that is converted to a duration by transports before being
55 // sent.
56 // TODO(ctiller): Move this elsewhere. During the transition we need to be able
57 // to name this in MetadataMap, but ultimately once the transition is done we
58 // should not need to.
60  static constexpr bool kRepeatable = false;
63  static absl::string_view key() { return "grpc-timeout"; }
66  static Slice Encode(ValueType x);
67  static std::string DisplayValue(MementoType x) { return x.ToString(); }
68 };
69 
70 // TE metadata trait.
71 struct TeMetadata {
72  static constexpr bool kRepeatable = false;
73  // HTTP2 says that TE can either be empty or "trailers".
74  // Empty means this trait is not included, "trailers" means kTrailers, and
75  // kInvalid is used to remember an invalid value.
76  enum ValueType : uint8_t {
79  };
81  static absl::string_view key() { return "te"; }
83  static ValueType MementoToValue(MementoType te) { return te; }
86  return StaticSlice::FromStaticString("trailers");
87  }
88  static const char* DisplayValue(MementoType te);
89 };
90 
91 // content-type metadata trait.
93  static constexpr bool kRepeatable = false;
94  // gRPC says that content-type can be application/grpc[;something]
95  // Core has only ever verified the prefix.
96  // IF we want to start verifying more, we can expand this type.
97  enum ValueType {
101  };
103  static absl::string_view key() { return "content-type"; }
105  static ValueType MementoToValue(MementoType content_type) {
106  return content_type;
107  }
108 
109  static StaticSlice Encode(ValueType x);
110  static const char* DisplayValue(MementoType content_type);
111 };
112 
113 // scheme metadata trait.
115  static constexpr bool kRepeatable = false;
116  enum ValueType {
120  };
122  static absl::string_view key() { return ":scheme"; }
124  return Parse(value.as_string_view(), on_error);
125  }
127  MetadataParseErrorFn on_error);
128  static ValueType MementoToValue(MementoType content_type) {
129  return content_type;
130  }
131  static StaticSlice Encode(ValueType x);
132  static const char* DisplayValue(MementoType content_type);
133 };
134 
135 // method metadata trait.
137  static constexpr bool kRepeatable = false;
138  enum ValueType {
143  };
145  static absl::string_view key() { return ":method"; }
147  static ValueType MementoToValue(MementoType content_type) {
148  return content_type;
149  }
150  static StaticSlice Encode(ValueType x);
151  static const char* DisplayValue(MementoType content_type);
152 };
153 
154 // Base type for metadata pertaining to a single compression algorithm
155 // (e.g., "grpc-encoding").
160  static ValueType MementoToValue(MementoType x) { return x; }
161  static Slice Encode(ValueType x) {
164  }
165  static const char* DisplayValue(MementoType x) {
166  if (const char* p = CompressionAlgorithmAsString(x)) {
167  return p;
168  } else {
169  return "<discarded-invalid-value>";
170  }
171  }
172 };
173 
174 // grpc-encoding metadata trait.
176  static constexpr bool kRepeatable = false;
177  static absl::string_view key() { return "grpc-encoding"; }
178 };
179 
180 // grpc-internal-encoding-request metadata trait.
182  static constexpr bool kRepeatable = false;
183  static absl::string_view key() { return "grpc-internal-encoding-request"; }
184 };
185 
186 // grpc-accept-encoding metadata trait.
188  static constexpr bool kRepeatable = false;
189  static absl::string_view key() { return "grpc-accept-encoding"; }
193  return CompressionAlgorithmSet::FromString(value.as_string_view());
194  }
195  static ValueType MementoToValue(MementoType x) { return x; }
196  static Slice Encode(ValueType x) { return x.ToSlice(); }
197  static absl::string_view DisplayValue(MementoType x) { return x.ToString(); }
198 };
199 
201  using ValueType = Slice;
204  return value.TakeOwned();
205  }
207  static Slice Encode(const ValueType& x) { return x.Ref(); }
209  return value.as_string_view();
210  }
211 };
212 
213 // user-agent metadata trait.
215  static constexpr bool kRepeatable = false;
216  static absl::string_view key() { return "user-agent"; }
217 };
218 
219 // grpc-message metadata trait.
221  static constexpr bool kRepeatable = false;
222  static absl::string_view key() { return "grpc-message"; }
223 };
224 
225 // host metadata trait.
227  static constexpr bool kRepeatable = false;
228  static absl::string_view key() { return "host"; }
229 };
230 
231 // endpoint-load-metrics-bin metadata trait.
233  static constexpr bool kRepeatable = false;
234  static absl::string_view key() { return "endpoint-load-metrics-bin"; }
235 };
236 
237 // grpc-server-stats-bin metadata trait.
239  static constexpr bool kRepeatable = false;
240  static absl::string_view key() { return "grpc-server-stats-bin"; }
241 };
242 
243 // grpc-trace-bin metadata trait.
245  static constexpr bool kRepeatable = false;
246  static absl::string_view key() { return "grpc-trace-bin"; }
247 };
248 
249 // grpc-tags-bin metadata trait.
251  static constexpr bool kRepeatable = false;
252  static absl::string_view key() { return "grpc-tags-bin"; }
253 };
254 
255 // :authority metadata trait.
257  static constexpr bool kRepeatable = false;
258  static absl::string_view key() { return ":authority"; }
259 };
260 
261 // :path metadata trait.
263  static constexpr bool kRepeatable = false;
264  static absl::string_view key() { return ":path"; }
265 };
266 
267 // We separate SimpleIntBasedMetadata into two pieces: one that does not
268 // depend on the invalid value, and one that does. This allows the compiler to
269 // easily see the functions that are shared, and helps reduce code bloat here.
270 template <typename Int>
272  using ValueType = Int;
273  using MementoType = Int;
275  static Slice Encode(ValueType x) { return Slice::FromInt64(x); }
276  static Int DisplayValue(MementoType x) { return x; }
277 };
278 
279 template <typename Int, Int kInvalidValue>
281  static constexpr Int invalid_value() { return kInvalidValue; }
283  Int out;
284  if (!absl::SimpleAtoi(value.as_string_view(), &out)) {
285  on_error("not an integer", value);
286  out = kInvalidValue;
287  }
288  return out;
289  }
290 };
291 
292 // grpc-status metadata trait.
294  : public SimpleIntBasedMetadata<grpc_status_code, GRPC_STATUS_UNKNOWN> {
295  static constexpr bool kRepeatable = false;
296  static absl::string_view key() { return "grpc-status"; }
297 };
298 
299 // grpc-previous-rpc-attempts metadata trait.
301  : public SimpleIntBasedMetadata<uint32_t, 0> {
302  static constexpr bool kRepeatable = false;
303  static absl::string_view key() { return "grpc-previous-rpc-attempts"; }
304 };
305 
306 // grpc-retry-pushback-ms metadata trait.
308  static constexpr bool kRepeatable = false;
309  static absl::string_view key() { return "grpc-retry-pushback-ms"; }
312  static ValueType MementoToValue(MementoType x) { return x; }
313  static Slice Encode(Duration x) { return Slice::FromInt64(x.millis()); }
314  static int64_t DisplayValue(Duration x) { return x.millis(); }
316 };
317 
318 // :status metadata trait.
319 // TODO(ctiller): consider moving to uint16_t
320 struct HttpStatusMetadata : public SimpleIntBasedMetadata<uint32_t, 0> {
321  static constexpr bool kRepeatable = false;
322  static absl::string_view key() { return ":status"; }
323 };
324 
325 // "secret" metadata trait used to pass load balancing token between filters.
326 // This should not be exposed outside of gRPC core.
327 class GrpcLbClientStats;
328 
330  static constexpr bool kRepeatable = false;
331  static absl::string_view key() { return "grpclb_client_stats"; }
335  static Slice Encode(ValueType) { abort(); }
336  static const char* DisplayValue(MementoType) { return "<internal-lb-stats>"; }
338  return nullptr;
339  }
340 };
341 
342 // lb-token metadata
344  static constexpr bool kRepeatable = false;
345  static absl::string_view key() { return "lb-token"; }
346 };
347 
348 // lb-cost-bin metadata
350  static constexpr bool kRepeatable = true;
351  static absl::string_view key() { return "lb-cost-bin"; }
352  struct ValueType {
353  double cost;
355  };
358  static Slice Encode(const ValueType& x);
361 };
362 
363 // Annotation added by a transport to note whether a failed request was never
364 // placed on the wire, or never seen by a server.
366  static absl::string_view DebugKey() { return "GrpcStreamNetworkState"; }
367  static constexpr bool kRepeatable = false;
371  };
373 };
374 
375 // Annotation added by a server transport to note the peer making a request.
376 struct PeerString {
377  static absl::string_view DebugKey() { return "PeerString"; }
378  static constexpr bool kRepeatable = false;
381 };
382 
383 // Annotation added by various systems to describe the reason for a failure.
385  static absl::string_view DebugKey() { return "GrpcStatusContext"; }
386  static constexpr bool kRepeatable = true;
388  static const std::string& DisplayValue(const std::string& x);
389 };
390 
391 namespace metadata_detail {
392 
393 // Build a key/value formatted debug string.
394 // Output looks like 'key1: value1, key2: value2'
395 // The string is expected to be readable, but not necessarily parsable.
397  public:
398  // Add one key/value pair to the output.
400 
401  // Finalize the output and return the string.
402  // Subsequent Add calls are UB.
404 
405  private:
407 };
408 
409 // IsEncodable: Given a trait, determine if that trait is encodable, or is
410 // just a value attached to a MetadataMap. We use the presence of the key()
411 // static method to determine if a trait is encodable or not - encodable
412 // traits have string names, and non-encodable traits do not.
413 template <typename Trait, typename Ignored = void>
415  static const bool value = false;
416 };
417 
418 template <typename Trait>
419 struct IsEncodableTrait<Trait, absl::void_t<decltype(Trait::key())>> {
420  static const bool value = true;
421 };
422 
423 // Helper type - maps a string name to a trait.
424 template <typename MustBeVoid, typename... Traits>
425 struct NameLookup;
426 
427 template <typename Trait, typename... Traits>
428 struct NameLookup<absl::enable_if_t<IsEncodableTrait<Trait>::value, void>,
429  Trait, Traits...> {
430  // Call op->Found(Trait()) if op->name == Trait::key() for some Trait in
431  // Traits. If not found, call op->NotFound().
432  template <typename Op>
433  static auto Lookup(absl::string_view key, Op* op)
434  -> decltype(op->Found(Trait())) {
435  if (key == Trait::key()) {
436  return op->Found(Trait());
437  }
439  }
440 };
441 
442 template <typename Trait, typename... Traits>
443 struct NameLookup<absl::enable_if_t<!IsEncodableTrait<Trait>::value, void>,
444  Trait, Traits...> {
445  template <typename Op>
446  static auto Lookup(absl::string_view key, Op* op)
449  }
450 };
451 
452 template <>
453 struct NameLookup<void> {
454  template <typename Op>
455  static auto Lookup(absl::string_view key, Op* op)
456  -> decltype(op->NotFound(key)) {
457  return op->NotFound(key);
458  }
459 };
460 
461 // Helper to take a slice to a memento to a value.
462 // By splitting this part out we can scale code size as the number of
463 // (memento, value) types, rather than as the number of traits.
464 template <typename ParseMementoFn, typename MementoToValueFn>
465 struct ParseValue {
466  template <ParseMementoFn parse_memento, MementoToValueFn memento_to_value>
468  MetadataParseErrorFn on_error)
469  -> decltype(memento_to_value(parse_memento(std::move(*value),
470  on_error))) {
471  return memento_to_value(parse_memento(std::move(*value), on_error));
472  }
473 };
474 
475 // This is an "Op" type for NameLookup.
476 // Used for MetadataMap::Parse, its Found/NotFound methods turn a slice into a
477 // ParsedMetadata object.
478 template <typename Container>
479 class ParseHelper {
480  public:
481  ParseHelper(Slice value, MetadataParseErrorFn on_error, size_t transport_size)
482  : value_(std::move(value)),
483  on_error_(on_error),
484  transport_size_(transport_size) {}
485 
486  template <typename Trait>
489  trait,
490  ParseValueToMemento<typename Trait::MementoType, Trait::ParseMemento>(),
492  }
493 
497  std::move(value_));
498  }
499 
500  private:
501  template <typename T, T (*parse_memento)(Slice, MetadataParseErrorFn)>
503  return parse_memento(std::move(value_), on_error_);
504  }
505 
508  const size_t transport_size_;
509 };
510 
511 // This is an "Op" type for NameLookup.
512 // Used for MetadataMap::Append, its Found/NotFound methods turn a slice into
513 // a value and add it to a container.
514 template <typename Container>
516  public:
518  : container_(container), value_(std::move(value)), on_error_(on_error) {}
519 
520  template <typename Trait>
521  GPR_ATTRIBUTE_NOINLINE void Found(Trait trait) {
522  container_->Set(
523  trait, ParseValue<decltype(Trait::ParseMemento),
524  decltype(Trait::MementoToValue)>::
525  template Parse<Trait::ParseMemento, Trait::MementoToValue>(
526  &value_, on_error_));
527  }
528 
530  container_->unknown_.Append(key, std::move(value_));
531  }
532 
533  private:
534  Container* const container_;
537 };
538 
539 // This is an "Op" type for NameLookup.
540 // Used for MetadataMap::Remove, its Found/NotFound methods remove a key from
541 // the container.
542 template <typename Container>
544  public:
545  explicit RemoveHelper(Container* container) : container_(container) {}
546 
547  template <typename Trait>
548  GPR_ATTRIBUTE_NOINLINE void Found(Trait trait) {
549  container_->Remove(trait);
550  }
551 
553  container_->unknown_.Remove(key);
554  }
555 
556  private:
557  Container* const container_;
558 };
559 
560 // This is an "Op" type for NameLookup.
561 // Used for MetadataMap::GetStringValue, its Found/NotFound methods generated
562 // a string value from the container.
563 template <typename Container>
565  public:
566  explicit GetStringValueHelper(const Container* container,
567  std::string* backing)
568  : container_(container), backing_(backing) {}
569 
570  template <typename Trait>
572  Trait::kRepeatable == false &&
575  Found(Trait) {
576  const auto* value = container_->get_pointer(Trait());
577  if (value == nullptr) return absl::nullopt;
578  return value->as_string_view();
579  }
580 
581  template <typename Trait>
583  Trait::kRepeatable == true &&
586  Found(Trait) {
587  const auto* value = container_->get_pointer(Trait());
588  if (value == nullptr) return absl::nullopt;
589  backing_->clear();
590  for (const auto& v : *value) {
591  if (!backing_->empty()) backing_->push_back(',');
592  auto new_segment = Trait::Encode(v);
593  backing_->append(new_segment.begin(), new_segment.end());
594  }
595  return *backing_;
596  }
597 
598  template <typename Trait>
600  Trait::kRepeatable == false &&
603  Found(Trait) {
604  const auto* value = container_->get_pointer(Trait());
605  if (value == nullptr) return absl::nullopt;
606  *backing_ = std::string(Trait::Encode(*value).as_string_view());
607  return *backing_;
608  }
609 
612  return container_->unknown_.GetStringValue(key, backing_);
613  }
614 
615  private:
616  const Container* const container_;
618 };
619 
620 // Sink for key value logs
622 
623 template <typename T>
625  static std::string ToString(const T& value) { return std::to_string(value); }
626 };
627 
628 template <>
630  static std::string ToString(const std::string& value) { return value; }
631 };
632 
633 template <>
635  static std::string ToString(const std::string& value) { return value; }
636 };
637 
638 template <>
641  return std::string(value.as_string_view());
642  }
643 };
644 
645 template <>
648  return value.as_string_view();
649  }
650 };
651 
652 template <typename T, typename U, typename V>
654  V (*display_value)(U), LogFn log_fn) {
655  log_fn(key, AdaptDisplayValueToLog<V>::ToString(display_value(value)));
656 }
657 
658 // Generate a strong type for metadata values per trait.
659 template <typename Which, typename Ignored = void>
660 struct Value;
661 
662 template <typename Which>
663 struct Value<Which, absl::enable_if_t<Which::kRepeatable == false &&
664  IsEncodableTrait<Which>::value,
665  void>> {
666  Value() = default;
667  explicit Value(const typename Which::ValueType& value) : value(value) {}
668  explicit Value(typename Which::ValueType&& value)
669  : value(std::forward<typename Which::ValueType>(value)) {}
670  Value(const Value&) = delete;
671  Value& operator=(const Value&) = delete;
672  Value(Value&&) noexcept = default;
673  Value& operator=(Value&& other) noexcept {
674  value = std::move(other.value);
675  return *this;
676  }
677  template <typename Encoder>
678  void EncodeTo(Encoder* encoder) const {
679  encoder->Encode(Which(), value);
680  }
681  void LogTo(LogFn log_fn) const {
682  LogKeyValueTo(Which::key(), value, Which::Encode, log_fn);
683  }
684  using StorageType = typename Which::ValueType;
686 };
687 
688 template <typename Which>
689 struct Value<Which, absl::enable_if_t<Which::kRepeatable == false &&
690  !IsEncodableTrait<Which>::value,
691  void>> {
692  Value() = default;
693  explicit Value(const typename Which::ValueType& value) : value(value) {}
694  explicit Value(typename Which::ValueType&& value)
695  : value(std::forward<typename Which::ValueType>(value)) {}
696  Value(const Value&) = delete;
697  Value& operator=(const Value&) = delete;
698  Value(Value&&) noexcept = default;
699  Value& operator=(Value&& other) noexcept {
700  value = std::move(other.value);
701  return *this;
702  }
703  template <typename Encoder>
704  void EncodeTo(Encoder*) const {}
705  void LogTo(LogFn log_fn) const {
706  LogKeyValueTo(Which::DebugKey(), value, Which::DisplayValue, log_fn);
707  }
708  using StorageType = typename Which::ValueType;
710 };
711 
712 template <typename Which>
713 struct Value<Which, absl::enable_if_t<Which::kRepeatable == true &&
714  IsEncodableTrait<Which>::value,
715  void>> {
716  Value() = default;
717  explicit Value(const typename Which::ValueType& value) {
718  this->value.push_back(value);
719  }
720  explicit Value(typename Which::ValueType&& value) {
721  this->value.emplace_back(std::forward<typename Which::ValueType>(value));
722  }
723  Value(const Value&) = delete;
724  Value& operator=(const Value&) = delete;
725  Value(Value&& other) noexcept : value(std::move(other.value)) {}
726  Value& operator=(Value&& other) noexcept {
727  value = std::move(other.value);
728  return *this;
729  }
730  template <typename Encoder>
731  void EncodeTo(Encoder* encoder) const {
732  for (const auto& v : value) {
733  encoder->Encode(Which(), v);
734  }
735  }
736  void LogTo(LogFn log_fn) const {
737  for (const auto& v : value) {
738  LogKeyValueTo(Which::key(), v, Which::Encode, log_fn);
739  }
740  }
743 };
744 
745 template <typename Which>
746 struct Value<Which, absl::enable_if_t<Which::kRepeatable == true &&
747  !IsEncodableTrait<Which>::value,
748  void>> {
749  Value() = default;
750  explicit Value(const typename Which::ValueType& value) {
751  this->value.push_back(value);
752  }
753  explicit Value(typename Which::ValueType&& value) {
754  this->value.emplace_back(std::forward<typename Which::ValueType>(value));
755  }
756  Value(const Value&) = delete;
757  Value& operator=(const Value&) = delete;
758  Value(Value&& other) noexcept : value(std::move(other.value)) {}
759  Value& operator=(Value&& other) noexcept {
760  value = std::move(other.value);
761  return *this;
762  }
763  template <typename Encoder>
764  void EncodeTo(Encoder*) const {}
765  void LogTo(LogFn log_fn) const {
766  for (const auto& v : value) {
767  LogKeyValueTo(Which::DebugKey(), v, Which::DisplayValue, log_fn);
768  }
769  }
772 };
773 
774 // Encoder to copy some metadata
775 template <typename Output>
776 class CopySink {
777  public:
778  explicit CopySink(Output* dst) : dst_(dst) {}
779 
780  template <class T, class V>
781  void Encode(T trait, V value) {
782  dst_->Set(trait, value);
783  }
784 
785  template <class T>
786  void Encode(T trait, const Slice& value) {
787  dst_->Set(trait, std::move(value.AsOwned()));
788  }
789 
790  void Encode(const Slice& key, const Slice& value) {
791  dst_->unknown_.Append(key.as_string_view(), value.Ref());
792  }
793 
794  private:
795  Output* dst_;
796 };
797 
798 // Callable for the ForEach in Encode() -- for each value, call the
799 // appropriate encoder method.
800 template <typename Encoder>
802  Encoder* encoder;
803  template <typename Which>
805  which.EncodeTo(encoder);
806  }
807 };
808 
809 // Callable for the ForEach in Log()
810 struct LogWrapper {
812  template <typename Which>
814  which.LogTo(log_fn);
815  }
816 };
817 
818 // Encoder to compute TransportSize
820  public:
821  void Encode(const Slice& key, const Slice& value) {
822  size_ += key.length() + value.length() + 32;
823  }
824 
825  template <typename Which>
826  void Encode(Which, const typename Which::ValueType& value) {
827  Add(Which(), value);
828  }
829 
831  const typename ContentTypeMetadata::ValueType& value) {
832  if (value == ContentTypeMetadata::kInvalid) return;
834  }
835 
836  size_t size() const { return size_; }
837 
838  private:
839  template <typename Which>
840  void Add(Which, const typename Which::ValueType& value) {
841  size_ += Which::key().length() + Which::Encode(value).length() + 32;
842  }
843 
845 };
846 
847 // Handle unknown (non-trait-based) fields in the metadata map.
848 class UnknownMap {
849  public:
851 
853 
857  std::string* backing) const;
858 
859  BackingType::ConstForwardIterator begin() const { return unknown_.cbegin(); }
860  BackingType::ConstForwardIterator end() const { return unknown_.cend(); }
861 
862  bool empty() const { return unknown_.empty(); }
863  size_t size() const { return unknown_.size(); }
864  void Clear() { unknown_.Clear(); }
865  Arena* arena() const { return unknown_.arena(); }
866 
867  private:
868  // Backing store for added metadata.
870 };
871 
872 } // namespace metadata_detail
873 
874 // Helper function for encoders
875 // Given a metadata trait, convert the value to a slice.
876 template <typename Which>
878  const Slice&>
880  return slice;
881 }
882 
883 template <typename Which>
886  return Slice(Which::Encode(value));
887 }
888 
889 // MetadataMap encodes the mapping of metadata keys to metadata values.
890 //
891 // MetadataMap takes a derived class and list of traits. Each of these trait
892 // objects defines one metadata field that is used by core, and so should have
893 // more specialized handling than just using the generic APIs.
894 //
895 // MetadataMap is the backing type for some derived type via the curiously
896 // recursive template pattern. This is because many types consumed by
897 // MetadataMap require the container type to operate on, and many of those
898 // types are instantiated one per trait. A naive implementation without the
899 // Derived type would, for traits A,B,C, then instantiate for some
900 // T<Container, Trait>:
901 // - T<MetadataMap<A,B,C>, A>,
902 // - T<MetadataMap<A,B,C>, B>,
903 // - T<MetadataMap<A,B,C>, C>.
904 // Since these types ultimately need to be recorded in the .dynstr segment
905 // for dynamic linkers (if gRPC is linked as a static library) this would
906 // create O(N^2) bytes of symbols even in stripped libraries. To avoid this
907 // we use the derived type (e.g. grpc_metadata_batch right now) to capture
908 // the container type, and we would write T<grpc_metadata_batch, A>, etc...
909 // Note that now the container type uses a number of bytes that is independent
910 // of the number of traits, and so we return to a linear symbol table growth
911 // function.
912 //
913 // Each trait object has one of two possible signatures, depending on whether
914 // that traits field is encodable or not.
915 // Non-encodable traits are carried in a MetadataMap, but are never passed to
916 // the application nor serialized to wire.
917 //
918 // Encodable traits have the following signature:
919 // // Traits for the "grpc-xyz" metadata field:
920 // struct GrpcXyzMetadata {
921 // // Can this metadata field be repeated?
922 // static constexpr bool kRepeatable = ...;
923 // // The type that's stored on MetadataBatch
924 // using ValueType = ...;
925 // // The type that's stored in compression/decompression tables
926 // using MementoType = ...;
927 // // The string key for this metadata type (for transports that require it)
928 // static absl::string_view key() { return "grpc-xyz"; }
929 // // Parse a memento from a slice
930 // // Takes ownership of value
931 // // Calls fn in the case of an error that should be reported to the user
932 // static MementoType ParseMemento(Slice value, MementoParseErrorFn fn) {
933 // ...
934 // }
935 // // Convert a memento to a value
936 // static ValueType MementoToValue(MementoType memento) { ... }
937 // // Convert a value to its canonical text wire format (the format that
938 // // ParseMemento will accept!)
939 // static Slice Encode(const ValueType& value);
940 // // Convert a value to something that can be passed to StrCat and
941 // displayed
942 // // for debugging
943 // static SomeStrCatableType DisplayValue(MementoType value) { ... }
944 // };
945 //
946 // Non-encodable traits are determined by missing the key() method, and have
947 // the following signature (and by convention omit the Metadata part of the
948 // type name):
949 // // Traits for the GrpcXyz field:
950 // struct GrpcXyz {
951 // // The string key that should be used for debug dumps - should not be a
952 // // valid http2 key (ie all lower case)
953 // static absl::string_view DebugKey() { return "GRPC_XYZ"; }
954 // // Can this metadata field be repeated?
955 // static constexpr bool kRepeatable = ...;
956 // // The type that's stored on MetadataBatch
957 // using ValueType = ...;
958 // // Convert a value to something that can be passed to StrCat and
959 // displayed
960 // // for debugging
961 // static SomeStrCatableType DisplayValue(ValueType value) { ... }
962 // };
963 //
964 // About parsing and mementos:
965 //
966 // Many gRPC transports exchange metadata as key/value strings, but also allow
967 // for a more efficient representation as a single integer. We can use this
968 // integer representation to avoid reparsing too, by storing the parsed value
969 // in the compression table. This is what mementos are used for.
970 //
971 // A trait offers the capability to turn a slice into a memento via
972 // ParseMemento. This is exposed to users of MetadataMap via the Parse()
973 // method, that returns a ParsedMetadata object. That ParsedMetadata object
974 // can in turn be used to set the same value on many different MetadataMaps
975 // without having to reparse.
976 //
977 // Implementation wise, ParsedMetadata is a type erased wrapper around
978 // MementoType. When we set a value on MetadataMap, we first turn that memento
979 // into a value. For most types, this is going to be a no-op, but for example
980 // for grpc-timeout we make the memento the timeout expressed on the wire, but
981 // we make the value the timestamp of when the timeout will expire (i.e. the
982 // deadline).
983 template <class Derived, typename... Traits>
984 class MetadataMap {
985  public:
986  explicit MetadataMap(Arena* arena);
987  ~MetadataMap();
988 
989  MetadataMap(const MetadataMap&) = delete;
990  MetadataMap& operator=(const MetadataMap&) = delete;
991  MetadataMap(MetadataMap&&) noexcept;
992  // We never create MetadataMap directly, instead we create Derived, but we
993  // want to be able to move it without redeclaring this.
994  // NOLINTNEXTLINE(misc-unconventional-assign-operator)
995  Derived& operator=(MetadataMap&&) noexcept;
996 
997  // Encode this metadata map into some encoder.
998  // For each field that is set in the MetadataMap, call
999  // encoder->Encode.
1000  //
1001  // For fields for which we have traits, this will be a method with
1002  // the signature:
1003  // void Encode(TraitsType, typename TraitsType::ValueType value);
1004  // For fields for which we do not have traits, this will be a method
1005  // with the signature:
1006  // void Encode(grpc_mdelem md);
1007  // TODO(ctiller): It's expected that the latter Encode method will
1008  // become Encode(Slice, Slice) by the end of the current metadata API
1009  // transitions.
1010  template <typename Encoder>
1011  void Encode(Encoder* encoder) const {
1013  for (const auto& unk : unknown_) {
1014  encoder->Encode(unk.first, unk.second);
1015  }
1016  }
1017 
1018  // Similar to Encode, but targeted at logging: for each metadatum,
1019  // call f(key, value) as absl::string_views.
1020  void Log(metadata_detail::LogFn log_fn) const {
1021  table_.ForEach(metadata_detail::LogWrapper{log_fn});
1022  for (const auto& unk : unknown_) {
1023  log_fn(unk.first.as_string_view(), unk.second.as_string_view());
1024  }
1025  }
1026 
1030  builder.Add(key, value);
1031  });
1032  return builder.TakeOutput();
1033  }
1034 
1035  // Get the pointer to the value of some known metadata.
1036  // Returns nullptr if the metadata is not present.
1037  // Causes a compilation error if Which is not an element of Traits.
1038  template <typename Which>
1040  Which) const {
1041  if (auto* p = table_.template get<Value<Which>>()) return &p->value;
1042  return nullptr;
1043  }
1044 
1045  // Get the pointer to the value of some known metadata.
1046  // Returns nullptr if the metadata is not present.
1047  // Causes a compilation error if Which is not an element of Traits.
1048  template <typename Which>
1050  if (auto* p = table_.template get<Value<Which>>()) return &p->value;
1051  return nullptr;
1052  }
1053 
1054  // Get the pointer to the value of some known metadata.
1055  // Adds the default value for the metadata is not present.
1056  // Causes a compilation error if Which is not an element of Traits.
1057  template <typename Which>
1059  Which) {
1060  return &table_.template get_or_create<Value<Which>>()->value;
1061  }
1062 
1063  // Get the value of some known metadata.
1064  // Returns nullopt if the metadata is not present.
1065  // Causes a compilation error if Which is not an element of Traits.
1066  template <typename Which>
1068  if (auto* p = table_.template get<Value<Which>>()) return p->value;
1069  return absl::nullopt;
1070  }
1071 
1072  // Set the value of some known metadata.
1073  // Returns a pointer to the new value.
1074  template <typename Which, typename... Args>
1076  Args&&... args) {
1077  table_.template set<Value<Which>>(std::forward<Args>(args)...);
1078  }
1079  template <typename Which, typename... Args>
1081  Args&&... args) {
1082  GetOrCreatePointer(Which())->emplace_back(std::forward<Args>(args)...);
1083  }
1084 
1085  // Remove a specific piece of known metadata.
1086  template <typename Which>
1087  void Remove(Which) {
1088  table_.template clear<Value<Which>>();
1089  }
1090 
1091  // Remove some metadata by name
1093  metadata_detail::RemoveHelper<Derived> helper(static_cast<Derived*>(this));
1095  }
1096 
1097  void Remove(const char* key) { Remove(absl::string_view(key)); }
1098 
1099  // Retrieve some metadata by name
1101  std::string* buffer) const {
1103  static_cast<const Derived*>(this), buffer);
1105  }
1106 
1107  // Extract a piece of known metadata.
1108  // Returns nullopt if the metadata was not present, or the value if it was.
1109  // The same as:
1110  // auto value = m.get(T());
1111  // m.Remove(T());
1112  template <typename Which>
1113  absl::enable_if_t<Which::kRepeatable == false,
1115  Take(Which which) {
1116  if (auto* p = get_pointer(which)) {
1118  Remove(which);
1119  return value;
1120  }
1121  return {};
1122  }
1123 
1124  // Extract repeated known metadata.
1125  // Returns an empty vector if the metadata was not present.
1126  template <typename Which>
1127  absl::enable_if_t<Which::kRepeatable == true,
1129  Take(Which which) {
1130  if (auto* p = get_pointer(which)) {
1131  typename Value<Which>::StorageType value = std::move(*p);
1132  Remove(which);
1133  return value;
1134  }
1135  return {};
1136  }
1137 
1138  // Parse metadata from a key/value pair, and return an object representing
1139  // that result.
1140  // TODO(ctiller): key should probably be an absl::string_view.
1141  // Once we don't care about interning anymore, make that change!
1143  uint32_t transport_size,
1144  MetadataParseErrorFn on_error) {
1145  metadata_detail::ParseHelper<Derived> helper(value.TakeOwned(), on_error,
1146  transport_size);
1148  }
1149 
1150  // Set a value from a parsed metadata object.
1152  m.SetOnContainer(static_cast<Derived*>(this));
1153  }
1154 
1155  // Append a key/value pair - takes ownership of value
1157  MetadataParseErrorFn on_error) {
1158  metadata_detail::AppendHelper<Derived> helper(static_cast<Derived*>(this),
1159  value.TakeOwned(), on_error);
1161  }
1162 
1163  void Clear();
1164  size_t TransportSize() const;
1165  Derived Copy() const;
1166  bool empty() const { return table_.empty() && unknown_.empty(); }
1167  size_t count() const { return table_.count() + unknown_.size(); }
1168 
1169  private:
1170  friend class metadata_detail::AppendHelper<Derived>;
1172  friend class metadata_detail::RemoveHelper<Derived>;
1173  friend class metadata_detail::CopySink<Derived>;
1174  friend class ParsedMetadata<Derived>;
1175 
1176  template <typename Which>
1178 
1179  // Table of known metadata types.
1182 };
1183 
1184 // Ok/not-ok check for metadata maps that contain GrpcStatusMetadata, so that
1185 // they can be used as result types for TrySeq.
1186 template <typename Derived, typename... Args>
1188  return m.get(GrpcStatusMetadata()).value_or(GRPC_STATUS_UNKNOWN) ==
1190 }
1191 
1192 template <typename Derived, typename... Traits>
1194 
1195 template <typename Derived, typename... Traits>
1197  : table_(std::move(other.table_)), unknown_(std::move(other.unknown_)) {}
1198 
1199 // We never create MetadataMap directly, instead we create Derived, but we
1200 // want to be able to move it without redeclaring this.
1201 // NOLINTNEXTLINE(misc-unconventional-assign-operator)
1202 template <typename Derived, typename... Traits>
1204  MetadataMap&& other) noexcept {
1205  table_ = std::move(other.table_);
1206  unknown_ = std::move(other.unknown_);
1207  return static_cast<Derived&>(*this);
1208 }
1209 
1210 template <typename Derived, typename... Traits>
1212 
1213 template <typename Derived, typename... Traits>
1215  table_.ClearAll();
1216  unknown_.Clear();
1217 }
1218 
1219 template <typename Derived, typename... Traits>
1222  Encode(&enc);
1223  return enc.size();
1224 }
1225 
1226 template <typename Derived, typename... Traits>
1228  Derived out(unknown_.arena());
1230  Encode(&sink);
1231  return out;
1232 }
1233 
1234 } // namespace grpc_core
1235 
1236 struct grpc_metadata_batch;
1237 
1240  // Colon prefixed headers first
1244  // Non-colon prefixed headers begin here
1255  // Non-encodable things
1258 
1261 };
1262 
1263 #endif /* GRPC_CORE_LIB_TRANSPORT_METADATA_BATCH_H */
grpc_core::TeMetadata::ParseMemento
static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error)
Definition: metadata_batch.cc:130
grpc_core::CompressionAlgorithmBasedMetadata::ValueType
grpc_compression_algorithm ValueType
Definition: metadata_batch.h:157
slice.h
grpc_core::MetadataMap::Log
void Log(metadata_detail::LogFn log_fn) const
Definition: metadata_batch.h:1020
grpc_core::metadata_detail::GetStringValueHelper::NotFound
GPR_ATTRIBUTE_NOINLINE absl::optional< absl::string_view > NotFound(absl::string_view key)
Definition: metadata_batch.h:610
grpc_core::metadata_detail::UnknownMap::arena
Arena * arena() const
Definition: metadata_batch.h:865
grpc_core::GrpcTimeoutMetadata
Definition: metadata_batch.h:59
dst
static const char dst[]
Definition: test-fs-copyfile.c:37
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==true &&IsEncodableTrait< Which >::value, void > >::LogTo
void LogTo(LogFn log_fn) const
Definition: metadata_batch.h:736
grpc_core::metadata_detail::DebugStringBuilder
Definition: metadata_batch.h:396
gen_build_yaml.out
dictionary out
Definition: src/benchmark/gen_build_yaml.py:24
grpc_core::GrpcTimeoutMetadata::MementoType
Duration MementoType
Definition: metadata_batch.h:62
grpc_core::MetadataMap::Set
absl::enable_if_t< Which::kRepeatable==false, void > Set(Which, Args &&... args)
Definition: metadata_batch.h:1075
grpc_core::metadata_detail::ParseValue::Parse
static GPR_ATTRIBUTE_NOINLINE auto Parse(Slice *value, MetadataParseErrorFn on_error) -> decltype(memento_to_value(parse_memento(std::move(*value), on_error)))
Definition: metadata_batch.h:467
log.h
grpc_core::metadata_detail::CopySink::Encode
void Encode(const Slice &key, const Slice &value)
Definition: metadata_batch.h:790
grpc_core::metadata_detail::DebugStringBuilder::out_
std::string out_
Definition: metadata_batch.h:406
grpc_core::metadata_detail::AppendHelper::AppendHelper
AppendHelper(Container *container, Slice value, MetadataParseErrorFn on_error)
Definition: metadata_batch.h:517
grpc_core::ContentTypeMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:93
grpc_core::MetadataMap::Append
void Append(absl::string_view key, Slice value, MetadataParseErrorFn on_error)
Definition: metadata_batch.h:1156
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==false &&!IsEncodableTrait< Which >::value, void > >::Value
Value(const typename Which::ValueType &value)
Definition: metadata_batch.h:693
const
#define const
Definition: bloaty/third_party/zlib/zconf.h:230
grpc_core::MetadataMap::Parse
static ParsedMetadata< Derived > Parse(absl::string_view key, Slice value, uint32_t transport_size, MetadataParseErrorFn on_error)
Definition: metadata_batch.h:1142
grpc_core::HttpPathMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:264
grpc_core::GrpcLbClientStats
Definition: grpclb_client_stats.h:40
grpc_core::GrpcStatusContext::ValueType
std::string ValueType
Definition: metadata_batch.h:387
grpc_core::metadata_detail::ParseHelper::NotFound
GPR_ATTRIBUTE_NOINLINE ParsedMetadata< Container > NotFound(absl::string_view key)
Definition: metadata_batch.h:494
grpc_core::GrpcRetryPushbackMsMetadata::Encode
static Slice Encode(Duration x)
Definition: metadata_batch.h:313
grpc_core::MetadataMap::get
absl::optional< typename Which::ValueType > get(Which) const
Definition: metadata_batch.h:1067
asyncio_get_stats.default
default
Definition: asyncio_get_stats.py:38
grpc_core::metadata_detail::NameLookup
Definition: metadata_batch.h:425
grpc_core::Table
Definition: table.h:171
grpc_core::GrpcLbClientStatsMetadata::DisplayValue
static const char * DisplayValue(MementoType)
Definition: metadata_batch.h:336
grpc_core::TeMetadata::MementoToValue
static ValueType MementoToValue(MementoType te)
Definition: metadata_batch.h:83
grpc_core::GrpcTimeoutMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:63
grpc_core::metadata_detail::EncodeWrapper
Definition: metadata_batch.h:801
grpc_core::metadata_detail::DebugStringBuilder::TakeOutput
std::string TakeOutput()
Definition: metadata_batch.h:403
grpc_core::CompressionAlgorithmSet
Definition: compression_internal.h:52
grpc_core::MetadataMap::Set
absl::enable_if_t< Which::kRepeatable==true, void > Set(Which, Args &&... args)
Definition: metadata_batch.h:1080
grpc_core::MetadataMap::Set
void Set(const ParsedMetadata< Derived > &m)
Definition: metadata_batch.h:1151
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==true &&IsEncodableTrait< Which >::value, void > >::EncodeTo
void EncodeTo(Encoder *encoder) const
Definition: metadata_batch.h:731
grpc_core::HttpMethodMetadata
Definition: metadata_batch.h:136
grpc_core::TeMetadata::kInvalid
@ kInvalid
Definition: metadata_batch.h:78
parsed_metadata.h
grpc_core::HttpMethodMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:137
grpc_core
Definition: call_metric_recorder.h:31
grpc_core::metadata_detail::GetStringValueHelper::Found
GPR_ATTRIBUTE_NOINLINE absl::enable_if_t< Trait::kRepeatable==true &&!std::is_same< Slice, typename Trait::ValueType >::value, absl::optional< absl::string_view > > Found(Trait)
Definition: metadata_batch.h:586
grpc_core::MetadataMap::get_pointer
const metadata_detail::Value< Which >::StorageType * get_pointer(Which) const
Definition: metadata_batch.h:1039
grpc_core::metadata_detail::AppendHelper::NotFound
GPR_ATTRIBUTE_NOINLINE void NotFound(absl::string_view key)
Definition: metadata_batch.h:529
grpc_core::Slice
Definition: src/core/lib/slice/slice.h:282
grpc_core::HttpPathMetadata
Definition: metadata_batch.h:262
grpc_core::GrpcRetryPushbackMsMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:308
grpc_core::TeMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:72
grpc_compression_algorithm
grpc_compression_algorithm
Definition: compression_types.h:60
grpc_core::PeerString::DebugKey
static absl::string_view DebugKey()
Definition: metadata_batch.h:377
grpc_core::HttpMethodMetadata::DisplayValue
static const char * DisplayValue(MementoType content_type)
Definition: metadata_batch.cc:212
grpc_core::slice_detail::StaticConstructors< StaticSlice >::FromStaticString
static StaticSlice FromStaticString(const char *s)
Definition: src/core/lib/slice/slice.h:201
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==false &&!IsEncodableTrait< Which >::value, void > >::value
GPR_NO_UNIQUE_ADDRESS StorageType value
Definition: metadata_batch.h:709
grpc_core::metadata_detail::UnknownMap::begin
BackingType::ConstForwardIterator begin() const
Definition: metadata_batch.h:859
absl::string_view
Definition: abseil-cpp/absl/strings/string_view.h:167
grpc_core::Timestamp
Definition: src/core/lib/gprpp/time.h:62
grpc_core::HttpSchemeMetadata::ValueType
ValueType
Definition: metadata_batch.h:116
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
grpc_core::GrpcMessageMetadata
Definition: metadata_batch.h:220
grpc_core::IsStatusOk
bool IsStatusOk(const absl::Status &status)
Definition: src/core/lib/promise/detail/status.h:46
grpc_status_code
grpc_status_code
Definition: include/grpc/impl/codegen/status.h:28
grpc_core::HttpMethodMetadata::kPut
@ kPut
Definition: metadata_batch.h:141
grpc_core::HttpSchemeMetadata::kHttp
@ kHttp
Definition: metadata_batch.h:117
grpc_core::GrpcEncodingMetadata
Definition: metadata_batch.h:175
grpc_core::ContentTypeMetadata::MementoType
ValueType MementoType
Definition: metadata_batch.h:102
arena.h
grpc_core::metadata_detail::CopySink::Encode
void Encode(T trait, const Slice &value)
Definition: metadata_batch.h:786
grpc_core::MetadataMap::Remove
void Remove(absl::string_view key)
Definition: metadata_batch.h:1092
grpc_core::GrpcLbClientStatsMetadata::Encode
static Slice Encode(ValueType)
Definition: metadata_batch.h:335
grpc_core::GrpcPreviousRpcAttemptsMetadata
Definition: metadata_batch.h:300
setup.name
name
Definition: setup.py:542
absl::enable_if_t
typename std::enable_if< B, T >::type enable_if_t
Definition: abseil-cpp/absl/meta/type_traits.h:631
grpc_core::GrpcTimeoutMetadata::ValueType
Timestamp ValueType
Definition: metadata_batch.h:61
grpc_core::HttpStatusMetadata
Definition: metadata_batch.h:320
grpc_core::GrpcTagsBinMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:252
grpc_core::metadata_detail::AppendHelper::container_
Container *const container_
Definition: metadata_batch.h:534
grpc_core::GrpcAcceptEncodingMetadata
Definition: metadata_batch.h:187
grpc_core::SimpleIntBasedMetadata
Definition: metadata_batch.h:280
grpc_core::SimpleIntBasedMetadataBase::Encode
static Slice Encode(ValueType x)
Definition: metadata_batch.h:275
grpc_core::GrpcServerStatsBinMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:240
grpc_core::GrpcAcceptEncodingMetadata::MementoToValue
static ValueType MementoToValue(MementoType x)
Definition: metadata_batch.h:195
grpc_core::metadata_detail::DebugStringBuilder::Add
void Add(absl::string_view key, absl::string_view value)
Definition: metadata_batch.cc:33
grpc_core::metadata_detail::AdaptDisplayValueToLog< StaticSlice >::ToString
static absl::string_view ToString(StaticSlice value)
Definition: metadata_batch.h:647
grpc_core::GrpcLbClientStatsMetadata::MementoToValue
static ValueType MementoToValue(MementoType value)
Definition: metadata_batch.h:334
uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
grpc_core::metadata_detail::UnknownMap
Definition: metadata_batch.h:848
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==false &&IsEncodableTrait< Which >::value, void > >::EncodeTo
void EncodeTo(Encoder *encoder) const
Definition: metadata_batch.h:678
grpc_core::metadata_detail::ParseValue
Definition: metadata_batch.h:465
grpc_core::TeMetadata
Definition: metadata_batch.h:71
grpc_core::Arena
Definition: src/core/lib/resource_quota/arena.h:45
grpc_core::SimpleIntBasedMetadataBase::MementoToValue
static ValueType MementoToValue(MementoType value)
Definition: metadata_batch.h:274
grpc_core::MetadataMap::DebugString
std::string DebugString() const
Definition: metadata_batch.h:1027
grpc_core::HttpSchemeMetadata::Encode
static StaticSlice Encode(ValueType x)
Definition: metadata_batch.cc:161
T
#define T(upbtypeconst, upbtype, ctype, default_value)
grpc_core::MetadataMap::GetStringValue
absl::optional< absl::string_view > GetStringValue(absl::string_view name, std::string *buffer) const
Definition: metadata_batch.h:1100
grpc_core::GrpcServerStatsBinMetadata
Definition: metadata_batch.h:238
grpc_core::CompressionAlgorithmBasedMetadata::ParseMemento
static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error)
Definition: metadata_batch.cc:226
grpc_core::HttpAuthorityMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:257
grpc_core::metadata_detail::AppendHelper::value_
Slice value_
Definition: metadata_batch.h:535
arena
grpc_core::ScopedArenaPtr arena
Definition: binder_transport_test.cc:237
grpc_core::metadata_detail::CopySink::CopySink
CopySink(Output *dst)
Definition: metadata_batch.h:778
grpc_core::MetadataMap
Definition: metadata_batch.h:984
status.h
grpc_core::MetadataMap::Take
absl::enable_if_t< Which::kRepeatable==true, typename metadata_detail::Value< Which >::StorageType > Take(Which which)
Definition: metadata_batch.h:1129
grpc_core::metadata_detail::ParseHelper::Found
GPR_ATTRIBUTE_NOINLINE ParsedMetadata< Container > Found(Trait trait)
Definition: metadata_batch.h:487
grpc_core::HostMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:227
grpc_core::MetadataMap::count
size_t count() const
Definition: metadata_batch.h:1167
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==false &&!IsEncodableTrait< Which >::value, void > >::LogTo
void LogTo(LogFn log_fn) const
Definition: metadata_batch.h:705
grpc_core::metadata_detail::GetStringValueHelper::Found
GPR_ATTRIBUTE_NOINLINE absl::enable_if_t< Trait::kRepeatable==false &&std::is_same< Slice, typename Trait::ValueType >::value, absl::optional< absl::string_view > > Found(Trait)
Definition: metadata_batch.h:575
grpc_core::LbTokenMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:344
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
grpc_core::LbCostBinMetadata
Definition: metadata_batch.h:349
grpc_core::metadata_detail::GetStringValueHelper::GetStringValueHelper
GetStringValueHelper(const Container *container, std::string *backing)
Definition: metadata_batch.h:566
grpc_core::MetadataMap::Remove
void Remove(Which)
Definition: metadata_batch.h:1087
grpc_core::SimpleSliceBasedMetadata::MementoToValue
static ValueType MementoToValue(MementoType value)
Definition: metadata_batch.h:206
grpc_core::HttpMethodMetadata::MementoType
ValueType MementoType
Definition: metadata_batch.h:144
grpc_core::MetadataMap::TransportSize
size_t TransportSize() const
Definition: metadata_batch.h:1220
grpc_core::SimpleSliceBasedMetadata::ParseMemento
static MementoType ParseMemento(Slice value, MetadataParseErrorFn)
Definition: metadata_batch.h:203
grpc_core::metadata_detail::LogWrapper::log_fn
LogFn log_fn
Definition: metadata_batch.h:811
absl::SimpleAtoi
ABSL_NAMESPACE_BEGIN ABSL_MUST_USE_RESULT bool SimpleAtoi(absl::string_view str, int_type *out)
Definition: abseil-cpp/absl/strings/numbers.h:271
grpc_core::SimpleIntBasedMetadataBase::DisplayValue
static Int DisplayValue(MementoType x)
Definition: metadata_batch.h:276
grpc_core::LbCostBinMetadata::ValueType
Definition: metadata_batch.h:352
grpc_core::HostMetadata
Definition: metadata_batch.h:226
grpc_core::GrpcAcceptEncodingMetadata::Encode
static Slice Encode(ValueType x)
Definition: metadata_batch.h:196
grpc_core::ContentTypeMetadata::ParseMemento
static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error)
Definition: metadata_batch.cc:66
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==true &&IsEncodableTrait< Which >::value, void > >::Value
Value(const typename Which::ValueType &value)
Definition: metadata_batch.h:717
grpc_core::MetadataMap::get_pointer
metadata_detail::Value< Which >::StorageType * get_pointer(Which)
Definition: metadata_batch.h:1049
grpc_core::MetadataMap::Copy
Derived Copy() const
Definition: metadata_batch.h:1227
grpc_core::metadata_detail::NameLookup< void >::Lookup
static auto Lookup(absl::string_view key, Op *op) -> decltype(op->NotFound(key))
Definition: metadata_batch.h:455
grpc_core::HttpStatusMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:321
grpc_core::slice_detail::CopyConstructors< Slice >::FromCopiedString
static Slice FromCopiedString(const char *s)
Definition: src/core/lib/slice/slice.h:173
profile_analyzer.builder
builder
Definition: profile_analyzer.py:159
grpc_core::metadata_detail::RemoveHelper::Found
GPR_ATTRIBUTE_NOINLINE void Found(Trait trait)
Definition: metadata_batch.h:548
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
grpc_core::metadata_detail::GetStringValueHelper
Definition: metadata_batch.h:564
grpc_core::metadata_detail::UnknownMap::end
BackingType::ConstForwardIterator end() const
Definition: metadata_batch.h:860
GRPC_STATUS_OK
@ GRPC_STATUS_OK
Definition: include/grpc/impl/codegen/status.h:30
grpc_core::HttpSchemeMetadata::MementoToValue
static ValueType MementoToValue(MementoType content_type)
Definition: metadata_batch.h:128
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
grpc_core::TeMetadata::DisplayValue
static const char * DisplayValue(MementoType te)
Definition: metadata_batch.cc:141
hpack_encoder_fixtures::Args
Args({0, 16384})
int64_t
signed __int64 int64_t
Definition: stdint-msvc2008.h:89
grpc_core::metadata_detail::TransportSizeEncoder::size_
uint32_t size_
Definition: metadata_batch.h:844
grpc_core::GrpcTagsBinMetadata
Definition: metadata_batch.h:250
grpc_core::GrpcStatusMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:295
grpc_core::CompressionAlgorithmBasedMetadata
Definition: metadata_batch.h:156
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==false &&IsEncodableTrait< Which >::value, void > >::Value
Value(const typename Which::ValueType &value)
Definition: metadata_batch.h:667
Timestamp
struct Timestamp Timestamp
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:672
grpc_core::LbCostBinMetadata::ValueType::cost
double cost
Definition: metadata_batch.h:353
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==true &&!IsEncodableTrait< Which >::value, void > >::Value
Value(Value &&other) noexcept
Definition: metadata_batch.h:758
grpc_core::HttpPathMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:263
grpc_core::metadata_detail::LogWrapper
Definition: metadata_batch.h:810
grpc_core::HttpAuthorityMetadata
Definition: metadata_batch.h:256
slice
grpc_slice slice
Definition: src/core/lib/surface/server.cc:467
setup.v
v
Definition: third_party/bloaty/third_party/capstone/bindings/python/setup.py:42
grpc_core::MetadataMap::operator=
MetadataMap & operator=(const MetadataMap &)=delete
grpc_core::HttpSchemeMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:115
grpc_core::LbCostBinMetadata::DisplayValue
static std::string DisplayValue(MementoType x)
Definition: metadata_batch.cc:254
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==true &&IsEncodableTrait< Which >::value, void > >::Value
Value(typename Which::ValueType &&value)
Definition: metadata_batch.h:720
grpc_core::HttpSchemeMetadata::ParseMemento
static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error)
Definition: metadata_batch.h:123
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==false &&!IsEncodableTrait< Which >::value, void > >::StorageType
typename Which::ValueType StorageType
Definition: metadata_batch.h:708
grpc_core::GrpcAcceptEncodingMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:189
grpc_core::GrpcStatusContext::DisplayValue
static const std::string & DisplayValue(const std::string &x)
Definition: metadata_batch.cc:283
grpc_core::LbCostBinMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:351
grpc_core::metadata_detail::AdaptDisplayValueToLog< std::string >::ToString
static std::string ToString(const std::string &value)
Definition: metadata_batch.h:630
grpc_core::HostMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:228
grpc_core::ContentTypeMetadata::DisplayValue
static const char * DisplayValue(MementoType content_type)
Definition: metadata_batch.cc:97
grpc_core::metadata_detail::UnknownMap::UnknownMap
UnknownMap(Arena *arena)
Definition: metadata_batch.h:850
grpc_core::metadata_detail::AppendHelper::Found
GPR_ATTRIBUTE_NOINLINE void Found(Trait trait)
Definition: metadata_batch.h:521
grpc_core::HttpMethodMetadata::ParseMemento
static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error)
Definition: metadata_batch.cc:183
grpc_core::HttpMethodMetadata::ValueType
ValueType
Definition: metadata_batch.h:138
python_utils.jobset.which
def which(filename)
Definition: jobset.py:157
absl::optional< absl::string_view >
grpc_core::GrpcLbClientStatsMetadata::ParseMemento
static MementoType ParseMemento(Slice, MetadataParseErrorFn)
Definition: metadata_batch.h:337
grpc_core::UserAgentMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:215
grpc_core::metadata_detail::TransportSizeEncoder
Definition: metadata_batch.h:819
grpc_core::GrpcRetryPushbackMsMetadata::ParseMemento
static Duration ParseMemento(Slice value, MetadataParseErrorFn on_error)
Definition: metadata_batch.cc:236
grpc_core::EndpointLoadMetricsBinMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:234
time.h
grpc_core::GrpcRetryPushbackMsMetadata
Definition: metadata_batch.h:307
grpc_core::metadata_detail::LogWrapper::operator()
void operator()(const Value< Which > &which)
Definition: metadata_batch.h:813
grpc_core::metadata_detail::AppendHelper
Definition: metadata_batch.h:515
grpc_core::metadata_detail::NameLookup< absl::enable_if_t< IsEncodableTrait< Trait >::value, void >, Trait, Traits... >::Lookup
static auto Lookup(absl::string_view key, Op *op) -> decltype(op->Found(Trait()))
Definition: metadata_batch.h:433
grpc_core::GrpcAcceptEncodingMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:188
grpc_core::ContentTypeMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:103
grpc_core::LbTokenMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:345
grpc_core::UserAgentMetadata
Definition: metadata_batch.h:214
grpc_core::TeMetadata::kTrailers
@ kTrailers
Definition: metadata_batch.h:77
x
int x
Definition: bloaty/third_party/googletest/googlemock/test/gmock-matchers_test.cc:3610
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==true &&!IsEncodableTrait< Which >::value, void > >::LogTo
void LogTo(LogFn log_fn) const
Definition: metadata_batch.h:765
grpc_core::GrpcTimeoutMetadata::DisplayValue
static std::string DisplayValue(MementoType x)
Definition: metadata_batch.h:67
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==true &&IsEncodableTrait< Which >::value, void > >::Value
Value(Value &&other) noexcept
Definition: metadata_batch.h:725
grpc_core::MetadataMap::Clear
void Clear()
Definition: metadata_batch.h:1214
grpc_core::metadata_detail::ParseHelper::ParseHelper
ParseHelper(Slice value, MetadataParseErrorFn on_error, size_t transport_size)
Definition: metadata_batch.h:481
grpc_core::HttpMethodMetadata::Encode
static StaticSlice Encode(ValueType x)
Definition: metadata_batch.cc:199
grpc_core::HttpAuthorityMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:258
grpc_core::MetadataMap::MetadataMap
MetadataMap(Arena *arena)
Definition: metadata_batch.h:1193
grpc_core::MetadataMap::Take
absl::enable_if_t< Which::kRepeatable==false, absl::optional< typename Which::ValueType > > Take(Which which)
Definition: metadata_batch.h:1115
buffer
char buffer[1024]
Definition: libuv/docs/code/idle-compute/main.c:8
grpc_core::MetadataMap::unknown_
metadata_detail::UnknownMap unknown_
Definition: metadata_batch.h:1181
grpc_core::metadata_detail::NameLookup< absl::enable_if_t<!IsEncodableTrait< Trait >::value, void >, Trait, Traits... >::Lookup
static auto Lookup(absl::string_view key, Op *op) -> decltype(NameLookup< void, Traits... >::Lookup(key, op))
Definition: metadata_batch.h:446
grpc_core::ChunkedVector
Definition: chunked_vector.h:37
grpc_core::HttpSchemeMetadata::DisplayValue
static const char * DisplayValue(MementoType content_type)
Definition: metadata_batch.cc:172
grpc_core::ContentTypeMetadata::kEmpty
@ kEmpty
Definition: metadata_batch.h:99
grpc_core::LbCostBinMetadata::ParseMemento
static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error)
Definition: metadata_batch.cc:258
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==false &&IsEncodableTrait< Which >::value, void > >::StorageType
typename Which::ValueType StorageType
Definition: metadata_batch.h:684
grpc_core::metadata_detail::IsEncodableTrait::value
static const bool value
Definition: metadata_batch.h:415
grpc_core::GrpcServerStatsBinMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:239
GPR_NO_UNIQUE_ADDRESS
#define GPR_NO_UNIQUE_ADDRESS
Definition: impl/codegen/port_platform.h:692
Json::Int
int Int
Definition: third_party/bloaty/third_party/protobuf/conformance/third_party/jsoncpp/json.h:228
grpc_metadata_batch_base
grpc_core::MetadataMap< grpc_metadata_batch, grpc_core::HttpPathMetadata, grpc_core::HttpAuthorityMetadata, grpc_core::HttpMethodMetadata, grpc_core::HttpStatusMetadata, grpc_core::HttpSchemeMetadata, grpc_core::ContentTypeMetadata, grpc_core::TeMetadata, grpc_core::GrpcEncodingMetadata, grpc_core::GrpcInternalEncodingRequest, grpc_core::GrpcAcceptEncodingMetadata, grpc_core::GrpcStatusMetadata, grpc_core::GrpcTimeoutMetadata, grpc_core::GrpcPreviousRpcAttemptsMetadata, grpc_core::GrpcRetryPushbackMsMetadata, grpc_core::UserAgentMetadata, grpc_core::GrpcMessageMetadata, grpc_core::HostMetadata, grpc_core::EndpointLoadMetricsBinMetadata, grpc_core::GrpcServerStatsBinMetadata, grpc_core::GrpcTraceBinMetadata, grpc_core::GrpcTagsBinMetadata, grpc_core::GrpcLbClientStatsMetadata, grpc_core::LbCostBinMetadata, grpc_core::LbTokenMetadata, grpc_core::GrpcStreamNetworkState, grpc_core::PeerString, grpc_core::GrpcStatusContext > grpc_metadata_batch_base
Definition: metadata_batch.h:1257
grpc_core::GrpcLbClientStatsMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:330
grpc_core::LbCostBinMetadata::MementoToValue
static ValueType MementoToValue(MementoType value)
Definition: metadata_batch.h:357
grpc_core::TeMetadata::MementoType
ValueType MementoType
Definition: metadata_batch.h:80
grpc_core::metadata_detail::GetStringValueHelper::container_
const Container *const container_
Definition: metadata_batch.h:616
grpc_core::metadata_detail::ParseHelper::value_
Slice value_
Definition: metadata_batch.h:506
grpc_core::metadata_detail::ParseHelper::ParseValueToMemento
GPR_ATTRIBUTE_NOINLINE T ParseValueToMemento()
Definition: metadata_batch.h:502
grpc_core::GrpcStatusMetadata
Definition: metadata_batch.h:293
Json::ValueType
ValueType
Type of the value held by a Value object.
Definition: third_party/bloaty/third_party/protobuf/conformance/third_party/jsoncpp/json.h:463
grpc_core::GrpcStreamNetworkState::kNotSentOnWire
@ kNotSentOnWire
Definition: metadata_batch.h:369
grpc_core::CompressionAlgorithmAsString
const char * CompressionAlgorithmAsString(grpc_compression_algorithm algorithm)
Definition: compression_internal.cc:38
grpc_core::GrpcPreviousRpcAttemptsMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:302
grpc_core::GrpcRetryPushbackMsMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:309
grpc_core::metadata_detail::TransportSizeEncoder::size
size_t size() const
Definition: metadata_batch.h:836
grpc_core::EndpointLoadMetricsBinMetadata
Definition: metadata_batch.h:232
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==false &&!IsEncodableTrait< Which >::value, void > >::Value
Value(typename Which::ValueType &&value)
Definition: metadata_batch.h:694
grpc_core::ParsedMetadata
Definition: parsed_metadata.h:117
grpc_core::CompressionAlgorithmBasedMetadata::DisplayValue
static const char * DisplayValue(MementoType x)
Definition: metadata_batch.h:165
grpc_core::metadata_detail::UnknownMap::Clear
void Clear()
Definition: metadata_batch.h:864
grpc_core::PeerString::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:378
grpc_core::GrpcStreamNetworkState::DisplayValue
static std::string DisplayValue(ValueType x)
Definition: metadata_batch.cc:272
grpc_core::ContentTypeMetadata::kInvalid
@ kInvalid
Definition: metadata_batch.h:100
grpc_core::MetadataMap::empty
bool empty() const
Definition: metadata_batch.h:1166
compression_types.h
grpc_core::slice_detail::CopyConstructors< Slice >::FromInt64
static Slice FromInt64(int64_t i)
Definition: src/core/lib/slice/slice.h:192
value
const char * value
Definition: hpack_parser_table.cc:165
grpc_core::GrpcRetryPushbackMsMetadata::DisplayValue
static int64_t DisplayValue(Duration x)
Definition: metadata_batch.h:314
compression_internal.h
grpc_core::GrpcTimeoutMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:60
chunked_vector.h
grpc_core::MetadataMap::Remove
void Remove(const char *key)
Definition: metadata_batch.h:1097
grpc_core::metadata_detail::UnknownMap::unknown_
ChunkedVector< std::pair< Slice, Slice >, 10 > unknown_
Definition: metadata_batch.h:869
grpc_core::StaticSlice
Definition: src/core/lib/slice/slice.h:221
grpc_core::LbCostBinMetadata::MementoType
ValueType MementoType
Definition: metadata_batch.h:356
absl::void_t
typename type_traits_internal::VoidTImpl< Ts... >::type void_t
Definition: abseil-cpp/absl/meta/type_traits.h:218
grpc_core::metadata_detail::CopySink::dst_
Output * dst_
Definition: metadata_batch.h:795
grpc_core::metadata_detail::TransportSizeEncoder::Encode
void Encode(const Slice &key, const Slice &value)
Definition: metadata_batch.h:821
grpc_core::ContentTypeMetadata::ValueType
ValueType
Definition: metadata_batch.h:97
key
const char * key
Definition: hpack_parser_table.cc:164
grpc_core::SimpleSliceBasedMetadata
Definition: metadata_batch.h:200
grpc_core::GrpcInternalEncodingRequest
Definition: metadata_batch.h:181
google::protobuf.internal.python_message.Clear
Clear
Definition: bloaty/third_party/protobuf/python/google/protobuf/internal/python_message.py:1430
grpc_core::CompressionAlgorithmSet::FromString
static CompressionAlgorithmSet FromString(absl::string_view str)
Definition: compression_internal.cc:215
grpc_core::metadata_detail::UnknownMap::size
size_t size() const
Definition: metadata_batch.h:863
grpc_core::metadata_detail::RemoveHelper
Definition: metadata_batch.h:543
sink
FormatSinkImpl * sink
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:450
grpc_core::HttpSchemeMetadata::Parse
static ValueType Parse(absl::string_view value, MetadataParseErrorFn on_error)
Definition: metadata_batch.cc:150
grpc_core::HttpSchemeMetadata
Definition: metadata_batch.h:114
table_
Vec< int32_t > table_
Definition: abseil-cpp/absl/synchronization/internal/graphcycles.cc:210
grpc_core::GrpcTimeoutMetadata::Encode
static Slice Encode(ValueType x)
Definition: metadata_batch.cc:126
grpc_core::HttpMethodMetadata::kPost
@ kPost
Definition: metadata_batch.h:139
grpc_core::GrpcMessageMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:222
grpc_core::PeerString
Definition: metadata_batch.h:376
grpc_core::metadata_detail::UnknownMap::Append
void Append(absl::string_view key, Slice value)
Definition: metadata_batch.cc:38
grpc_core::HttpSchemeMetadata::kHttps
@ kHttps
Definition: metadata_batch.h:118
grpc_core::MetadataMap::table_
Table< Value< Traits >... > table_
Definition: metadata_batch.h:1180
grpc_core::HttpMethodMetadata::kGet
@ kGet
Definition: metadata_batch.h:140
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==true &&!IsEncodableTrait< Which >::value, void > >::value
StorageType value
Definition: metadata_batch.h:771
grpc_core::GrpcStatusContext::DebugKey
static absl::string_view DebugKey()
Definition: metadata_batch.h:385
grpc_core::PeerString::DisplayValue
static std::string DisplayValue(ValueType x)
Definition: metadata_batch.cc:282
Copy
@ Copy
Definition: upb/benchmarks/benchmark.cc:200
std
Definition: grpcpp/impl/codegen/async_unary_call.h:407
string_view
absl::string_view string_view
Definition: attr.cc:22
GRPC_COMPRESS_ALGORITHMS_COUNT
@ GRPC_COMPRESS_ALGORITHMS_COUNT
Definition: compression_types.h:65
grpc_core::GrpcStreamNetworkState
Definition: metadata_batch.h:365
grpc_core::metadata_detail::AdaptDisplayValueToLog< Slice >::ToString
static std::string ToString(Slice value)
Definition: metadata_batch.h:640
grpc_core::metadata_detail::CopySink
Definition: metadata_batch.h:776
grpc_core::ContentTypeMetadata::Encode
static StaticSlice Encode(ValueType x)
Definition: metadata_batch.cc:84
grpc_core::GrpcStatusContext
Definition: metadata_batch.h:384
grpc_core::MetadataValueAsSlice
absl::enable_if_t< std::is_same< typename Which::ValueType, Slice >::value, const Slice & > MetadataValueAsSlice(const Slice &slice)
Definition: metadata_batch.h:879
grpc_core::metadata_detail::AdaptDisplayValueToLog< const std::string & >::ToString
static std::string ToString(const std::string &value)
Definition: metadata_batch.h:635
grpc_core::GrpcRetryPushbackMsMetadata::MementoToValue
static ValueType MementoToValue(MementoType x)
Definition: metadata_batch.h:312
grpc_core::GrpcEncodingMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:177
grpc_core::metadata_detail::GetStringValueHelper::Found
GPR_ATTRIBUTE_NOINLINE absl::enable_if_t< Trait::kRepeatable==false &&!std::is_same< Slice, typename Trait::ValueType >::value, absl::optional< absl::string_view > > Found(Trait)
Definition: metadata_batch.h:603
grpc_core::GrpcInternalEncodingRequest::key
static absl::string_view key()
Definition: metadata_batch.h:183
grpc_core::GrpcStreamNetworkState::DebugKey
static absl::string_view DebugKey()
Definition: metadata_batch.h:366
grpc_core::LbTokenMetadata
Definition: metadata_batch.h:343
grpc_core::metadata_detail::CopySink::Encode
void Encode(T trait, V value)
Definition: metadata_batch.h:781
grpc_core::GrpcInternalEncodingRequest::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:182
grpc_core::GrpcTraceBinMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:246
grpc_core::GrpcStatusMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:296
grpc_core::metadata_detail::AppendHelper::on_error_
MetadataParseErrorFn on_error_
Definition: metadata_batch.h:536
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==false &&IsEncodableTrait< Which >::value, void > >::LogTo
void LogTo(LogFn log_fn) const
Definition: metadata_batch.h:681
grpc_core::metadata_detail::EncodeWrapper::encoder
Encoder * encoder
Definition: metadata_batch.h:802
grpc_core::CompressionAlgorithmBasedMetadata::Encode
static Slice Encode(ValueType x)
Definition: metadata_batch.h:161
grpc_core::metadata_detail::EncodeWrapper::operator()
void operator()(const Value< Which > &which)
Definition: metadata_batch.h:804
grpc_core::metadata_detail::ParseHelper::on_error_
MetadataParseErrorFn on_error_
Definition: metadata_batch.h:507
grpc_core::metadata_detail::RemoveHelper::container_
Container *const container_
Definition: metadata_batch.h:557
grpc_core::GrpcStreamNetworkState::ValueType
ValueType
Definition: metadata_batch.h:368
grpc_core::LbCostBinMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:350
absl::FunctionRef< void(absl::string_view error, const Slice &value)>
grpc_core::GrpcStreamNetworkState::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:367
grpc_core::metadata_detail::RemoveHelper::RemoveHelper
RemoveHelper(Container *container)
Definition: metadata_batch.h:545
grpc_core::GrpcTagsBinMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:251
grpc_core::HttpStatusMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:322
grpc_core::GrpcAcceptEncodingMetadata::DisplayValue
static absl::string_view DisplayValue(MementoType x)
Definition: metadata_batch.h:197
grpc_core::metadata_detail::ParseHelper
Definition: metadata_batch.h:479
grpc_core::ContentTypeMetadata::kApplicationGrpc
@ kApplicationGrpc
Definition: metadata_batch.h:98
grpc_core::GrpcStreamNetworkState::kNotSeenByServer
@ kNotSeenByServer
Definition: metadata_batch.h:370
grpc_core::GrpcTimeoutMetadata::MementoToValue
static ValueType MementoToValue(MementoType timeout)
Definition: metadata_batch.cc:118
grpc_core::ChunkedVector::ConstForwardIterator
Definition: chunked_vector.h:159
grpc_core::GrpcLbClientStatsMetadata::ValueType
GrpcLbClientStats * ValueType
Definition: metadata_batch.h:332
grpc_core::HttpSchemeMetadata::MementoType
ValueType MementoType
Definition: metadata_batch.h:121
grpc_core::SimpleSliceBasedMetadata::Encode
static Slice Encode(const ValueType &x)
Definition: metadata_batch.h:207
absl
Definition: abseil-cpp/absl/algorithm/algorithm.h:31
grpc_core::LbCostBinMetadata::ValueType::name
std::string name
Definition: metadata_batch.h:354
grpc_core::ContentTypeMetadata
Definition: metadata_batch.h:92
grpc_core::GrpcStatusContext::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:386
grpc_core::GrpcTimeoutMetadata::ParseMemento
static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error)
Definition: metadata_batch.cc:108
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==false &&IsEncodableTrait< Which >::value, void > >::value
GPR_NO_UNIQUE_ADDRESS StorageType value
Definition: metadata_batch.h:685
grpc_core::ContentTypeMetadata::MementoToValue
static ValueType MementoToValue(MementoType content_type)
Definition: metadata_batch.h:105
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==true &&IsEncodableTrait< Which >::value, void > >::operator=
Value & operator=(Value &&other) noexcept
Definition: metadata_batch.h:726
grpc_core::metadata_detail::LogKeyValueTo
GPR_ATTRIBUTE_NOINLINE void LogKeyValueTo(absl::string_view key, const T &value, V(*display_value)(U), LogFn log_fn)
Definition: metadata_batch.h:653
grpc_core::GrpcPreviousRpcAttemptsMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:303
grpc_core::GrpcMessageMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:221
absl::forward
constexpr T && forward(absl::remove_reference_t< T > &t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:230
grpc_core::UserAgentMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:216
grpc_core::GrpcAcceptEncodingMetadata::ValueType
CompressionAlgorithmSet ValueType
Definition: metadata_batch.h:190
Value
struct Value Value
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:676
absl::InlinedVector< typename Which::ValueType, 1 >
grpc_core::LbCostBinMetadata::Encode
static Slice Encode(const ValueType &x)
Definition: metadata_batch.cc:246
grpc_core::metadata_detail::TransportSizeEncoder::Add
void Add(Which, const typename Which::ValueType &value)
Definition: metadata_batch.h:840
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==true &&!IsEncodableTrait< Which >::value, void > >::operator=
Value & operator=(Value &&other) noexcept
Definition: metadata_batch.h:759
grpc_core::TeMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:81
grpc_core::metadata_detail::UnknownMap::GetStringValue
absl::optional< absl::string_view > GetStringValue(absl::string_view key, std::string *backing) const
Definition: metadata_batch.cc:49
grpc_core::SimpleIntBasedMetadata::ParseMemento
static Int ParseMemento(Slice value, MetadataParseErrorFn on_error)
Definition: metadata_batch.h:282
Duration
struct Duration Duration
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:640
grpc_core::Duration
Definition: src/core/lib/gprpp/time.h:122
grpc_core::metadata_detail::GetStringValueHelper::backing_
std::string * backing_
Definition: metadata_batch.h:617
grpc_core::metadata_detail::Value
Definition: metadata_batch.h:660
regress.m
m
Definition: regress/regress.py:25
grpc_core::MetadataMap::GetOrCreatePointer
metadata_detail::Value< Which >::StorageType * GetOrCreatePointer(Which)
Definition: metadata_batch.h:1058
grpc_metadata_batch
Definition: metadata_batch.h:1259
Lookup
static const char * Lookup(std::map< std::string, std::unique_ptr< char[]>> *dummy_lh, const char *key)
Definition: lhash_test.cc:53
grpc_core::SimpleIntBasedMetadata::invalid_value
static constexpr Int invalid_value()
Definition: metadata_batch.h:281
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==true &&!IsEncodableTrait< Which >::value, void > >::EncodeTo
void EncodeTo(Encoder *) const
Definition: metadata_batch.h:764
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==true &&IsEncodableTrait< Which >::value, void > >::value
StorageType value
Definition: metadata_batch.h:742
grpc_core::MetadataMap::Encode
void Encode(Encoder *encoder) const
Definition: metadata_batch.h:1011
grpc_core::metadata_detail::TransportSizeEncoder::Encode
void Encode(ContentTypeMetadata, const typename ContentTypeMetadata::ValueType &value)
Definition: metadata_batch.h:830
grpc_core::TeMetadata::ValueType
ValueType
Definition: metadata_batch.h:76
to_string
static bool to_string(zval *from)
Definition: protobuf/php/ext/google/protobuf/convert.c:333
grpc_core::GrpcLbClientStatsMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:331
grpc_core::metadata_detail::TransportSizeEncoder::Encode
void Encode(Which, const typename Which::ValueType &value)
Definition: metadata_batch.h:826
op
static grpc_op * op
Definition: test/core/fling/client.cc:47
grpc_core::GrpcLbClientStatsMetadata
Definition: metadata_batch.h:329
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==true &&!IsEncodableTrait< Which >::value, void > >::Value
Value(typename Which::ValueType &&value)
Definition: metadata_batch.h:753
grpc_core::EndpointLoadMetricsBinMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:233
grpc_core::GrpcTraceBinMetadata
Definition: metadata_batch.h:244
grpc_core::GrpcTraceBinMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:245
grpc_core::HttpMethodMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:145
grpc_core::HttpSchemeMetadata::kInvalid
@ kInvalid
Definition: metadata_batch.h:119
grpc_core::SimpleSliceBasedMetadata::DisplayValue
static absl::string_view DisplayValue(const MementoType &value)
Definition: metadata_batch.h:208
table.h
grpc_core::HttpMethodMetadata::kInvalid
@ kInvalid
Definition: metadata_batch.h:142
grpc_core::GrpcEncodingMetadata::kRepeatable
static constexpr bool kRepeatable
Definition: metadata_batch.h:176
grpc_core::metadata_detail::IsEncodableTrait
Definition: metadata_batch.h:414
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==false &&IsEncodableTrait< Which >::value, void > >::Value
Value(typename Which::ValueType &&value)
Definition: metadata_batch.h:668
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==true &&!IsEncodableTrait< Which >::value, void > >::Value
Value(const typename Which::ValueType &value)
Definition: metadata_batch.h:750
grpc_core::metadata_detail::RemoveHelper::NotFound
GPR_ATTRIBUTE_NOINLINE void NotFound(absl::string_view key)
Definition: metadata_batch.h:552
timeout
uv_timer_t timeout
Definition: libuv/docs/code/uvwget/main.c:9
grpc_core::TeMetadata::Encode
static StaticSlice Encode(ValueType x)
Definition: metadata_batch.h:84
grpc_core::CompressionAlgorithmBasedMetadata::MementoToValue
static ValueType MementoToValue(MementoType x)
Definition: metadata_batch.h:160
container
static struct async_container * container
Definition: benchmark-million-async.c:33
GPR_ATTRIBUTE_NOINLINE
#define GPR_ATTRIBUTE_NOINLINE
Definition: impl/codegen/port_platform.h:684
grpc_core::HttpSchemeMetadata::key
static absl::string_view key()
Definition: metadata_batch.h:122
grpc_core::metadata_detail::UnknownMap::empty
bool empty() const
Definition: metadata_batch.h:862
GRPC_STATUS_UNKNOWN
@ GRPC_STATUS_UNKNOWN
Definition: include/grpc/impl/codegen/status.h:40
grpc_core::metadata_detail::Value< Which, absl::enable_if_t< Which::kRepeatable==false &&!IsEncodableTrait< Which >::value, void > >::EncodeTo
void EncodeTo(Encoder *) const
Definition: metadata_batch.h:704
grpc_core::SimpleIntBasedMetadataBase
Definition: metadata_batch.h:271
grpc_core::metadata_detail::AdaptDisplayValueToLog
Definition: metadata_batch.h:624
grpc_core::metadata_detail::AdaptDisplayValueToLog::ToString
static std::string ToString(const T &value)
Definition: metadata_batch.h:625
grpc_core::metadata_detail::UnknownMap::Remove
void Remove(absl::string_view key)
Definition: metadata_batch.cc:42
grpc_core::MetadataMap::~MetadataMap
~MetadataMap()
grpc_core::HttpMethodMetadata::MementoToValue
static ValueType MementoToValue(MementoType content_type)
Definition: metadata_batch.h:147
port_platform.h
grpc_core::metadata_detail::ParseHelper::transport_size_
const size_t transport_size_
Definition: metadata_batch.h:508
grpc_core::GrpcAcceptEncodingMetadata::ParseMemento
static MementoType ParseMemento(Slice value, MetadataParseErrorFn)
Definition: metadata_batch.h:192


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:39