Merge pull request #10391 from dgquintas/lr_back_to_md

Load Reporting back to using metadata
pull/10678/head
David G. Quintas 8 years ago committed by GitHub
commit a6f64f4c00
  1. 1
      grpc.def
  2. 6
      include/grpc/grpc.h
  3. 12
      include/grpc/load_reporting.h
  4. 17
      src/core/ext/filters/load_reporting/load_reporting.c
  5. 27
      src/core/ext/filters/load_reporting/load_reporting_filter.c
  6. 3
      src/core/lib/channel/context.h
  7. 195
      src/core/lib/transport/static_metadata.c
  8. 97
      src/core/lib/transport/static_metadata.h
  9. 12
      src/cpp/server/server_context.cc
  10. 2
      src/ruby/ext/grpc/rb_grpc_imports.generated.c
  11. 3
      src/ruby/ext/grpc/rb_grpc_imports.generated.h
  12. 2
      test/core/end2end/fuzzers/hpack.dictionary
  13. 22
      test/core/end2end/tests/load_reporting_hook.c
  14. 1
      tools/codegen/core/gen_static_metadata.py

@ -72,7 +72,6 @@ EXPORTS
grpc_channel_create_registered_call grpc_channel_create_registered_call
grpc_call_start_batch grpc_call_start_batch
grpc_call_get_peer grpc_call_get_peer
grpc_call_set_load_reporting_cost_context
grpc_census_call_set_context grpc_census_call_set_context
grpc_census_call_get_context grpc_census_call_get_context
grpc_channel_get_target grpc_channel_get_target

@ -296,12 +296,6 @@ GRPCAPI grpc_call_error grpc_call_start_batch(grpc_call *call,
functionality. Instead, use grpc_auth_context. */ functionality. Instead, use grpc_auth_context. */
GRPCAPI char *grpc_call_get_peer(grpc_call *call); GRPCAPI char *grpc_call_get_peer(grpc_call *call);
struct grpc_load_reporting_cost_context;
/* Associate costs contained in \a cost_context to \a call. */
GRPCAPI void grpc_call_set_load_reporting_cost_context(
grpc_call *call, struct grpc_load_reporting_cost_context *context);
struct census_context; struct census_context;
/** Set census context for a call; Must be called before first call to /** Set census context for a call; Must be called before first call to

@ -35,7 +35,6 @@
#define GRPC_LOAD_REPORTING_H #define GRPC_LOAD_REPORTING_H
#include <grpc/impl/codegen/port_platform.h> #include <grpc/impl/codegen/port_platform.h>
#include <grpc/slice.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -50,11 +49,12 @@ extern "C" {
* gRPC LB system. */ * gRPC LB system. */
#define GRPC_LB_TOKEN_MD_KEY "lb-token" #define GRPC_LB_TOKEN_MD_KEY "lb-token"
/** A sequence of values for load reporting purposes */ /** Metadata key for gRPC LB cost reporting.
typedef struct grpc_load_reporting_cost_context { *
grpc_slice *values; * The value corresponding to this key is an opaque binary blob reported by the
size_t values_count; * backend as part of its trailing metadata containing cost information for the
} grpc_load_reporting_cost_context; * call. */
#define GRPC_LB_COST_MD_KEY "lb-cost-bin"
#ifdef __cplusplus #ifdef __cplusplus
} }

@ -47,23 +47,6 @@
#include "src/core/lib/surface/call.h" #include "src/core/lib/surface/call.h"
#include "src/core/lib/surface/channel_init.h" #include "src/core/lib/surface/channel_init.h"
static void destroy_lr_cost_context(void *c) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_load_reporting_cost_context *cost_ctx = c;
for (size_t i = 0; i < cost_ctx->values_count; ++i) {
grpc_slice_unref_internal(&exec_ctx, cost_ctx->values[i]);
}
grpc_exec_ctx_finish(&exec_ctx);
gpr_free(cost_ctx->values);
gpr_free(cost_ctx);
}
void grpc_call_set_load_reporting_cost_context(
grpc_call *call, grpc_load_reporting_cost_context *ctx) {
grpc_call_context_set(call, GRPC_CONTEXT_LR_COST, ctx,
destroy_lr_cost_context);
}
static bool is_load_reporting_enabled(const grpc_channel_args *a) { static bool is_load_reporting_enabled(const grpc_channel_args *a) {
return grpc_channel_arg_get_bool( return grpc_channel_arg_get_bool(
grpc_channel_args_find(a, GRPC_ARG_ENABLE_LOAD_REPORTING), false); grpc_channel_args_find(a, GRPC_ARG_ENABLE_LOAD_REPORTING), false);

@ -48,6 +48,8 @@
typedef struct call_data { typedef struct call_data {
intptr_t id; /**< an id unique to the call */ intptr_t id; /**< an id unique to the call */
bool have_trailing_md_string;
grpc_slice trailing_md_string;
bool have_initial_md_string; bool have_initial_md_string;
grpc_slice initial_md_string; grpc_slice initial_md_string;
bool have_service_method; bool have_service_method;
@ -140,6 +142,9 @@ static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
if (calld->have_initial_md_string) { if (calld->have_initial_md_string) {
grpc_slice_unref_internal(exec_ctx, calld->initial_md_string); grpc_slice_unref_internal(exec_ctx, calld->initial_md_string);
} }
if (calld->have_trailing_md_string) {
grpc_slice_unref_internal(exec_ctx, calld->trailing_md_string);
}
if (calld->have_service_method) { if (calld->have_service_method) {
grpc_slice_unref_internal(exec_ctx, calld->service_method); grpc_slice_unref_internal(exec_ctx, calld->service_method);
} }
@ -183,6 +188,18 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
*/ */
} }
static grpc_filtered_mdelem lr_trailing_md_filter(grpc_exec_ctx *exec_ctx,
void *user_data,
grpc_mdelem md) {
grpc_call_element *elem = user_data;
call_data *calld = elem->call_data;
if (grpc_slice_eq(GRPC_MDKEY(md), GRPC_MDSTR_LB_COST_BIN)) {
calld->trailing_md_string = GRPC_MDVALUE(md);
return GRPC_FILTERED_REMOVE();
}
return GRPC_FILTERED_MDELEM(md);
}
static void lr_start_transport_stream_op_batch( static void lr_start_transport_stream_op_batch(
grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
grpc_transport_stream_op_batch *op) { grpc_transport_stream_op_batch *op) {
@ -190,13 +207,21 @@ static void lr_start_transport_stream_op_batch(
call_data *calld = elem->call_data; call_data *calld = elem->call_data;
if (op->recv_initial_metadata) { if (op->recv_initial_metadata) {
/* substitute our callback for the higher callback */
calld->recv_initial_metadata = calld->recv_initial_metadata =
op->payload->recv_initial_metadata.recv_initial_metadata; op->payload->recv_initial_metadata.recv_initial_metadata;
/* substitute our callback for the higher callback */
calld->ops_recv_initial_metadata_ready = calld->ops_recv_initial_metadata_ready =
op->payload->recv_initial_metadata.recv_initial_metadata_ready; op->payload->recv_initial_metadata.recv_initial_metadata_ready;
op->payload->recv_initial_metadata.recv_initial_metadata_ready = op->payload->recv_initial_metadata.recv_initial_metadata_ready =
&calld->on_initial_md_ready; &calld->on_initial_md_ready;
} else if (op->send_trailing_metadata) {
GRPC_LOG_IF_ERROR(
"grpc_metadata_batch_filter",
grpc_metadata_batch_filter(
exec_ctx,
op->payload->send_trailing_metadata.send_trailing_metadata,
lr_trailing_md_filter, elem,
"LR trailing metadata filtering error"));
} }
grpc_call_next_op(exec_ctx, elem, op); grpc_call_next_op(exec_ctx, elem, op);

@ -50,9 +50,6 @@ typedef enum {
/// Reserved for traffic_class_context. /// Reserved for traffic_class_context.
GRPC_CONTEXT_TRAFFIC, GRPC_CONTEXT_TRAFFIC,
/// Costs for Load Reporting.
GRPC_CONTEXT_LR_COST,
GRPC_CONTEXT_COUNT GRPC_CONTEXT_COUNT
} grpc_context_index; } grpc_context_index;

@ -97,23 +97,23 @@ static uint8_t g_bytes[] = {
101, 105, 102, 45, 110, 111, 110, 101, 45, 109, 97, 116, 99, 104, 105, 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, 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, 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, 45, 109, 111, 100, 105, 102, 105, 101, 100, 108, 98, 45, 99, 111, 115,
99, 97, 116, 105, 111, 110, 109, 97, 120, 45, 102, 111, 114, 119, 97, 116, 45, 98, 105, 110, 108, 105, 110, 107, 108, 111, 99, 97, 116, 105,
114, 100, 115, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, 101, 110, 111, 110, 109, 97, 120, 45, 102, 111, 114, 119, 97, 114, 100, 115, 112,
116, 105, 99, 97, 116, 101, 112, 114, 111, 120, 121, 45, 97, 117, 116, 114, 111, 120, 121, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97,
104, 111, 114, 105, 122, 97, 116, 105, 111, 110, 114, 97, 110, 103, 101, 116, 101, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, 111, 114, 105,
114, 101, 102, 101, 114, 101, 114, 114, 101, 102, 114, 101, 115, 104, 114, 122, 97, 116, 105, 111, 110, 114, 97, 110, 103, 101, 114, 101, 102, 101,
101, 116, 114, 121, 45, 97, 102, 116, 101, 114, 115, 101, 114, 118, 101, 114, 101, 114, 114, 101, 102, 114, 101, 115, 104, 114, 101, 116, 114, 121,
114, 115, 101, 116, 45, 99, 111, 111, 107, 105, 101, 115, 116, 114, 105, 45, 97, 102, 116, 101, 114, 115, 101, 114, 118, 101, 114, 115, 101, 116,
99, 116, 45, 116, 114, 97, 110, 115, 112, 111, 114, 116, 45, 115, 101, 45, 99, 111, 111, 107, 105, 101, 115, 116, 114, 105, 99, 116, 45, 116,
99, 117, 114, 105, 116, 121, 116, 114, 97, 110, 115, 102, 101, 114, 45, 114, 97, 110, 115, 112, 111, 114, 116, 45, 115, 101, 99, 117, 114, 105,
101, 110, 99, 111, 100, 105, 110, 103, 118, 97, 114, 121, 118, 105, 97, 116, 121, 116, 114, 97, 110, 115, 102, 101, 114, 45, 101, 110, 99, 111,
119, 119, 119, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 100, 105, 110, 103, 118, 97, 114, 121, 118, 105, 97, 119, 119, 119, 45,
101, 105, 100, 101, 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 105, 100, 101,
116, 101, 105, 100, 101, 110, 116, 105, 116, 121, 44, 103, 122, 105, 112, 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 105, 100,
100, 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112, 105, 100, 101, 101, 110, 116, 105, 116, 121, 44, 103, 122, 105, 112, 100, 101, 102, 108,
110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 44, 103, 97, 116, 101, 44, 103, 122, 105, 112, 105, 100, 101, 110, 116, 105, 116,
122, 105, 112}; 121, 44, 100, 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112};
static void static_ref(void *unused) {} static void static_ref(void *unused) {}
static void static_unref(grpc_exec_ctx *exec_ctx, void *unused) {} static void static_unref(grpc_exec_ctx *exec_ctx, void *unused) {}
@ -223,6 +223,7 @@ grpc_slice_refcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = {
{&grpc_static_metadata_vtable, &static_sub_refcnt}, {&grpc_static_metadata_vtable, &static_sub_refcnt},
{&grpc_static_metadata_vtable, &static_sub_refcnt}, {&grpc_static_metadata_vtable, &static_sub_refcnt},
{&grpc_static_metadata_vtable, &static_sub_refcnt}, {&grpc_static_metadata_vtable, &static_sub_refcnt},
{&grpc_static_metadata_vtable, &static_sub_refcnt},
}; };
const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = { const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = {
@ -383,64 +384,67 @@ const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = {
{.refcount = &grpc_static_metadata_refcounts[77], {.refcount = &grpc_static_metadata_refcounts[77],
.data.refcounted = {g_bytes + 791, 13}}, .data.refcounted = {g_bytes + 791, 13}},
{.refcount = &grpc_static_metadata_refcounts[78], {.refcount = &grpc_static_metadata_refcounts[78],
.data.refcounted = {g_bytes + 804, 4}}, .data.refcounted = {g_bytes + 804, 11}},
{.refcount = &grpc_static_metadata_refcounts[79], {.refcount = &grpc_static_metadata_refcounts[79],
.data.refcounted = {g_bytes + 808, 8}}, .data.refcounted = {g_bytes + 815, 4}},
{.refcount = &grpc_static_metadata_refcounts[80], {.refcount = &grpc_static_metadata_refcounts[80],
.data.refcounted = {g_bytes + 816, 12}}, .data.refcounted = {g_bytes + 819, 8}},
{.refcount = &grpc_static_metadata_refcounts[81], {.refcount = &grpc_static_metadata_refcounts[81],
.data.refcounted = {g_bytes + 828, 18}}, .data.refcounted = {g_bytes + 827, 12}},
{.refcount = &grpc_static_metadata_refcounts[82], {.refcount = &grpc_static_metadata_refcounts[82],
.data.refcounted = {g_bytes + 846, 19}}, .data.refcounted = {g_bytes + 839, 18}},
{.refcount = &grpc_static_metadata_refcounts[83], {.refcount = &grpc_static_metadata_refcounts[83],
.data.refcounted = {g_bytes + 865, 5}}, .data.refcounted = {g_bytes + 857, 19}},
{.refcount = &grpc_static_metadata_refcounts[84], {.refcount = &grpc_static_metadata_refcounts[84],
.data.refcounted = {g_bytes + 870, 7}}, .data.refcounted = {g_bytes + 876, 5}},
{.refcount = &grpc_static_metadata_refcounts[85], {.refcount = &grpc_static_metadata_refcounts[85],
.data.refcounted = {g_bytes + 877, 7}}, .data.refcounted = {g_bytes + 881, 7}},
{.refcount = &grpc_static_metadata_refcounts[86], {.refcount = &grpc_static_metadata_refcounts[86],
.data.refcounted = {g_bytes + 884, 11}}, .data.refcounted = {g_bytes + 888, 7}},
{.refcount = &grpc_static_metadata_refcounts[87], {.refcount = &grpc_static_metadata_refcounts[87],
.data.refcounted = {g_bytes + 895, 6}}, .data.refcounted = {g_bytes + 895, 11}},
{.refcount = &grpc_static_metadata_refcounts[88], {.refcount = &grpc_static_metadata_refcounts[88],
.data.refcounted = {g_bytes + 901, 10}}, .data.refcounted = {g_bytes + 906, 6}},
{.refcount = &grpc_static_metadata_refcounts[89], {.refcount = &grpc_static_metadata_refcounts[89],
.data.refcounted = {g_bytes + 911, 25}}, .data.refcounted = {g_bytes + 912, 10}},
{.refcount = &grpc_static_metadata_refcounts[90], {.refcount = &grpc_static_metadata_refcounts[90],
.data.refcounted = {g_bytes + 936, 17}}, .data.refcounted = {g_bytes + 922, 25}},
{.refcount = &grpc_static_metadata_refcounts[91], {.refcount = &grpc_static_metadata_refcounts[91],
.data.refcounted = {g_bytes + 953, 4}}, .data.refcounted = {g_bytes + 947, 17}},
{.refcount = &grpc_static_metadata_refcounts[92], {.refcount = &grpc_static_metadata_refcounts[92],
.data.refcounted = {g_bytes + 957, 3}}, .data.refcounted = {g_bytes + 964, 4}},
{.refcount = &grpc_static_metadata_refcounts[93], {.refcount = &grpc_static_metadata_refcounts[93],
.data.refcounted = {g_bytes + 960, 16}}, .data.refcounted = {g_bytes + 968, 3}},
{.refcount = &grpc_static_metadata_refcounts[94], {.refcount = &grpc_static_metadata_refcounts[94],
.data.refcounted = {g_bytes + 976, 16}}, .data.refcounted = {g_bytes + 971, 16}},
{.refcount = &grpc_static_metadata_refcounts[95], {.refcount = &grpc_static_metadata_refcounts[95],
.data.refcounted = {g_bytes + 992, 13}}, .data.refcounted = {g_bytes + 987, 16}},
{.refcount = &grpc_static_metadata_refcounts[96], {.refcount = &grpc_static_metadata_refcounts[96],
.data.refcounted = {g_bytes + 1005, 12}}, .data.refcounted = {g_bytes + 1003, 13}},
{.refcount = &grpc_static_metadata_refcounts[97], {.refcount = &grpc_static_metadata_refcounts[97],
.data.refcounted = {g_bytes + 1017, 21}}, .data.refcounted = {g_bytes + 1016, 12}},
{.refcount = &grpc_static_metadata_refcounts[98],
.data.refcounted = {g_bytes + 1028, 21}},
}; };
uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = { uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 6, 6, 8, 8}; 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 6, 6, 8, 8};
static const int8_t elems_r[] = { static const int8_t elems_r[] = {
10, 8, -3, 0, 9, 21, -76, 22, 0, 10, -7, 0, 0, 0, 14, 0, 10, 8, -3, 0, 9, 21, -77, 22, 0, 10, -7, 0, 0, 0,
13, 12, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 13, 12, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, -50, -51, 15, -53, -54, -55, -56, -56, -57, -58, 0, 37, 36, 35, 34, 0, 0, 0, 0, 0, 0, 0, -50, -51, 16, -53, -54, -55, -56,
33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, -56, -57, -58, -59, 0, 37, 36, 35, 34, 33, 32, 31, 30, 29,
17, 16, 15, 14, 13, 12, 11, 10, 13, 12, 11, 10, 9, 8, 7, 0}; 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15,
14, 13, 12, 11, 10, 13, 12, 11, 10, 9, 8, 7, 0};
static uint32_t elems_phash(uint32_t i) { static uint32_t elems_phash(uint32_t i) {
i -= 42; i -= 42;
uint32_t x = i % 96; uint32_t x = i % 97;
uint32_t y = i / 96; uint32_t y = i / 97;
uint32_t h = x; uint32_t h = x;
if (y < GPR_ARRAY_SIZE(elems_r)) { if (y < GPR_ARRAY_SIZE(elems_r)) {
uint32_t delta = (uint32_t)elems_r[y]; uint32_t delta = (uint32_t)elems_r[y];
@ -450,29 +454,30 @@ static uint32_t elems_phash(uint32_t i) {
} }
static const uint16_t elem_keys[] = { static const uint16_t elem_keys[] = {
1009, 1010, 1011, 240, 241, 242, 243, 244, 138, 139, 42, 43, 1019, 1020, 1021, 242, 243, 244, 245, 246, 139, 140, 42, 43,
429, 430, 431, 911, 912, 913, 712, 713, 1392, 522, 714, 1588, 433, 434, 435, 920, 921, 922, 719, 720, 1406, 527, 721, 1604,
1686, 1784, 4822, 4920, 4951, 5116, 5214, 5312, 5410, 1405, 5508, 5606, 1703, 1802, 4871, 4970, 5001, 5168, 5267, 5366, 5465, 1419, 5564, 5663,
5704, 5802, 5900, 5998, 6096, 6194, 6292, 6390, 6488, 6586, 6684, 6782, 5762, 5861, 5960, 6059, 6158, 6257, 6356, 6455, 6554, 6653, 6752, 6851,
6880, 6978, 7076, 7174, 7272, 7370, 7468, 7566, 7664, 7762, 7860, 7958, 6950, 7049, 7148, 7247, 7346, 7445, 7544, 7643, 7742, 7841, 7940, 8039,
8056, 8154, 8252, 8350, 8448, 1074, 1075, 1076, 1077, 8546, 8644, 8742, 8138, 8237, 8336, 8435, 8534, 8633, 1085, 1086, 1087, 1088, 8732, 8831,
8840, 8938, 9036, 9134, 0, 314, 0, 0, 0, 0, 0, 0, 8930, 9029, 9128, 9227, 9326, 0, 317, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 133, 233, 234, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 132, 231, 232, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 0};
static const uint8_t elem_idxs[] = { static const uint8_t elem_idxs[] = {
73, 76, 74, 19, 20, 21, 22, 23, 15, 16, 17, 18, 11, 12, 13, 74, 77, 75, 19, 20, 21, 22, 23, 15, 16, 17, 18, 11, 12, 13,
3, 4, 5, 0, 1, 41, 6, 2, 69, 48, 55, 24, 25, 26, 27, 3, 4, 5, 0, 1, 41, 6, 2, 70, 48, 55, 24, 25, 26, 27,
28, 29, 30, 7, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 42, 28, 29, 30, 7, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 42,
43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59,
60, 61, 62, 63, 64, 75, 77, 78, 79, 65, 66, 67, 68, 70, 71, 60, 61, 62, 63, 64, 65, 76, 78, 79, 80, 66, 67, 68, 69, 71,
72, 255, 14, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 72, 73, 255, 14, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 8, 9, 10}; 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 8, 9, 10};
grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b) { grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b) {
if (a == -1 || b == -1) return GRPC_MDNULL; if (a == -1 || b == -1) return GRPC_MDNULL;
uint32_t k = (uint32_t)(a * 98 + b); uint32_t k = (uint32_t)(a * 99 + b);
uint32_t h = elems_phash(k); uint32_t h = elems_phash(k);
return h < GPR_ARRAY_SIZE(elem_keys) && elem_keys[h] == k return h < GPR_ARRAY_SIZE(elem_keys) && elem_keys[h] == k
? GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[elem_idxs[h]], ? GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[elem_idxs[h]],
@ -706,71 +711,75 @@ grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = {
{.refcount = &grpc_static_metadata_refcounts[20], {.refcount = &grpc_static_metadata_refcounts[20],
.data.refcounted = {g_bytes + 234, 0}}}, .data.refcounted = {g_bytes + 234, 0}}},
{{.refcount = &grpc_static_metadata_refcounts[78], {{.refcount = &grpc_static_metadata_refcounts[78],
.data.refcounted = {g_bytes + 804, 4}}, .data.refcounted = {g_bytes + 804, 11}},
{.refcount = &grpc_static_metadata_refcounts[20], {.refcount = &grpc_static_metadata_refcounts[20],
.data.refcounted = {g_bytes + 234, 0}}}, .data.refcounted = {g_bytes + 234, 0}}},
{{.refcount = &grpc_static_metadata_refcounts[79], {{.refcount = &grpc_static_metadata_refcounts[79],
.data.refcounted = {g_bytes + 808, 8}}, .data.refcounted = {g_bytes + 815, 4}},
{.refcount = &grpc_static_metadata_refcounts[20], {.refcount = &grpc_static_metadata_refcounts[20],
.data.refcounted = {g_bytes + 234, 0}}}, .data.refcounted = {g_bytes + 234, 0}}},
{{.refcount = &grpc_static_metadata_refcounts[80], {{.refcount = &grpc_static_metadata_refcounts[80],
.data.refcounted = {g_bytes + 816, 12}}, .data.refcounted = {g_bytes + 819, 8}},
{.refcount = &grpc_static_metadata_refcounts[20], {.refcount = &grpc_static_metadata_refcounts[20],
.data.refcounted = {g_bytes + 234, 0}}}, .data.refcounted = {g_bytes + 234, 0}}},
{{.refcount = &grpc_static_metadata_refcounts[81], {{.refcount = &grpc_static_metadata_refcounts[81],
.data.refcounted = {g_bytes + 828, 18}}, .data.refcounted = {g_bytes + 827, 12}},
{.refcount = &grpc_static_metadata_refcounts[20], {.refcount = &grpc_static_metadata_refcounts[20],
.data.refcounted = {g_bytes + 234, 0}}}, .data.refcounted = {g_bytes + 234, 0}}},
{{.refcount = &grpc_static_metadata_refcounts[82], {{.refcount = &grpc_static_metadata_refcounts[82],
.data.refcounted = {g_bytes + 846, 19}}, .data.refcounted = {g_bytes + 839, 18}},
{.refcount = &grpc_static_metadata_refcounts[20], {.refcount = &grpc_static_metadata_refcounts[20],
.data.refcounted = {g_bytes + 234, 0}}}, .data.refcounted = {g_bytes + 234, 0}}},
{{.refcount = &grpc_static_metadata_refcounts[83], {{.refcount = &grpc_static_metadata_refcounts[83],
.data.refcounted = {g_bytes + 865, 5}}, .data.refcounted = {g_bytes + 857, 19}},
{.refcount = &grpc_static_metadata_refcounts[20], {.refcount = &grpc_static_metadata_refcounts[20],
.data.refcounted = {g_bytes + 234, 0}}}, .data.refcounted = {g_bytes + 234, 0}}},
{{.refcount = &grpc_static_metadata_refcounts[84], {{.refcount = &grpc_static_metadata_refcounts[84],
.data.refcounted = {g_bytes + 870, 7}}, .data.refcounted = {g_bytes + 876, 5}},
{.refcount = &grpc_static_metadata_refcounts[20], {.refcount = &grpc_static_metadata_refcounts[20],
.data.refcounted = {g_bytes + 234, 0}}}, .data.refcounted = {g_bytes + 234, 0}}},
{{.refcount = &grpc_static_metadata_refcounts[85], {{.refcount = &grpc_static_metadata_refcounts[85],
.data.refcounted = {g_bytes + 877, 7}}, .data.refcounted = {g_bytes + 881, 7}},
{.refcount = &grpc_static_metadata_refcounts[20], {.refcount = &grpc_static_metadata_refcounts[20],
.data.refcounted = {g_bytes + 234, 0}}}, .data.refcounted = {g_bytes + 234, 0}}},
{{.refcount = &grpc_static_metadata_refcounts[86], {{.refcount = &grpc_static_metadata_refcounts[86],
.data.refcounted = {g_bytes + 884, 11}}, .data.refcounted = {g_bytes + 888, 7}},
{.refcount = &grpc_static_metadata_refcounts[20], {.refcount = &grpc_static_metadata_refcounts[20],
.data.refcounted = {g_bytes + 234, 0}}}, .data.refcounted = {g_bytes + 234, 0}}},
{{.refcount = &grpc_static_metadata_refcounts[87], {{.refcount = &grpc_static_metadata_refcounts[87],
.data.refcounted = {g_bytes + 895, 6}}, .data.refcounted = {g_bytes + 895, 11}},
{.refcount = &grpc_static_metadata_refcounts[20], {.refcount = &grpc_static_metadata_refcounts[20],
.data.refcounted = {g_bytes + 234, 0}}}, .data.refcounted = {g_bytes + 234, 0}}},
{{.refcount = &grpc_static_metadata_refcounts[88], {{.refcount = &grpc_static_metadata_refcounts[88],
.data.refcounted = {g_bytes + 901, 10}}, .data.refcounted = {g_bytes + 906, 6}},
{.refcount = &grpc_static_metadata_refcounts[20], {.refcount = &grpc_static_metadata_refcounts[20],
.data.refcounted = {g_bytes + 234, 0}}}, .data.refcounted = {g_bytes + 234, 0}}},
{{.refcount = &grpc_static_metadata_refcounts[89], {{.refcount = &grpc_static_metadata_refcounts[89],
.data.refcounted = {g_bytes + 911, 25}}, .data.refcounted = {g_bytes + 912, 10}},
{.refcount = &grpc_static_metadata_refcounts[20], {.refcount = &grpc_static_metadata_refcounts[20],
.data.refcounted = {g_bytes + 234, 0}}}, .data.refcounted = {g_bytes + 234, 0}}},
{{.refcount = &grpc_static_metadata_refcounts[90], {{.refcount = &grpc_static_metadata_refcounts[90],
.data.refcounted = {g_bytes + 936, 17}}, .data.refcounted = {g_bytes + 922, 25}},
{.refcount = &grpc_static_metadata_refcounts[20], {.refcount = &grpc_static_metadata_refcounts[20],
.data.refcounted = {g_bytes + 234, 0}}}, .data.refcounted = {g_bytes + 234, 0}}},
{{.refcount = &grpc_static_metadata_refcounts[16], {{.refcount = &grpc_static_metadata_refcounts[91],
.data.refcounted = {g_bytes + 200, 10}}, .data.refcounted = {g_bytes + 947, 17}},
{.refcount = &grpc_static_metadata_refcounts[20], {.refcount = &grpc_static_metadata_refcounts[20],
.data.refcounted = {g_bytes + 234, 0}}}, .data.refcounted = {g_bytes + 234, 0}}},
{{.refcount = &grpc_static_metadata_refcounts[91], {{.refcount = &grpc_static_metadata_refcounts[16],
.data.refcounted = {g_bytes + 953, 4}}, .data.refcounted = {g_bytes + 200, 10}},
{.refcount = &grpc_static_metadata_refcounts[20], {.refcount = &grpc_static_metadata_refcounts[20],
.data.refcounted = {g_bytes + 234, 0}}}, .data.refcounted = {g_bytes + 234, 0}}},
{{.refcount = &grpc_static_metadata_refcounts[92], {{.refcount = &grpc_static_metadata_refcounts[92],
.data.refcounted = {g_bytes + 957, 3}}, .data.refcounted = {g_bytes + 964, 4}},
{.refcount = &grpc_static_metadata_refcounts[20], {.refcount = &grpc_static_metadata_refcounts[20],
.data.refcounted = {g_bytes + 234, 0}}}, .data.refcounted = {g_bytes + 234, 0}}},
{{.refcount = &grpc_static_metadata_refcounts[93], {{.refcount = &grpc_static_metadata_refcounts[93],
.data.refcounted = {g_bytes + 960, 16}}, .data.refcounted = {g_bytes + 968, 3}},
{.refcount = &grpc_static_metadata_refcounts[20],
.data.refcounted = {g_bytes + 234, 0}}},
{{.refcount = &grpc_static_metadata_refcounts[94],
.data.refcounted = {g_bytes + 971, 16}},
{.refcount = &grpc_static_metadata_refcounts[20], {.refcount = &grpc_static_metadata_refcounts[20],
.data.refcounted = {g_bytes + 234, 0}}}, .data.refcounted = {g_bytes + 234, 0}}},
{{.refcount = &grpc_static_metadata_refcounts[10], {{.refcount = &grpc_static_metadata_refcounts[10],
@ -783,24 +792,24 @@ grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = {
.data.refcounted = {g_bytes + 377, 7}}}, .data.refcounted = {g_bytes + 377, 7}}},
{{.refcount = &grpc_static_metadata_refcounts[10], {{.refcount = &grpc_static_metadata_refcounts[10],
.data.refcounted = {g_bytes + 90, 20}}, .data.refcounted = {g_bytes + 90, 20}},
{.refcount = &grpc_static_metadata_refcounts[94], {.refcount = &grpc_static_metadata_refcounts[95],
.data.refcounted = {g_bytes + 976, 16}}}, .data.refcounted = {g_bytes + 987, 16}}},
{{.refcount = &grpc_static_metadata_refcounts[10], {{.refcount = &grpc_static_metadata_refcounts[10],
.data.refcounted = {g_bytes + 90, 20}}, .data.refcounted = {g_bytes + 90, 20}},
{.refcount = &grpc_static_metadata_refcounts[30], {.refcount = &grpc_static_metadata_refcounts[30],
.data.refcounted = {g_bytes + 373, 4}}}, .data.refcounted = {g_bytes + 373, 4}}},
{{.refcount = &grpc_static_metadata_refcounts[10],
.data.refcounted = {g_bytes + 90, 20}},
{.refcount = &grpc_static_metadata_refcounts[95],
.data.refcounted = {g_bytes + 992, 13}}},
{{.refcount = &grpc_static_metadata_refcounts[10], {{.refcount = &grpc_static_metadata_refcounts[10],
.data.refcounted = {g_bytes + 90, 20}}, .data.refcounted = {g_bytes + 90, 20}},
{.refcount = &grpc_static_metadata_refcounts[96], {.refcount = &grpc_static_metadata_refcounts[96],
.data.refcounted = {g_bytes + 1005, 12}}}, .data.refcounted = {g_bytes + 1003, 13}}},
{{.refcount = &grpc_static_metadata_refcounts[10], {{.refcount = &grpc_static_metadata_refcounts[10],
.data.refcounted = {g_bytes + 90, 20}}, .data.refcounted = {g_bytes + 90, 20}},
{.refcount = &grpc_static_metadata_refcounts[97], {.refcount = &grpc_static_metadata_refcounts[97],
.data.refcounted = {g_bytes + 1017, 21}}}, .data.refcounted = {g_bytes + 1016, 12}}},
{{.refcount = &grpc_static_metadata_refcounts[10],
.data.refcounted = {g_bytes + 90, 20}},
{.refcount = &grpc_static_metadata_refcounts[98],
.data.refcounted = {g_bytes + 1028, 21}}},
}; };
const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 73, 74, 75, const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 74, 75, 76,
76, 77, 78, 79}; 77, 78, 79, 80};

@ -44,7 +44,7 @@
#include "src/core/lib/transport/metadata.h" #include "src/core/lib/transport/metadata.h"
#define GRPC_STATIC_MDSTR_COUNT 98 #define GRPC_STATIC_MDSTR_COUNT 99
extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]; extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT];
/* ":path" */ /* ":path" */
#define GRPC_MDSTR_PATH (grpc_static_slice_table[0]) #define GRPC_MDSTR_PATH (grpc_static_slice_table[0])
@ -205,47 +205,49 @@ extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT];
#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[76]) #define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[76])
/* "last-modified" */ /* "last-modified" */
#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[77]) #define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[77])
/* "lb-cost-bin" */
#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[78])
/* "link" */ /* "link" */
#define GRPC_MDSTR_LINK (grpc_static_slice_table[78]) #define GRPC_MDSTR_LINK (grpc_static_slice_table[79])
/* "location" */ /* "location" */
#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[79]) #define GRPC_MDSTR_LOCATION (grpc_static_slice_table[80])
/* "max-forwards" */ /* "max-forwards" */
#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[80]) #define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[81])
/* "proxy-authenticate" */ /* "proxy-authenticate" */
#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[81]) #define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[82])
/* "proxy-authorization" */ /* "proxy-authorization" */
#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[82]) #define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[83])
/* "range" */ /* "range" */
#define GRPC_MDSTR_RANGE (grpc_static_slice_table[83]) #define GRPC_MDSTR_RANGE (grpc_static_slice_table[84])
/* "referer" */ /* "referer" */
#define GRPC_MDSTR_REFERER (grpc_static_slice_table[84]) #define GRPC_MDSTR_REFERER (grpc_static_slice_table[85])
/* "refresh" */ /* "refresh" */
#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[85]) #define GRPC_MDSTR_REFRESH (grpc_static_slice_table[86])
/* "retry-after" */ /* "retry-after" */
#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[86]) #define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[87])
/* "server" */ /* "server" */
#define GRPC_MDSTR_SERVER (grpc_static_slice_table[87]) #define GRPC_MDSTR_SERVER (grpc_static_slice_table[88])
/* "set-cookie" */ /* "set-cookie" */
#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[88]) #define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[89])
/* "strict-transport-security" */ /* "strict-transport-security" */
#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[89]) #define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[90])
/* "transfer-encoding" */ /* "transfer-encoding" */
#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[90]) #define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[91])
/* "vary" */ /* "vary" */
#define GRPC_MDSTR_VARY (grpc_static_slice_table[91]) #define GRPC_MDSTR_VARY (grpc_static_slice_table[92])
/* "via" */ /* "via" */
#define GRPC_MDSTR_VIA (grpc_static_slice_table[92]) #define GRPC_MDSTR_VIA (grpc_static_slice_table[93])
/* "www-authenticate" */ /* "www-authenticate" */
#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[93]) #define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[94])
/* "identity,deflate" */ /* "identity,deflate" */
#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[94]) #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[95])
/* "identity,gzip" */ /* "identity,gzip" */
#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[95]) #define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[96])
/* "deflate,gzip" */ /* "deflate,gzip" */
#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[96]) #define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[97])
/* "identity,deflate,gzip" */ /* "identity,deflate,gzip" */
#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \
(grpc_static_slice_table[97]) (grpc_static_slice_table[98])
extern const grpc_slice_refcount_vtable grpc_static_metadata_vtable; extern const grpc_slice_refcount_vtable grpc_static_metadata_vtable;
extern grpc_slice_refcount extern grpc_slice_refcount
@ -257,7 +259,7 @@ extern grpc_slice_refcount
#define GRPC_STATIC_METADATA_INDEX(static_slice) \ #define GRPC_STATIC_METADATA_INDEX(static_slice) \
((int)((static_slice).refcount - grpc_static_metadata_refcounts)) ((int)((static_slice).refcount - grpc_static_metadata_refcounts))
#define GRPC_STATIC_MDELEM_COUNT 80 #define GRPC_STATIC_MDELEM_COUNT 81
extern grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT]; extern grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];
extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT]; extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];
/* "grpc-status": "0" */ /* "grpc-status": "0" */
@ -428,78 +430,81 @@ extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];
/* "lb-token": "" */ /* "lb-token": "" */
#define GRPC_MDELEM_LB_TOKEN_EMPTY \ #define GRPC_MDELEM_LB_TOKEN_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[55], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[55], GRPC_MDELEM_STORAGE_STATIC))
/* "lb-cost-bin": "" */
#define GRPC_MDELEM_LB_COST_BIN_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[56], GRPC_MDELEM_STORAGE_STATIC))
/* "link": "" */ /* "link": "" */
#define GRPC_MDELEM_LINK_EMPTY \ #define GRPC_MDELEM_LINK_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[56], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[57], GRPC_MDELEM_STORAGE_STATIC))
/* "location": "" */ /* "location": "" */
#define GRPC_MDELEM_LOCATION_EMPTY \ #define GRPC_MDELEM_LOCATION_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[57], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[58], GRPC_MDELEM_STORAGE_STATIC))
/* "max-forwards": "" */ /* "max-forwards": "" */
#define GRPC_MDELEM_MAX_FORWARDS_EMPTY \ #define GRPC_MDELEM_MAX_FORWARDS_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[58], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[59], GRPC_MDELEM_STORAGE_STATIC))
/* "proxy-authenticate": "" */ /* "proxy-authenticate": "" */
#define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY \ #define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[59], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[60], GRPC_MDELEM_STORAGE_STATIC))
/* "proxy-authorization": "" */ /* "proxy-authorization": "" */
#define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY \ #define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[60], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[61], GRPC_MDELEM_STORAGE_STATIC))
/* "range": "" */ /* "range": "" */
#define GRPC_MDELEM_RANGE_EMPTY \ #define GRPC_MDELEM_RANGE_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[61], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[62], GRPC_MDELEM_STORAGE_STATIC))
/* "referer": "" */ /* "referer": "" */
#define GRPC_MDELEM_REFERER_EMPTY \ #define GRPC_MDELEM_REFERER_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[62], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[63], GRPC_MDELEM_STORAGE_STATIC))
/* "refresh": "" */ /* "refresh": "" */
#define GRPC_MDELEM_REFRESH_EMPTY \ #define GRPC_MDELEM_REFRESH_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[63], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[64], GRPC_MDELEM_STORAGE_STATIC))
/* "retry-after": "" */ /* "retry-after": "" */
#define GRPC_MDELEM_RETRY_AFTER_EMPTY \ #define GRPC_MDELEM_RETRY_AFTER_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[64], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[65], GRPC_MDELEM_STORAGE_STATIC))
/* "server": "" */ /* "server": "" */
#define GRPC_MDELEM_SERVER_EMPTY \ #define GRPC_MDELEM_SERVER_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[65], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[66], GRPC_MDELEM_STORAGE_STATIC))
/* "set-cookie": "" */ /* "set-cookie": "" */
#define GRPC_MDELEM_SET_COOKIE_EMPTY \ #define GRPC_MDELEM_SET_COOKIE_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[66], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[67], GRPC_MDELEM_STORAGE_STATIC))
/* "strict-transport-security": "" */ /* "strict-transport-security": "" */
#define GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY \ #define GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[67], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[68], GRPC_MDELEM_STORAGE_STATIC))
/* "transfer-encoding": "" */ /* "transfer-encoding": "" */
#define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY \ #define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[68], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[69], GRPC_MDELEM_STORAGE_STATIC))
/* "user-agent": "" */ /* "user-agent": "" */
#define GRPC_MDELEM_USER_AGENT_EMPTY \ #define GRPC_MDELEM_USER_AGENT_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[69], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[70], GRPC_MDELEM_STORAGE_STATIC))
/* "vary": "" */ /* "vary": "" */
#define GRPC_MDELEM_VARY_EMPTY \ #define GRPC_MDELEM_VARY_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[70], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[71], GRPC_MDELEM_STORAGE_STATIC))
/* "via": "" */ /* "via": "" */
#define GRPC_MDELEM_VIA_EMPTY \ #define GRPC_MDELEM_VIA_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[71], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[72], GRPC_MDELEM_STORAGE_STATIC))
/* "www-authenticate": "" */ /* "www-authenticate": "" */
#define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY \ #define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[72], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[73], GRPC_MDELEM_STORAGE_STATIC))
/* "grpc-accept-encoding": "identity" */ /* "grpc-accept-encoding": "identity" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY \ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[73], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[74], GRPC_MDELEM_STORAGE_STATIC))
/* "grpc-accept-encoding": "deflate" */ /* "grpc-accept-encoding": "deflate" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE \ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[74], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[75], GRPC_MDELEM_STORAGE_STATIC))
/* "grpc-accept-encoding": "identity,deflate" */ /* "grpc-accept-encoding": "identity,deflate" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE \ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[75], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[76], GRPC_MDELEM_STORAGE_STATIC))
/* "grpc-accept-encoding": "gzip" */ /* "grpc-accept-encoding": "gzip" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP \ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[76], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[77], GRPC_MDELEM_STORAGE_STATIC))
/* "grpc-accept-encoding": "identity,gzip" */ /* "grpc-accept-encoding": "identity,gzip" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[77], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[78], GRPC_MDELEM_STORAGE_STATIC))
/* "grpc-accept-encoding": "deflate,gzip" */ /* "grpc-accept-encoding": "deflate,gzip" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE_COMMA_GZIP \ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE_COMMA_GZIP \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[78], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[79], GRPC_MDELEM_STORAGE_STATIC))
/* "grpc-accept-encoding": "identity,deflate,gzip" */ /* "grpc-accept-encoding": "identity,deflate,gzip" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[79], GRPC_MDELEM_STORAGE_STATIC)) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[80], GRPC_MDELEM_STORAGE_STATIC))
grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b); grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b);
typedef enum { typedef enum {

@ -229,17 +229,9 @@ const struct census_context* ServerContext::census_context() const {
void ServerContext::SetLoadReportingCosts( void ServerContext::SetLoadReportingCosts(
const std::vector<grpc::string>& cost_data) { const std::vector<grpc::string>& cost_data) {
if (call_ == nullptr) return; if (call_ == nullptr) return;
grpc_load_reporting_cost_context* cost_ctx = for (const auto& cost_datum : cost_data) {
static_cast<grpc_load_reporting_cost_context*>( AddTrailingMetadata(GRPC_LB_COST_MD_KEY, cost_datum);
gpr_malloc(sizeof(*cost_ctx)));
cost_ctx->values_count = cost_data.size();
cost_ctx->values = static_cast<grpc_slice*>(
gpr_malloc(sizeof(*cost_ctx->values) * cost_ctx->values_count));
for (size_t i = 0; i < cost_ctx->values_count; ++i) {
cost_ctx->values[i] =
grpc_slice_from_copied_buffer(cost_data[i].data(), cost_data[i].size());
} }
grpc_call_set_load_reporting_cost_context(call_, cost_ctx);
} }
} // namespace grpc } // namespace grpc

@ -110,7 +110,6 @@ grpc_channel_register_call_type grpc_channel_register_call_import;
grpc_channel_create_registered_call_type grpc_channel_create_registered_call_import; grpc_channel_create_registered_call_type grpc_channel_create_registered_call_import;
grpc_call_start_batch_type grpc_call_start_batch_import; grpc_call_start_batch_type grpc_call_start_batch_import;
grpc_call_get_peer_type grpc_call_get_peer_import; grpc_call_get_peer_type grpc_call_get_peer_import;
grpc_call_set_load_reporting_cost_context_type grpc_call_set_load_reporting_cost_context_import;
grpc_census_call_set_context_type grpc_census_call_set_context_import; grpc_census_call_set_context_type grpc_census_call_set_context_import;
grpc_census_call_get_context_type grpc_census_call_get_context_import; grpc_census_call_get_context_type grpc_census_call_get_context_import;
grpc_channel_get_target_type grpc_channel_get_target_import; grpc_channel_get_target_type grpc_channel_get_target_import;
@ -407,7 +406,6 @@ void grpc_rb_load_imports(HMODULE library) {
grpc_channel_create_registered_call_import = (grpc_channel_create_registered_call_type) GetProcAddress(library, "grpc_channel_create_registered_call"); grpc_channel_create_registered_call_import = (grpc_channel_create_registered_call_type) GetProcAddress(library, "grpc_channel_create_registered_call");
grpc_call_start_batch_import = (grpc_call_start_batch_type) GetProcAddress(library, "grpc_call_start_batch"); grpc_call_start_batch_import = (grpc_call_start_batch_type) GetProcAddress(library, "grpc_call_start_batch");
grpc_call_get_peer_import = (grpc_call_get_peer_type) GetProcAddress(library, "grpc_call_get_peer"); grpc_call_get_peer_import = (grpc_call_get_peer_type) GetProcAddress(library, "grpc_call_get_peer");
grpc_call_set_load_reporting_cost_context_import = (grpc_call_set_load_reporting_cost_context_type) GetProcAddress(library, "grpc_call_set_load_reporting_cost_context");
grpc_census_call_set_context_import = (grpc_census_call_set_context_type) GetProcAddress(library, "grpc_census_call_set_context"); grpc_census_call_set_context_import = (grpc_census_call_set_context_type) GetProcAddress(library, "grpc_census_call_set_context");
grpc_census_call_get_context_import = (grpc_census_call_get_context_type) GetProcAddress(library, "grpc_census_call_get_context"); grpc_census_call_get_context_import = (grpc_census_call_get_context_type) GetProcAddress(library, "grpc_census_call_get_context");
grpc_channel_get_target_import = (grpc_channel_get_target_type) GetProcAddress(library, "grpc_channel_get_target"); grpc_channel_get_target_import = (grpc_channel_get_target_type) GetProcAddress(library, "grpc_channel_get_target");

@ -281,9 +281,6 @@ extern grpc_call_start_batch_type grpc_call_start_batch_import;
typedef char *(*grpc_call_get_peer_type)(grpc_call *call); typedef char *(*grpc_call_get_peer_type)(grpc_call *call);
extern grpc_call_get_peer_type grpc_call_get_peer_import; extern grpc_call_get_peer_type grpc_call_get_peer_import;
#define grpc_call_get_peer grpc_call_get_peer_import #define grpc_call_get_peer grpc_call_get_peer_import
typedef void(*grpc_call_set_load_reporting_cost_context_type)(grpc_call *call, struct grpc_load_reporting_cost_context *context);
extern grpc_call_set_load_reporting_cost_context_type grpc_call_set_load_reporting_cost_context_import;
#define grpc_call_set_load_reporting_cost_context grpc_call_set_load_reporting_cost_context_import
typedef void(*grpc_census_call_set_context_type)(grpc_call *call, struct census_context *context); typedef void(*grpc_census_call_set_context_type)(grpc_call *call, struct census_context *context);
extern grpc_census_call_set_context_type grpc_census_call_set_context_import; extern grpc_census_call_set_context_type grpc_census_call_set_context_import;
#define grpc_census_call_set_context grpc_census_call_set_context_import #define grpc_census_call_set_context grpc_census_call_set_context_import

@ -77,6 +77,7 @@
"\x08if-range" "\x08if-range"
"\x13if-unmodified-since" "\x13if-unmodified-since"
"\x0Dlast-modified" "\x0Dlast-modified"
"\x0Blb-cost-bin"
"\x04link" "\x04link"
"\x08location" "\x08location"
"\x0Cmax-forwards" "\x0Cmax-forwards"
@ -153,6 +154,7 @@
"\x00\x13if-unmodified-since\x00" "\x00\x13if-unmodified-since\x00"
"\x00\x0Dlast-modified\x00" "\x00\x0Dlast-modified\x00"
"\x00\x08lb-token\x00" "\x00\x08lb-token\x00"
"\x00\x0Blb-cost-bin\x00"
"\x00\x04link\x00" "\x00\x04link\x00"
"\x00\x08location\x00" "\x00\x08location\x00"
"\x00\x0Cmax-forwards\x00" "\x00\x0Cmax-forwards\x00"

@ -129,8 +129,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void request_response_with_payload( static void request_response_with_payload(
grpc_end2end_test_config config, grpc_end2end_test_fixture f, grpc_end2end_test_config config, grpc_end2end_test_fixture f,
const char *method_name, const char *request_msg, const char *response_msg, const char *method_name, const char *request_msg, const char *response_msg,
grpc_metadata *initial_lr_metadata, grpc_metadata *initial_lr_metadata, grpc_metadata *trailing_lr_metadata) {
grpc_load_reporting_cost_context *cost_ctx) {
grpc_slice request_payload_slice = grpc_slice_from_static_string(request_msg); grpc_slice request_payload_slice = grpc_slice_from_static_string(request_msg);
grpc_slice response_payload_slice = grpc_slice response_payload_slice =
grpc_slice_from_static_string(response_msg); grpc_slice_from_static_string(response_msg);
@ -243,8 +242,9 @@ static void request_response_with_payload(
op->reserved = NULL; op->reserved = NULL;
op++; op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
GPR_ASSERT(cost_ctx != NULL); GPR_ASSERT(trailing_lr_metadata != NULL);
grpc_call_set_load_reporting_cost_context(s, cost_ctx); op->data.send_status_from_server.trailing_metadata_count = 1;
op->data.send_status_from_server.trailing_metadata = trailing_lr_metadata;
op->data.send_status_from_server.status = GRPC_STATUS_OK; op->data.send_status_from_server.status = GRPC_STATUS_OK;
grpc_slice status_details = grpc_slice_from_static_string("xyz"); grpc_slice status_details = grpc_slice_from_static_string("xyz");
op->data.send_status_from_server.status_details = &status_details; op->data.send_status_from_server.status_details = &status_details;
@ -298,21 +298,21 @@ static void test_load_reporting_hook(grpc_end2end_test_config config) {
const char *response_msg = "... and the response from the server"; const char *response_msg = "... and the response from the server";
grpc_metadata initial_lr_metadata; grpc_metadata initial_lr_metadata;
grpc_metadata trailing_lr_metadata;
initial_lr_metadata.key = GRPC_MDSTR_LB_TOKEN; initial_lr_metadata.key = GRPC_MDSTR_LB_TOKEN;
initial_lr_metadata.value = grpc_slice_from_static_string("client-token"); initial_lr_metadata.value = grpc_slice_from_static_string("client-token");
memset(&initial_lr_metadata.internal_data, 0, memset(&initial_lr_metadata.internal_data, 0,
sizeof(initial_lr_metadata.internal_data)); sizeof(initial_lr_metadata.internal_data));
grpc_load_reporting_cost_context *cost_ctx = gpr_malloc(sizeof(*cost_ctx)); trailing_lr_metadata.key = GRPC_MDSTR_LB_COST_BIN;
memset(cost_ctx, 0, sizeof(*cost_ctx)); trailing_lr_metadata.value = grpc_slice_from_static_string("server-token");
cost_ctx->values_count = 1; memset(&trailing_lr_metadata.internal_data, 0,
cost_ctx->values = sizeof(trailing_lr_metadata.internal_data));
gpr_malloc(sizeof(*cost_ctx->values) * cost_ctx->values_count);
cost_ctx->values[0] = grpc_slice_from_static_string("cost-token");
request_response_with_payload(config, f, method_name, request_msg, request_response_with_payload(config, f, method_name, request_msg,
response_msg, &initial_lr_metadata, cost_ctx); response_msg, &initial_lr_metadata,
&trailing_lr_metadata);
end_test(&f); end_test(&f);
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;

@ -124,6 +124,7 @@ CONFIG = [
('if-unmodified-since', ''), ('if-unmodified-since', ''),
('last-modified', ''), ('last-modified', ''),
('lb-token', ''), ('lb-token', ''),
('lb-cost-bin', ''),
('link', ''), ('link', ''),
('location', ''), ('location', ''),
('max-forwards', ''), ('max-forwards', ''),

Loading…
Cancel
Save