diff options
author | Craig Tiller <ctiller@google.com> | 2017-08-29 14:16:14 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-08-29 14:16:14 -0700 |
commit | e944c5d4907732b2bc0a9c6e355ff1e6a65b37e2 (patch) | |
tree | 7be516e29013f54061921af50862ad736b8fb020 /tools/codegen | |
parent | 33aeabad66e8083d47f47ddc4bafa4483f1585f8 (diff) | |
parent | 33b51aaa755b2e5f10aade60b67f216bff86cb36 (diff) |
Merge branch 'stats' into stats_histo
Diffstat (limited to 'tools/codegen')
-rwxr-xr-x | tools/codegen/core/gen_static_metadata.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py index 339a82a497..e56c627721 100755 --- a/tools/codegen/core/gen_static_metadata.py +++ b/tools/codegen/core/gen_static_metadata.py @@ -33,6 +33,7 @@ CONFIG = [ 'host', 'grpc-timeout', 'grpc-internal-encoding-request', + 'grpc-internal-stream-encoding-request', 'grpc-payload-bin', ':path', 'grpc-encoding', @@ -89,6 +90,8 @@ CONFIG = [ ('authorization', ''), ('cache-control', ''), ('content-disposition', ''), + ('content-encoding', 'identity'), + ('content-encoding', 'gzip'), ('content-encoding', ''), ('content-language', ''), ('content-length', ''), @@ -145,7 +148,10 @@ METADATA_BATCH_CALLOUTS = [ 'grpc-tags-bin', 'grpc-trace-bin', 'content-type', + 'content-encoding', + 'accept-encoding', 'grpc-internal-encoding-request', + 'grpc-internal-stream-encoding-request', 'user-agent', 'host', 'lb-token', @@ -157,6 +163,10 @@ COMPRESSION_ALGORITHMS = [ 'gzip', ] +STREAM_COMPRESSION_ALGORITHMS = [ + 'identity', + 'gzip', +] # utility: mangle the name of a config def mangle(elem, name=None): @@ -251,6 +261,18 @@ for mask in range(1, 1 << len(COMPRESSION_ALGORITHMS)): all_elems.append(elem) compression_elems.append(elem) static_userdata[elem] = 1 + (mask | 1) +stream_compression_elems = [] +for mask in range(1, 1 << len(STREAM_COMPRESSION_ALGORITHMS)): + val = ','.join(STREAM_COMPRESSION_ALGORITHMS[alg] + for alg in range(0, len(STREAM_COMPRESSION_ALGORITHMS)) + if (1 << alg) & mask) + elem = ('accept-encoding', val) + if val not in all_strs: + all_strs.append(val) + if elem not in all_elems: + all_elems.append(elem) + stream_compression_elems.append(elem) + static_userdata[elem] = 1 + (mask | 1) # output configuration args = sys.argv[1:] @@ -544,6 +566,16 @@ print >> C, '};' print >> C print >> H, '#define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(algs) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[grpc_static_accept_encoding_metadata[(algs)]], GRPC_MDELEM_STORAGE_STATIC))' +print >> H + +print >> H, 'extern const uint8_t grpc_static_accept_stream_encoding_metadata[%d];' % ( + 1 << len(STREAM_COMPRESSION_ALGORITHMS)) +print >> C, 'const uint8_t grpc_static_accept_stream_encoding_metadata[%d] = {' % ( + 1 << len(STREAM_COMPRESSION_ALGORITHMS)) +print >> C, '0,%s' % ','.join('%d' % md_idx(elem) for elem in stream_compression_elems) +print >> C, '};' + +print >> H, '#define GRPC_MDELEM_ACCEPT_STREAM_ENCODING_FOR_ALGORITHMS(algs) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[grpc_static_accept_stream_encoding_metadata[(algs)]], GRPC_MDELEM_STORAGE_STATIC))' print >> H, '#endif /* GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H */' |