Revert "Reland te: trailers metadata stuff (#27781)" (#27784)

This reverts commit f5ab108ab7.
pull/27785/head
Craig Tiller 3 years ago committed by GitHub
parent 4dc6a11227
commit 33fff40174
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 43
      src/core/ext/filters/client_channel/retry_filter.cc
  2. 10
      src/core/ext/filters/http/client/http_client_filter.cc
  3. 17
      src/core/ext/filters/http/server/http_server_filter.cc
  4. 20
      src/core/ext/transport/binder/transport/binder_transport.cc
  5. 39
      src/core/ext/transport/chttp2/transport/hpack_encoder.cc
  6. 10
      src/core/ext/transport/chttp2/transport/hpack_encoder.h
  7. 110
      src/core/ext/transport/cronet/transport/cronet_transport.cc
  8. 52
      src/core/ext/transport/inproc/inproc_transport.cc
  9. 528
      src/core/lib/slice/static_slice.cc
  10. 198
      src/core/lib/slice/static_slice.h
  11. 2
      src/core/lib/surface/call.cc
  12. 34
      src/core/lib/surface/channel.cc
  13. 9
      src/core/lib/surface/channel.h
  14. 33
      src/core/lib/transport/metadata.cc
  15. 45
      src/core/lib/transport/metadata_batch.cc
  16. 169
      src/core/lib/transport/metadata_batch.h
  17. 5
      src/core/lib/transport/parsed_metadata.h
  18. 707
      src/core/lib/transport/static_metadata.cc
  19. 40
      src/core/lib/transport/static_metadata.h
  20. 23
      src/core/lib/transport/transport_op_string.cc
  21. 5
      test/core/end2end/fuzzers/hpack.dictionary
  22. 153
      test/cpp/microbenchmarks/bm_chttp2_hpack.cc
  23. 59
      test/cpp/microbenchmarks/bm_chttp2_transport.cc
  24. 5
      tools/codegen/core/gen_static_metadata.py

@ -420,12 +420,17 @@ class RetryFilter::CallData {
// BatchData.batch.payload points to this.
grpc_transport_stream_op_batch_payload batch_payload_;
// For send_initial_metadata.
grpc_linked_mdelem retry_attempts_metadata_;
// Note that we need to make a copy of the initial metadata for each
// call attempt instead of just referring to the copy in call_data,
// because filters in the subchannel stack may modify the metadata,
// so we need to start in a pristine state for each attempt of the call.
grpc_linked_mdelem* send_initial_metadata_storage_;
grpc_metadata_batch send_initial_metadata_{calld_->arena_};
// For send_message.
// TODO(roth): Restructure this to eliminate use of ManualConstructor.
ManualConstructor<ByteStreamCache::CachingByteStream> send_message_;
// For send_trailing_metadata.
grpc_linked_mdelem* send_trailing_metadata_storage_;
grpc_metadata_batch send_trailing_metadata_{calld_->arena_};
// For intercepting recv_initial_metadata.
grpc_metadata_batch recv_initial_metadata_{calld_->arena_};
@ -568,6 +573,7 @@ class RetryFilter::CallData {
// Cached data for retrying send ops.
// send_initial_metadata
bool seen_send_initial_metadata_ = false;
grpc_linked_mdelem* send_initial_metadata_storage_ = nullptr;
grpc_metadata_batch send_initial_metadata_{arena_};
uint32_t send_initial_metadata_flags_;
// TODO(roth): As part of implementing hedging, we'll probably need to
@ -593,6 +599,7 @@ class RetryFilter::CallData {
absl::InlinedVector<ByteStreamCache*, 3> send_messages_;
// send_trailing_metadata
bool seen_send_trailing_metadata_ = false;
grpc_linked_mdelem* send_trailing_metadata_storage_ = nullptr;
grpc_metadata_batch send_trailing_metadata_{arena_};
};
@ -1902,8 +1909,14 @@ void RetryFilter::CallData::CallAttempt::BatchData::
//
// If we've already completed one or more attempts, add the
// grpc-retry-attempts header.
call_attempt_->send_initial_metadata_storage_ =
static_cast<grpc_linked_mdelem*>(calld->arena_->Alloc(
sizeof(grpc_linked_mdelem) *
(calld->send_initial_metadata_.non_deadline_count() +
(calld->num_attempts_completed_ > 0))));
grpc_metadata_batch_copy(&calld->send_initial_metadata_,
&call_attempt_->send_initial_metadata_);
&call_attempt_->send_initial_metadata_,
call_attempt_->send_initial_metadata_storage_);
if (GPR_UNLIKELY(call_attempt_->send_initial_metadata_.legacy_index()
->named.grpc_previous_rpc_attempts != nullptr)) {
call_attempt_->send_initial_metadata_.Remove(
@ -1915,8 +1928,9 @@ void RetryFilter::CallData::CallAttempt::BatchData::
*retry_count_strings[calld->num_attempts_completed_ - 1], nullptr);
grpc_error_handle error = grpc_metadata_batch_add_tail(
&call_attempt_->send_initial_metadata_,
&call_attempt_->retry_attempts_metadata_, retry_md,
GRPC_BATCH_GRPC_PREVIOUS_RPC_ATTEMPTS);
&call_attempt_->send_initial_metadata_storage_
[calld->send_initial_metadata_.non_deadline_count()],
retry_md, GRPC_BATCH_GRPC_PREVIOUS_RPC_ATTEMPTS);
if (GPR_UNLIKELY(error != GRPC_ERROR_NONE)) {
gpr_log(GPR_ERROR, "error adding retry metadata: %s",
grpc_error_std_string(error).c_str());
@ -1958,8 +1972,13 @@ void RetryFilter::CallData::CallAttempt::BatchData::
// We need to make a copy of the metadata batch for each attempt, since
// the filters in the subchannel stack may modify this batch, and we don't
// want those modifications to be passed forward to subsequent attempts.
call_attempt_->send_trailing_metadata_storage_ =
static_cast<grpc_linked_mdelem*>(calld->arena_->Alloc(
sizeof(grpc_linked_mdelem) *
calld->send_trailing_metadata_.non_deadline_count()));
grpc_metadata_batch_copy(&calld->send_trailing_metadata_,
&call_attempt_->send_trailing_metadata_);
&call_attempt_->send_trailing_metadata_,
call_attempt_->send_trailing_metadata_storage_);
call_attempt_->started_send_trailing_metadata_ = true;
batch_.send_trailing_metadata = true;
batch_.payload->send_trailing_metadata.send_trailing_metadata =
@ -2272,9 +2291,14 @@ void RetryFilter::CallData::MaybeCacheSendOpsForBatch(PendingBatch* pending) {
// Save a copy of metadata for send_initial_metadata ops.
if (batch->send_initial_metadata) {
seen_send_initial_metadata_ = true;
GPR_ASSERT(send_initial_metadata_storage_ == nullptr);
grpc_metadata_batch* send_initial_metadata =
batch->payload->send_initial_metadata.send_initial_metadata;
grpc_metadata_batch_copy(send_initial_metadata, &send_initial_metadata_);
send_initial_metadata_storage_ = static_cast<grpc_linked_mdelem*>(
arena_->Alloc(sizeof(grpc_linked_mdelem) *
send_initial_metadata->non_deadline_count()));
grpc_metadata_batch_copy(send_initial_metadata, &send_initial_metadata_,
send_initial_metadata_storage_);
send_initial_metadata_flags_ =
batch->payload->send_initial_metadata.send_initial_metadata_flags;
peer_string_ = batch->payload->send_initial_metadata.peer_string;
@ -2288,9 +2312,14 @@ void RetryFilter::CallData::MaybeCacheSendOpsForBatch(PendingBatch* pending) {
// Save metadata batch for send_trailing_metadata ops.
if (batch->send_trailing_metadata) {
seen_send_trailing_metadata_ = true;
GPR_ASSERT(send_trailing_metadata_storage_ == nullptr);
grpc_metadata_batch* send_trailing_metadata =
batch->payload->send_trailing_metadata.send_trailing_metadata;
grpc_metadata_batch_copy(send_trailing_metadata, &send_trailing_metadata_);
send_trailing_metadata_storage_ = static_cast<grpc_linked_mdelem*>(
arena_->Alloc(sizeof(grpc_linked_mdelem) *
send_trailing_metadata->non_deadline_count()));
grpc_metadata_batch_copy(send_trailing_metadata, &send_trailing_metadata_,
send_trailing_metadata_storage_);
}
}

@ -78,6 +78,7 @@ struct call_data {
// State for handling send_initial_metadata ops.
grpc_linked_mdelem method;
grpc_linked_mdelem scheme;
grpc_linked_mdelem te_trailers;
grpc_linked_mdelem content_type;
grpc_linked_mdelem user_agent;
// State for handling recv_initial_metadata ops.
@ -440,6 +441,9 @@ static void http_client_start_transport_stream_op_batch(
remove_if_present(
batch->payload->send_initial_metadata.send_initial_metadata,
GRPC_BATCH_SCHEME);
remove_if_present(
batch->payload->send_initial_metadata.send_initial_metadata,
GRPC_BATCH_TE);
remove_if_present(
batch->payload->send_initial_metadata.send_initial_metadata,
GRPC_BATCH_CONTENT_TYPE);
@ -457,8 +461,10 @@ static void http_client_start_transport_stream_op_batch(
batch->payload->send_initial_metadata.send_initial_metadata,
&calld->scheme, channeld->static_scheme, GRPC_BATCH_SCHEME);
if (error != GRPC_ERROR_NONE) goto done;
batch->payload->send_initial_metadata.send_initial_metadata->Set(
grpc_core::TeMetadata(), grpc_core::TeMetadata::kTrailers);
error = grpc_metadata_batch_add_tail(
batch->payload->send_initial_metadata.send_initial_metadata,
&calld->te_trailers, GRPC_MDELEM_TE_TRAILERS, GRPC_BATCH_TE);
if (error != GRPC_ERROR_NONE) goto done;
error = grpc_metadata_batch_add_tail(
batch->payload->send_initial_metadata.send_initial_metadata,
&calld->content_type, GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC,

@ -193,17 +193,20 @@ static grpc_error_handle hs_filter_incoming_metadata(grpc_call_element* elem,
GRPC_ERROR_STR_KEY, ":method"));
}
auto te = b->Take(grpc_core::TeMetadata());
if (te == grpc_core::TeMetadata::kTrailers) {
// Do nothing, ok.
} else if (!te.has_value()) {
if (b->legacy_index()->named.te != nullptr) {
if (!grpc_mdelem_static_value_eq(b->legacy_index()->named.te->md,
GRPC_MDELEM_TE_TRAILERS)) {
hs_add_error(error_name, &error,
grpc_attach_md_to_error(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Bad header"),
b->legacy_index()->named.te->md));
}
b->Remove(GRPC_BATCH_TE);
} else {
hs_add_error(error_name, &error,
grpc_error_set_str(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Missing header"),
GRPC_ERROR_STR_KEY, "te"));
} else {
hs_add_error(error_name, &error,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Bad te header"));
}
if (b->legacy_index()->named.scheme != nullptr) {

@ -118,11 +118,21 @@ static void set_pollset_set(grpc_transport*, grpc_stream*, grpc_pollset_set*) {
gpr_log(GPR_INFO, __func__);
}
static void AssignMetadata(grpc_metadata_batch* mb,
static void AssignMetadata(grpc_metadata_batch* mb, grpc_core::Arena* arena,
const grpc_binder::Metadata& md) {
mb->Clear();
for (auto& p : md) {
mb->Append(p.first, grpc_slice_from_cpp_string(p.second));
grpc_linked_mdelem* glm = static_cast<grpc_linked_mdelem*>(
arena->Alloc(sizeof(grpc_linked_mdelem)));
memset(glm, 0, sizeof(grpc_linked_mdelem));
grpc_slice key = grpc_slice_from_cpp_string(p.first);
grpc_slice value = grpc_slice_from_cpp_string(p.second);
glm->md = grpc_mdelem_from_slices(grpc_slice_intern(key),
grpc_slice_intern(value));
// Unref here to prevent memory leak
grpc_slice_unref_internal(key);
grpc_slice_unref_internal(value);
GPR_ASSERT(mb->LinkTail(glm) == GRPC_ERROR_NONE);
}
}
@ -200,7 +210,8 @@ static void recv_initial_metadata_locked(void* arg,
"Missing :authority or :path in initial metadata");
}
}
AssignMetadata(gbs->recv_initial_metadata, *args->initial_metadata);
AssignMetadata(gbs->recv_initial_metadata, gbs->arena,
*args->initial_metadata);
return GRPC_ERROR_NONE;
}();
@ -282,7 +293,8 @@ static void recv_trailing_metadata_locked(void* arg,
return GRPC_ERROR_CANCELLED;
}
} else {
AssignMetadata(gbs->recv_trailing_metadata, *args->trailing_metadata);
AssignMetadata(gbs->recv_trailing_metadata, gbs->arena,
*args->trailing_metadata);
// Append status to metadata
// TODO(b/192208695): See if we can avoid to manually put status
// code into the header

@ -265,22 +265,6 @@ class StringValue {
VarintWriter<1> len_val_;
};
class NonBinaryStringValue {
public:
explicit NonBinaryStringValue(const grpc_slice& value)
: value_(value), len_val_(GRPC_SLICE_LENGTH(value)) {}
size_t prefix_length() const { return len_val_.length(); }
void WritePrefix(uint8_t* prefix_data) { len_val_.Write(0x00, prefix_data); }
const grpc_slice& data() { return value_; }
private:
grpc_slice value_;
VarintWriter<1> len_val_;
};
class StringKey {
public:
explicit StringKey(grpc_slice key)
@ -333,18 +317,6 @@ void HPackCompressor::Framer::EmitLitHdrWithStringKeyIncIdx(grpc_mdelem elem) {
Add(emit.data());
}
void HPackCompressor::Framer::EmitLitHdrWithNonBinaryStringKeyIncIdx(
const grpc_slice& key_slice, const grpc_slice& value_slice) {
GRPC_STATS_INC_HPACK_SEND_LITHDR_INCIDX_V();
GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED();
StringKey key(key_slice);
key.WritePrefix(0x40, AddTiny(key.prefix_length()));
Add(grpc_slice_ref_internal(key.key()));
NonBinaryStringValue emit(value_slice);
emit.WritePrefix(AddTiny(emit.prefix_length()));
Add(grpc_slice_ref_internal(emit.data()));
}
void HPackCompressor::Framer::EmitLitHdrWithStringKeyNotIdx(grpc_mdelem elem) {
GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX_V();
GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED();
@ -476,17 +448,6 @@ void HPackCompressor::Framer::EncodeDynamic(grpc_mdelem elem) {
}
}
void HPackCompressor::Framer::Encode(TeMetadata, TeMetadata::ValueType value) {
GPR_ASSERT(value == TeMetadata::ValueType::kTrailers);
if (compressor_->table_.ConvertableToDynamicIndex(compressor_->te_index_)) {
EmitIndexed(compressor_->table_.DynamicIndex(compressor_->te_index_));
} else {
compressor_->te_index_ = compressor_->table_.AllocateIndex(
2 /* te */ + 8 /* trailers */ + hpack_constants::kEntryOverhead);
EmitLitHdrWithNonBinaryStringKeyIncIdx(GRPC_MDSTR_TE, GRPC_MDSTR_TRAILERS);
}
}
void HPackCompressor::Framer::Encode(GrpcTimeoutMetadata,
grpc_millis deadline) {
char timeout_str[GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE];

@ -118,7 +118,6 @@ class HPackCompressor {
void Encode(grpc_mdelem md);
void Encode(GrpcTimeoutMetadata, grpc_millis deadline);
void Encode(TeMetadata, TeMetadata::ValueType value);
private:
struct FramePrefix {
@ -141,8 +140,6 @@ class HPackCompressor {
void EmitLitHdrIncIdx(uint32_t key_index, grpc_mdelem elem);
void EmitLitHdrNotIdx(uint32_t key_index, grpc_mdelem elem);
void EmitLitHdrWithStringKeyIncIdx(grpc_mdelem elem);
void EmitLitHdrWithNonBinaryStringKeyIncIdx(const grpc_slice& key_slice,
const grpc_slice& value_slice);
void EmitLitHdrWithStringKeyNotIdx(grpc_mdelem elem);
size_t CurrentFrameSize() const;
@ -190,7 +187,7 @@ class HPackCompressor {
// a new literal should be added to the compression table or not.
// They track a single integer that counts how often a particular value has
// been seen. When that count reaches max (255), all values are halved.
PopularityCount<kNumFilterValues> filter_elems_;
grpc_core::PopularityCount<kNumFilterValues> filter_elems_;
class KeyElem {
public:
@ -267,9 +264,8 @@ class HPackCompressor {
// entry tables for keys & elems: these tables track values that have been
// seen and *may* be in the decompressor table
HPackEncoderIndex<KeyElem, kNumFilterValues> elem_index_;
HPackEncoderIndex<KeySliceRef, kNumFilterValues> key_index_;
uint32_t te_index_ = 0;
grpc_core::HPackEncoderIndex<KeyElem, kNumFilterValues> elem_index_;
grpc_core::HPackEncoderIndex<KeySliceRef, kNumFilterValues> key_index_;
};
} // namespace grpc_core

@ -408,8 +408,10 @@ static void convert_cronet_array_to_metadata(
for (size_t i = 0; i < header_array->count; i++) {
CRONET_LOG(GPR_DEBUG, "header key=%s, value=%s",
header_array->headers[i].key, header_array->headers[i].value);
grpc_slice key = grpc_slice_intern(
grpc_slice_from_static_string(header_array->headers[i].key));
grpc_slice value;
if (absl::EndsWith(header_array->headers[i].key, "-bin")) {
if (grpc_is_refcounted_slice_binary_header(key)) {
value = grpc_slice_from_static_string(header_array->headers[i].value);
value = grpc_slice_intern(grpc_chttp2_base64_decode_with_length(
value, grpc_chttp2_base64_infer_length_after_decode(value)));
@ -417,7 +419,8 @@ static void convert_cronet_array_to_metadata(
value = grpc_slice_intern(
grpc_slice_from_static_string(header_array->headers[i].value));
}
mds->Append(header_array->headers[i].key, value);
GRPC_LOG_IF_ERROR("convert_cronet_array_to_metadata",
mds->Append(grpc_mdelem_from_slices(key, value)));
}
}
@ -692,39 +695,29 @@ static void create_grpc_frame(grpc_slice_buffer* write_slice_buffer,
}
}
namespace {
class CronetMetadataEncoder {
public:
explicit CronetMetadataEncoder(bidirectional_stream_header** pp_headers,
size_t* p_count, const char* host,
size_t capacity, const char** method,
std::string* url)
: host_(host),
capacity_(capacity),
count_(*p_count),
headers_(*pp_headers),
method_(method),
url_(url) {
count_ = 0;
headers_ = static_cast<bidirectional_stream_header*>(
gpr_malloc(sizeof(bidirectional_stream_header) * capacity_));
}
~CronetMetadataEncoder() { gpr_free(headers_); }
CronetMetadataEncoder(const CronetMetadataEncoder&) = delete;
CronetMetadataEncoder& operator=(const CronetMetadataEncoder&) = delete;
template <class T, class V>
void Encode(T, V value) {
auto value_slice = T::Encode(value);
auto key_slice = grpc_slice_from_static_string(T::key());
auto mdelem = grpc_mdelem_from_slices(key_slice, value_slice);
Encode(mdelem);
GRPC_MDELEM_UNREF(mdelem);
}
void Encode(grpc_mdelem mdelem) {
/*
Convert metadata in a format that Cronet can consume
*/
static void convert_metadata_to_cronet_headers(
grpc_metadata_batch* metadata, const char* host, std::string* pp_url,
bidirectional_stream_header** pp_headers, size_t* p_num_headers,
const char** method) {
/* Get number of header fields */
size_t num_headers_available = metadata->count();
/* Allocate enough memory. It is freed in the on_stream_ready callback
*/
bidirectional_stream_header* headers =
static_cast<bidirectional_stream_header*>(gpr_malloc(
sizeof(bidirectional_stream_header) * num_headers_available));
*pp_headers = headers;
/* Walk the linked list again, this time copying the header fields.
s->num_headers can be less than num_headers_available, as some headers
are not used for cronet.
TODO (makdharma): Eliminate need to traverse the LL second time for perf.
*/
size_t num_headers = 0;
metadata->ForEach([&](grpc_mdelem mdelem) {
char* key = grpc_slice_to_c_string(GRPC_MDKEY(mdelem));
char* value;
if (grpc_is_binary_header_internal(GRPC_MDKEY(mdelem))) {
@ -744,10 +737,10 @@ class CronetMetadataEncoder {
}
if (grpc_slice_eq_static_interned(GRPC_MDKEY(mdelem), GRPC_MDSTR_METHOD)) {
if (grpc_slice_eq_static_interned(GRPC_MDVALUE(mdelem), GRPC_MDSTR_PUT)) {
*method_ = "PUT";
*method = "PUT";
} else {
/* POST method in default*/
*method_ = "POST";
*method = "POST";
}
gpr_free(key);
gpr_free(value);
@ -755,38 +748,29 @@ class CronetMetadataEncoder {
}
if (grpc_slice_eq_static_interned(GRPC_MDKEY(mdelem), GRPC_MDSTR_PATH)) {
/* Create URL by appending :path value to the hostname */
*url_ = absl::StrCat("https://", host_, value);
*pp_url = absl::StrCat("https://", host, value);
gpr_free(key);
gpr_free(value);
return;
}
CRONET_LOG(GPR_DEBUG, "header %s = %s", key, value);
GPR_ASSERT(count_ < capacity_);
headers_[count_].key = key;
headers_[count_].value = value;
++count_;
}
private:
const char* host_;
size_t capacity_;
size_t& count_;
bidirectional_stream_header*& headers_;
const char** method_;
std::string* url_;
};
} // namespace
headers[num_headers].key = key;
headers[num_headers].value = value;
num_headers++;
});
if (metadata->deadline() != GRPC_MILLIS_INF_FUTURE) {
char* key = grpc_slice_to_c_string(GRPC_MDSTR_GRPC_TIMEOUT);
char* value =
static_cast<char*>(gpr_malloc(GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE));
grpc_http2_encode_timeout(
metadata->deadline() - grpc_core::ExecCtx::Get()->Now(), value);
headers[num_headers].key = key;
headers[num_headers].value = value;
/*
Convert metadata in a format that Cronet can consume
*/
static void convert_metadata_to_cronet_headers(
grpc_metadata_batch* metadata, const char* host, std::string* pp_url,
bidirectional_stream_header** pp_headers, size_t* p_num_headers,
const char** method) {
CronetMetadataEncoder encoder(pp_headers, p_num_headers, host,
metadata->count(), method, pp_url);
metadata->Encode(&encoder);
num_headers++;
}
*p_num_headers = num_headers;
}
static void parse_grpc_header(const uint8_t* data, int* length,

@ -57,7 +57,8 @@ void maybe_process_ops_locked(inproc_stream* s, grpc_error_handle error);
void op_state_machine_locked(inproc_stream* s, grpc_error_handle error);
void log_metadata(const grpc_metadata_batch* md_batch, bool is_client,
bool is_initial);
void fill_in_metadata(inproc_stream* s, const grpc_metadata_batch* metadata,
grpc_error_handle fill_in_metadata(inproc_stream* s,
const grpc_metadata_batch* metadata,
uint32_t flags, grpc_metadata_batch* out_md,
uint32_t* outflags, bool* markfilled);
@ -289,7 +290,8 @@ void log_metadata(const grpc_metadata_batch* md_batch, bool is_client,
});
}
void fill_in_metadata(inproc_stream* s, const grpc_metadata_batch* metadata,
grpc_error_handle fill_in_metadata(inproc_stream* s,
const grpc_metadata_batch* metadata,
uint32_t flags, grpc_metadata_batch* out_md,
uint32_t* outflags, bool* markfilled) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_inproc_trace)) {
@ -302,7 +304,17 @@ void fill_in_metadata(inproc_stream* s, const grpc_metadata_batch* metadata,
if (markfilled != nullptr) {
*markfilled = true;
}
grpc_metadata_batch_copy(metadata, out_md);
grpc_error_handle error = GRPC_ERROR_NONE;
metadata->ForEach([&](grpc_mdelem md) {
if (error != GRPC_ERROR_NONE) return;
grpc_linked_mdelem* nelem =
static_cast<grpc_linked_mdelem*>(s->arena->Alloc(sizeof(*nelem)));
nelem->md = grpc_mdelem_from_slices(grpc_slice_intern(GRPC_MDKEY(md)),
grpc_slice_intern(GRPC_MDVALUE(md)));
error = out_md->LinkTail(nelem);
});
return error;
}
int init_stream(grpc_transport* gt, grpc_stream* gs,
@ -678,7 +690,7 @@ void op_state_machine_locked(inproc_stream* s, grpc_error_handle error) {
if (s->to_read_initial_md_filled) {
s->initial_md_recvd = true;
fill_in_metadata(
new_err = fill_in_metadata(
s, &s->to_read_initial_md, s->to_read_initial_md_flags,
s->recv_initial_md_op->payload->recv_initial_metadata
.recv_initial_metadata,
@ -697,15 +709,26 @@ void op_state_machine_locked(inproc_stream* s, grpc_error_handle error) {
}
s->to_read_initial_md.Clear();
s->to_read_initial_md_filled = false;
INPROC_LOG(GPR_INFO,
"op_state_machine %p scheduling initial-metadata-ready %s", s,
grpc_error_std_string(new_err).c_str());
grpc_core::ExecCtx::Run(
DEBUG_LOCATION,
s->recv_initial_md_op->payload->recv_initial_metadata
.recv_initial_metadata_ready,
GRPC_ERROR_NONE);
GRPC_ERROR_REF(new_err));
complete_if_batch_end_locked(
s, GRPC_ERROR_NONE, s->recv_initial_md_op,
s, new_err, s->recv_initial_md_op,
"op_state_machine scheduling recv-initial-metadata-on-complete");
s->recv_initial_md_op = nullptr;
if (new_err != GRPC_ERROR_NONE) {
INPROC_LOG(GPR_INFO,
"op_state_machine %p scheduling on_complete errors2 %s", s,
grpc_error_std_string(new_err).c_str());
fail_helper_locked(s, GRPC_ERROR_REF(new_err));
goto done;
}
}
}
if (s->recv_message_op) {
@ -763,9 +786,10 @@ void op_state_machine_locked(inproc_stream* s, grpc_error_handle error) {
if (s->recv_trailing_md_op != nullptr) {
// We wanted trailing metadata and we got it
s->trailing_md_recvd = true;
new_err =
fill_in_metadata(s, &s->to_read_trailing_md, 0,
s->recv_trailing_md_op->payload->recv_trailing_metadata
.recv_trailing_metadata,
s->recv_trailing_md_op->payload
->recv_trailing_metadata.recv_trailing_metadata,
nullptr, nullptr);
s->to_read_trailing_md.Clear();
s->to_read_trailing_md_filled = false;
@ -776,16 +800,24 @@ void op_state_machine_locked(inproc_stream* s, grpc_error_handle error) {
// (If the server hasn't already sent its trailing md, it doesn't have
// a final status, so don't mark this op complete)
if (s->t->is_client || s->trailing_md_sent) {
INPROC_LOG(GPR_INFO,
"op_state_machine %p scheduling trailing-md-on-complete %s",
s, grpc_error_std_string(new_err).c_str());
grpc_core::ExecCtx::Run(
DEBUG_LOCATION,
s->recv_trailing_md_op->payload->recv_trailing_metadata
.recv_trailing_metadata_ready,
GRPC_ERROR_NONE);
GRPC_ERROR_REF(new_err));
grpc_core::ExecCtx::Run(DEBUG_LOCATION,
s->recv_trailing_md_op->on_complete,
GRPC_ERROR_NONE);
GRPC_ERROR_REF(new_err));
s->recv_trailing_md_op = nullptr;
needs_close = s->trailing_md_sent;
} else {
INPROC_LOG(GPR_INFO,
"op_state_machine %p server needs to delay handling "
"trailing-md-on-complete %s",
s, grpc_error_std_string(new_err).c_str());
}
} else if (!s->trailing_md_recvd) {
INPROC_LOG(

@ -32,97 +32,97 @@ namespace grpc_core {
const uint8_t g_static_metadata_bytes[] = {
58, 112, 97, 116, 104, 58, 109, 101, 116, 104, 111, 100, 58, 115, 116,
97, 116, 117, 115, 58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 58,
115, 99, 104, 101, 109, 101, 103, 114, 112, 99, 45, 109, 101, 115, 115,
97, 103, 101, 103, 114, 112, 99, 45, 115, 116, 97, 116, 117, 115, 103,
114, 112, 99, 45, 112, 97, 121, 108, 111, 97, 100, 45, 98, 105, 110,
103, 114, 112, 99, 45, 101, 110, 99, 111, 100, 105, 110, 103, 103, 114,
112, 99, 45, 97, 99, 99, 101, 112, 116, 45, 101, 110, 99, 111, 100,
105, 110, 103, 103, 114, 112, 99, 45, 115, 101, 114, 118, 101, 114, 45,
115, 116, 97, 116, 115, 45, 98, 105, 110, 103, 114, 112, 99, 45, 116,
97, 103, 115, 45, 98, 105, 110, 103, 114, 112, 99, 45, 116, 114, 97,
99, 101, 45, 98, 105, 110, 99, 111, 110, 116, 101, 110, 116, 45, 116,
121, 112, 101, 99, 111, 110, 116, 101, 110, 116, 45, 101, 110, 99, 111,
100, 105, 110, 103, 97, 99, 99, 101, 112, 116, 45, 101, 110, 99, 111,
100, 105, 110, 103, 103, 114, 112, 99, 45, 105, 110, 116, 101, 114, 110,
97, 108, 45, 101, 110, 99, 111, 100, 105, 110, 103, 45, 114, 101, 113,
117, 101, 115, 116, 103, 114, 112, 99, 45, 105, 110, 116, 101, 114, 110,
97, 108, 45, 115, 116, 114, 101, 97, 109, 45, 101, 110, 99, 111, 100,
105, 110, 103, 45, 114, 101, 113, 117, 101, 115, 116, 117, 115, 101, 114,
45, 97, 103, 101, 110, 116, 104, 111, 115, 116, 103, 114, 112, 99, 45,
112, 114, 101, 118, 105, 111, 117, 115, 45, 114, 112, 99, 45, 97, 116,
116, 101, 109, 112, 116, 115, 103, 114, 112, 99, 45, 114, 101, 116, 114,
121, 45, 112, 117, 115, 104, 98, 97, 99, 107, 45, 109, 115, 120, 45,
101, 110, 100, 112, 111, 105, 110, 116, 45, 108, 111, 97, 100, 45, 109,
101, 116, 114, 105, 99, 115, 45, 98, 105, 110, 103, 114, 112, 99, 45,
116, 105, 109, 101, 111, 117, 116, 49, 50, 51, 52, 103, 114, 112, 99,
46, 119, 97, 105, 116, 95, 102, 111, 114, 95, 114, 101, 97, 100, 121,
103, 114, 112, 99, 46, 116, 105, 109, 101, 111, 117, 116, 103, 114, 112,
99, 46, 109, 97, 120, 95, 114, 101, 113, 117, 101, 115, 116, 95, 109,
101, 115, 115, 97, 103, 101, 95, 98, 121, 116, 101, 115, 103, 114, 112,
99, 46, 109, 97, 120, 95, 114, 101, 115, 112, 111, 110, 115, 101, 95,
109, 101, 115, 115, 97, 103, 101, 95, 98, 121, 116, 101, 115, 47, 103,
114, 112, 99, 46, 108, 98, 46, 118, 49, 46, 76, 111, 97, 100, 66,
97, 108, 97, 110, 99, 101, 114, 47, 66, 97, 108, 97, 110, 99, 101,
76, 111, 97, 100, 47, 101, 110, 118, 111, 121, 46, 115, 101, 114, 118,
105, 99, 101, 46, 108, 111, 97, 100, 95, 115, 116, 97, 116, 115, 46,
118, 50, 46, 76, 111, 97, 100, 82, 101, 112, 111, 114, 116, 105, 110,
103, 83, 101, 114, 118, 105, 99, 101, 47, 83, 116, 114, 101, 97, 109,
76, 111, 97, 100, 83, 116, 97, 116, 115, 47, 101, 110, 118, 111, 121,
46, 115, 101, 114, 118, 105, 99, 101, 46, 108, 111, 97, 100, 95, 115,
116, 97, 116, 115, 46, 118, 51, 46, 76, 111, 97, 100, 82, 101, 112,
111, 114, 116, 105, 110, 103, 83, 101, 114, 118, 105, 99, 101, 47, 83,
116, 114, 101, 97, 109, 76, 111, 97, 100, 83, 116, 97, 116, 115, 47,
103, 114, 112, 99, 46, 104, 101, 97, 108, 116, 104, 46, 118, 49, 46,
72, 101, 97, 108, 116, 104, 47, 87, 97, 116, 99, 104, 47, 101, 110,
118, 111, 121, 46, 115, 101, 114, 118, 105, 99, 101, 46, 100, 105, 115,
99, 111, 118, 101, 114, 121, 46, 118, 50, 46, 65, 103, 103, 114, 101,
103, 97, 116, 101, 100, 68, 105, 115, 99, 111, 118, 101, 114, 121, 83,
101, 114, 118, 105, 99, 101, 47, 83, 116, 114, 101, 97, 109, 65, 103,
103, 114, 101, 103, 97, 116, 101, 100, 82, 101, 115, 111, 117, 114, 99,
101, 115, 47, 101, 110, 118, 111, 121, 46, 115, 101, 114, 118, 105, 99,
101, 46, 100, 105, 115, 99, 111, 118, 101, 114, 121, 46, 118, 51, 46,
65, 103, 103, 114, 101, 103, 97, 116, 101, 100, 68, 105, 115, 99, 111,
118, 101, 114, 121, 83, 101, 114, 118, 105, 99, 101, 47, 83, 116, 114,
101, 97, 109, 65, 103, 103, 114, 101, 103, 97, 116, 101, 100, 82, 101,
115, 111, 117, 114, 99, 101, 115, 100, 101, 102, 108, 97, 116, 101, 103,
122, 105, 112, 115, 116, 114, 101, 97, 109, 47, 103, 122, 105, 112, 116,
101, 116, 114, 97, 105, 108, 101, 114, 115, 71, 69, 84, 80, 79, 83,
84, 47, 47, 105, 110, 100, 101, 120, 46, 104, 116, 109, 108, 104, 116,
116, 112, 104, 116, 116, 112, 115, 50, 48, 48, 50, 48, 52, 50, 48,
54, 51, 48, 52, 52, 48, 48, 52, 48, 52, 53, 48, 48, 97, 99,
99, 101, 112, 116, 45, 99, 104, 97, 114, 115, 101, 116, 103, 122, 105,
112, 44, 32, 100, 101, 102, 108, 97, 116, 101, 97, 99, 99, 101, 112,
116, 45, 108, 97, 110, 103, 117, 97, 103, 101, 97, 99, 99, 101, 112,
116, 45, 114, 97, 110, 103, 101, 115, 97, 99, 99, 101, 112, 116, 97,
99, 99, 101, 115, 115, 45, 99, 111, 110, 116, 114, 111, 108, 45, 97,
108, 108, 111, 119, 45, 111, 114, 105, 103, 105, 110, 97, 103, 101, 97,
108, 108, 111, 119, 97, 117, 116, 104, 111, 114, 105, 122, 97, 116, 105,
111, 110, 99, 97, 99, 104, 101, 45, 99, 111, 110, 116, 114, 111, 108,
99, 111, 110, 116, 101, 110, 116, 45, 100, 105, 115, 112, 111, 115, 105,
116, 105, 111, 110, 99, 111, 110, 116, 101, 110, 116, 45, 108, 97, 110,
103, 117, 97, 103, 101, 99, 111, 110, 116, 101, 110, 116, 45, 108, 101,
110, 103, 116, 104, 99, 111, 110, 116, 101, 110, 116, 45, 108, 111, 99,
97, 116, 105, 111, 110, 99, 111, 110, 116, 101, 110, 116, 45, 114, 97,
110, 103, 101, 99, 111, 111, 107, 105, 101, 100, 97, 116, 101, 101, 116,
97, 103, 101, 120, 112, 101, 99, 116, 101, 120, 112, 105, 114, 101, 115,
102, 114, 111, 109, 105, 102, 45, 109, 97, 116, 99, 104, 105, 102, 45,
109, 111, 100, 105, 102, 105, 101, 100, 45, 115, 105, 110, 99, 101, 105,
102, 45, 110, 111, 110, 101, 45, 109, 97, 116, 99, 104, 105, 102, 45,
114, 97, 110, 103, 101, 105, 102, 45, 117, 110, 109, 111, 100, 105, 102,
105, 101, 100, 45, 115, 105, 110, 99, 101, 108, 97, 115, 116, 45, 109,
111, 100, 105, 102, 105, 101, 100, 108, 105, 110, 107, 108, 111, 99, 97,
116, 105, 111, 110, 109, 97, 120, 45, 102, 111, 114, 119, 97, 114, 100,
115, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, 101, 110, 116, 105,
99, 97, 116, 101, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, 111,
114, 105, 122, 97, 116, 105, 111, 110, 114, 97, 110, 103, 101, 114, 101,
102, 101, 114, 101, 114, 114, 101, 102, 114, 101, 115, 104, 114, 101, 116,
114, 121, 45, 97, 102, 116, 101, 114, 115, 101, 114, 118, 101, 114, 115,
101, 116, 45, 99, 111, 111, 107, 105, 101, 115, 116, 114, 105, 99, 116,
45, 116, 114, 97, 110, 115, 112, 111, 114, 116, 45, 115, 101, 99, 117,
114, 105, 116, 121, 116, 114, 97, 110, 115, 102, 101, 114, 45, 101, 110,
99, 111, 100, 105, 110, 103, 118, 97, 114, 121, 118, 105, 97, 119, 119,
119, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 48,
105, 100, 101, 110, 116, 105, 116, 121, 97, 112, 112, 108, 105, 99, 97,
115, 99, 104, 101, 109, 101, 116, 101, 103, 114, 112, 99, 45, 109, 101,
115, 115, 97, 103, 101, 103, 114, 112, 99, 45, 115, 116, 97, 116, 117,
115, 103, 114, 112, 99, 45, 112, 97, 121, 108, 111, 97, 100, 45, 98,
105, 110, 103, 114, 112, 99, 45, 101, 110, 99, 111, 100, 105, 110, 103,
103, 114, 112, 99, 45, 97, 99, 99, 101, 112, 116, 45, 101, 110, 99,
111, 100, 105, 110, 103, 103, 114, 112, 99, 45, 115, 101, 114, 118, 101,
114, 45, 115, 116, 97, 116, 115, 45, 98, 105, 110, 103, 114, 112, 99,
45, 116, 97, 103, 115, 45, 98, 105, 110, 103, 114, 112, 99, 45, 116,
114, 97, 99, 101, 45, 98, 105, 110, 99, 111, 110, 116, 101, 110, 116,
45, 116, 121, 112, 101, 99, 111, 110, 116, 101, 110, 116, 45, 101, 110,
99, 111, 100, 105, 110, 103, 97, 99, 99, 101, 112, 116, 45, 101, 110,
99, 111, 100, 105, 110, 103, 103, 114, 112, 99, 45, 105, 110, 116, 101,
114, 110, 97, 108, 45, 101, 110, 99, 111, 100, 105, 110, 103, 45, 114,
101, 113, 117, 101, 115, 116, 103, 114, 112, 99, 45, 105, 110, 116, 101,
114, 110, 97, 108, 45, 115, 116, 114, 101, 97, 109, 45, 101, 110, 99,
111, 100, 105, 110, 103, 45, 114, 101, 113, 117, 101, 115, 116, 117, 115,
101, 114, 45, 97, 103, 101, 110, 116, 104, 111, 115, 116, 103, 114, 112,
99, 45, 112, 114, 101, 118, 105, 111, 117, 115, 45, 114, 112, 99, 45,
97, 116, 116, 101, 109, 112, 116, 115, 103, 114, 112, 99, 45, 114, 101,
116, 114, 121, 45, 112, 117, 115, 104, 98, 97, 99, 107, 45, 109, 115,
120, 45, 101, 110, 100, 112, 111, 105, 110, 116, 45, 108, 111, 97, 100,
45, 109, 101, 116, 114, 105, 99, 115, 45, 98, 105, 110, 103, 114, 112,
99, 45, 116, 105, 109, 101, 111, 117, 116, 49, 50, 51, 52, 103, 114,
112, 99, 46, 119, 97, 105, 116, 95, 102, 111, 114, 95, 114, 101, 97,
100, 121, 103, 114, 112, 99, 46, 116, 105, 109, 101, 111, 117, 116, 103,
114, 112, 99, 46, 109, 97, 120, 95, 114, 101, 113, 117, 101, 115, 116,
95, 109, 101, 115, 115, 97, 103, 101, 95, 98, 121, 116, 101, 115, 103,
114, 112, 99, 46, 109, 97, 120, 95, 114, 101, 115, 112, 111, 110, 115,
101, 95, 109, 101, 115, 115, 97, 103, 101, 95, 98, 121, 116, 101, 115,
47, 103, 114, 112, 99, 46, 108, 98, 46, 118, 49, 46, 76, 111, 97,
100, 66, 97, 108, 97, 110, 99, 101, 114, 47, 66, 97, 108, 97, 110,
99, 101, 76, 111, 97, 100, 47, 101, 110, 118, 111, 121, 46, 115, 101,
114, 118, 105, 99, 101, 46, 108, 111, 97, 100, 95, 115, 116, 97, 116,
115, 46, 118, 50, 46, 76, 111, 97, 100, 82, 101, 112, 111, 114, 116,
105, 110, 103, 83, 101, 114, 118, 105, 99, 101, 47, 83, 116, 114, 101,
97, 109, 76, 111, 97, 100, 83, 116, 97, 116, 115, 47, 101, 110, 118,
111, 121, 46, 115, 101, 114, 118, 105, 99, 101, 46, 108, 111, 97, 100,
95, 115, 116, 97, 116, 115, 46, 118, 51, 46, 76, 111, 97, 100, 82,
101, 112, 111, 114, 116, 105, 110, 103, 83, 101, 114, 118, 105, 99, 101,
47, 83, 116, 114, 101, 97, 109, 76, 111, 97, 100, 83, 116, 97, 116,
115, 47, 103, 114, 112, 99, 46, 104, 101, 97, 108, 116, 104, 46, 118,
49, 46, 72, 101, 97, 108, 116, 104, 47, 87, 97, 116, 99, 104, 47,
101, 110, 118, 111, 121, 46, 115, 101, 114, 118, 105, 99, 101, 46, 100,
105, 115, 99, 111, 118, 101, 114, 121, 46, 118, 50, 46, 65, 103, 103,
114, 101, 103, 97, 116, 101, 100, 68, 105, 115, 99, 111, 118, 101, 114,
121, 83, 101, 114, 118, 105, 99, 101, 47, 83, 116, 114, 101, 97, 109,
65, 103, 103, 114, 101, 103, 97, 116, 101, 100, 82, 101, 115, 111, 117,
114, 99, 101, 115, 47, 101, 110, 118, 111, 121, 46, 115, 101, 114, 118,
105, 99, 101, 46, 100, 105, 115, 99, 111, 118, 101, 114, 121, 46, 118,
51, 46, 65, 103, 103, 114, 101, 103, 97, 116, 101, 100, 68, 105, 115,
99, 111, 118, 101, 114, 121, 83, 101, 114, 118, 105, 99, 101, 47, 83,
116, 114, 101, 97, 109, 65, 103, 103, 114, 101, 103, 97, 116, 101, 100,
82, 101, 115, 111, 117, 114, 99, 101, 115, 100, 101, 102, 108, 97, 116,
101, 103, 122, 105, 112, 115, 116, 114, 101, 97, 109, 47, 103, 122, 105,
112, 71, 69, 84, 80, 79, 83, 84, 47, 47, 105, 110, 100, 101, 120,
46, 104, 116, 109, 108, 104, 116, 116, 112, 104, 116, 116, 112, 115, 50,
48, 48, 50, 48, 52, 50, 48, 54, 51, 48, 52, 52, 48, 48, 52,
48, 52, 53, 48, 48, 97, 99, 99, 101, 112, 116, 45, 99, 104, 97,
114, 115, 101, 116, 103, 122, 105, 112, 44, 32, 100, 101, 102, 108, 97,
116, 101, 97, 99, 99, 101, 112, 116, 45, 108, 97, 110, 103, 117, 97,
103, 101, 97, 99, 99, 101, 112, 116, 45, 114, 97, 110, 103, 101, 115,
97, 99, 99, 101, 112, 116, 97, 99, 99, 101, 115, 115, 45, 99, 111,
110, 116, 114, 111, 108, 45, 97, 108, 108, 111, 119, 45, 111, 114, 105,
103, 105, 110, 97, 103, 101, 97, 108, 108, 111, 119, 97, 117, 116, 104,
111, 114, 105, 122, 97, 116, 105, 111, 110, 99, 97, 99, 104, 101, 45,
99, 111, 110, 116, 114, 111, 108, 99, 111, 110, 116, 101, 110, 116, 45,
100, 105, 115, 112, 111, 115, 105, 116, 105, 111, 110, 99, 111, 110, 116,
101, 110, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, 99, 111, 110,
116, 101, 110, 116, 45, 108, 101, 110, 103, 116, 104, 99, 111, 110, 116,
101, 110, 116, 45, 108, 111, 99, 97, 116, 105, 111, 110, 99, 111, 110,
116, 101, 110, 116, 45, 114, 97, 110, 103, 101, 99, 111, 111, 107, 105,
101, 100, 97, 116, 101, 101, 116, 97, 103, 101, 120, 112, 101, 99, 116,
101, 120, 112, 105, 114, 101, 115, 102, 114, 111, 109, 105, 102, 45, 109,
97, 116, 99, 104, 105, 102, 45, 109, 111, 100, 105, 102, 105, 101, 100,
45, 115, 105, 110, 99, 101, 105, 102, 45, 110, 111, 110, 101, 45, 109,
97, 116, 99, 104, 105, 102, 45, 114, 97, 110, 103, 101, 105, 102, 45,
117, 110, 109, 111, 100, 105, 102, 105, 101, 100, 45, 115, 105, 110, 99,
101, 108, 97, 115, 116, 45, 109, 111, 100, 105, 102, 105, 101, 100, 108,
105, 110, 107, 108, 111, 99, 97, 116, 105, 111, 110, 109, 97, 120, 45,
102, 111, 114, 119, 97, 114, 100, 115, 112, 114, 111, 120, 121, 45, 97,
117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 112, 114, 111, 120,
121, 45, 97, 117, 116, 104, 111, 114, 105, 122, 97, 116, 105, 111, 110,
114, 97, 110, 103, 101, 114, 101, 102, 101, 114, 101, 114, 114, 101, 102,
114, 101, 115, 104, 114, 101, 116, 114, 121, 45, 97, 102, 116, 101, 114,
115, 101, 114, 118, 101, 114, 115, 101, 116, 45, 99, 111, 111, 107, 105,
101, 115, 116, 114, 105, 99, 116, 45, 116, 114, 97, 110, 115, 112, 111,
114, 116, 45, 115, 101, 99, 117, 114, 105, 116, 121, 116, 114, 97, 110,
115, 102, 101, 114, 45, 101, 110, 99, 111, 100, 105, 110, 103, 118, 97,
114, 121, 118, 105, 97, 119, 119, 119, 45, 97, 117, 116, 104, 101, 110,
116, 105, 99, 97, 116, 101, 48, 105, 100, 101, 110, 116, 105, 116, 121,
116, 114, 97, 105, 108, 101, 114, 115, 97, 112, 112, 108, 105, 99, 97,
116, 105, 111, 110, 47, 103, 114, 112, 99, 103, 114, 112, 99, 80, 85,
84, 108, 98, 45, 99, 111, 115, 116, 45, 98, 105, 110, 105, 100, 101,
110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 105, 100,
@ -211,293 +211,293 @@ const StaticMetadataSlice
&g_static_metadata_slice_refcounts[4].base, 7,
g_static_metadata_bytes + 29),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[5].base, 12,
&g_static_metadata_slice_refcounts[5].base, 2,
g_static_metadata_bytes + 36),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[6].base, 11,
g_static_metadata_bytes + 48),
&g_static_metadata_slice_refcounts[6].base, 12,
g_static_metadata_bytes + 38),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[7].base, 16,
g_static_metadata_bytes + 59),
&g_static_metadata_slice_refcounts[7].base, 11,
g_static_metadata_bytes + 50),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[8].base, 13,
g_static_metadata_bytes + 75),
&g_static_metadata_slice_refcounts[8].base, 16,
g_static_metadata_bytes + 61),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[9].base, 20,
g_static_metadata_bytes + 88),
&g_static_metadata_slice_refcounts[9].base, 13,
g_static_metadata_bytes + 77),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[10].base, 21,
g_static_metadata_bytes + 108),
&g_static_metadata_slice_refcounts[10].base, 20,
g_static_metadata_bytes + 90),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[11].base, 13,
g_static_metadata_bytes + 129),
&g_static_metadata_slice_refcounts[11].base, 21,
g_static_metadata_bytes + 110),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[12].base, 14,
g_static_metadata_bytes + 142),
&g_static_metadata_slice_refcounts[12].base, 13,
g_static_metadata_bytes + 131),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[13].base, 12,
g_static_metadata_bytes + 156),
&g_static_metadata_slice_refcounts[13].base, 14,
g_static_metadata_bytes + 144),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[14].base, 16,
g_static_metadata_bytes + 168),
&g_static_metadata_slice_refcounts[14].base, 12,
g_static_metadata_bytes + 158),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[15].base, 15,
g_static_metadata_bytes + 184),
&g_static_metadata_slice_refcounts[15].base, 16,
g_static_metadata_bytes + 170),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[16].base, 30,
g_static_metadata_bytes + 199),
&g_static_metadata_slice_refcounts[16].base, 15,
g_static_metadata_bytes + 186),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[17].base, 37,
g_static_metadata_bytes + 229),
&g_static_metadata_slice_refcounts[17].base, 30,
g_static_metadata_bytes + 201),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[18].base, 10,
g_static_metadata_bytes + 266),
&g_static_metadata_slice_refcounts[18].base, 37,
g_static_metadata_bytes + 231),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[19].base, 4,
g_static_metadata_bytes + 276),
&g_static_metadata_slice_refcounts[19].base, 10,
g_static_metadata_bytes + 268),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[20].base, 26,
g_static_metadata_bytes + 280),
&g_static_metadata_slice_refcounts[20].base, 4,
g_static_metadata_bytes + 278),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[21].base, 22,
g_static_metadata_bytes + 306),
&g_static_metadata_slice_refcounts[21].base, 26,
g_static_metadata_bytes + 282),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[22].base, 27,
g_static_metadata_bytes + 328),
&g_static_metadata_slice_refcounts[22].base, 22,
g_static_metadata_bytes + 308),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[23].base, 12,
g_static_metadata_bytes + 355),
&g_static_metadata_slice_refcounts[23].base, 27,
g_static_metadata_bytes + 330),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[24].base, 1,
g_static_metadata_bytes + 367),
&g_static_metadata_slice_refcounts[24].base, 12,
g_static_metadata_bytes + 357),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[25].base, 1,
g_static_metadata_bytes + 368),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[26].base, 1,
g_static_metadata_bytes + 369),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[27].base, 1,
&g_static_metadata_slice_refcounts[26].base, 1,
g_static_metadata_bytes + 370),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[28].base, 0,
&g_static_metadata_slice_refcounts[27].base, 1,
g_static_metadata_bytes + 371),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[29].base, 19,
g_static_metadata_bytes + 371),
&g_static_metadata_slice_refcounts[28].base, 1,
g_static_metadata_bytes + 372),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[30].base, 12,
g_static_metadata_bytes + 390),
&g_static_metadata_slice_refcounts[29].base, 0,
g_static_metadata_bytes + 373),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[31].base, 30,
g_static_metadata_bytes + 402),
&g_static_metadata_slice_refcounts[30].base, 19,
g_static_metadata_bytes + 373),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[32].base, 31,
g_static_metadata_bytes + 432),
&g_static_metadata_slice_refcounts[31].base, 12,
g_static_metadata_bytes + 392),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[33].base, 36,
g_static_metadata_bytes + 463),
&g_static_metadata_slice_refcounts[32].base, 30,
g_static_metadata_bytes + 404),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[34].base, 65,
g_static_metadata_bytes + 499),
&g_static_metadata_slice_refcounts[33].base, 31,
g_static_metadata_bytes + 434),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[34].base, 36,
g_static_metadata_bytes + 465),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[35].base, 65,
g_static_metadata_bytes + 564),
g_static_metadata_bytes + 501),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[36].base, 28,
g_static_metadata_bytes + 629),
&g_static_metadata_slice_refcounts[36].base, 65,
g_static_metadata_bytes + 566),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[37].base, 80,
g_static_metadata_bytes + 657),
&g_static_metadata_slice_refcounts[37].base, 28,
g_static_metadata_bytes + 631),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[38].base, 80,
g_static_metadata_bytes + 737),
g_static_metadata_bytes + 659),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[39].base, 7,
g_static_metadata_bytes + 817),
&g_static_metadata_slice_refcounts[39].base, 80,
g_static_metadata_bytes + 739),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[40].base, 4,
g_static_metadata_bytes + 824),
&g_static_metadata_slice_refcounts[40].base, 7,
g_static_metadata_bytes + 819),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[41].base, 11,
g_static_metadata_bytes + 828),
&g_static_metadata_slice_refcounts[41].base, 4,
g_static_metadata_bytes + 826),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[42].base, 2,
g_static_metadata_bytes + 839),
&g_static_metadata_slice_refcounts[42].base, 11,
g_static_metadata_bytes + 830),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[43].base, 8,
&g_static_metadata_slice_refcounts[43].base, 3,
g_static_metadata_bytes + 841),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[44].base, 3,
g_static_metadata_bytes + 849),
&g_static_metadata_slice_refcounts[44].base, 4,
g_static_metadata_bytes + 844),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[45].base, 4,
g_static_metadata_bytes + 852),
&g_static_metadata_slice_refcounts[45].base, 1,
g_static_metadata_bytes + 848),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[46].base, 1,
g_static_metadata_bytes + 856),
&g_static_metadata_slice_refcounts[46].base, 11,
g_static_metadata_bytes + 849),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[47].base, 11,
g_static_metadata_bytes + 857),
&g_static_metadata_slice_refcounts[47].base, 4,
g_static_metadata_bytes + 860),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[48].base, 4,
g_static_metadata_bytes + 868),
&g_static_metadata_slice_refcounts[48].base, 5,
g_static_metadata_bytes + 864),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[49].base, 5,
g_static_metadata_bytes + 872),
&g_static_metadata_slice_refcounts[49].base, 3,
g_static_metadata_bytes + 869),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[50].base, 3,
g_static_metadata_bytes + 877),
g_static_metadata_bytes + 872),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[51].base, 3,
g_static_metadata_bytes + 880),
g_static_metadata_bytes + 875),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[52].base, 3,
g_static_metadata_bytes + 883),
g_static_metadata_bytes + 878),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[53].base, 3,
g_static_metadata_bytes + 886),
g_static_metadata_bytes + 881),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[54].base, 3,
g_static_metadata_bytes + 889),
g_static_metadata_bytes + 884),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[55].base, 3,
g_static_metadata_bytes + 892),
g_static_metadata_bytes + 887),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[56].base, 3,
g_static_metadata_bytes + 895),
&g_static_metadata_slice_refcounts[56].base, 14,
g_static_metadata_bytes + 890),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[57].base, 14,
g_static_metadata_bytes + 898),
&g_static_metadata_slice_refcounts[57].base, 13,
g_static_metadata_bytes + 904),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[58].base, 13,
g_static_metadata_bytes + 912),
&g_static_metadata_slice_refcounts[58].base, 15,
g_static_metadata_bytes + 917),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[59].base, 15,
g_static_metadata_bytes + 925),
&g_static_metadata_slice_refcounts[59].base, 13,
g_static_metadata_bytes + 932),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[60].base, 13,
g_static_metadata_bytes + 940),
&g_static_metadata_slice_refcounts[60].base, 6,
g_static_metadata_bytes + 945),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[61].base, 6,
g_static_metadata_bytes + 953),
&g_static_metadata_slice_refcounts[61].base, 27,
g_static_metadata_bytes + 951),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[62].base, 27,
g_static_metadata_bytes + 959),
&g_static_metadata_slice_refcounts[62].base, 3,
g_static_metadata_bytes + 978),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[63].base, 3,
g_static_metadata_bytes + 986),
&g_static_metadata_slice_refcounts[63].base, 5,
g_static_metadata_bytes + 981),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[64].base, 5,
g_static_metadata_bytes + 989),
&g_static_metadata_slice_refcounts[64].base, 13,
g_static_metadata_bytes + 986),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[65].base, 13,
g_static_metadata_bytes + 994),
g_static_metadata_bytes + 999),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[66].base, 13,
g_static_metadata_bytes + 1007),
&g_static_metadata_slice_refcounts[66].base, 19,
g_static_metadata_bytes + 1012),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[67].base, 19,
g_static_metadata_bytes + 1020),
&g_static_metadata_slice_refcounts[67].base, 16,
g_static_metadata_bytes + 1031),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[68].base, 16,
g_static_metadata_bytes + 1039),
&g_static_metadata_slice_refcounts[68].base, 14,
g_static_metadata_bytes + 1047),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[69].base, 14,
g_static_metadata_bytes + 1055),
&g_static_metadata_slice_refcounts[69].base, 16,
g_static_metadata_bytes + 1061),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[70].base, 16,
g_static_metadata_bytes + 1069),
&g_static_metadata_slice_refcounts[70].base, 13,
g_static_metadata_bytes + 1077),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[71].base, 13,
g_static_metadata_bytes + 1085),
&g_static_metadata_slice_refcounts[71].base, 6,
g_static_metadata_bytes + 1090),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[72].base, 6,
g_static_metadata_bytes + 1098),
&g_static_metadata_slice_refcounts[72].base, 4,
g_static_metadata_bytes + 1096),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[73].base, 4,
g_static_metadata_bytes + 1104),
g_static_metadata_bytes + 1100),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[74].base, 4,
g_static_metadata_bytes + 1108),
&g_static_metadata_slice_refcounts[74].base, 6,
g_static_metadata_bytes + 1104),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[75].base, 6,
g_static_metadata_bytes + 1112),
&g_static_metadata_slice_refcounts[75].base, 7,
g_static_metadata_bytes + 1110),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[76].base, 7,
g_static_metadata_bytes + 1118),
&g_static_metadata_slice_refcounts[76].base, 4,
g_static_metadata_bytes + 1117),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[77].base, 4,
g_static_metadata_bytes + 1125),
&g_static_metadata_slice_refcounts[77].base, 8,
g_static_metadata_bytes + 1121),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[78].base, 8,
&g_static_metadata_slice_refcounts[78].base, 17,
g_static_metadata_bytes + 1129),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[79].base, 17,
g_static_metadata_bytes + 1137),
&g_static_metadata_slice_refcounts[79].base, 13,
g_static_metadata_bytes + 1146),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[80].base, 13,
g_static_metadata_bytes + 1154),
&g_static_metadata_slice_refcounts[80].base, 8,
g_static_metadata_bytes + 1159),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[81].base, 8,
&g_static_metadata_slice_refcounts[81].base, 19,
g_static_metadata_bytes + 1167),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[82].base, 19,
g_static_metadata_bytes + 1175),
&g_static_metadata_slice_refcounts[82].base, 13,
g_static_metadata_bytes + 1186),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[83].base, 13,
g_static_metadata_bytes + 1194),
&g_static_metadata_slice_refcounts[83].base, 4,
g_static_metadata_bytes + 1199),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[84].base, 4,
g_static_metadata_bytes + 1207),
&g_static_metadata_slice_refcounts[84].base, 8,
g_static_metadata_bytes + 1203),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[85].base, 8,
&g_static_metadata_slice_refcounts[85].base, 12,
g_static_metadata_bytes + 1211),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[86].base, 12,
g_static_metadata_bytes + 1219),
&g_static_metadata_slice_refcounts[86].base, 18,
g_static_metadata_bytes + 1223),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[87].base, 18,
g_static_metadata_bytes + 1231),
&g_static_metadata_slice_refcounts[87].base, 19,
g_static_metadata_bytes + 1241),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[88].base, 19,
g_static_metadata_bytes + 1249),
&g_static_metadata_slice_refcounts[88].base, 5,
g_static_metadata_bytes + 1260),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[89].base, 5,
g_static_metadata_bytes + 1268),
&g_static_metadata_slice_refcounts[89].base, 7,
g_static_metadata_bytes + 1265),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[90].base, 7,
g_static_metadata_bytes + 1273),
g_static_metadata_bytes + 1272),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[91].base, 7,
g_static_metadata_bytes + 1280),
&g_static_metadata_slice_refcounts[91].base, 11,
g_static_metadata_bytes + 1279),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[92].base, 11,
g_static_metadata_bytes + 1287),
&g_static_metadata_slice_refcounts[92].base, 6,
g_static_metadata_bytes + 1290),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[93].base, 6,
g_static_metadata_bytes + 1298),
&g_static_metadata_slice_refcounts[93].base, 10,
g_static_metadata_bytes + 1296),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[94].base, 10,
g_static_metadata_bytes + 1304),
&g_static_metadata_slice_refcounts[94].base, 25,
g_static_metadata_bytes + 1306),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[95].base, 25,
g_static_metadata_bytes + 1314),
&g_static_metadata_slice_refcounts[95].base, 17,
g_static_metadata_bytes + 1331),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[96].base, 17,
g_static_metadata_bytes + 1339),
&g_static_metadata_slice_refcounts[96].base, 4,
g_static_metadata_bytes + 1348),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[97].base, 4,
g_static_metadata_bytes + 1356),
&g_static_metadata_slice_refcounts[97].base, 3,
g_static_metadata_bytes + 1352),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[98].base, 3,
g_static_metadata_bytes + 1360),
&g_static_metadata_slice_refcounts[98].base, 16,
g_static_metadata_bytes + 1355),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[99].base, 16,
g_static_metadata_bytes + 1363),
&g_static_metadata_slice_refcounts[99].base, 1,
g_static_metadata_bytes + 1371),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[100].base, 1,
g_static_metadata_bytes + 1379),
&g_static_metadata_slice_refcounts[100].base, 8,
g_static_metadata_bytes + 1372),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[101].base, 8,
g_static_metadata_bytes + 1380),

@ -49,247 +49,247 @@ static_assert(
#define GRPC_MDSTR_AUTHORITY (::grpc_core::g_static_metadata_slice_table[3])
/* ":scheme" */
#define GRPC_MDSTR_SCHEME (::grpc_core::g_static_metadata_slice_table[4])
/* "te" */
#define GRPC_MDSTR_TE (::grpc_core::g_static_metadata_slice_table[5])
/* "grpc-message" */
#define GRPC_MDSTR_GRPC_MESSAGE (::grpc_core::g_static_metadata_slice_table[5])
#define GRPC_MDSTR_GRPC_MESSAGE (::grpc_core::g_static_metadata_slice_table[6])
/* "grpc-status" */
#define GRPC_MDSTR_GRPC_STATUS (::grpc_core::g_static_metadata_slice_table[6])
#define GRPC_MDSTR_GRPC_STATUS (::grpc_core::g_static_metadata_slice_table[7])
/* "grpc-payload-bin" */
#define GRPC_MDSTR_GRPC_PAYLOAD_BIN \
(::grpc_core::g_static_metadata_slice_table[7])
(::grpc_core::g_static_metadata_slice_table[8])
/* "grpc-encoding" */
#define GRPC_MDSTR_GRPC_ENCODING (::grpc_core::g_static_metadata_slice_table[8])
#define GRPC_MDSTR_GRPC_ENCODING (::grpc_core::g_static_metadata_slice_table[9])
/* "grpc-accept-encoding" */
#define GRPC_MDSTR_GRPC_ACCEPT_ENCODING \
(::grpc_core::g_static_metadata_slice_table[9])
(::grpc_core::g_static_metadata_slice_table[10])
/* "grpc-server-stats-bin" */
#define GRPC_MDSTR_GRPC_SERVER_STATS_BIN \
(::grpc_core::g_static_metadata_slice_table[10])
(::grpc_core::g_static_metadata_slice_table[11])
/* "grpc-tags-bin" */
#define GRPC_MDSTR_GRPC_TAGS_BIN \
(::grpc_core::g_static_metadata_slice_table[11])
(::grpc_core::g_static_metadata_slice_table[12])
/* "grpc-trace-bin" */
#define GRPC_MDSTR_GRPC_TRACE_BIN \
(::grpc_core::g_static_metadata_slice_table[12])
(::grpc_core::g_static_metadata_slice_table[13])
/* "content-type" */
#define GRPC_MDSTR_CONTENT_TYPE (::grpc_core::g_static_metadata_slice_table[13])
#define GRPC_MDSTR_CONTENT_TYPE (::grpc_core::g_static_metadata_slice_table[14])
/* "content-encoding" */
#define GRPC_MDSTR_CONTENT_ENCODING \
(::grpc_core::g_static_metadata_slice_table[14])
(::grpc_core::g_static_metadata_slice_table[15])
/* "accept-encoding" */
#define GRPC_MDSTR_ACCEPT_ENCODING \
(::grpc_core::g_static_metadata_slice_table[15])
(::grpc_core::g_static_metadata_slice_table[16])
/* "grpc-internal-encoding-request" */
#define GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST \
(::grpc_core::g_static_metadata_slice_table[16])
(::grpc_core::g_static_metadata_slice_table[17])
/* "grpc-internal-stream-encoding-request" */
#define GRPC_MDSTR_GRPC_INTERNAL_STREAM_ENCODING_REQUEST \
(::grpc_core::g_static_metadata_slice_table[17])
(::grpc_core::g_static_metadata_slice_table[18])
/* "user-agent" */
#define GRPC_MDSTR_USER_AGENT (::grpc_core::g_static_metadata_slice_table[18])
#define GRPC_MDSTR_USER_AGENT (::grpc_core::g_static_metadata_slice_table[19])
/* "host" */
#define GRPC_MDSTR_HOST (::grpc_core::g_static_metadata_slice_table[19])
#define GRPC_MDSTR_HOST (::grpc_core::g_static_metadata_slice_table[20])
/* "grpc-previous-rpc-attempts" */
#define GRPC_MDSTR_GRPC_PREVIOUS_RPC_ATTEMPTS \
(::grpc_core::g_static_metadata_slice_table[20])
(::grpc_core::g_static_metadata_slice_table[21])
/* "grpc-retry-pushback-ms" */
#define GRPC_MDSTR_GRPC_RETRY_PUSHBACK_MS \
(::grpc_core::g_static_metadata_slice_table[21])
(::grpc_core::g_static_metadata_slice_table[22])
/* "x-endpoint-load-metrics-bin" */
#define GRPC_MDSTR_X_ENDPOINT_LOAD_METRICS_BIN \
(::grpc_core::g_static_metadata_slice_table[22])
(::grpc_core::g_static_metadata_slice_table[23])
/* "grpc-timeout" */
#define GRPC_MDSTR_GRPC_TIMEOUT (::grpc_core::g_static_metadata_slice_table[23])
#define GRPC_MDSTR_GRPC_TIMEOUT (::grpc_core::g_static_metadata_slice_table[24])
/* "1" */
#define GRPC_MDSTR_1 (::grpc_core::g_static_metadata_slice_table[24])
#define GRPC_MDSTR_1 (::grpc_core::g_static_metadata_slice_table[25])
/* "2" */
#define GRPC_MDSTR_2 (::grpc_core::g_static_metadata_slice_table[25])
#define GRPC_MDSTR_2 (::grpc_core::g_static_metadata_slice_table[26])
/* "3" */
#define GRPC_MDSTR_3 (::grpc_core::g_static_metadata_slice_table[26])
#define GRPC_MDSTR_3 (::grpc_core::g_static_metadata_slice_table[27])
/* "4" */
#define GRPC_MDSTR_4 (::grpc_core::g_static_metadata_slice_table[27])
#define GRPC_MDSTR_4 (::grpc_core::g_static_metadata_slice_table[28])
/* "" */
#define GRPC_MDSTR_EMPTY (::grpc_core::g_static_metadata_slice_table[28])
#define GRPC_MDSTR_EMPTY (::grpc_core::g_static_metadata_slice_table[29])
/* "grpc.wait_for_ready" */
#define GRPC_MDSTR_GRPC_DOT_WAIT_FOR_READY \
(::grpc_core::g_static_metadata_slice_table[29])
(::grpc_core::g_static_metadata_slice_table[30])
/* "grpc.timeout" */
#define GRPC_MDSTR_GRPC_DOT_TIMEOUT \
(::grpc_core::g_static_metadata_slice_table[30])
(::grpc_core::g_static_metadata_slice_table[31])
/* "grpc.max_request_message_bytes" */
#define GRPC_MDSTR_GRPC_DOT_MAX_REQUEST_MESSAGE_BYTES \
(::grpc_core::g_static_metadata_slice_table[31])
(::grpc_core::g_static_metadata_slice_table[32])
/* "grpc.max_response_message_bytes" */
#define GRPC_MDSTR_GRPC_DOT_MAX_RESPONSE_MESSAGE_BYTES \
(::grpc_core::g_static_metadata_slice_table[32])
(::grpc_core::g_static_metadata_slice_table[33])
/* "/grpc.lb.v1.LoadBalancer/BalanceLoad" */
#define GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD \
(::grpc_core::g_static_metadata_slice_table[33])
(::grpc_core::g_static_metadata_slice_table[34])
/* "/envoy.service.load_stats.v2.LoadReportingService/StreamLoadStats" */
#define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_LOAD_STATS_DOT_V2_DOT_LOADREPORTINGSERVICE_SLASH_STREAMLOADSTATS \
(::grpc_core::g_static_metadata_slice_table[34])
(::grpc_core::g_static_metadata_slice_table[35])
/* "/envoy.service.load_stats.v3.LoadReportingService/StreamLoadStats" */
#define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_LOAD_STATS_DOT_V3_DOT_LOADREPORTINGSERVICE_SLASH_STREAMLOADSTATS \
(::grpc_core::g_static_metadata_slice_table[35])
(::grpc_core::g_static_metadata_slice_table[36])
/* "/grpc.health.v1.Health/Watch" */
#define GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH \
(::grpc_core::g_static_metadata_slice_table[36])
(::grpc_core::g_static_metadata_slice_table[37])
/* "/envoy.service.discovery.v2.AggregatedDiscoveryService/StreamAggregatedResources"
*/
#define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V2_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES \
(::grpc_core::g_static_metadata_slice_table[37])
(::grpc_core::g_static_metadata_slice_table[38])
/* "/envoy.service.discovery.v3.AggregatedDiscoveryService/StreamAggregatedResources"
*/
#define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V3_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES \
(::grpc_core::g_static_metadata_slice_table[38])
(::grpc_core::g_static_metadata_slice_table[39])
/* "deflate" */
#define GRPC_MDSTR_DEFLATE (::grpc_core::g_static_metadata_slice_table[39])
#define GRPC_MDSTR_DEFLATE (::grpc_core::g_static_metadata_slice_table[40])
/* "gzip" */
#define GRPC_MDSTR_GZIP (::grpc_core::g_static_metadata_slice_table[40])
#define GRPC_MDSTR_GZIP (::grpc_core::g_static_metadata_slice_table[41])
/* "stream/gzip" */
#define GRPC_MDSTR_STREAM_SLASH_GZIP \
(::grpc_core::g_static_metadata_slice_table[41])
/* "te" */
#define GRPC_MDSTR_TE (::grpc_core::g_static_metadata_slice_table[42])
/* "trailers" */
#define GRPC_MDSTR_TRAILERS (::grpc_core::g_static_metadata_slice_table[43])
(::grpc_core::g_static_metadata_slice_table[42])
/* "GET" */
#define GRPC_MDSTR_GET (::grpc_core::g_static_metadata_slice_table[44])
#define GRPC_MDSTR_GET (::grpc_core::g_static_metadata_slice_table[43])
/* "POST" */
#define GRPC_MDSTR_POST (::grpc_core::g_static_metadata_slice_table[45])
#define GRPC_MDSTR_POST (::grpc_core::g_static_metadata_slice_table[44])
/* "/" */
#define GRPC_MDSTR_SLASH (::grpc_core::g_static_metadata_slice_table[46])
#define GRPC_MDSTR_SLASH (::grpc_core::g_static_metadata_slice_table[45])
/* "/index.html" */
#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML \
(::grpc_core::g_static_metadata_slice_table[47])
(::grpc_core::g_static_metadata_slice_table[46])
/* "http" */
#define GRPC_MDSTR_HTTP (::grpc_core::g_static_metadata_slice_table[48])
#define GRPC_MDSTR_HTTP (::grpc_core::g_static_metadata_slice_table[47])
/* "https" */
#define GRPC_MDSTR_HTTPS (::grpc_core::g_static_metadata_slice_table[49])
#define GRPC_MDSTR_HTTPS (::grpc_core::g_static_metadata_slice_table[48])
/* "200" */
#define GRPC_MDSTR_200 (::grpc_core::g_static_metadata_slice_table[50])
#define GRPC_MDSTR_200 (::grpc_core::g_static_metadata_slice_table[49])
/* "204" */
#define GRPC_MDSTR_204 (::grpc_core::g_static_metadata_slice_table[51])
#define GRPC_MDSTR_204 (::grpc_core::g_static_metadata_slice_table[50])
/* "206" */
#define GRPC_MDSTR_206 (::grpc_core::g_static_metadata_slice_table[52])
#define GRPC_MDSTR_206 (::grpc_core::g_static_metadata_slice_table[51])
/* "304" */
#define GRPC_MDSTR_304 (::grpc_core::g_static_metadata_slice_table[53])
#define GRPC_MDSTR_304 (::grpc_core::g_static_metadata_slice_table[52])
/* "400" */
#define GRPC_MDSTR_400 (::grpc_core::g_static_metadata_slice_table[54])
#define GRPC_MDSTR_400 (::grpc_core::g_static_metadata_slice_table[53])
/* "404" */
#define GRPC_MDSTR_404 (::grpc_core::g_static_metadata_slice_table[55])
#define GRPC_MDSTR_404 (::grpc_core::g_static_metadata_slice_table[54])
/* "500" */
#define GRPC_MDSTR_500 (::grpc_core::g_static_metadata_slice_table[56])
#define GRPC_MDSTR_500 (::grpc_core::g_static_metadata_slice_table[55])
/* "accept-charset" */
#define GRPC_MDSTR_ACCEPT_CHARSET \
(::grpc_core::g_static_metadata_slice_table[57])
(::grpc_core::g_static_metadata_slice_table[56])
/* "gzip, deflate" */
#define GRPC_MDSTR_GZIP_COMMA_DEFLATE \
(::grpc_core::g_static_metadata_slice_table[58])
(::grpc_core::g_static_metadata_slice_table[57])
/* "accept-language" */
#define GRPC_MDSTR_ACCEPT_LANGUAGE \
(::grpc_core::g_static_metadata_slice_table[59])
(::grpc_core::g_static_metadata_slice_table[58])
/* "accept-ranges" */
#define GRPC_MDSTR_ACCEPT_RANGES \
(::grpc_core::g_static_metadata_slice_table[60])
(::grpc_core::g_static_metadata_slice_table[59])
/* "accept" */
#define GRPC_MDSTR_ACCEPT (::grpc_core::g_static_metadata_slice_table[61])
#define GRPC_MDSTR_ACCEPT (::grpc_core::g_static_metadata_slice_table[60])
/* "access-control-allow-origin" */
#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN \
(::grpc_core::g_static_metadata_slice_table[62])
(::grpc_core::g_static_metadata_slice_table[61])
/* "age" */
#define GRPC_MDSTR_AGE (::grpc_core::g_static_metadata_slice_table[63])
#define GRPC_MDSTR_AGE (::grpc_core::g_static_metadata_slice_table[62])
/* "allow" */
#define GRPC_MDSTR_ALLOW (::grpc_core::g_static_metadata_slice_table[64])
#define GRPC_MDSTR_ALLOW (::grpc_core::g_static_metadata_slice_table[63])
/* "authorization" */
#define GRPC_MDSTR_AUTHORIZATION \
(::grpc_core::g_static_metadata_slice_table[65])
(::grpc_core::g_static_metadata_slice_table[64])
/* "cache-control" */
#define GRPC_MDSTR_CACHE_CONTROL \
(::grpc_core::g_static_metadata_slice_table[66])
(::grpc_core::g_static_metadata_slice_table[65])
/* "content-disposition" */
#define GRPC_MDSTR_CONTENT_DISPOSITION \
(::grpc_core::g_static_metadata_slice_table[67])
(::grpc_core::g_static_metadata_slice_table[66])
/* "content-language" */
#define GRPC_MDSTR_CONTENT_LANGUAGE \
(::grpc_core::g_static_metadata_slice_table[68])
(::grpc_core::g_static_metadata_slice_table[67])
/* "content-length" */
#define GRPC_MDSTR_CONTENT_LENGTH \
(::grpc_core::g_static_metadata_slice_table[69])
(::grpc_core::g_static_metadata_slice_table[68])
/* "content-location" */
#define GRPC_MDSTR_CONTENT_LOCATION \
(::grpc_core::g_static_metadata_slice_table[70])
(::grpc_core::g_static_metadata_slice_table[69])
/* "content-range" */
#define GRPC_MDSTR_CONTENT_RANGE \
(::grpc_core::g_static_metadata_slice_table[71])
(::grpc_core::g_static_metadata_slice_table[70])
/* "cookie" */
#define GRPC_MDSTR_COOKIE (::grpc_core::g_static_metadata_slice_table[72])
#define GRPC_MDSTR_COOKIE (::grpc_core::g_static_metadata_slice_table[71])
/* "date" */
#define GRPC_MDSTR_DATE (::grpc_core::g_static_metadata_slice_table[73])
#define GRPC_MDSTR_DATE (::grpc_core::g_static_metadata_slice_table[72])
/* "etag" */
#define GRPC_MDSTR_ETAG (::grpc_core::g_static_metadata_slice_table[74])
#define GRPC_MDSTR_ETAG (::grpc_core::g_static_metadata_slice_table[73])
/* "expect" */
#define GRPC_MDSTR_EXPECT (::grpc_core::g_static_metadata_slice_table[75])
#define GRPC_MDSTR_EXPECT (::grpc_core::g_static_metadata_slice_table[74])
/* "expires" */
#define GRPC_MDSTR_EXPIRES (::grpc_core::g_static_metadata_slice_table[76])
#define GRPC_MDSTR_EXPIRES (::grpc_core::g_static_metadata_slice_table[75])
/* "from" */
#define GRPC_MDSTR_FROM (::grpc_core::g_static_metadata_slice_table[77])
#define GRPC_MDSTR_FROM (::grpc_core::g_static_metadata_slice_table[76])
/* "if-match" */
#define GRPC_MDSTR_IF_MATCH (::grpc_core::g_static_metadata_slice_table[78])
#define GRPC_MDSTR_IF_MATCH (::grpc_core::g_static_metadata_slice_table[77])
/* "if-modified-since" */
#define GRPC_MDSTR_IF_MODIFIED_SINCE \
(::grpc_core::g_static_metadata_slice_table[79])
(::grpc_core::g_static_metadata_slice_table[78])
/* "if-none-match" */
#define GRPC_MDSTR_IF_NONE_MATCH \
(::grpc_core::g_static_metadata_slice_table[80])
(::grpc_core::g_static_metadata_slice_table[79])
/* "if-range" */
#define GRPC_MDSTR_IF_RANGE (::grpc_core::g_static_metadata_slice_table[81])
#define GRPC_MDSTR_IF_RANGE (::grpc_core::g_static_metadata_slice_table[80])
/* "if-unmodified-since" */
#define GRPC_MDSTR_IF_UNMODIFIED_SINCE \
(::grpc_core::g_static_metadata_slice_table[82])
(::grpc_core::g_static_metadata_slice_table[81])
/* "last-modified" */
#define GRPC_MDSTR_LAST_MODIFIED \
(::grpc_core::g_static_metadata_slice_table[83])
(::grpc_core::g_static_metadata_slice_table[82])
/* "link" */
#define GRPC_MDSTR_LINK (::grpc_core::g_static_metadata_slice_table[84])
#define GRPC_MDSTR_LINK (::grpc_core::g_static_metadata_slice_table[83])
/* "location" */
#define GRPC_MDSTR_LOCATION (::grpc_core::g_static_metadata_slice_table[85])
#define GRPC_MDSTR_LOCATION (::grpc_core::g_static_metadata_slice_table[84])
/* "max-forwards" */
#define GRPC_MDSTR_MAX_FORWARDS (::grpc_core::g_static_metadata_slice_table[86])
#define GRPC_MDSTR_MAX_FORWARDS (::grpc_core::g_static_metadata_slice_table[85])
/* "proxy-authenticate" */
#define GRPC_MDSTR_PROXY_AUTHENTICATE \
(::grpc_core::g_static_metadata_slice_table[87])
(::grpc_core::g_static_metadata_slice_table[86])
/* "proxy-authorization" */
#define GRPC_MDSTR_PROXY_AUTHORIZATION \
(::grpc_core::g_static_metadata_slice_table[88])
(::grpc_core::g_static_metadata_slice_table[87])
/* "range" */
#define GRPC_MDSTR_RANGE (::grpc_core::g_static_metadata_slice_table[89])
#define GRPC_MDSTR_RANGE (::grpc_core::g_static_metadata_slice_table[88])
/* "referer" */
#define GRPC_MDSTR_REFERER (::grpc_core::g_static_metadata_slice_table[90])
#define GRPC_MDSTR_REFERER (::grpc_core::g_static_metadata_slice_table[89])
/* "refresh" */
#define GRPC_MDSTR_REFRESH (::grpc_core::g_static_metadata_slice_table[91])
#define GRPC_MDSTR_REFRESH (::grpc_core::g_static_metadata_slice_table[90])
/* "retry-after" */
#define GRPC_MDSTR_RETRY_AFTER (::grpc_core::g_static_metadata_slice_table[92])
#define GRPC_MDSTR_RETRY_AFTER (::grpc_core::g_static_metadata_slice_table[91])
/* "server" */
#define GRPC_MDSTR_SERVER (::grpc_core::g_static_metadata_slice_table[93])
#define GRPC_MDSTR_SERVER (::grpc_core::g_static_metadata_slice_table[92])
/* "set-cookie" */
#define GRPC_MDSTR_SET_COOKIE (::grpc_core::g_static_metadata_slice_table[94])
#define GRPC_MDSTR_SET_COOKIE (::grpc_core::g_static_metadata_slice_table[93])
/* "strict-transport-security" */
#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY \
(::grpc_core::g_static_metadata_slice_table[95])
(::grpc_core::g_static_metadata_slice_table[94])
/* "transfer-encoding" */
#define GRPC_MDSTR_TRANSFER_ENCODING \
(::grpc_core::g_static_metadata_slice_table[96])
(::grpc_core::g_static_metadata_slice_table[95])
/* "vary" */
#define GRPC_MDSTR_VARY (::grpc_core::g_static_metadata_slice_table[97])
#define GRPC_MDSTR_VARY (::grpc_core::g_static_metadata_slice_table[96])
/* "via" */
#define GRPC_MDSTR_VIA (::grpc_core::g_static_metadata_slice_table[98])
#define GRPC_MDSTR_VIA (::grpc_core::g_static_metadata_slice_table[97])
/* "www-authenticate" */
#define GRPC_MDSTR_WWW_AUTHENTICATE \
(::grpc_core::g_static_metadata_slice_table[99])
(::grpc_core::g_static_metadata_slice_table[98])
/* "0" */
#define GRPC_MDSTR_0 (::grpc_core::g_static_metadata_slice_table[100])
#define GRPC_MDSTR_0 (::grpc_core::g_static_metadata_slice_table[99])
/* "identity" */
#define GRPC_MDSTR_IDENTITY (::grpc_core::g_static_metadata_slice_table[101])
#define GRPC_MDSTR_IDENTITY (::grpc_core::g_static_metadata_slice_table[100])
/* "trailers" */
#define GRPC_MDSTR_TRAILERS (::grpc_core::g_static_metadata_slice_table[101])
/* "application/grpc" */
#define GRPC_MDSTR_APPLICATION_SLASH_GRPC \
(::grpc_core::g_static_metadata_slice_table[102])

@ -1755,7 +1755,7 @@ static grpc_call_error call_start_batch(grpc_call* call, const grpc_op* ops,
if (op->data.send_status_from_server.status_details != nullptr) {
call->send_extra_metadata[1].md = grpc_mdelem_from_slices(
GRPC_MDSTR_GRPC_MESSAGE,
grpc_slice_copy(
grpc_slice_ref_internal(
*op->data.send_status_from_server.status_details));
call->send_extra_metadata_count++;
if (status_error != GRPC_ERROR_NONE) {

@ -423,19 +423,35 @@ grpc_call* grpc_channel_create_pollset_set_call(
namespace grpc_core {
RegisteredCall::RegisteredCall(const char* method_arg, const char* host_arg)
: path(method_arg != nullptr && method_arg[0] != 0
: method(method_arg != nullptr ? method_arg : ""),
host(host_arg != nullptr ? host_arg : ""),
path(grpc_mdelem_from_slices(
GRPC_MDSTR_PATH, grpc_core::ExternallyManagedSlice(method.c_str()))),
authority(!host.empty()
? grpc_mdelem_from_slices(
GRPC_MDSTR_PATH, grpc_slice_from_copied_string(method_arg))
: GRPC_MDNULL),
authority(
host_arg != nullptr && host_arg[0] != 0
? grpc_mdelem_from_slices(GRPC_MDSTR_AUTHORITY,
grpc_slice_from_copied_string(host_arg))
GRPC_MDSTR_AUTHORITY,
grpc_core::ExternallyManagedSlice(host.c_str()))
: GRPC_MDNULL) {}
// TODO(vjpai): Delete copy-constructor when allowed by all supported compilers.
RegisteredCall::RegisteredCall(const RegisteredCall& other)
: path(GRPC_MDELEM_REF(other.path)),
authority(GRPC_MDELEM_REF(other.authority)) {}
: RegisteredCall(other.method.c_str(), other.host.c_str()) {}
RegisteredCall::RegisteredCall(RegisteredCall&& other) noexcept
: method(std::move(other.method)),
host(std::move(other.host)),
path(grpc_mdelem_from_slices(
GRPC_MDSTR_PATH, grpc_core::ExternallyManagedSlice(method.c_str()))),
authority(!host.empty()
? grpc_mdelem_from_slices(
GRPC_MDSTR_AUTHORITY,
grpc_core::ExternallyManagedSlice(host.c_str()))
: GRPC_MDNULL) {
GRPC_MDELEM_UNREF(other.path);
GRPC_MDELEM_UNREF(other.authority);
other.path = GRPC_MDNULL;
other.authority = GRPC_MDNULL;
}
RegisteredCall::~RegisteredCall() {
GRPC_MDELEM_UNREF(path);

@ -82,12 +82,21 @@ void grpc_channel_update_call_size_estimate(grpc_channel* channel, size_t size);
namespace grpc_core {
struct RegisteredCall {
// The method and host are kept as part of this struct just to manage their
// lifetime since they must outlive the mdelem contents.
std::string method;
std::string host;
grpc_mdelem path;
grpc_mdelem authority;
explicit RegisteredCall(const char* method_arg, const char* host_arg);
// TODO(vjpai): delete copy constructor once all supported compilers allow
// std::map value_type to be MoveConstructible.
RegisteredCall(const RegisteredCall& other);
RegisteredCall(RegisteredCall&& other) noexcept;
RegisteredCall& operator=(const RegisteredCall&) = delete;
RegisteredCall& operator=(RegisteredCall&&) = delete;
~RegisteredCall();
};

@ -549,35 +549,14 @@ grpc_mdelem grpc_mdelem_from_slices(
}
grpc_mdelem grpc_mdelem_from_grpc_metadata(grpc_metadata* metadata) {
bool key_changed = false;
bool changed = false;
grpc_slice key_slice =
grpc_slice_maybe_static_intern(metadata->key, &key_changed);
bool value_changed = false;
grpc_slice* unref_slice = nullptr;
grpc_slice_maybe_static_intern(metadata->key, &changed);
grpc_slice value_slice =
grpc_slice_maybe_static_intern(metadata->value, &value_changed);
// If key or value changed, but the other didn't.... AND the other is a NOP
// refcount, then we need to convert it to a slice with a refcount else we run
// the risk of leaving a dangling reference to that metadata on the heap via
// this mdelem.
if (key_changed && !value_changed && value_slice.refcount != nullptr &&
value_slice.refcount->GetType() == grpc_slice_refcount::Type::NOP) {
value_slice = grpc_slice_copy(value_slice);
unref_slice = &value_slice;
value_changed = true;
} else if (!key_changed && value_changed && key_slice.refcount != nullptr &&
key_slice.refcount->GetType() == grpc_slice_refcount::Type::NOP) {
key_slice = grpc_slice_copy(key_slice);
unref_slice = &key_slice;
key_changed = true;
}
auto mdelem =
grpc_mdelem_create(key_slice, value_slice,
key_changed || value_changed
? nullptr
: reinterpret_cast<grpc_mdelem_data*>(metadata));
if (unref_slice != nullptr) grpc_slice_unref_internal(*unref_slice);
return mdelem;
grpc_slice_maybe_static_intern(metadata->value, &changed);
return grpc_mdelem_create(
key_slice, value_slice,
changed ? nullptr : reinterpret_cast<grpc_mdelem_data*>(metadata));
}
static void* get_user_data(UserData* user_data, void (*destroy_func)(void*)) {

@ -41,47 +41,34 @@ void grpc_metadata_batch_set_value(grpc_linked_mdelem* storage,
GRPC_MDELEM_UNREF(old_mdelem);
}
namespace {
class CopySink {
public:
explicit CopySink(grpc_metadata_batch* dst) : dst_(dst) {}
void Encode(grpc_mdelem md) {
void grpc_metadata_batch_copy(grpc_metadata_batch* src,
grpc_metadata_batch* dst,
grpc_linked_mdelem* storage) {
dst->Clear();
// TODO(ctiller): this should be templated and automatically derived.
if (auto* p = src->get_pointer(grpc_core::GrpcTimeoutMetadata())) {
dst->Set(grpc_core::GrpcTimeoutMetadata(), *p);
}
size_t i = 0;
src->ForEach([&](grpc_mdelem md) {
// If the mdelem is not external, take a ref.
// Otherwise, create a new copy, holding its own refs to the
// underlying slices.
if (GRPC_MDELEM_STORAGE(md) != GRPC_MDELEM_STORAGE_EXTERNAL) {
md = GRPC_MDELEM_REF(md);
} else {
md = grpc_mdelem_from_slices(grpc_slice_copy(GRPC_MDKEY(md)),
grpc_slice_copy(GRPC_MDVALUE(md)));
md = grpc_mdelem_from_slices(grpc_slice_ref_internal(GRPC_MDKEY(md)),
grpc_slice_ref_internal(GRPC_MDVALUE(md)));
}
// Error unused in non-debug builds.
grpc_error_handle GRPC_UNUSED error = dst_->Append(md);
// The only way that Append() can fail is if
grpc_error_handle GRPC_UNUSED error =
grpc_metadata_batch_add_tail(dst, &storage[i++], md);
// The only way that grpc_metadata_batch_add_tail() can fail is if
// there's a duplicate entry for a callout. However, that can't be
// the case here, because we would not have been allowed to create
// a source batch that had that kind of conflict.
GPR_DEBUG_ASSERT(error == GRPC_ERROR_NONE);
}
template <class T, class V>
void Encode(T trait, V value) {
dst_->Set(trait, value);
}
private:
grpc_metadata_batch* dst_;
};
} // namespace
void grpc_metadata_batch_copy(const grpc_metadata_batch* src,
grpc_metadata_batch* dst) {
dst->Clear();
CopySink sink(dst);
src->Encode(&sink);
});
}
grpc_error_handle grpc_attach_md_to_error(grpc_error_handle src,

@ -88,7 +88,6 @@ struct GrpcTimeoutMetadata {
if (GPR_UNLIKELY(!grpc_http2_decode_timeout(value, &timeout))) {
timeout = GRPC_MILLIS_INF_FUTURE;
}
grpc_slice_unref_internal(value);
return timeout;
}
static ValueType MementoToValue(MementoType timeout) {
@ -97,115 +96,9 @@ struct GrpcTimeoutMetadata {
}
return grpc_core::ExecCtx::Get()->Now() + timeout;
}
static grpc_slice Encode(ValueType x) {
char timeout[GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE];
grpc_http2_encode_timeout(x, timeout);
return grpc_slice_from_copied_string(timeout);
}
static MementoType DisplayValue(MementoType x) { return x; }
};
// TE metadata trait.
struct TeMetadata {
// HTTP2 says that TE can either be empty or "trailers".
// Empty means this trait is not included, "trailers" means kTrailers, and
// kInvalid is used to remember an invalid value.
enum ValueType : uint8_t {
kTrailers,
kInvalid,
};
using MementoType = ValueType;
static const char* key() { return "te"; }
static MementoType ParseMemento(const grpc_slice& value) {
auto out = kInvalid;
if (grpc_slice_eq(value, GRPC_MDSTR_TRAILERS)) {
out = kTrailers;
}
grpc_slice_unref_internal(value);
return out;
}
static ValueType MementoToValue(MementoType te) { return te; }
static grpc_slice Encode(ValueType x) {
GPR_ASSERT(x == kTrailers);
return GRPC_MDSTR_TRAILERS;
}
static const char* DisplayValue(MementoType te) {
switch (te) {
case ValueType::kTrailers:
return "trailers";
default:
return "<discarded-invalid-value>";
}
}
};
namespace metadata_detail {
// Inner implementation of MetadataMap<Container>::Parse()
// Recursive in terms of metadata trait, tries each known type in order by doing
// a string comparison on key, and if that key is found parses it. If not found,
// calls not_found to generate the result value.
template <typename Container, typename... Traits>
struct ParseHelper;
template <typename Container, typename Trait, typename... Traits>
struct ParseHelper<Container, Trait, Traits...> {
template <typename NotFound>
static ParsedMetadata<Container> Parse(absl::string_view key,
const grpc_slice& value,
NotFound not_found) {
if (key == Trait::key()) {
return ParsedMetadata<Container>(
Trait(), Trait::ParseMemento(value),
ParsedMetadata<Container>::TransportSize(key.size(),
GRPC_SLICE_LENGTH(value)));
}
return ParseHelper<Container, Traits...>::Parse(key, value, not_found);
}
};
template <typename Container>
struct ParseHelper<Container> {
template <typename NotFound>
static ParsedMetadata<Container> Parse(absl::string_view, const grpc_slice&,
NotFound not_found) {
return not_found();
}
};
// Inner implementation of MetadataMap<Container>::Append()
// Recursive in terms of metadata trait, tries each known type in order by doing
// a string comparison on key, and if that key is found sets it. If not found,
// calls not_found to append generically.
template <typename Container, typename... Traits>
struct AppendHelper;
template <typename Container, typename Trait, typename... Traits>
struct AppendHelper<Container, Trait, Traits...> {
template <typename NotFound>
static void Append(Container* container, absl::string_view key,
const grpc_slice& value, NotFound not_found) {
if (key == Trait::key()) {
container->Set(Trait(),
Trait::MementoToValue(Trait::ParseMemento(value)));
return;
}
AppendHelper<Container, Traits...>::Append(container, key, value,
not_found);
}
};
template <typename Container>
struct AppendHelper<Container> {
template <typename NotFound>
static void Append(Container*, absl::string_view, const grpc_slice&,
NotFound not_found) {
not_found();
}
};
} // namespace metadata_detail
// MetadataMap encodes the mapping of metadata keys to metadata values.
// Right now the API presented is the minimal one that will allow us to
// substitute this type for grpc_metadata_batch in a relatively easy fashion. At
@ -230,13 +123,9 @@ struct AppendHelper<Container> {
// // The string key for this metadata type (for transports that require it)
// static constexpr char* key() { return "grpc-xyz"; }
// // Parse a memento from a slice
// // Takes ownership of value
// static MementoType ParseMemento(const grpc_slice& value) { ... }
// // Convert a memento to a value
// static ValueType MementoToValue(MementoType memento) { ... }
// // Convert a value to its canonical text wire format (the format that
// // ParseMemento will accept!)
// static grpc_slice Encode(ValueType value);
// // Convert a value to something that can be passed to StrCat and displayed
// // for debugging
// static SomeStrCatableType DisplayValue(MementoType value) { ... }
@ -334,37 +223,24 @@ class MetadataMap {
table_.template clear<Value<Which>>();
}
// Extract a piece of known metadata.
// Returns nullopt if the metadata was not present, or the value if it was.
// The same as:
// auto value = m.get(T());
// m.Remove(T());
template <typename Which>
absl::optional<typename Which::ValueType> Take(Which which) {
auto value = get(which);
Remove(which);
return value;
}
// Parse metadata from a key/value pair, and return an object representing
// that result.
// TODO(ctiller): key should probably be an absl::string_view.
// Once we don't care about interning anymore, make that change!
template <class KeySlice, class ValueSlice>
static ParsedMetadata<MetadataMap> Parse(const KeySlice& key,
const ValueSlice& value) {
bool parsed = true;
auto out = metadata_detail::ParseHelper<MetadataMap, Traits...>::Parse(
StringViewFromSlice(key), value, [&] {
parsed = false;
return ParsedMetadata<MetadataMap>(
grpc_mdelem_from_slices(key, value));
});
if (parsed) {
auto key_view = StringViewFromSlice(key);
// hack for now.
if (key_view == GrpcTimeoutMetadata::key()) {
ParsedMetadata<MetadataMap> out(
GrpcTimeoutMetadata(), GrpcTimeoutMetadata::ParseMemento(value),
ParsedMetadata<MetadataMap>::TransportSize(GRPC_SLICE_LENGTH(key),
GRPC_SLICE_LENGTH(value)));
grpc_slice_unref_internal(key);
}
grpc_slice_unref_internal(value);
return out;
}
return ParsedMetadata<MetadataMap>(grpc_mdelem_from_slices(key, value));
}
// Set a value from a parsed metadata object.
GRPC_MUST_USE_RESULT grpc_error_handle
@ -372,18 +248,6 @@ class MetadataMap {
return m.SetOnContainer(this);
}
// Append a key/value pair - takes ownership of value
void Append(absl::string_view key, const grpc_slice& value) {
metadata_detail::AppendHelper<MetadataMap, Traits...>::Append(
this, key, value, [&] {
GPR_ASSERT(GRPC_ERROR_NONE ==
Append(grpc_mdelem_from_slices(
grpc_slice_intern(grpc_slice_from_static_buffer(
key.data(), key.length())),
value)));
});
}
//
// All APIs below this point are subject to change.
//
@ -896,8 +760,7 @@ bool MetadataMap<Traits...>::ReplaceIfExists(grpc_slice key, grpc_slice value) {
} // namespace grpc_core
using grpc_metadata_batch =
grpc_core::MetadataMap<grpc_core::GrpcTimeoutMetadata,
grpc_core::TeMetadata>;
grpc_core::MetadataMap<grpc_core::GrpcTimeoutMetadata>;
inline void grpc_metadata_batch_clear(grpc_metadata_batch* batch) {
batch->Clear();
@ -1043,13 +906,17 @@ inline void grpc_metadata_batch_assert_ok(grpc_metadata_batch* batch) {
batch->AssertOk();
}
/// Copies \a src to \a dst.
/// Copies \a src to \a dst. \a storage must point to an array of
/// \a grpc_linked_mdelem structs of at least the same size as \a src.
///
/// For each mdelem in \a src, if the mdelem is of storage types
/// GRPC_MDELEM_STORAGE_INTERNED or GRPC_MDELEM_STORAGE_ALLOCATED,
/// refs the original mdelem for the copy. Otherwise, makes a new
/// mdelem that will hold its own refs to the key and value slices.
void grpc_metadata_batch_copy(const grpc_metadata_batch* src,
grpc_metadata_batch* dst);
///
/// Currently used only in the retry code.
void grpc_metadata_batch_copy(grpc_metadata_batch* src,
grpc_metadata_batch* dst,
grpc_linked_mdelem* storage);
#endif /* GRPC_CORE_LIB_TRANSPORT_METADATA_BATCH_H */

@ -184,10 +184,7 @@ ParsedMetadata<MetadataContainer>::TrivialTraitVTable() {
},
// debug_string
[](intptr_t value) {
return absl::StrCat(
Which::key(), ": ",
Which::DisplayValue(
static_cast<typename Which::MementoType>(value)));
return absl::StrCat(Which::key(), ": ", Which::DisplayValue(value));
}};
return &vtable;
}

File diff suppressed because it is too large Load Diff

@ -34,7 +34,7 @@
#include "src/core/lib/slice/static_slice.h"
#include "src/core/lib/transport/metadata.h"
#define GRPC_STATIC_MDELEM_COUNT 84
#define GRPC_STATIC_MDELEM_COUNT 85
namespace grpc_core {
extern StaticMetadata g_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];
@ -207,55 +207,57 @@ extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];
/* "grpc-encoding": "deflate" */
#define GRPC_MDELEM_GRPC_ENCODING_DEFLATE \
(::grpc_core::g_static_mdelem_manifested[66])
/* "te": "trailers" */
#define GRPC_MDELEM_TE_TRAILERS (::grpc_core::g_static_mdelem_manifested[67])
/* "content-type": "application/grpc" */
#define GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC \
(::grpc_core::g_static_mdelem_manifested[67])
(::grpc_core::g_static_mdelem_manifested[68])
/* ":scheme": "grpc" */
#define GRPC_MDELEM_SCHEME_GRPC (::grpc_core::g_static_mdelem_manifested[68])
#define GRPC_MDELEM_SCHEME_GRPC (::grpc_core::g_static_mdelem_manifested[69])
/* ":method": "PUT" */
#define GRPC_MDELEM_METHOD_PUT (::grpc_core::g_static_mdelem_manifested[69])
#define GRPC_MDELEM_METHOD_PUT (::grpc_core::g_static_mdelem_manifested[70])
/* "accept-encoding": "" */
#define GRPC_MDELEM_ACCEPT_ENCODING_EMPTY \
(::grpc_core::g_static_mdelem_manifested[70])
(::grpc_core::g_static_mdelem_manifested[71])
/* "content-encoding": "identity" */
#define GRPC_MDELEM_CONTENT_ENCODING_IDENTITY \
(::grpc_core::g_static_mdelem_manifested[71])
(::grpc_core::g_static_mdelem_manifested[72])
/* "content-encoding": "gzip" */
#define GRPC_MDELEM_CONTENT_ENCODING_GZIP \
(::grpc_core::g_static_mdelem_manifested[72])
(::grpc_core::g_static_mdelem_manifested[73])
/* "lb-cost-bin": "" */
#define GRPC_MDELEM_LB_COST_BIN_EMPTY \
(::grpc_core::g_static_mdelem_manifested[73])
(::grpc_core::g_static_mdelem_manifested[74])
/* "grpc-accept-encoding": "identity" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY \
(::grpc_core::g_static_mdelem_manifested[74])
(::grpc_core::g_static_mdelem_manifested[75])
/* "grpc-accept-encoding": "deflate" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE \
(::grpc_core::g_static_mdelem_manifested[75])
(::grpc_core::g_static_mdelem_manifested[76])
/* "grpc-accept-encoding": "identity,deflate" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE \
(::grpc_core::g_static_mdelem_manifested[76])
(::grpc_core::g_static_mdelem_manifested[77])
/* "grpc-accept-encoding": "gzip" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP \
(::grpc_core::g_static_mdelem_manifested[77])
(::grpc_core::g_static_mdelem_manifested[78])
/* "grpc-accept-encoding": "identity,gzip" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \
(::grpc_core::g_static_mdelem_manifested[78])
(::grpc_core::g_static_mdelem_manifested[79])
/* "grpc-accept-encoding": "deflate,gzip" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE_COMMA_GZIP \
(::grpc_core::g_static_mdelem_manifested[79])
(::grpc_core::g_static_mdelem_manifested[80])
/* "grpc-accept-encoding": "identity,deflate,gzip" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \
(::grpc_core::g_static_mdelem_manifested[80])
(::grpc_core::g_static_mdelem_manifested[81])
/* "accept-encoding": "identity" */
#define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY \
(::grpc_core::g_static_mdelem_manifested[81])
(::grpc_core::g_static_mdelem_manifested[82])
/* "accept-encoding": "gzip" */
#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP \
(::grpc_core::g_static_mdelem_manifested[82])
(::grpc_core::g_static_mdelem_manifested[83])
/* "accept-encoding": "identity,gzip" */
#define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \
(::grpc_core::g_static_mdelem_manifested[83])
(::grpc_core::g_static_mdelem_manifested[84])
grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b);
typedef enum {
@ -264,6 +266,7 @@ typedef enum {
GRPC_BATCH_STATUS,
GRPC_BATCH_AUTHORITY,
GRPC_BATCH_SCHEME,
GRPC_BATCH_TE,
GRPC_BATCH_GRPC_MESSAGE,
GRPC_BATCH_GRPC_STATUS,
GRPC_BATCH_GRPC_PAYLOAD_BIN,
@ -293,6 +296,7 @@ typedef union {
struct grpc_linked_mdelem* status;
struct grpc_linked_mdelem* authority;
struct grpc_linked_mdelem* scheme;
struct grpc_linked_mdelem* te;
struct grpc_linked_mdelem* grpc_message;
struct grpc_linked_mdelem* grpc_status;
struct grpc_linked_mdelem* grpc_payload_bin;

@ -40,14 +40,16 @@
/* These routines are here to facilitate debugging - they produce string
representations of various transport data structures */
namespace {
class MetadataListEncoder {
static void put_metadata_list(const grpc_metadata_batch& md,
std::vector<std::string>* out) {
class Encoder {
public:
explicit MetadataListEncoder(std::vector<std::string>* out) : out_(out) {}
explicit Encoder(std::vector<std::string>* out) : out_(out) {}
void Encode(const grpc_mdelem& md) {
MaybeAddComma();
out_->push_back("key=");
char* dump = grpc_dump_slice(GRPC_MDKEY(md), GPR_DUMP_HEX | GPR_DUMP_ASCII);
char* dump =
grpc_dump_slice(GRPC_MDKEY(md), GPR_DUMP_HEX | GPR_DUMP_ASCII);
out_->push_back(dump);
gpr_free(dump);
out_->push_back(" value=");
@ -61,13 +63,6 @@ class MetadataListEncoder {
out_->push_back(absl::StrFormat("deadline=%" PRId64, deadline));
}
template <typename Which>
void Encode(Which, typename Which::ValueType value) {
MaybeAddComma();
out_->push_back(
absl::StrCat(Which::key(), "=", Which::DisplayValue(value)));
}
private:
void MaybeAddComma() {
if (out_->size() != initial_size_) out_->push_back(", ");
@ -75,11 +70,7 @@ class MetadataListEncoder {
std::vector<std::string>* const out_;
const size_t initial_size_ = out_->size();
};
} // namespace
static void put_metadata_list(const grpc_metadata_batch& md,
std::vector<std::string>* out) {
MetadataListEncoder encoder(out);
Encoder encoder(out);
md.Encode(&encoder);
}

@ -4,6 +4,7 @@
"\x07:status"
"\x0A:authority"
"\x07:scheme"
"\x02te"
"\x0Cgrpc-message"
"\x0Bgrpc-status"
"\x10grpc-payload-bin"
@ -41,8 +42,6 @@
"\x07deflate"
"\x04gzip"
"\x0Bstream/gzip"
"\x02te"
"\x08trailers"
"\x03GET"
"\x04POST"
"\x01/"
@ -101,6 +100,7 @@
"\x10www-authenticate"
"\x010"
"\x08identity"
"\x08trailers"
"\x10application/grpc"
"\x04grpc"
"\x03PUT"
@ -176,6 +176,7 @@
"\x00\x0Dgrpc-encoding\x08identity"
"\x00\x0Dgrpc-encoding\x04gzip"
"\x00\x0Dgrpc-encoding\x07deflate"
"\x00\x02te\x08trailers"
"\x00\x0Ccontent-type\x10application/grpc"
"\x00\x07:scheme\x04grpc"
"\x00\x07:method\x03PUT"

@ -111,9 +111,14 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State& state) {
grpc_core::ExecCtx exec_ctx;
static bool logged_representative_output = false;
std::vector<grpc_mdelem> elems = Fixture::GetElems();
std::vector<grpc_linked_mdelem> storage(elems.size());
auto arena = grpc_core::MakeScopedArena(1024);
grpc_metadata_batch b(arena.get());
Fixture::Prepare(&b);
for (size_t i = 0; i < elems.size(); i++) {
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd", grpc_metadata_batch_add_tail(&b, &storage[i], elems[i])));
}
grpc_core::HPackCompressor c;
grpc_transport_one_way_stats stats;
@ -160,28 +165,24 @@ namespace hpack_encoder_fixtures {
class EmptyBatch {
public:
static constexpr bool kEnableTrueBinary = false;
static void Prepare(grpc_metadata_batch*) {}
static std::vector<grpc_mdelem> GetElems() { return {}; }
};
class SingleStaticElem {
public:
static constexpr bool kEnableTrueBinary = false;
static void Prepare(grpc_metadata_batch* b) {
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd",
b->Append(GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE)));
static std::vector<grpc_mdelem> GetElems() {
return {GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE};
}
};
class SingleInternedElem {
public:
static constexpr bool kEnableTrueBinary = false;
static void Prepare(grpc_metadata_batch* b) {
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd",
b->Append(grpc_mdelem_from_slices(
static std::vector<grpc_mdelem> GetElems() {
return {grpc_mdelem_from_slices(
grpc_slice_intern(grpc_slice_from_static_string("abc")),
grpc_slice_intern(grpc_slice_from_static_string("def"))))));
grpc_slice_intern(grpc_slice_from_static_string("def")))};
}
};
@ -189,14 +190,13 @@ template <int kLength, bool kTrueBinary>
class SingleInternedBinaryElem {
public:
static constexpr bool kEnableTrueBinary = kTrueBinary;
static void Prepare(grpc_metadata_batch* b) {
static std::vector<grpc_mdelem> GetElems() {
grpc_slice bytes = MakeBytes();
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd",
b->Append(grpc_mdelem_from_slices(
std::vector<grpc_mdelem> out = {grpc_mdelem_from_slices(
grpc_slice_intern(grpc_slice_from_static_string("abc-bin")),
grpc_slice_intern(bytes)))));
grpc_slice_intern(bytes))};
grpc_slice_unref(bytes);
return out;
}
private:
@ -213,22 +213,19 @@ class SingleInternedBinaryElem {
class SingleInternedKeyElem {
public:
static constexpr bool kEnableTrueBinary = false;
static void Prepare(grpc_metadata_batch* b) {
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd", b->Append(grpc_mdelem_from_slices(
static std::vector<grpc_mdelem> GetElems() {
return {grpc_mdelem_from_slices(
grpc_slice_intern(grpc_slice_from_static_string("abc")),
grpc_slice_from_static_string("def")))));
grpc_slice_from_static_string("def"))};
}
};
class SingleNonInternedElem {
public:
static constexpr bool kEnableTrueBinary = false;
static void Prepare(grpc_metadata_batch* b) {
GPR_ASSERT(
GRPC_LOG_IF_ERROR("addmd", b->Append(grpc_mdelem_from_slices(
grpc_slice_from_static_string("abc"),
grpc_slice_from_static_string("def")))));
static std::vector<grpc_mdelem> GetElems() {
return {grpc_mdelem_from_slices(grpc_slice_from_static_string("abc"),
grpc_slice_from_static_string("def"))};
}
};
@ -236,10 +233,9 @@ template <int kLength, bool kTrueBinary>
class SingleNonInternedBinaryElem {
public:
static constexpr bool kEnableTrueBinary = kTrueBinary;
static void Prepare(grpc_metadata_batch* b) {
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd", b->Append(grpc_mdelem_from_slices(
grpc_slice_from_static_string("abc-bin"), MakeBytes()))));
static std::vector<grpc_mdelem> GetElems() {
return {grpc_mdelem_from_slices(grpc_slice_from_static_string("abc-bin"),
MakeBytes())};
}
private:
@ -256,31 +252,23 @@ class SingleNonInternedBinaryElem {
class RepresentativeClientInitialMetadata {
public:
static constexpr bool kEnableTrueBinary = true;
static void Prepare(grpc_metadata_batch* b) {
GPR_ASSERT(GRPC_LOG_IF_ERROR("addmd", b->Append(GRPC_MDELEM_SCHEME_HTTP)));
GPR_ASSERT(GRPC_LOG_IF_ERROR("addmd", b->Append(GRPC_MDELEM_METHOD_POST)));
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd",
b->Append(grpc_mdelem_from_slices(
static std::vector<grpc_mdelem> GetElems() {
return {
GRPC_MDELEM_SCHEME_HTTP,
GRPC_MDELEM_METHOD_POST,
grpc_mdelem_from_slices(
GRPC_MDSTR_PATH,
grpc_slice_intern(grpc_slice_from_static_string("/foo/bar"))))));
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd", b->Append(grpc_mdelem_from_slices(
GRPC_MDSTR_AUTHORITY,
grpc_slice_intern(grpc_slice_from_static_string("/foo/bar"))),
grpc_mdelem_from_slices(GRPC_MDSTR_AUTHORITY,
grpc_slice_intern(grpc_slice_from_static_string(
"foo.test.google.fr:1234"))))));
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd",
b->Append(
GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP)));
b->Set(grpc_core::TeMetadata(), grpc_core::TeMetadata::kTrailers);
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd", b->Append(GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC)));
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd", b->Append(grpc_mdelem_from_slices(
"foo.test.google.fr:1234"))),
GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP,
GRPC_MDELEM_TE_TRAILERS,
GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC,
grpc_mdelem_from_slices(
GRPC_MDSTR_USER_AGENT,
grpc_slice_intern(grpc_slice_from_static_string(
"grpc-c/3.0.0-dev (linux; chttp2; green)"))))));
"grpc-c/3.0.0-dev (linux; chttp2; green)")))};
}
};
@ -290,22 +278,17 @@ class RepresentativeClientInitialMetadata {
class MoreRepresentativeClientInitialMetadata {
public:
static constexpr bool kEnableTrueBinary = true;
static void Prepare(grpc_metadata_batch* b) {
GPR_ASSERT(GRPC_LOG_IF_ERROR("addmd", b->Append(GRPC_MDELEM_SCHEME_HTTP)));
GPR_ASSERT(GRPC_LOG_IF_ERROR("addmd", b->Append(GRPC_MDELEM_METHOD_POST)));
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd",
b->Append(grpc_mdelem_from_slices(
GRPC_MDSTR_PATH, grpc_slice_intern(grpc_slice_from_static_string(
"/grpc.test.FooService/BarMethod"))))));
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd", b->Append(grpc_mdelem_from_slices(
GRPC_MDSTR_AUTHORITY,
static std::vector<grpc_mdelem> GetElems() {
return {
GRPC_MDELEM_SCHEME_HTTP,
GRPC_MDELEM_METHOD_POST,
grpc_mdelem_from_slices(GRPC_MDSTR_PATH,
grpc_slice_intern(grpc_slice_from_static_string(
"foo.test.google.fr:1234"))))));
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd",
b->Append(grpc_mdelem_from_slices(
"/grpc.test.FooService/BarMethod"))),
grpc_mdelem_from_slices(GRPC_MDSTR_AUTHORITY,
grpc_slice_intern(grpc_slice_from_static_string(
"foo.test.google.fr:1234"))),
grpc_mdelem_from_slices(
GRPC_MDSTR_GRPC_TRACE_BIN,
grpc_slice_from_static_string("\x00\x01\x02\x03\x04\x05\x06\x07\x08"
"\x09\x0a\x0b\x0c\x0d\x0e\x0f"
@ -313,49 +296,37 @@ class MoreRepresentativeClientInitialMetadata {
"\x19\x1a\x1b\x1c\x1d\x1e\x1f"
"\x20\x21\x22\x23\x24\x25\x26\x27\x28"
"\x29\x2a\x2b\x2c\x2d\x2e\x2f"
"\x30")))));
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd",
b->Append(grpc_mdelem_from_slices(
"\x30")),
grpc_mdelem_from_slices(
GRPC_MDSTR_GRPC_TAGS_BIN,
grpc_slice_from_static_string("\x00\x01\x02\x03\x04\x05\x06\x07\x08"
"\x09\x0a\x0b\x0c\x0d\x0e\x0f"
"\x10\x11\x12\x13")))));
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd",
b->Append(
GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP)));
b->Set(grpc_core::TeMetadata(), grpc_core::TeMetadata::kTrailers);
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd", b->Append(GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC)));
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd", b->Append(grpc_mdelem_from_slices(
"\x10\x11\x12\x13")),
GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP,
GRPC_MDELEM_TE_TRAILERS,
GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC,
grpc_mdelem_from_slices(
GRPC_MDSTR_USER_AGENT,
grpc_slice_intern(grpc_slice_from_static_string(
"grpc-c/3.0.0-dev (linux; chttp2; green)"))))));
"grpc-c/3.0.0-dev (linux; chttp2; green)")))};
}
};
class RepresentativeServerInitialMetadata {
public:
static constexpr bool kEnableTrueBinary = true;
static void Prepare(grpc_metadata_batch* b) {
GPR_ASSERT(GRPC_LOG_IF_ERROR("addmd", b->Append(GRPC_MDELEM_STATUS_200)));
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd", b->Append(GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC)));
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd",
b->Append(
GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP)));
static std::vector<grpc_mdelem> GetElems() {
return {GRPC_MDELEM_STATUS_200,
GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC,
GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP};
}
};
class RepresentativeServerTrailingMetadata {
public:
static constexpr bool kEnableTrueBinary = true;
static void Prepare(grpc_metadata_batch* b) {
GPR_ASSERT(
GRPC_LOG_IF_ERROR("addmd", b->Append(GRPC_MDELEM_GRPC_STATUS_0)));
static std::vector<grpc_mdelem> GetElems() {
return {GRPC_MDELEM_GRPC_STATUS_0};
}
};

@ -287,31 +287,23 @@ BENCHMARK(BM_StreamCreateDestroy);
class RepresentativeClientInitialMetadata {
public:
static void Prepare(grpc_metadata_batch* b) {
GPR_ASSERT(GRPC_LOG_IF_ERROR("addmd", b->Append(GRPC_MDELEM_SCHEME_HTTP)));
GPR_ASSERT(GRPC_LOG_IF_ERROR("addmd", b->Append(GRPC_MDELEM_METHOD_POST)));
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd",
b->Append(grpc_mdelem_from_slices(
GRPC_MDSTR_PATH, grpc_slice_intern(grpc_slice_from_static_string(
"/foo/bar/bm_chttp2_transport"))))));
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd", b->Append(grpc_mdelem_from_slices(
GRPC_MDSTR_AUTHORITY,
static std::vector<grpc_mdelem> GetElems() {
return {
GRPC_MDELEM_SCHEME_HTTP,
GRPC_MDELEM_METHOD_POST,
grpc_mdelem_from_slices(GRPC_MDSTR_PATH,
grpc_slice_intern(grpc_slice_from_static_string(
"foo.test.google.fr:1234"))))));
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd",
b->Append(
GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP)));
b->Set(grpc_core::TeMetadata(), grpc_core::TeMetadata::kTrailers);
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd", b->Append(GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC)));
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd", b->Append(grpc_mdelem_from_slices(
"/foo/bar/bm_chttp2_transport"))),
grpc_mdelem_from_slices(GRPC_MDSTR_AUTHORITY,
grpc_slice_intern(grpc_slice_from_static_string(
"foo.test.google.fr:1234"))),
GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP,
GRPC_MDELEM_TE_TRAILERS,
GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC,
grpc_mdelem_from_slices(
GRPC_MDSTR_USER_AGENT,
grpc_slice_intern(grpc_slice_from_static_string(
"grpc-c/3.0.0-dev (linux; chttp2; green)"))))));
"grpc-c/3.0.0-dev (linux; chttp2; green)")))};
}
};
@ -332,8 +324,13 @@ static void BM_StreamCreateSendInitialMetadataDestroy(benchmark::State& state) {
};
auto arena = grpc_core::MakeScopedArena(1024);
std::vector<grpc_mdelem> elems = Metadata::GetElems();
std::vector<grpc_linked_mdelem> storage(elems.size());
grpc_metadata_batch b(arena.get());
Metadata::Prepare(&b);
for (size_t i = 0; i < elems.size(); i++) {
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd", grpc_metadata_batch_add_tail(&b, &storage[i], elems[i])));
}
f.FlushExecCtx();
gpr_event bm_done;
@ -428,9 +425,15 @@ static void BM_TransportStreamSend(benchmark::State& state) {
grpc_slice send_slice = grpc_slice_malloc_large(state.range(0));
memset(GRPC_SLICE_START_PTR(send_slice), 0, GRPC_SLICE_LENGTH(send_slice));
grpc_core::ManualConstructor<grpc_core::SliceBufferByteStream> send_stream;
std::vector<grpc_mdelem> elems =
RepresentativeClientInitialMetadata::GetElems();
std::vector<grpc_linked_mdelem> storage(elems.size());
auto arena = grpc_core::MakeScopedArena(1024);
grpc_metadata_batch b(arena.get());
RepresentativeClientInitialMetadata::Prepare(&b);
for (size_t i = 0; i < elems.size(); i++) {
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd", grpc_metadata_batch_add_tail(&b, &storage[i], elems[i])));
}
gpr_event* bm_done = new gpr_event;
gpr_event_init(bm_done);
@ -563,8 +566,14 @@ static void BM_TransportStreamRecv(benchmark::State& state) {
};
auto arena = grpc_core::MakeScopedArena(1024);
std::vector<grpc_mdelem> elems =
RepresentativeClientInitialMetadata::GetElems();
std::vector<grpc_linked_mdelem> storage(elems.size());
grpc_metadata_batch b(arena.get());
RepresentativeClientInitialMetadata::Prepare(&b);
for (size_t i = 0; i < elems.size(); i++) {
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"addmd", grpc_metadata_batch_add_tail(&b, &storage[i], elems[i])));
}
std::unique_ptr<TestClosure> do_nothing =
MakeTestClosure([](grpc_error_handle /*error*/) {});

@ -74,9 +74,6 @@ CONFIG = [
'deflate',
'gzip',
'stream/gzip',
# te: trailers strings
'te',
'trailers',
# metadata elements
# begin hpack static elements
(':authority', ''),
@ -147,6 +144,7 @@ CONFIG = [
('grpc-encoding', 'identity'),
('grpc-encoding', 'gzip'),
('grpc-encoding', 'deflate'),
('te', 'trailers'),
('content-type', 'application/grpc'),
(':scheme', 'grpc'),
(':method', 'PUT'),
@ -164,6 +162,7 @@ METADATA_BATCH_CALLOUTS = [
':status',
':authority',
':scheme',
'te',
'grpc-message',
'grpc-status',
'grpc-payload-bin',

Loading…
Cancel
Save