diff --git a/doc/core/moving-to-c++.md b/doc/core/moving-to-c++.md new file mode 100644 index 00000000000..4c745b38a90 --- /dev/null +++ b/doc/core/moving-to-c++.md @@ -0,0 +1,60 @@ +# Moving gRPC core to C++ + +October 2017 + +ctiller, markdroth, vjpai + +## Background and Goal + +gRPC core was originally written in C89 for several reasons +(possibility of kernel integration, ease of wrapping, compiler +support, etc). Over time, this was changed to C99 as all relevant +compilers in active use came to support C99 effectively. +[Now, gRPC core is C++](https://github.com/grpc/proposal/blob/master/L6-allow-c%2B%2B-in-grpc-core.md) +(although the code is still idiomatically C code) with C linkage for +public functions. Throughout all of these transitions, the public +header files are committed to remain in C89. + +The goal now is to make the gRPC core implementation true idiomatic +C++ compatible with +[Google's C++ style guide](https://google.github.io/styleguide/cppguide.html). + +## Constraints + +- No use of standard library + - Standard library makes wrapping difficult/impossible and also reduces platform portability + - This takes precedence over using C++ style guide +- But lambdas are ok +- As are third-party libraries that meet our build requirements (such as many parts of abseil) +- There will be some C++ features that don't work + - `new` and `delete` + - pure virtual functions are not allowed because the message that prints out "Pure Virtual Function called" is part of the standard library + - Make a `#define GRPC_ABSTRACT {GPR_ASSERT(false);}` instead of `= 0;` +- The sanity for making sure that we don't depend on libstdc++ is that at least some tests should explicitly not include it + - Most tests can migrate to use gtest + - There are tremendous # of code paths that can now be exposed to unit tests because of the use of gtest and C++ + - But at least some tests should not use gtest + + +## Roadmap + +- What should be the phases of getting code converted to idiomatic C++ + - Opportunistically do leaf code that other parts don't depend on + - Spend a little time deciding how to do non-leaf stuff that isn't central or polymorphic (e.g., timer, call combiner) + - For big central or polymorphic interfaces, actually do an API review (for things like transport, filter API, endpoint, closure, exec_ctx, ...) . + - Core internal changes don't need a gRFC, but core surface changes do + - But an API review should include at least a PR with the header change and tests to use it before it gets used more broadly + - iomgr polling for POSIX is a gray area whether it's a leaf or central +- What is the schedule? + - In Q4 2017, if some stuff happens opportunistically, great; otherwise ¯\\\_(ツ)\_/¯ + - More updates as team time becomes available and committed to this project + +## Implications for C++ API and wrapped languages + +- For C++ structs, switch to `using` when possible (e.g., Slice, +ByteBuffer, ...) +- The C++ API implementation might directly start using +`grpc_transport_stream_op_batch` rather than the core surface `grpc_op`. +- Can we get wrapped languages to a point where we can statically link C++? This will take a year in probability but that would allow the use of `std::` + - Are there other environments that don't support std library, like maybe Android NDK? + - Probably, that might push things out to 18 months diff --git a/src/core/ext/census/base_resources.h b/src/core/ext/census/base_resources.h index 4b1b988e3f7..d24923b5970 100644 --- a/src/core/ext/census/base_resources.h +++ b/src/core/ext/census/base_resources.h @@ -29,4 +29,4 @@ void define_base_resources(); } #endif -#endif /* GRPC_CORE_EXT_CENSUS_BASE_RESOURCES_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_CENSUS_BASE_RESOURCES_H */ diff --git a/src/core/ext/census/census_interface.h b/src/core/ext/census/census_interface.h index 12438e3c0a6..113c2b16efb 100644 --- a/src/core/ext/census/census_interface.h +++ b/src/core/ext/census/census_interface.h @@ -66,4 +66,4 @@ void census_tracing_end_op(census_op_id op_id); } #endif -#endif /* GRPC_CORE_EXT_CENSUS_CENSUS_INTERFACE_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_CENSUS_CENSUS_INTERFACE_H */ diff --git a/src/core/ext/census/census_log.h b/src/core/ext/census/census_log.h index cc9e008907f..ee336ae733d 100644 --- a/src/core/ext/census/census_log.h +++ b/src/core/ext/census/census_log.h @@ -81,4 +81,4 @@ int census_log_out_of_space_count(void); } #endif -#endif /* GRPC_CORE_EXT_CENSUS_CENSUS_LOG_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_CENSUS_CENSUS_LOG_H */ diff --git a/src/core/ext/census/hash_table.h b/src/core/ext/census/hash_table.h index c22ba8df9de..c3ed94ea14c 100644 --- a/src/core/ext/census/hash_table.h +++ b/src/core/ext/census/hash_table.h @@ -121,4 +121,4 @@ uint64_t census_ht_for_all(const census_ht *ht, census_ht_itr_cb); } #endif -#endif /* GRPC_CORE_EXT_CENSUS_HASH_TABLE_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_CENSUS_HASH_TABLE_H */ diff --git a/src/core/ext/census/mlog.h b/src/core/ext/census/mlog.h index 7b4d39272b3..8f74ba231db 100644 --- a/src/core/ext/census/mlog.h +++ b/src/core/ext/census/mlog.h @@ -85,4 +85,4 @@ int64_t census_log_out_of_space_count(void); } #endif -#endif /* GRPC_CORE_EXT_CENSUS_MLOG_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_CENSUS_MLOG_H */ diff --git a/src/core/ext/census/resource.h b/src/core/ext/census/resource.h index 5f7ac2ad27a..56aaaaf750e 100644 --- a/src/core/ext/census/resource.h +++ b/src/core/ext/census/resource.h @@ -53,4 +53,4 @@ int32_t define_resource(const resource *base); } #endif -#endif /* GRPC_CORE_EXT_CENSUS_RESOURCE_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_CENSUS_RESOURCE_H */ diff --git a/src/core/ext/census/trace_context.h b/src/core/ext/census/trace_context.h index c707c632633..2b828ba4da1 100644 --- a/src/core/ext/census/trace_context.h +++ b/src/core/ext/census/trace_context.h @@ -61,4 +61,4 @@ bool decode_trace_context(google_trace_TraceContext *ctxt, uint8_t *buffer, } #endif -#endif /* GRPC_CORE_EXT_CENSUS_TRACE_CONTEXT_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_CENSUS_TRACE_CONTEXT_H */ diff --git a/src/core/ext/census/trace_propagation.h b/src/core/ext/census/trace_propagation.h index 3394e9e0fd3..e05fd23a1fb 100644 --- a/src/core/ext/census/trace_propagation.h +++ b/src/core/ext/census/trace_propagation.h @@ -53,4 +53,4 @@ size_t http_format_to_trace_span_context(const char *buf, size_t buf_size, } #endif -#endif /* GRPC_CORE_EXT_CENSUS_TRACE_PROPAGATION_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_CENSUS_TRACE_PROPAGATION_H */ diff --git a/src/core/ext/census/tracing.h b/src/core/ext/census/tracing.h index 5fcbb1e1f76..0690de8655c 100644 --- a/src/core/ext/census/tracing.h +++ b/src/core/ext/census/tracing.h @@ -114,4 +114,4 @@ void trace_end_span(const trace_status *status, trace_span_context *span_ctxt); } #endif -#endif /* GRPC_CORE_EXT_CENSUS_TRACING_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_CENSUS_TRACING_H */ diff --git a/src/core/ext/census/window_stats.h b/src/core/ext/census/window_stats.h index 3b1d197f76a..2a1d6d0d167 100644 --- a/src/core/ext/census/window_stats.h +++ b/src/core/ext/census/window_stats.h @@ -163,4 +163,4 @@ void census_window_stats_destroy(struct census_window_stats *wstats); } #endif -#endif /* GRPC_CORE_EXT_CENSUS_WINDOW_STATS_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_CENSUS_WINDOW_STATS_H */ diff --git a/src/core/ext/filters/client_channel/client_channel.h b/src/core/ext/filters/client_channel/client_channel.h index b32f378c6ca..152fe2365af 100644 --- a/src/core/ext/filters/client_channel/client_channel.h +++ b/src/core/ext/filters/client_channel/client_channel.h @@ -60,4 +60,4 @@ grpc_subchannel_call *grpc_client_channel_get_subchannel_call( } #endif -#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CLIENT_CHANNEL_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CLIENT_CHANNEL_H */ diff --git a/src/core/ext/filters/client_channel/client_channel_factory.h b/src/core/ext/filters/client_channel/client_channel_factory.h index bad8b970425..4273c900583 100644 --- a/src/core/ext/filters/client_channel/client_channel_factory.h +++ b/src/core/ext/filters/client_channel/client_channel_factory.h @@ -82,4 +82,4 @@ grpc_arg grpc_client_channel_factory_create_channel_arg( } #endif -#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CLIENT_CHANNEL_FACTORY_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CLIENT_CHANNEL_FACTORY_H */ diff --git a/src/core/ext/filters/client_channel/connector.h b/src/core/ext/filters/client_channel/connector.h index b91c93e446f..b71e0aab004 100644 --- a/src/core/ext/filters/client_channel/connector.h +++ b/src/core/ext/filters/client_channel/connector.h @@ -78,4 +78,4 @@ void grpc_connector_shutdown(grpc_exec_ctx *exec_ctx, grpc_connector *connector, } #endif -#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CONNECTOR_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CONNECTOR_H */ diff --git a/src/core/ext/filters/client_channel/http_connect_handshaker.h b/src/core/ext/filters/client_channel/http_connect_handshaker.h index 5042c61becd..05a23cdba34 100644 --- a/src/core/ext/filters/client_channel/http_connect_handshaker.h +++ b/src/core/ext/filters/client_channel/http_connect_handshaker.h @@ -39,4 +39,4 @@ void grpc_http_connect_register_handshaker_factory(); } #endif -#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_HTTP_CONNECT_HANDSHAKER_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_HTTP_CONNECT_HANDSHAKER_H */ diff --git a/src/core/ext/filters/client_channel/http_proxy.h b/src/core/ext/filters/client_channel/http_proxy.h index 65d52334af2..bdad03def31 100644 --- a/src/core/ext/filters/client_channel/http_proxy.h +++ b/src/core/ext/filters/client_channel/http_proxy.h @@ -29,4 +29,4 @@ void grpc_register_http_proxy_mapper(); } #endif -#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_HTTP_PROXY_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_HTTP_PROXY_H */ diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h index c67df609fc2..15c8a680b73 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h @@ -34,4 +34,4 @@ grpc_lb_policy_factory *grpc_glb_lb_factory_create(); } #endif -#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_H */ diff --git a/src/core/ext/filters/client_channel/lb_policy_factory.h b/src/core/ext/filters/client_channel/lb_policy_factory.h index 69bcba42323..8790ffdda31 100644 --- a/src/core/ext/filters/client_channel/lb_policy_factory.h +++ b/src/core/ext/filters/client_channel/lb_policy_factory.h @@ -138,4 +138,4 @@ grpc_lb_policy *grpc_lb_policy_factory_create_lb_policy( } #endif -#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_FACTORY_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_FACTORY_H */ diff --git a/src/core/ext/filters/client_channel/lb_policy_registry.h b/src/core/ext/filters/client_channel/lb_policy_registry.h index 0867844c371..55154cb02a1 100644 --- a/src/core/ext/filters/client_channel/lb_policy_registry.h +++ b/src/core/ext/filters/client_channel/lb_policy_registry.h @@ -45,4 +45,4 @@ grpc_lb_policy *grpc_lb_policy_create(grpc_exec_ctx *exec_ctx, const char *name, } #endif -#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_REGISTRY_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_REGISTRY_H */ diff --git a/src/core/ext/filters/client_channel/parse_address.h b/src/core/ext/filters/client_channel/parse_address.h index 742df380b7e..27d06a1cb3d 100644 --- a/src/core/ext/filters/client_channel/parse_address.h +++ b/src/core/ext/filters/client_channel/parse_address.h @@ -53,4 +53,4 @@ bool grpc_parse_ipv6_hostport(const char *hostport, grpc_resolved_address *addr, } #endif -#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PARSE_ADDRESS_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PARSE_ADDRESS_H */ diff --git a/src/core/ext/filters/client_channel/proxy_mapper.h b/src/core/ext/filters/client_channel/proxy_mapper.h index 1325a9f1f62..bb8259f8545 100644 --- a/src/core/ext/filters/client_channel/proxy_mapper.h +++ b/src/core/ext/filters/client_channel/proxy_mapper.h @@ -79,4 +79,4 @@ void grpc_proxy_mapper_destroy(grpc_proxy_mapper* mapper); } #endif -#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PROXY_MAPPER_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PROXY_MAPPER_H */ diff --git a/src/core/ext/filters/client_channel/proxy_mapper_registry.h b/src/core/ext/filters/client_channel/proxy_mapper_registry.h index 2d389f1c21d..39c607cefcf 100644 --- a/src/core/ext/filters/client_channel/proxy_mapper_registry.h +++ b/src/core/ext/filters/client_channel/proxy_mapper_registry.h @@ -49,4 +49,4 @@ bool grpc_proxy_mappers_map_address(grpc_exec_ctx* exec_ctx, } #endif -#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PROXY_MAPPER_REGISTRY_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PROXY_MAPPER_REGISTRY_H */ diff --git a/src/core/ext/filters/client_channel/resolver_factory.h b/src/core/ext/filters/client_channel/resolver_factory.h index 6e533e32488..c8b2c58db3e 100644 --- a/src/core/ext/filters/client_channel/resolver_factory.h +++ b/src/core/ext/filters/client_channel/resolver_factory.h @@ -75,4 +75,4 @@ char *grpc_resolver_factory_get_default_authority( } #endif -#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FACTORY_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FACTORY_H */ diff --git a/src/core/ext/filters/client_channel/resolver_registry.h b/src/core/ext/filters/client_channel/resolver_registry.h index eb08d887b18..06d0b99a355 100644 --- a/src/core/ext/filters/client_channel/resolver_registry.h +++ b/src/core/ext/filters/client_channel/resolver_registry.h @@ -74,4 +74,4 @@ char *grpc_resolver_factory_add_default_prefix_if_needed( } #endif -#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_REGISTRY_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_REGISTRY_H */ diff --git a/src/core/ext/filters/client_channel/retry_throttle.h b/src/core/ext/filters/client_channel/retry_throttle.h index 3b849475b95..399383df78b 100644 --- a/src/core/ext/filters/client_channel/retry_throttle.h +++ b/src/core/ext/filters/client_channel/retry_throttle.h @@ -55,4 +55,4 @@ grpc_server_retry_throttle_data* grpc_retry_throttle_map_get_data_for_server( } #endif -#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RETRY_THROTTLE_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RETRY_THROTTLE_H */ diff --git a/src/core/ext/filters/client_channel/subchannel_index.h b/src/core/ext/filters/client_channel/subchannel_index.h index 09bac3592ca..05c3878379f 100644 --- a/src/core/ext/filters/client_channel/subchannel_index.h +++ b/src/core/ext/filters/client_channel/subchannel_index.h @@ -86,4 +86,4 @@ void grpc_subchannel_index_test_only_set_force_creation(bool force_creation); } #endif -#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_SUBCHANNEL_INDEX_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_SUBCHANNEL_INDEX_H */ diff --git a/src/core/ext/filters/client_channel/uri_parser.h b/src/core/ext/filters/client_channel/uri_parser.h index 43e8ae64e03..e78da5928b6 100644 --- a/src/core/ext/filters/client_channel/uri_parser.h +++ b/src/core/ext/filters/client_channel/uri_parser.h @@ -55,4 +55,4 @@ void grpc_uri_destroy(grpc_uri *uri); } #endif -#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_URI_PARSER_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_URI_PARSER_H */ diff --git a/src/core/ext/filters/deadline/deadline_filter.h b/src/core/ext/filters/deadline/deadline_filter.h index 4a80535b147..e665dc53ee3 100644 --- a/src/core/ext/filters/deadline/deadline_filter.h +++ b/src/core/ext/filters/deadline/deadline_filter.h @@ -98,4 +98,4 @@ extern const grpc_channel_filter grpc_server_deadline_filter; } #endif -#endif /* GRPC_CORE_EXT_FILTERS_DEADLINE_DEADLINE_FILTER_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_FILTERS_DEADLINE_DEADLINE_FILTER_H */ diff --git a/src/core/ext/filters/workarounds/workaround_utils.h b/src/core/ext/filters/workarounds/workaround_utils.h index afd5291333a..3913cae6b2b 100644 --- a/src/core/ext/filters/workarounds/workaround_utils.h +++ b/src/core/ext/filters/workarounds/workaround_utils.h @@ -42,4 +42,4 @@ void grpc_register_workaround(uint32_t id, user_agent_parser parser); } #endif -#endif /* GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_UTILS_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_FILTERS_WORKAROUNDS_WORKAROUND_UTILS_H */ diff --git a/src/core/ext/transport/chttp2/alpn/alpn.h b/src/core/ext/transport/chttp2/alpn/alpn.h index 5842204c204..99b928ea591 100644 --- a/src/core/ext/transport/chttp2/alpn/alpn.h +++ b/src/core/ext/transport/chttp2/alpn/alpn.h @@ -39,4 +39,4 @@ const char *grpc_chttp2_get_alpn_version_index(size_t i); } #endif -#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_ALPN_ALPN_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_ALPN_ALPN_H */ diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.h b/src/core/ext/transport/chttp2/server/chttp2_server.h index e1df28ed11f..2ac155160fc 100644 --- a/src/core/ext/transport/chttp2/server/chttp2_server.h +++ b/src/core/ext/transport/chttp2/server/chttp2_server.h @@ -37,4 +37,4 @@ grpc_error *grpc_chttp2_server_add_port(grpc_exec_ctx *exec_ctx, } #endif -#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_SERVER_CHTTP2_SERVER_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_SERVER_CHTTP2_SERVER_H */ diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.h b/src/core/ext/transport/chttp2/transport/bin_decoder.h index f50e0a8ac42..1c0b2b7e97a 100644 --- a/src/core/ext/transport/chttp2/transport/bin_decoder.h +++ b/src/core/ext/transport/chttp2/transport/bin_decoder.h @@ -57,4 +57,4 @@ grpc_slice grpc_chttp2_base64_decode_with_length(grpc_exec_ctx *exec_ctx, } #endif -#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H */ diff --git a/src/core/ext/transport/chttp2/transport/bin_encoder.h b/src/core/ext/transport/chttp2/transport/bin_encoder.h index ae8219c5ced..0be3633354e 100644 --- a/src/core/ext/transport/chttp2/transport/bin_encoder.h +++ b/src/core/ext/transport/chttp2/transport/bin_encoder.h @@ -44,4 +44,4 @@ grpc_slice grpc_chttp2_base64_encode_and_huffman_compress(grpc_slice input); } #endif -#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H */ diff --git a/src/core/ext/transport/chttp2/transport/frame_data.h b/src/core/ext/transport/chttp2/transport/frame_data.h index 2df99ccf987..81ec5361a39 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.h +++ b/src/core/ext/transport/chttp2/transport/frame_data.h @@ -88,4 +88,4 @@ grpc_error *grpc_deframe_unprocessed_incoming_frames( } #endif -#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H */ diff --git a/src/core/ext/transport/chttp2/transport/frame_goaway.h b/src/core/ext/transport/chttp2/transport/frame_goaway.h index ce6f18b35c3..7b3aa45f3f2 100644 --- a/src/core/ext/transport/chttp2/transport/frame_goaway.h +++ b/src/core/ext/transport/chttp2/transport/frame_goaway.h @@ -68,4 +68,4 @@ void grpc_chttp2_goaway_append(uint32_t last_stream_id, uint32_t error_code, } #endif -#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_GOAWAY_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_GOAWAY_H */ diff --git a/src/core/ext/transport/chttp2/transport/frame_ping.h b/src/core/ext/transport/chttp2/transport/frame_ping.h index 91f16f050fb..ffc2f0cf2ff 100644 --- a/src/core/ext/transport/chttp2/transport/frame_ping.h +++ b/src/core/ext/transport/chttp2/transport/frame_ping.h @@ -49,4 +49,4 @@ void grpc_set_disable_ping_ack(bool disable_ping_ack); } #endif -#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_PING_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_PING_H */ diff --git a/src/core/ext/transport/chttp2/transport/frame_rst_stream.h b/src/core/ext/transport/chttp2/transport/frame_rst_stream.h index bdca064a917..102ffdb3f36 100644 --- a/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +++ b/src/core/ext/transport/chttp2/transport/frame_rst_stream.h @@ -48,4 +48,4 @@ grpc_error *grpc_chttp2_rst_stream_parser_parse(grpc_exec_ctx *exec_ctx, } #endif -#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_RST_STREAM_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_RST_STREAM_H */ diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.h b/src/core/ext/transport/chttp2/transport/frame_settings.h index f0793f0e737..3364da15207 100644 --- a/src/core/ext/transport/chttp2/transport/frame_settings.h +++ b/src/core/ext/transport/chttp2/transport/frame_settings.h @@ -66,4 +66,4 @@ grpc_error *grpc_chttp2_settings_parser_parse(grpc_exec_ctx *exec_ctx, } #endif -#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H */ diff --git a/src/core/ext/transport/chttp2/transport/frame_window_update.h b/src/core/ext/transport/chttp2/transport/frame_window_update.h index 29cf0cc740a..400f9f53989 100644 --- a/src/core/ext/transport/chttp2/transport/frame_window_update.h +++ b/src/core/ext/transport/chttp2/transport/frame_window_update.h @@ -47,4 +47,4 @@ grpc_error *grpc_chttp2_window_update_parser_parse( } #endif -#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_WINDOW_UPDATE_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_WINDOW_UPDATE_H */ diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.h b/src/core/ext/transport/chttp2/transport/hpack_encoder.h index dc28b5566a6..16316b63f7c 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.h +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.h @@ -99,4 +99,4 @@ void grpc_chttp2_encode_header(grpc_exec_ctx *exec_ctx, } #endif -#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H */ diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.h b/src/core/ext/transport/chttp2/transport/hpack_parser.h index 6c36ebdf8d1..52014175a06 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.h +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.h @@ -119,4 +119,4 @@ grpc_error *grpc_chttp2_header_parser_parse(grpc_exec_ctx *exec_ctx, } #endif -#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSER_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSER_H */ diff --git a/src/core/ext/transport/chttp2/transport/http2_settings.h b/src/core/ext/transport/chttp2/transport/http2_settings.h index 01e80b8d014..0f76106dceb 100644 --- a/src/core/ext/transport/chttp2/transport/http2_settings.h +++ b/src/core/ext/transport/chttp2/transport/http2_settings.h @@ -64,4 +64,4 @@ extern const grpc_chttp2_setting_parameters } #endif -#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H */ diff --git a/src/core/ext/transport/chttp2/transport/incoming_metadata.h b/src/core/ext/transport/chttp2/transport/incoming_metadata.h index 995e8001b13..a0e01f2c4d2 100644 --- a/src/core/ext/transport/chttp2/transport/incoming_metadata.h +++ b/src/core/ext/transport/chttp2/transport/incoming_metadata.h @@ -53,4 +53,4 @@ void grpc_chttp2_incoming_metadata_buffer_set_deadline( } #endif -#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INCOMING_METADATA_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INCOMING_METADATA_H */ diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 05b677dd4b6..f7a57a6543e 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -658,8 +658,8 @@ bool grpc_chttp2_list_add_writable_stream(grpc_chttp2_transport *t, returns non-zero if there was a stream available */ bool grpc_chttp2_list_pop_writable_stream(grpc_chttp2_transport *t, grpc_chttp2_stream **s); -bool grpc_chttp2_list_remove_writable_stream( - grpc_chttp2_transport *t, grpc_chttp2_stream *s) GRPC_MUST_USE_RESULT; +bool grpc_chttp2_list_remove_writable_stream(grpc_chttp2_transport *t, + grpc_chttp2_stream *s); bool grpc_chttp2_list_add_writing_stream(grpc_chttp2_transport *t, grpc_chttp2_stream *s); diff --git a/src/core/ext/transport/chttp2/transport/stream_map.h b/src/core/ext/transport/chttp2/transport/stream_map.h index 364d37c33af..7ab6a4f5ed0 100644 --- a/src/core/ext/transport/chttp2/transport/stream_map.h +++ b/src/core/ext/transport/chttp2/transport/stream_map.h @@ -73,4 +73,4 @@ void grpc_chttp2_stream_map_for_each(grpc_chttp2_stream_map *map, } #endif -#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_STREAM_MAP_H */ \ No newline at end of file +#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_STREAM_MAP_H */ diff --git a/src/core/ext/transport/chttp2/transport/writing.cc b/src/core/ext/transport/chttp2/transport/writing.cc index 4134890f3fe..25c1a5ef056 100644 --- a/src/core/ext/transport/chttp2/transport/writing.cc +++ b/src/core/ext/transport/chttp2/transport/writing.cc @@ -174,343 +174,451 @@ static bool is_default_initial_metadata(grpc_metadata_batch *initial_metadata) { return initial_metadata->list.default_count == initial_metadata->list.count; } -grpc_chttp2_begin_write_result grpc_chttp2_begin_write( - grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) { - grpc_chttp2_stream *s; - - /* stats histogram counters: we increment these throughout this function, - and at the end publish to the central stats histograms */ - int flow_control_writes = 0; - int initial_metadata_writes = 0; - int trailing_metadata_writes = 0; - int message_writes = 0; +namespace { +class StreamWriteContext; + +class WriteContext { + public: + WriteContext(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) : t_(t) { + GRPC_STATS_INC_HTTP2_WRITES_BEGUN(exec_ctx); + GPR_TIMER_BEGIN("grpc_chttp2_begin_write", 0); + } - GRPC_STATS_INC_HTTP2_WRITES_BEGUN(exec_ctx); + // TODO(ctiller): make this the destructor + void FlushStats(grpc_exec_ctx *exec_ctx) { + GRPC_STATS_INC_HTTP2_SEND_INITIAL_METADATA_PER_WRITE( + exec_ctx, initial_metadata_writes_); + GRPC_STATS_INC_HTTP2_SEND_MESSAGE_PER_WRITE(exec_ctx, message_writes_); + GRPC_STATS_INC_HTTP2_SEND_TRAILING_METADATA_PER_WRITE( + exec_ctx, trailing_metadata_writes_); + GRPC_STATS_INC_HTTP2_SEND_FLOWCTL_PER_WRITE(exec_ctx, flow_control_writes_); + } - GPR_TIMER_BEGIN("grpc_chttp2_begin_write", 0); + void FlushSettings(grpc_exec_ctx *exec_ctx) { + if (t_->dirtied_local_settings && !t_->sent_local_settings) { + grpc_slice_buffer_add( + &t_->outbuf, grpc_chttp2_settings_create( + t_->settings[GRPC_SENT_SETTINGS], + t_->settings[GRPC_LOCAL_SETTINGS], + t_->force_send_settings, GRPC_CHTTP2_NUM_SETTINGS)); + t_->force_send_settings = false; + t_->dirtied_local_settings = false; + t_->sent_local_settings = true; + GRPC_STATS_INC_HTTP2_SETTINGS_WRITES(exec_ctx); + } + } - if (t->dirtied_local_settings && !t->sent_local_settings) { - grpc_slice_buffer_add( - &t->outbuf, - grpc_chttp2_settings_create( - t->settings[GRPC_SENT_SETTINGS], t->settings[GRPC_LOCAL_SETTINGS], - t->force_send_settings, GRPC_CHTTP2_NUM_SETTINGS)); - t->force_send_settings = 0; - t->dirtied_local_settings = 0; - t->sent_local_settings = 1; - GRPC_STATS_INC_HTTP2_SETTINGS_WRITES(exec_ctx); + void FlushQueuedBuffers(grpc_exec_ctx *exec_ctx) { + /* simple writes are queued to qbuf, and flushed here */ + grpc_slice_buffer_move_into(&t_->qbuf, &t_->outbuf); + GPR_ASSERT(t_->qbuf.count == 0); } - for (size_t i = 0; i < t->ping_ack_count; i++) { - grpc_slice_buffer_add(&t->outbuf, - grpc_chttp2_ping_create(1, t->ping_acks[i])); + void FlushWindowUpdates(grpc_exec_ctx *exec_ctx) { + uint32_t transport_announce = + grpc_chttp2_flowctl_maybe_send_transport_update(&t_->flow_control, + t_->outbuf.count > 0); + if (transport_announce) { + grpc_transport_one_way_stats throwaway_stats; + grpc_slice_buffer_add( + &t_->outbuf, grpc_chttp2_window_update_create(0, transport_announce, + &throwaway_stats)); + ResetPingRecvClock(); + } } - t->ping_ack_count = 0; - /* simple writes are queued to qbuf, and flushed here */ - grpc_slice_buffer_move_into(&t->qbuf, &t->outbuf); - GPR_ASSERT(t->qbuf.count == 0); + void FlushPingAcks() { + for (size_t i = 0; i < t_->ping_ack_count; i++) { + grpc_slice_buffer_add(&t_->outbuf, + grpc_chttp2_ping_create(true, t_->ping_acks[i])); + } + t_->ping_ack_count = 0; + } - grpc_chttp2_hpack_compressor_set_max_table_size( - &t->hpack_compressor, - t->settings[GRPC_PEER_SETTINGS][GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE]); + void EnactHpackSettings(grpc_exec_ctx *exec_ctx) { + grpc_chttp2_hpack_compressor_set_max_table_size( + &t_->hpack_compressor, + t_->settings[GRPC_PEER_SETTINGS] + [GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE]); + } - if (t->flow_control.remote_window > 0) { - while (grpc_chttp2_list_pop_stalled_by_transport(t, &s)) { - if (!t->closed && grpc_chttp2_list_add_writable_stream(t, s)) { - stream_ref_if_not_destroyed(&s->refcount->refs); + void UpdateStreamsNoLongerStalled() { + grpc_chttp2_stream *s; + while (grpc_chttp2_list_pop_stalled_by_transport(t_, &s)) { + if (!t_->closed && grpc_chttp2_list_add_writable_stream(t_, s)) { + if (!stream_ref_if_not_destroyed(&s->refcount->refs)) { + grpc_chttp2_list_remove_writable_stream(t_, s); + } } } } - grpc_chttp2_begin_write_result result = {false, false, false}; + grpc_chttp2_stream *NextStream() { + if (t_->outbuf.length > target_write_size(t_)) { + result_.partial = true; + return nullptr; + } - /* for each grpc_chttp2_stream that's become writable, frame it's data - (according to available window sizes) and add to the output buffer */ - while (true) { - if (t->outbuf.length > target_write_size(t)) { - result.partial = true; - break; + grpc_chttp2_stream *s; + if (!grpc_chttp2_list_pop_writable_stream(t_, &s)) { + return nullptr; + } + + return s; + } + + void ResetPingRecvClock() { + if (!t_->is_client) { + t_->ping_recv_state.last_ping_recv_time = GRPC_MILLIS_INF_PAST; + t_->ping_recv_state.ping_strikes = 0; + } + } + + void IncInitialMetadataWrites() { ++initial_metadata_writes_; } + void IncWindowUpdateWrites() { ++flow_control_writes_; } + void IncMessageWrites() { ++message_writes_; } + void IncTrailingMetadataWrites() { ++trailing_metadata_writes_; } + + void NoteScheduledResults() { result_.early_results_scheduled = true; } + + grpc_chttp2_transport *transport() const { return t_; } + + grpc_chttp2_begin_write_result Result() { + result_.writing = t_->outbuf.count > 0; + return result_; + } + + private: + grpc_chttp2_transport *const t_; + + /* stats histogram counters: we increment these throughout this function, + and at the end publish to the central stats histograms */ + int flow_control_writes_ = 0; + int initial_metadata_writes_ = 0; + int trailing_metadata_writes_ = 0; + int message_writes_ = 0; + grpc_chttp2_begin_write_result result_ = {false, false, false}; +}; + +class DataSendContext { + public: + DataSendContext(WriteContext *write_context, grpc_chttp2_transport *t, + grpc_chttp2_stream *s) + : write_context_(write_context), + t_(t), + s_(s), + sending_bytes_before_(s_->sending_bytes) {} + + uint32_t stream_remote_window() const { + return (uint32_t)GPR_MAX( + 0, s_->flow_control.remote_window_delta + + (int64_t)t_->settings[GRPC_PEER_SETTINGS] + [GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE]); + } + + uint32_t max_outgoing() const { + return (uint32_t)GPR_MIN( + t_->settings[GRPC_PEER_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], + GPR_MIN(stream_remote_window(), t_->flow_control.remote_window)); + } + + bool AnyOutgoing() const { return max_outgoing() != 0; } + + void FlushCompressedBytes() { + uint32_t send_bytes = + (uint32_t)GPR_MIN(max_outgoing(), s_->compressed_data_buffer.length); + bool is_last_data_frame = + (send_bytes == s_->compressed_data_buffer.length && + s_->flow_controlled_buffer.length == 0 && + s_->fetching_send_message == NULL); + if (is_last_data_frame && s_->send_trailing_metadata != NULL && + s_->stream_compression_ctx != NULL) { + if (!grpc_stream_compress(s_->stream_compression_ctx, + &s_->flow_controlled_buffer, + &s_->compressed_data_buffer, NULL, MAX_SIZE_T, + GRPC_STREAM_COMPRESSION_FLUSH_FINISH)) { + gpr_log(GPR_ERROR, "Stream compression failed."); + } + grpc_stream_compression_context_destroy(s_->stream_compression_ctx); + s_->stream_compression_ctx = NULL; + /* After finish, bytes in s->compressed_data_buffer may be + * more than max_outgoing. Start another round of the current + * while loop so that send_bytes and is_last_data_frame are + * recalculated. */ + return; + } + is_last_frame_ = is_last_data_frame && s_->send_trailing_metadata != NULL && + grpc_metadata_batch_is_empty(s_->send_trailing_metadata); + grpc_chttp2_encode_data(s_->id, &s_->compressed_data_buffer, send_bytes, + is_last_frame_, &s_->stats.outgoing, &t_->outbuf); + grpc_chttp2_flowctl_sent_data(&t_->flow_control, &s_->flow_control, + send_bytes); + if (s_->compressed_data_buffer.length == 0) { + s_->sending_bytes += s_->uncompressed_data_size; } + } - if (!grpc_chttp2_list_pop_writable_stream(t, &s)) { - break; + void CompressMoreBytes() { + if (s_->stream_compression_ctx == NULL) { + s_->stream_compression_ctx = + grpc_stream_compression_context_create(s_->stream_compression_method); + } + s_->uncompressed_data_size = s_->flow_controlled_buffer.length; + if (!grpc_stream_compress(s_->stream_compression_ctx, + &s_->flow_controlled_buffer, + &s_->compressed_data_buffer, NULL, MAX_SIZE_T, + GRPC_STREAM_COMPRESSION_FLUSH_SYNC)) { + gpr_log(GPR_ERROR, "Stream compression failed."); } + } + + bool is_last_frame() const { return is_last_frame_; } - bool sent_initial_metadata = s->sent_initial_metadata; - bool now_writing = false; + void CallCallbacks(grpc_exec_ctx *exec_ctx) { + if (update_list(exec_ctx, t_, s_, + (int64_t)(s_->sending_bytes - sending_bytes_before_), + &s_->on_flow_controlled_cbs, + &s_->flow_controlled_bytes_flowed, GRPC_ERROR_NONE)) { + write_context_->NoteScheduledResults(); + } + } + private: + WriteContext *write_context_; + grpc_chttp2_transport *t_; + grpc_chttp2_stream *s_; + const size_t sending_bytes_before_; + bool is_last_frame_ = false; +}; + +class StreamWriteContext { + public: + StreamWriteContext(WriteContext *write_context, grpc_chttp2_stream *s) + : write_context_(write_context), t_(write_context->transport()), s_(s) { GRPC_CHTTP2_IF_TRACING( - gpr_log(GPR_DEBUG, "W:%p %s[%d] im-(sent,send)=(%d,%d) announce=%d", t, - t->is_client ? "CLIENT" : "SERVER", s->id, - sent_initial_metadata, s->send_initial_metadata != NULL, + gpr_log(GPR_DEBUG, "W:%p %s[%d] im-(sent,send)=(%d,%d) announce=%d", t_, + t_->is_client ? "CLIENT" : "SERVER", s->id, + s->sent_initial_metadata, s->send_initial_metadata != NULL, (int)(s->flow_control.local_window_delta - s->flow_control.announced_window_delta))); + } - grpc_mdelem *extra_headers_for_trailing_metadata[2]; - size_t num_extra_headers_for_trailing_metadata = 0; - + void FlushInitialMetadata(grpc_exec_ctx *exec_ctx) { /* send initial metadata if it's available */ - if (!sent_initial_metadata && s->send_initial_metadata != NULL) { - // We skip this on the server side if there is no custom initial - // metadata, there are no messages to send, and we are also sending - // trailing metadata. This results in a Trailers-Only response, - // which is required for retries, as per: - // https://github.com/grpc/proposal/blob/master/A6-client-retries.md#when-retries-are-valid - if (t->is_client || s->fetching_send_message != NULL || - s->flow_controlled_buffer.length != 0 || - s->send_trailing_metadata == NULL || - !is_default_initial_metadata(s->send_initial_metadata)) { - grpc_encode_header_options hopt = { - s->id, // stream_id - false, // is_eof - t->settings[GRPC_PEER_SETTINGS] - [GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA] != - 0, // use_true_binary_metadata - t->settings[GRPC_PEER_SETTINGS] - [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], // max_frame_size - &s->stats.outgoing // stats - }; - grpc_chttp2_encode_header(exec_ctx, &t->hpack_compressor, NULL, 0, - s->send_initial_metadata, &hopt, &t->outbuf); - now_writing = true; - if (!t->is_client) { - t->ping_recv_state.last_ping_recv_time = GRPC_MILLIS_INF_PAST; - t->ping_recv_state.ping_strikes = 0; - } - initial_metadata_writes++; - } else { - GRPC_CHTTP2_IF_TRACING( - gpr_log(GPR_INFO, "not sending initial_metadata (Trailers-Only)")); - // When sending Trailers-Only, we need to move the :status and - // content-type headers to the trailers. - if (s->send_initial_metadata->idx.named.status != NULL) { - extra_headers_for_trailing_metadata - [num_extra_headers_for_trailing_metadata++] = - &s->send_initial_metadata->idx.named.status->md; - } - if (s->send_initial_metadata->idx.named.content_type != NULL) { - extra_headers_for_trailing_metadata - [num_extra_headers_for_trailing_metadata++] = - &s->send_initial_metadata->idx.named.content_type->md; - } - trailing_metadata_writes++; - } - s->send_initial_metadata = NULL; - s->sent_initial_metadata = true; - sent_initial_metadata = true; - result.early_results_scheduled = true; - grpc_chttp2_complete_closure_step( - exec_ctx, t, s, &s->send_initial_metadata_finished, GRPC_ERROR_NONE, - "send_initial_metadata_finished"); + if (s_->sent_initial_metadata) return; + if (s_->send_initial_metadata == nullptr) return; + + // We skip this on the server side if there is no custom initial + // metadata, there are no messages to send, and we are also sending + // trailing metadata. This results in a Trailers-Only response, + // which is required for retries, as per: + // https://github.com/grpc/proposal/blob/master/A6-client-retries.md#when-retries-are-valid + if (!t_->is_client && s_->fetching_send_message == nullptr && + s_->flow_controlled_buffer.length == 0 && + s_->compressed_data_buffer.length == 0 && + s_->send_trailing_metadata != nullptr && + is_default_initial_metadata(s_->send_initial_metadata)) { + ConvertInitialMetadataToTrailingMetadata(); + } else { + grpc_encode_header_options hopt = { + s_->id, // stream_id + false, // is_eof + t_->settings[GRPC_PEER_SETTINGS] + [GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA] != + 0, // use_true_binary_metadata + t_->settings[GRPC_PEER_SETTINGS] + [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], // max_frame_size + &s_->stats.outgoing // stats + }; + grpc_chttp2_encode_header(exec_ctx, &t_->hpack_compressor, NULL, 0, + s_->send_initial_metadata, &hopt, &t_->outbuf); + write_context_->ResetPingRecvClock(); + write_context_->IncInitialMetadataWrites(); } + s_->send_initial_metadata = NULL; + s_->sent_initial_metadata = true; + write_context_->NoteScheduledResults(); + grpc_chttp2_complete_closure_step( + exec_ctx, t_, s_, &s_->send_initial_metadata_finished, GRPC_ERROR_NONE, + "send_initial_metadata_finished"); + } + + void FlushWindowUpdates(grpc_exec_ctx *exec_ctx) { /* send any window updates */ uint32_t stream_announce = grpc_chttp2_flowctl_maybe_send_stream_update( - &t->flow_control, &s->flow_control); - if (stream_announce > 0) { - grpc_slice_buffer_add( - &t->outbuf, grpc_chttp2_window_update_create(s->id, stream_announce, - &s->stats.outgoing)); - if (!t->is_client) { - t->ping_recv_state.last_ping_recv_time = GRPC_MILLIS_INF_PAST; - t->ping_recv_state.ping_strikes = 0; + &t_->flow_control, &s_->flow_control); + if (stream_announce == 0) return; + + grpc_slice_buffer_add( + &t_->outbuf, grpc_chttp2_window_update_create(s_->id, stream_announce, + &s_->stats.outgoing)); + write_context_->ResetPingRecvClock(); + write_context_->IncWindowUpdateWrites(); + } + + void FlushData(grpc_exec_ctx *exec_ctx) { + if (!s_->sent_initial_metadata) return; + + if (s_->flow_controlled_buffer.length == 0 && + s_->compressed_data_buffer.length == 0) { + return; // early out: nothing to do + } + + DataSendContext data_send_context(write_context_, t_, s_); + + if (!data_send_context.AnyOutgoing()) { + if (t_->flow_control.remote_window == 0) { + report_stall(t_, s_, "transport"); + grpc_chttp2_list_add_stalled_by_transport(t_, s_); + } else if (data_send_context.stream_remote_window() == 0) { + report_stall(t_, s_, "stream"); + grpc_chttp2_list_add_stalled_by_stream(t_, s_); } - flow_control_writes++; + return; // early out: nothing to do } - if (sent_initial_metadata) { - /* send any body bytes, if allowed by flow control */ - if (s->flow_controlled_buffer.length > 0 || - s->compressed_data_buffer.length > 0) { - uint32_t stream_remote_window = (uint32_t)GPR_MAX( - 0, - s->flow_control.remote_window_delta + - (int64_t)t->settings[GRPC_PEER_SETTINGS] - [GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE]); - uint32_t max_outgoing = (uint32_t)GPR_MIN( - t->settings[GRPC_PEER_SETTINGS] - [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], - GPR_MIN(stream_remote_window, t->flow_control.remote_window)); - if (max_outgoing > 0) { - bool is_last_data_frame = false; - bool is_last_frame = false; - size_t sending_bytes_before = s->sending_bytes; - while ((s->flow_controlled_buffer.length > 0 || - s->compressed_data_buffer.length > 0) && - max_outgoing > 0) { - if (s->compressed_data_buffer.length > 0) { - uint32_t send_bytes = (uint32_t)GPR_MIN( - max_outgoing, s->compressed_data_buffer.length); - is_last_data_frame = - (send_bytes == s->compressed_data_buffer.length && - s->flow_controlled_buffer.length == 0 && - s->fetching_send_message == NULL); - if (is_last_data_frame && s->send_trailing_metadata != NULL && - s->stream_compression_ctx != NULL) { - if (!grpc_stream_compress( - s->stream_compression_ctx, &s->flow_controlled_buffer, - &s->compressed_data_buffer, NULL, MAX_SIZE_T, - GRPC_STREAM_COMPRESSION_FLUSH_FINISH)) { - gpr_log(GPR_ERROR, "Stream compression failed."); - } - grpc_stream_compression_context_destroy( - s->stream_compression_ctx); - s->stream_compression_ctx = NULL; - /* After finish, bytes in s->compressed_data_buffer may be - * more than max_outgoing. Start another round of the current - * while loop so that send_bytes and is_last_data_frame are - * recalculated. */ - continue; - } - is_last_frame = - is_last_data_frame && s->send_trailing_metadata != NULL && - grpc_metadata_batch_is_empty(s->send_trailing_metadata); - grpc_chttp2_encode_data(s->id, &s->compressed_data_buffer, - send_bytes, is_last_frame, - &s->stats.outgoing, &t->outbuf); - grpc_chttp2_flowctl_sent_data(&t->flow_control, &s->flow_control, - send_bytes); - max_outgoing -= send_bytes; - if (s->compressed_data_buffer.length == 0) { - s->sending_bytes += s->uncompressed_data_size; - } - } else { - if (s->stream_compression_ctx == NULL) { - s->stream_compression_ctx = - grpc_stream_compression_context_create( - s->stream_compression_method); - } - s->uncompressed_data_size = s->flow_controlled_buffer.length; - if (!grpc_stream_compress( - s->stream_compression_ctx, &s->flow_controlled_buffer, - &s->compressed_data_buffer, NULL, MAX_SIZE_T, - GRPC_STREAM_COMPRESSION_FLUSH_SYNC)) { - gpr_log(GPR_ERROR, "Stream compression failed."); - } - } - } - if (!t->is_client) { - t->ping_recv_state.last_ping_recv_time = 0; - t->ping_recv_state.ping_strikes = 0; - } - if (is_last_frame) { - s->send_trailing_metadata = NULL; - s->sent_trailing_metadata = true; - if (!t->is_client && !s->read_closed) { - grpc_slice_buffer_add(&t->outbuf, grpc_chttp2_rst_stream_create( - s->id, GRPC_HTTP2_NO_ERROR, - &s->stats.outgoing)); - } - grpc_chttp2_mark_stream_closed(exec_ctx, t, s, !t->is_client, 1, - GRPC_ERROR_NONE); - } - result.early_results_scheduled |= - update_list(exec_ctx, t, s, - (int64_t)(s->sending_bytes - sending_bytes_before), - &s->on_flow_controlled_cbs, - &s->flow_controlled_bytes_flowed, GRPC_ERROR_NONE); - now_writing = true; - if (s->flow_controlled_buffer.length > 0 || - s->compressed_data_buffer.length > 0) { - GRPC_CHTTP2_STREAM_REF(s, "chttp2_writing:fork"); - grpc_chttp2_list_add_writable_stream(t, s); - } - message_writes++; - } else if (t->flow_control.remote_window == 0) { - report_stall(t, s, "transport"); - grpc_chttp2_list_add_stalled_by_transport(t, s); - now_writing = true; - } else if (stream_remote_window == 0) { - report_stall(t, s, "stream"); - grpc_chttp2_list_add_stalled_by_stream(t, s); - now_writing = true; - } + + while ((s_->flow_controlled_buffer.length > 0 || + s_->compressed_data_buffer.length > 0) && + data_send_context.max_outgoing() > 0) { + if (s_->compressed_data_buffer.length > 0) { + data_send_context.FlushCompressedBytes(); + } else { + data_send_context.CompressMoreBytes(); } - if (s->send_trailing_metadata != NULL && - s->fetching_send_message == NULL && - s->flow_controlled_buffer.length == 0 && - s->compressed_data_buffer.length == 0) { - GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_INFO, "sending trailing_metadata")); - if (grpc_metadata_batch_is_empty(s->send_trailing_metadata)) { - grpc_chttp2_encode_data(s->id, &s->flow_controlled_buffer, 0, true, - &s->stats.outgoing, &t->outbuf); - } else { - grpc_encode_header_options hopt = { - s->id, true, - - t->settings - [GRPC_PEER_SETTINGS] + } + write_context_->ResetPingRecvClock(); + if (data_send_context.is_last_frame()) { + SentLastFrame(exec_ctx); + } + data_send_context.CallCallbacks(exec_ctx); + stream_became_writable_ = true; + if (s_->flow_controlled_buffer.length > 0 || + s_->compressed_data_buffer.length > 0) { + GRPC_CHTTP2_STREAM_REF(s_, "chttp2_writing:fork"); + grpc_chttp2_list_add_writable_stream(t_, s_); + } + write_context_->IncMessageWrites(); + } + + void FlushTrailingMetadata(grpc_exec_ctx *exec_ctx) { + if (!s_->sent_initial_metadata) return; + + if (s_->send_trailing_metadata == NULL) return; + if (s_->fetching_send_message != NULL) return; + if (s_->flow_controlled_buffer.length != 0) return; + if (s_->compressed_data_buffer.length != 0) return; + + GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_INFO, "sending trailing_metadata")); + if (grpc_metadata_batch_is_empty(s_->send_trailing_metadata)) { + grpc_chttp2_encode_data(s_->id, &s_->flow_controlled_buffer, 0, true, + &s_->stats.outgoing, &t_->outbuf); + } else { + grpc_encode_header_options hopt = { + s_->id, true, + t_->settings[GRPC_PEER_SETTINGS] [GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA] != - 0, - - t->settings[GRPC_PEER_SETTINGS] - [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], - &s->stats.outgoing}; - grpc_chttp2_encode_header(exec_ctx, &t->hpack_compressor, - extra_headers_for_trailing_metadata, - num_extra_headers_for_trailing_metadata, - s->send_trailing_metadata, &hopt, - &t->outbuf); - trailing_metadata_writes++; - } - s->send_trailing_metadata = NULL; - s->sent_trailing_metadata = true; - if (!t->is_client) { - t->ping_recv_state.last_ping_recv_time = GRPC_MILLIS_INF_PAST; - t->ping_recv_state.ping_strikes = 0; - } - if (!t->is_client && !s->read_closed) { - grpc_slice_buffer_add( - &t->outbuf, grpc_chttp2_rst_stream_create( - s->id, GRPC_HTTP2_NO_ERROR, &s->stats.outgoing)); - } - grpc_chttp2_mark_stream_closed(exec_ctx, t, s, !t->is_client, 1, - GRPC_ERROR_NONE); - now_writing = true; - result.early_results_scheduled = true; - grpc_chttp2_complete_closure_step( - exec_ctx, t, s, &s->send_trailing_metadata_finished, - GRPC_ERROR_NONE, "send_trailing_metadata_finished"); - } + 0, + + t_->settings[GRPC_PEER_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], + &s_->stats.outgoing}; + grpc_chttp2_encode_header(exec_ctx, &t_->hpack_compressor, + extra_headers_for_trailing_metadata_, + num_extra_headers_for_trailing_metadata_, + s_->send_trailing_metadata, &hopt, &t_->outbuf); + } + write_context_->IncTrailingMetadataWrites(); + write_context_->ResetPingRecvClock(); + SentLastFrame(exec_ctx); + + write_context_->NoteScheduledResults(); + grpc_chttp2_complete_closure_step( + exec_ctx, t_, s_, &s_->send_trailing_metadata_finished, GRPC_ERROR_NONE, + "send_trailing_metadata_finished"); + } + + bool stream_became_writable() { return stream_became_writable_; } + + private: + void ConvertInitialMetadataToTrailingMetadata() { + GRPC_CHTTP2_IF_TRACING( + gpr_log(GPR_INFO, "not sending initial_metadata (Trailers-Only)")); + // When sending Trailers-Only, we need to move the :status and + // content-type headers to the trailers. + if (s_->send_initial_metadata->idx.named.status != NULL) { + extra_headers_for_trailing_metadata_ + [num_extra_headers_for_trailing_metadata_++] = + &s_->send_initial_metadata->idx.named.status->md; } + if (s_->send_initial_metadata->idx.named.content_type != NULL) { + extra_headers_for_trailing_metadata_ + [num_extra_headers_for_trailing_metadata_++] = + &s_->send_initial_metadata->idx.named.content_type->md; + } + } + + void SentLastFrame(grpc_exec_ctx *exec_ctx) { + s_->send_trailing_metadata = NULL; + s_->sent_trailing_metadata = true; + + if (!t_->is_client && !s_->read_closed) { + grpc_slice_buffer_add( + &t_->outbuf, grpc_chttp2_rst_stream_create( + s_->id, GRPC_HTTP2_NO_ERROR, &s_->stats.outgoing)); + } + grpc_chttp2_mark_stream_closed(exec_ctx, t_, s_, !t_->is_client, true, + GRPC_ERROR_NONE); + } - if (now_writing) { - GRPC_STATS_INC_HTTP2_SEND_INITIAL_METADATA_PER_WRITE( - exec_ctx, initial_metadata_writes); - GRPC_STATS_INC_HTTP2_SEND_MESSAGE_PER_WRITE(exec_ctx, message_writes); - GRPC_STATS_INC_HTTP2_SEND_TRAILING_METADATA_PER_WRITE( - exec_ctx, trailing_metadata_writes); - GRPC_STATS_INC_HTTP2_SEND_FLOWCTL_PER_WRITE(exec_ctx, - flow_control_writes); + WriteContext *const write_context_; + grpc_chttp2_transport *const t_; + grpc_chttp2_stream *const s_; + bool stream_became_writable_ = false; + grpc_mdelem *extra_headers_for_trailing_metadata_[2]; + size_t num_extra_headers_for_trailing_metadata_ = 0; +}; +} // namespace +grpc_chttp2_begin_write_result grpc_chttp2_begin_write( + grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) { + WriteContext ctx(exec_ctx, t); + ctx.FlushSettings(exec_ctx); + ctx.FlushPingAcks(); + ctx.FlushQueuedBuffers(exec_ctx); + ctx.EnactHpackSettings(exec_ctx); + + if (t->flow_control.remote_window > 0) { + ctx.UpdateStreamsNoLongerStalled(); + } + + /* for each grpc_chttp2_stream that's become writable, frame it's data + (according to available window sizes) and add to the output buffer */ + while (grpc_chttp2_stream *s = ctx.NextStream()) { + StreamWriteContext stream_ctx(&ctx, s); + stream_ctx.FlushInitialMetadata(exec_ctx); + stream_ctx.FlushWindowUpdates(exec_ctx); + stream_ctx.FlushData(exec_ctx); + stream_ctx.FlushTrailingMetadata(exec_ctx); + + if (stream_ctx.stream_became_writable()) { if (!grpc_chttp2_list_add_writing_stream(t, s)) { /* already in writing list: drop ref */ GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "chttp2_writing:already_writing"); + } else { + /* ref will be dropped at end of write */ } } else { GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "chttp2_writing:no_write"); } } - maybe_initiate_ping(exec_ctx, t); + ctx.FlushWindowUpdates(exec_ctx); - uint32_t transport_announce = grpc_chttp2_flowctl_maybe_send_transport_update( - &t->flow_control, t->outbuf.count > 0); - if (transport_announce) { - grpc_transport_one_way_stats throwaway_stats; - grpc_slice_buffer_add( - &t->outbuf, grpc_chttp2_window_update_create(0, transport_announce, - &throwaway_stats)); - if (!t->is_client) { - t->ping_recv_state.last_ping_recv_time = GRPC_MILLIS_INF_PAST; - t->ping_recv_state.ping_strikes = 0; - } - } + maybe_initiate_ping(exec_ctx, t); GPR_TIMER_END("grpc_chttp2_begin_write", 0); - result.writing = t->outbuf.count > 0; - return result; + return ctx.Result(); } void grpc_chttp2_end_write(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, diff --git a/src/core/lib/channel/channel_args.h b/src/core/lib/channel/channel_args.h index 2837174f491..1896d35cf45 100644 --- a/src/core/lib/channel/channel_args.h +++ b/src/core/lib/channel/channel_args.h @@ -157,4 +157,4 @@ grpc_arg grpc_channel_arg_pointer_create(char *name, void *value, } #endif -#endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_H */ diff --git a/src/core/lib/channel/connected_channel.h b/src/core/lib/channel/connected_channel.h index b55a1089a00..4615727baa1 100644 --- a/src/core/lib/channel/connected_channel.h +++ b/src/core/lib/channel/connected_channel.h @@ -38,4 +38,4 @@ grpc_stream *grpc_connected_channel_get_stream(grpc_call_element *elem); } #endif -#endif /* GRPC_CORE_LIB_CHANNEL_CONNECTED_CHANNEL_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_CHANNEL_CONNECTED_CHANNEL_H */ diff --git a/src/core/lib/channel/handshaker.h b/src/core/lib/channel/handshaker.h index 51ee56af437..8ed38c15ba1 100644 --- a/src/core/lib/channel/handshaker.h +++ b/src/core/lib/channel/handshaker.h @@ -172,4 +172,4 @@ void grpc_handshake_manager_pending_list_shutdown_all( } #endif -#endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_H */ diff --git a/src/core/lib/channel/handshaker_factory.h b/src/core/lib/channel/handshaker_factory.h index 2a130de252a..59008adf057 100644 --- a/src/core/lib/channel/handshaker_factory.h +++ b/src/core/lib/channel/handshaker_factory.h @@ -56,4 +56,4 @@ void grpc_handshaker_factory_destroy( } #endif -#endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_FACTORY_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_FACTORY_H */ diff --git a/src/core/lib/channel/handshaker_registry.h b/src/core/lib/channel/handshaker_registry.h index e96bf06b6af..ddd280bea8a 100644 --- a/src/core/lib/channel/handshaker_registry.h +++ b/src/core/lib/channel/handshaker_registry.h @@ -53,4 +53,4 @@ void grpc_handshakers_add(grpc_exec_ctx* exec_ctx, } #endif -#endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_REGISTRY_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_REGISTRY_H */ diff --git a/src/core/lib/compression/algorithm_metadata.h b/src/core/lib/compression/algorithm_metadata.h index 3eb7088230b..17caf58f69c 100644 --- a/src/core/lib/compression/algorithm_metadata.h +++ b/src/core/lib/compression/algorithm_metadata.h @@ -57,4 +57,4 @@ grpc_stream_compression_algorithm grpc_stream_compression_algorithm_from_slice( } #endif -#endif /* GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H */ diff --git a/src/core/lib/compression/message_compress.h b/src/core/lib/compression/message_compress.h index d2545a02c2e..fffe175fd22 100644 --- a/src/core/lib/compression/message_compress.h +++ b/src/core/lib/compression/message_compress.h @@ -44,4 +44,4 @@ int grpc_msg_decompress(grpc_exec_ctx* exec_ctx, } #endif -#endif /* GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H */ diff --git a/src/core/lib/http/format_request.h b/src/core/lib/http/format_request.h index a559aac6603..2e77e8661a7 100644 --- a/src/core/lib/http/format_request.h +++ b/src/core/lib/http/format_request.h @@ -37,4 +37,4 @@ grpc_slice grpc_httpcli_format_connect_request( } #endif -#endif /* GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H */ diff --git a/src/core/lib/http/httpcli.h b/src/core/lib/http/httpcli.h index 3e6bdc0e461..76b790fa8ac 100644 --- a/src/core/lib/http/httpcli.h +++ b/src/core/lib/http/httpcli.h @@ -131,4 +131,4 @@ void grpc_httpcli_set_override(grpc_httpcli_get_override get, } #endif -#endif /* GRPC_CORE_LIB_HTTP_HTTPCLI_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_HTTP_HTTPCLI_H */ diff --git a/src/core/lib/http/parser.h b/src/core/lib/http/parser.h index 5484948bea8..d2bda6ae0e4 100644 --- a/src/core/lib/http/parser.h +++ b/src/core/lib/http/parser.h @@ -117,4 +117,4 @@ extern grpc_tracer_flag grpc_http1_trace; } #endif -#endif /* GRPC_CORE_LIB_HTTP_PARSER_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_HTTP_PARSER_H */ diff --git a/src/core/lib/iomgr/endpoint.h b/src/core/lib/iomgr/endpoint.h index 16ff0ab733e..21347d90230 100644 --- a/src/core/lib/iomgr/endpoint.h +++ b/src/core/lib/iomgr/endpoint.h @@ -103,4 +103,4 @@ struct grpc_endpoint { } #endif -#endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_H */ diff --git a/src/core/lib/iomgr/endpoint_pair.h b/src/core/lib/iomgr/endpoint_pair.h index f8830022f4b..ee91795749b 100644 --- a/src/core/lib/iomgr/endpoint_pair.h +++ b/src/core/lib/iomgr/endpoint_pair.h @@ -37,4 +37,4 @@ grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char *name, } #endif -#endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_PAIR_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_PAIR_H */ diff --git a/src/core/lib/iomgr/error_internal.h b/src/core/lib/iomgr/error_internal.h index f718e06d4e5..8746d5d353f 100644 --- a/src/core/lib/iomgr/error_internal.h +++ b/src/core/lib/iomgr/error_internal.h @@ -65,4 +65,4 @@ bool grpc_error_is_special(grpc_error *err); } #endif -#endif /* GRPC_CORE_LIB_IOMGR_ERROR_INTERNAL_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_ERROR_INTERNAL_H */ diff --git a/src/core/lib/iomgr/ev_epoll1_linux.h b/src/core/lib/iomgr/ev_epoll1_linux.h index 66fd826b495..b437032b368 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.h +++ b/src/core/lib/iomgr/ev_epoll1_linux.h @@ -34,4 +34,4 @@ const grpc_event_engine_vtable *grpc_init_epoll1_linux(bool explicit_request); } #endif -#endif /* GRPC_CORE_LIB_IOMGR_EV_EPOLL1_LINUX_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_EV_EPOLL1_LINUX_H */ diff --git a/src/core/lib/iomgr/ev_epollex_linux.h b/src/core/lib/iomgr/ev_epollex_linux.h index 58cc5a24f8f..2849a232835 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.h +++ b/src/core/lib/iomgr/ev_epollex_linux.h @@ -33,4 +33,4 @@ const grpc_event_engine_vtable *grpc_init_epollex_linux( } #endif -#endif /* GRPC_CORE_LIB_IOMGR_EV_EPOLLEX_LINUX_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_EV_EPOLLEX_LINUX_H */ diff --git a/src/core/lib/iomgr/ev_epollsig_linux.cc b/src/core/lib/iomgr/ev_epollsig_linux.cc index 370ea1d50bf..035bdc4cb55 100644 --- a/src/core/lib/iomgr/ev_epollsig_linux.cc +++ b/src/core/lib/iomgr/ev_epollsig_linux.cc @@ -18,6 +18,8 @@ #include "src/core/lib/iomgr/port.h" +#include + /* This polling engine is only relevant on linux kernels supporting epoll() */ #ifdef GRPC_LINUX_EPOLL diff --git a/src/core/lib/iomgr/ev_poll_posix.h b/src/core/lib/iomgr/ev_poll_posix.h index 84b68155b5f..861257204b5 100644 --- a/src/core/lib/iomgr/ev_poll_posix.h +++ b/src/core/lib/iomgr/ev_poll_posix.h @@ -32,4 +32,4 @@ const grpc_event_engine_vtable *grpc_init_poll_cv_posix(bool explicit_request); } #endif -#endif /* GRPC_CORE_LIB_IOMGR_EV_POLL_POSIX_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_EV_POLL_POSIX_H */ diff --git a/src/core/lib/iomgr/ev_posix.h b/src/core/lib/iomgr/ev_posix.h index 955326c5f72..bc4456c2a29 100644 --- a/src/core/lib/iomgr/ev_posix.h +++ b/src/core/lib/iomgr/ev_posix.h @@ -166,4 +166,4 @@ const grpc_event_engine_vtable *grpc_get_event_engine_test_only(); } #endif -#endif /* GRPC_CORE_LIB_IOMGR_EV_POSIX_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_EV_POSIX_H */ diff --git a/src/core/lib/iomgr/executor.h b/src/core/lib/iomgr/executor.h index ab3fc901de2..ef5ac56c832 100644 --- a/src/core/lib/iomgr/executor.h +++ b/src/core/lib/iomgr/executor.h @@ -53,4 +53,4 @@ void grpc_executor_set_threading(grpc_exec_ctx *exec_ctx, bool enable); } #endif -#endif /* GRPC_CORE_LIB_IOMGR_EXECUTOR_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_EXECUTOR_H */ diff --git a/src/core/lib/iomgr/iocp_windows.cc b/src/core/lib/iomgr/iocp_windows.cc index 336cc86c757..78185cc084e 100644 --- a/src/core/lib/iomgr/iocp_windows.cc +++ b/src/core/lib/iomgr/iocp_windows.cc @@ -21,6 +21,7 @@ #ifdef GRPC_WINSOCK_SOCKET #include +#include #include #include @@ -43,11 +44,14 @@ static HANDLE g_iocp; static DWORD deadline_to_millis_timeout(grpc_exec_ctx *exec_ctx, grpc_millis deadline) { - gpr_timespec timeout; if (deadline == GRPC_MILLIS_INF_FUTURE) { return INFINITE; } - return (DWORD)GPR_MAX(0, deadline - grpc_exec_ctx_now(exec_ctx)); + grpc_millis now = grpc_exec_ctx_now(exec_ctx); + if (deadline < now) return 0; + grpc_millis timeout = deadline - now; + if (timeout > std::numeric_limits::max()) return INFINITE; + return static_cast(deadline - now); } grpc_iocp_work_status grpc_iocp_work(grpc_exec_ctx *exec_ctx, @@ -63,6 +67,7 @@ grpc_iocp_work_status grpc_iocp_work(grpc_exec_ctx *exec_ctx, success = GetQueuedCompletionStatus(g_iocp, &bytes, &completion_key, &overlapped, deadline_to_millis_timeout(exec_ctx, deadline)); + grpc_exec_ctx_invalidate_now(exec_ctx); if (success == 0 && overlapped == NULL) { return GRPC_IOCP_WORK_TIMEOUT; } diff --git a/src/core/lib/iomgr/iocp_windows.h b/src/core/lib/iomgr/iocp_windows.h index aefe7a294a2..4efbc94645a 100644 --- a/src/core/lib/iomgr/iocp_windows.h +++ b/src/core/lib/iomgr/iocp_windows.h @@ -45,4 +45,4 @@ void grpc_iocp_add_socket(grpc_winsocket *); } #endif -#endif /* GRPC_CORE_LIB_IOMGR_IOCP_WINDOWS_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_IOCP_WINDOWS_H */ diff --git a/src/core/lib/iomgr/iomgr.h b/src/core/lib/iomgr/iomgr.h index fea08496fef..6c0a08b9183 100644 --- a/src/core/lib/iomgr/iomgr.h +++ b/src/core/lib/iomgr/iomgr.h @@ -40,4 +40,4 @@ void grpc_iomgr_shutdown(grpc_exec_ctx *exec_ctx); } #endif -#endif /* GRPC_CORE_LIB_IOMGR_IOMGR_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_IOMGR_H */ diff --git a/src/core/lib/iomgr/iomgr_internal.h b/src/core/lib/iomgr/iomgr_internal.h index 005abbed13e..52db37c89ae 100644 --- a/src/core/lib/iomgr/iomgr_internal.h +++ b/src/core/lib/iomgr/iomgr_internal.h @@ -48,4 +48,4 @@ bool grpc_iomgr_abort_on_leaks(void); } #endif -#endif /* GRPC_CORE_LIB_IOMGR_IOMGR_INTERNAL_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_IOMGR_INTERNAL_H */ diff --git a/src/core/lib/iomgr/is_epollexclusive_available.h b/src/core/lib/iomgr/is_epollexclusive_available.h index 5c3e4830655..9ae9c5c1915 100644 --- a/src/core/lib/iomgr/is_epollexclusive_available.h +++ b/src/core/lib/iomgr/is_epollexclusive_available.h @@ -31,4 +31,4 @@ bool grpc_is_epollexclusive_available(void); } #endif -#endif /* GRPC_CORE_LIB_IOMGR_IS_EPOLLEXCLUSIVE_AVAILABLE_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_IS_EPOLLEXCLUSIVE_AVAILABLE_H */ diff --git a/src/core/lib/iomgr/lockfree_event.h b/src/core/lib/iomgr/lockfree_event.h index 925f0049458..02229e569ef 100644 --- a/src/core/lib/iomgr/lockfree_event.h +++ b/src/core/lib/iomgr/lockfree_event.h @@ -45,4 +45,4 @@ void grpc_lfev_set_ready(grpc_exec_ctx *exec_ctx, gpr_atm *state, } #endif -#endif /* GRPC_CORE_LIB_IOMGR_LOCKFREE_EVENT_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_LOCKFREE_EVENT_H */ diff --git a/src/core/lib/iomgr/network_status_tracker.h b/src/core/lib/iomgr/network_status_tracker.h index af50d51257e..cba38d4530f 100644 --- a/src/core/lib/iomgr/network_status_tracker.h +++ b/src/core/lib/iomgr/network_status_tracker.h @@ -35,4 +35,4 @@ void grpc_network_status_shutdown_all_endpoints(); } #endif -#endif /* GRPC_CORE_LIB_IOMGR_NETWORK_STATUS_TRACKER_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_NETWORK_STATUS_TRACKER_H */ diff --git a/src/core/lib/iomgr/polling_entity.h b/src/core/lib/iomgr/polling_entity.h index 4a37acf212f..009f968fac4 100644 --- a/src/core/lib/iomgr/polling_entity.h +++ b/src/core/lib/iomgr/polling_entity.h @@ -72,4 +72,4 @@ void grpc_polling_entity_del_from_pollset_set(grpc_exec_ctx *exec_ctx, } #endif -#endif /* GRPC_CORE_LIB_IOMGR_POLLING_ENTITY_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_POLLING_ENTITY_H */ diff --git a/src/core/lib/iomgr/pollset_set.h b/src/core/lib/iomgr/pollset_set.h index 17df86542dd..5455eda02fd 100644 --- a/src/core/lib/iomgr/pollset_set.h +++ b/src/core/lib/iomgr/pollset_set.h @@ -52,4 +52,4 @@ void grpc_pollset_set_del_pollset_set(grpc_exec_ctx *exec_ctx, } #endif -#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_SET_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_SET_H */ diff --git a/src/core/lib/iomgr/pollset_uv.h b/src/core/lib/iomgr/pollset_uv.h index d8f72ff867b..5cc9faf4ff1 100644 --- a/src/core/lib/iomgr/pollset_uv.h +++ b/src/core/lib/iomgr/pollset_uv.h @@ -32,4 +32,4 @@ void grpc_pollset_global_shutdown(void); } #endif -#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_UV_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_UV_H */ diff --git a/src/core/lib/iomgr/pollset_windows.h b/src/core/lib/iomgr/pollset_windows.h index 7733d26471c..2479b25286d 100644 --- a/src/core/lib/iomgr/pollset_windows.h +++ b/src/core/lib/iomgr/pollset_windows.h @@ -68,4 +68,4 @@ void grpc_pollset_global_shutdown(void); } #endif -#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_WINDOWS_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_WINDOWS_H */ diff --git a/src/core/lib/iomgr/resolve_address.h b/src/core/lib/iomgr/resolve_address.h index 4a6df2cf264..5f0634299e0 100644 --- a/src/core/lib/iomgr/resolve_address.h +++ b/src/core/lib/iomgr/resolve_address.h @@ -60,4 +60,4 @@ extern grpc_error *(*grpc_blocking_resolve_address)( } #endif -#endif /* GRPC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_H */ diff --git a/src/core/lib/iomgr/resource_quota.h b/src/core/lib/iomgr/resource_quota.h index 3afb5254349..1d4249b7e29 100644 --- a/src/core/lib/iomgr/resource_quota.h +++ b/src/core/lib/iomgr/resource_quota.h @@ -158,4 +158,4 @@ grpc_slice grpc_resource_user_slice_malloc(grpc_exec_ctx *exec_ctx, } #endif -#endif /* GRPC_CORE_LIB_IOMGR_RESOURCE_QUOTA_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_RESOURCE_QUOTA_H */ diff --git a/src/core/lib/iomgr/sockaddr_utils.h b/src/core/lib/iomgr/sockaddr_utils.h index 129bb54fc9e..1fd552febbb 100644 --- a/src/core/lib/iomgr/sockaddr_utils.h +++ b/src/core/lib/iomgr/sockaddr_utils.h @@ -85,4 +85,4 @@ int grpc_sockaddr_get_family(const grpc_resolved_address *resolved_addr); } #endif -#endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_UTILS_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_UTILS_H */ diff --git a/src/core/lib/iomgr/socket_utils.h b/src/core/lib/iomgr/socket_utils.h index f319e931b61..d6c538ec6f3 100644 --- a/src/core/lib/iomgr/socket_utils.h +++ b/src/core/lib/iomgr/socket_utils.h @@ -32,4 +32,4 @@ const char *grpc_inet_ntop(int af, const void *src, char *dst, size_t size); } #endif -#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_H */ diff --git a/src/core/lib/iomgr/socket_utils_posix.h b/src/core/lib/iomgr/socket_utils_posix.h index 623b83f08b1..73809b68d30 100644 --- a/src/core/lib/iomgr/socket_utils_posix.h +++ b/src/core/lib/iomgr/socket_utils_posix.h @@ -137,4 +137,4 @@ grpc_error *grpc_create_dualstack_socket_using_factory( } #endif -#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_POSIX_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_POSIX_H */ diff --git a/src/core/lib/iomgr/socket_windows.h b/src/core/lib/iomgr/socket_windows.h index a00a7615a37..84fa071e89a 100644 --- a/src/core/lib/iomgr/socket_windows.h +++ b/src/core/lib/iomgr/socket_windows.h @@ -115,4 +115,4 @@ void grpc_socket_become_ready(grpc_exec_ctx *exec_ctx, } #endif -#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_WINDOWS_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_WINDOWS_H */ diff --git a/src/core/lib/iomgr/tcp_client.h b/src/core/lib/iomgr/tcp_client.h index 1b102b5784a..b2f365f2af6 100644 --- a/src/core/lib/iomgr/tcp_client.h +++ b/src/core/lib/iomgr/tcp_client.h @@ -45,4 +45,4 @@ void grpc_tcp_client_connect(grpc_exec_ctx *exec_ctx, grpc_closure *on_connect, } #endif -#endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_H */ diff --git a/src/core/lib/iomgr/tcp_client_posix.h b/src/core/lib/iomgr/tcp_client_posix.h index 0b9775504ca..8740511804d 100644 --- a/src/core/lib/iomgr/tcp_client_posix.h +++ b/src/core/lib/iomgr/tcp_client_posix.h @@ -35,4 +35,4 @@ grpc_endpoint *grpc_tcp_client_create_from_fd( } #endif -#endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_POSIX_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_POSIX_H */ diff --git a/src/core/lib/iomgr/tcp_posix.h b/src/core/lib/iomgr/tcp_posix.h index dda78b2f8e1..47e78fa67e6 100644 --- a/src/core/lib/iomgr/tcp_posix.h +++ b/src/core/lib/iomgr/tcp_posix.h @@ -61,4 +61,4 @@ void grpc_tcp_destroy_and_release_fd(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, } #endif -#endif /* GRPC_CORE_LIB_IOMGR_TCP_POSIX_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_TCP_POSIX_H */ diff --git a/src/core/lib/iomgr/tcp_server.h b/src/core/lib/iomgr/tcp_server.h index 3f190ac2853..8f9ce3819e6 100644 --- a/src/core/lib/iomgr/tcp_server.h +++ b/src/core/lib/iomgr/tcp_server.h @@ -106,4 +106,4 @@ void grpc_tcp_server_shutdown_listeners(grpc_exec_ctx *exec_ctx, } #endif -#endif /* GRPC_CORE_LIB_IOMGR_TCP_SERVER_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_TCP_SERVER_H */ diff --git a/src/core/lib/iomgr/tcp_server_utils_posix.h b/src/core/lib/iomgr/tcp_server_utils_posix.h index 4bb0660f091..67463339608 100644 --- a/src/core/lib/iomgr/tcp_server_utils_posix.h +++ b/src/core/lib/iomgr/tcp_server_utils_posix.h @@ -125,4 +125,4 @@ bool grpc_tcp_server_have_ifaddrs(void); } #endif -#endif /* GRPC_CORE_LIB_IOMGR_TCP_SERVER_UTILS_POSIX_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_TCP_SERVER_UTILS_POSIX_H */ diff --git a/src/core/lib/iomgr/tcp_uv.h b/src/core/lib/iomgr/tcp_uv.h index ba7db8a0f7f..3399535b421 100644 --- a/src/core/lib/iomgr/tcp_uv.h +++ b/src/core/lib/iomgr/tcp_uv.h @@ -50,4 +50,4 @@ grpc_endpoint *grpc_tcp_create(uv_tcp_t *handle, } #endif -#endif /* GRPC_CORE_LIB_IOMGR_TCP_UV_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_TCP_UV_H */ diff --git a/src/core/lib/iomgr/time_averaged_stats.h b/src/core/lib/iomgr/time_averaged_stats.h index e255b58feeb..d38ed272b6d 100644 --- a/src/core/lib/iomgr/time_averaged_stats.h +++ b/src/core/lib/iomgr/time_averaged_stats.h @@ -78,4 +78,4 @@ double grpc_time_averaged_stats_update_average(grpc_time_averaged_stats* stats); } #endif -#endif /* GRPC_CORE_LIB_IOMGR_TIME_AVERAGED_STATS_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_TIME_AVERAGED_STATS_H */ diff --git a/src/core/lib/iomgr/timer_heap.h b/src/core/lib/iomgr/timer_heap.h index f15e8a3abb8..228d038ab38 100644 --- a/src/core/lib/iomgr/timer_heap.h +++ b/src/core/lib/iomgr/timer_heap.h @@ -47,4 +47,4 @@ int grpc_timer_heap_is_empty(grpc_timer_heap *heap); } #endif -#endif /* GRPC_CORE_LIB_IOMGR_TIMER_HEAP_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_TIMER_HEAP_H */ diff --git a/src/core/lib/iomgr/timer_manager.h b/src/core/lib/iomgr/timer_manager.h index d8a59a9477a..72960d6ffc0 100644 --- a/src/core/lib/iomgr/timer_manager.h +++ b/src/core/lib/iomgr/timer_manager.h @@ -42,4 +42,4 @@ void grpc_timer_manager_tick(void); } #endif -#endif /* GRPC_CORE_LIB_IOMGR_TIMER_MANAGER_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_TIMER_MANAGER_H */ diff --git a/src/core/lib/iomgr/udp_server.h b/src/core/lib/iomgr/udp_server.h index bcd8572260a..e887cb1bcf4 100644 --- a/src/core/lib/iomgr/udp_server.h +++ b/src/core/lib/iomgr/udp_server.h @@ -81,4 +81,4 @@ void grpc_udp_server_destroy(grpc_exec_ctx *exec_ctx, grpc_udp_server *server, } #endif -#endif /* GRPC_CORE_LIB_IOMGR_UDP_SERVER_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_UDP_SERVER_H */ diff --git a/src/core/lib/iomgr/unix_sockets_posix.h b/src/core/lib/iomgr/unix_sockets_posix.h index b96131ae1ce..3e7f9c7d1e3 100644 --- a/src/core/lib/iomgr/unix_sockets_posix.h +++ b/src/core/lib/iomgr/unix_sockets_posix.h @@ -46,4 +46,4 @@ char *grpc_sockaddr_to_uri_unix_if_possible( } #endif -#endif /* GRPC_CORE_LIB_IOMGR_UNIX_SOCKETS_POSIX_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_IOMGR_UNIX_SOCKETS_POSIX_H */ diff --git a/src/core/lib/json/json.h b/src/core/lib/json/json.h index 81b7e0c9da3..c9fdec4ecb7 100644 --- a/src/core/lib/json/json.h +++ b/src/core/lib/json/json.h @@ -78,4 +78,4 @@ void grpc_json_destroy(grpc_json* json); } #endif -#endif /* GRPC_CORE_LIB_JSON_JSON_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_JSON_JSON_H */ diff --git a/src/core/lib/json/json_reader.h b/src/core/lib/json/json_reader.h index ab2384f7a71..7f14a9a9c81 100644 --- a/src/core/lib/json/json_reader.h +++ b/src/core/lib/json/json_reader.h @@ -150,4 +150,4 @@ int grpc_json_reader_is_complete(grpc_json_reader *reader); } #endif -#endif /* GRPC_CORE_LIB_JSON_JSON_READER_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_JSON_JSON_READER_H */ diff --git a/src/core/lib/json/json_writer.h b/src/core/lib/json/json_writer.h index 18bd2a80fec..132d1f24e85 100644 --- a/src/core/lib/json/json_writer.h +++ b/src/core/lib/json/json_writer.h @@ -87,4 +87,4 @@ void grpc_json_writer_value_string(grpc_json_writer *writer, } #endif -#endif /* GRPC_CORE_LIB_JSON_JSON_WRITER_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_JSON_JSON_WRITER_H */ diff --git a/src/core/lib/security/credentials/fake/fake_credentials.h b/src/core/lib/security/credentials/fake/fake_credentials.h index 64f6f439f0a..ed3f893c58f 100644 --- a/src/core/lib/security/credentials/fake/fake_credentials.h +++ b/src/core/lib/security/credentials/fake/fake_credentials.h @@ -64,4 +64,4 @@ typedef struct { } #endif -#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_FAKE_FAKE_CREDENTIALS_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_FAKE_FAKE_CREDENTIALS_H */ diff --git a/src/core/lib/security/credentials/jwt/jwt_credentials.h b/src/core/lib/security/credentials/jwt/jwt_credentials.h index c09485fd55a..5cee6ed0da6 100644 --- a/src/core/lib/security/credentials/jwt/jwt_credentials.h +++ b/src/core/lib/security/credentials/jwt/jwt_credentials.h @@ -53,4 +53,4 @@ grpc_service_account_jwt_access_credentials_create_from_auth_json_key( } #endif -#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JWT_CREDENTIALS_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JWT_CREDENTIALS_H */ diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.h b/src/core/lib/security/credentials/oauth2/oauth2_credentials.h index 4beaec93e3e..c12db896f33 100644 --- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.h @@ -110,4 +110,4 @@ grpc_oauth2_token_fetcher_credentials_parse_server_response( } #endif -#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_OAUTH2_OAUTH2_CREDENTIALS_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_OAUTH2_OAUTH2_CREDENTIALS_H */ diff --git a/src/core/lib/security/transport/lb_targets_info.h b/src/core/lib/security/transport/lb_targets_info.h index 705d33b0abe..43f0e645565 100644 --- a/src/core/lib/security/transport/lb_targets_info.h +++ b/src/core/lib/security/transport/lb_targets_info.h @@ -37,4 +37,4 @@ grpc_slice_hash_table *grpc_lb_targets_info_find_in_args( } #endif -#endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_LB_TARGETS_INFO_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_LB_TARGETS_INFO_H */ diff --git a/src/core/lib/security/transport/secure_endpoint.h b/src/core/lib/security/transport/secure_endpoint.h index 832cc1c0ce9..980449c03ee 100644 --- a/src/core/lib/security/transport/secure_endpoint.h +++ b/src/core/lib/security/transport/secure_endpoint.h @@ -44,4 +44,4 @@ grpc_endpoint *grpc_secure_endpoint_create( } #endif -#endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURE_ENDPOINT_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURE_ENDPOINT_H */ diff --git a/src/core/lib/security/transport/security_handshaker.h b/src/core/lib/security/transport/security_handshaker.h index 345065f26c8..178099bb945 100644 --- a/src/core/lib/security/transport/security_handshaker.h +++ b/src/core/lib/security/transport/security_handshaker.h @@ -39,4 +39,4 @@ void grpc_security_register_handshaker_factories(); } #endif -#endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURITY_HANDSHAKER_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURITY_HANDSHAKER_H */ diff --git a/src/core/lib/security/transport/tsi_error.h b/src/core/lib/security/transport/tsi_error.h index 4c78b06603d..4e19daf796f 100644 --- a/src/core/lib/security/transport/tsi_error.h +++ b/src/core/lib/security/transport/tsi_error.h @@ -32,4 +32,4 @@ grpc_error *grpc_set_tsi_error_result(grpc_error *error, tsi_result result); } #endif -#endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_TSI_ERROR_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_TSI_ERROR_H */ diff --git a/src/core/lib/security/util/json_util.h b/src/core/lib/security/util/json_util.h index 43a2f6b9d18..cdd8a7198a8 100644 --- a/src/core/lib/security/util/json_util.h +++ b/src/core/lib/security/util/json_util.h @@ -45,4 +45,4 @@ bool grpc_copy_json_string_property(const grpc_json *json, } #endif -#endif /* GRPC_CORE_LIB_SECURITY_UTIL_JSON_UTIL_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_SECURITY_UTIL_JSON_UTIL_H */ diff --git a/src/core/lib/slice/b64.h b/src/core/lib/slice/b64.h index c01da56575c..9b4dc65dbbb 100644 --- a/src/core/lib/slice/b64.h +++ b/src/core/lib/slice/b64.h @@ -55,4 +55,4 @@ grpc_slice grpc_base64_decode_with_len(grpc_exec_ctx *exec_ctx, const char *b64, } #endif -#endif /* GRPC_CORE_LIB_SLICE_B64_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_SLICE_B64_H */ diff --git a/src/core/lib/slice/percent_encoding.h b/src/core/lib/slice/percent_encoding.h index e6f85120c3a..14a4deb44b8 100644 --- a/src/core/lib/slice/percent_encoding.h +++ b/src/core/lib/slice/percent_encoding.h @@ -68,4 +68,4 @@ grpc_slice grpc_permissive_percent_decode_slice(grpc_slice slice_in); } #endif -#endif /* GRPC_CORE_LIB_SLICE_PERCENT_ENCODING_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_SLICE_PERCENT_ENCODING_H */ diff --git a/src/core/lib/slice/slice_hash_table.h b/src/core/lib/slice/slice_hash_table.h index 3c3f0e61f3a..41250df7385 100644 --- a/src/core/lib/slice/slice_hash_table.h +++ b/src/core/lib/slice/slice_hash_table.h @@ -75,4 +75,4 @@ int grpc_slice_hash_table_cmp(const grpc_slice_hash_table *a, } #endif -#endif /* GRPC_CORE_LIB_SLICE_SLICE_HASH_TABLE_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_SLICE_SLICE_HASH_TABLE_H */ diff --git a/src/core/lib/slice/slice_internal.h b/src/core/lib/slice/slice_internal.h index 8591185c53b..fcf70a0e55f 100644 --- a/src/core/lib/slice/slice_internal.h +++ b/src/core/lib/slice/slice_internal.h @@ -54,4 +54,4 @@ int grpc_static_slice_eq(grpc_slice a, grpc_slice b); } #endif -#endif /* GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H */ diff --git a/src/core/lib/slice/slice_traits.h b/src/core/lib/slice/slice_traits.h index 1eda17cf00b..7fdb6752cb4 100644 --- a/src/core/lib/slice/slice_traits.h +++ b/src/core/lib/slice/slice_traits.h @@ -34,4 +34,4 @@ bool grpc_slice_is_bin_suffixed(grpc_slice s); } #endif -#endif /* GRPC_CORE_LIB_SLICE_SLICE_TRAITS_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_SLICE_SLICE_TRAITS_H */ diff --git a/src/core/lib/support/env_windows.cc b/src/core/lib/support/env_windows.cc index 73c643c5600..c5a25dc201d 100644 --- a/src/core/lib/support/env_windows.cc +++ b/src/core/lib/support/env_windows.cc @@ -43,7 +43,10 @@ char *gpr_getenv(const char *name) { DWORD ret; ret = GetEnvironmentVariable(tname, NULL, 0); - if (ret == 0) return NULL; + if (ret == 0) { + gpr_free(tname); + return NULL; + } size = ret * (DWORD)sizeof(TCHAR); tresult = (LPTSTR)gpr_malloc(size); ret = GetEnvironmentVariable(tname, tresult, size); diff --git a/src/core/lib/surface/channel_stack_type.h b/src/core/lib/surface/channel_stack_type.h index 903b90a0716..c77848794cc 100644 --- a/src/core/lib/surface/channel_stack_type.h +++ b/src/core/lib/surface/channel_stack_type.h @@ -50,4 +50,4 @@ const char *grpc_channel_stack_type_string(grpc_channel_stack_type type); } #endif -#endif /* GRPC_CORE_LIB_SURFACE_CHANNEL_STACK_TYPE_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_SURFACE_CHANNEL_STACK_TYPE_H */ diff --git a/src/core/lib/surface/completion_queue_factory.h b/src/core/lib/surface/completion_queue_factory.h index cb0af6f0fb6..af8f3d60c38 100644 --- a/src/core/lib/surface/completion_queue_factory.h +++ b/src/core/lib/surface/completion_queue_factory.h @@ -41,4 +41,4 @@ struct grpc_completion_queue_factory { } #endif -#endif /* GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_FACTORY_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_FACTORY_H */ diff --git a/src/core/lib/surface/event_string.h b/src/core/lib/surface/event_string.h index 127609c404f..2d53cf0facf 100644 --- a/src/core/lib/surface/event_string.h +++ b/src/core/lib/surface/event_string.h @@ -32,4 +32,4 @@ char *grpc_event_string(grpc_event *ev); } #endif -#endif /* GRPC_CORE_LIB_SURFACE_EVENT_STRING_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_SURFACE_EVENT_STRING_H */ diff --git a/src/core/lib/surface/init.h b/src/core/lib/surface/init.h index b2f48576e50..d429026327f 100644 --- a/src/core/lib/surface/init.h +++ b/src/core/lib/surface/init.h @@ -32,4 +32,4 @@ int grpc_is_initialized(void); } #endif -#endif /* GRPC_CORE_LIB_SURFACE_INIT_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_SURFACE_INIT_H */ diff --git a/src/core/lib/surface/server.h b/src/core/lib/surface/server.h index 1114715833b..375eab4a048 100644 --- a/src/core/lib/surface/server.h +++ b/src/core/lib/surface/server.h @@ -62,4 +62,4 @@ void grpc_server_get_pollsets(grpc_server *server, grpc_pollset ***pollsets, } #endif -#endif /* GRPC_CORE_LIB_SURFACE_SERVER_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_SURFACE_SERVER_H */ diff --git a/src/core/lib/surface/validate_metadata.h b/src/core/lib/surface/validate_metadata.h index aa02419d9f7..afc8be6dfda 100644 --- a/src/core/lib/surface/validate_metadata.h +++ b/src/core/lib/surface/validate_metadata.h @@ -33,4 +33,4 @@ grpc_error *grpc_validate_header_nonbin_value_is_legal(grpc_slice slice); } #endif -#endif /* GRPC_CORE_LIB_SURFACE_VALIDATE_METADATA_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_SURFACE_VALIDATE_METADATA_H */ diff --git a/src/core/lib/transport/byte_stream.h b/src/core/lib/transport/byte_stream.h index d3e04df5c06..c1d8ee543f5 100644 --- a/src/core/lib/transport/byte_stream.h +++ b/src/core/lib/transport/byte_stream.h @@ -143,4 +143,4 @@ void grpc_caching_byte_stream_reset(grpc_caching_byte_stream *stream); } #endif -#endif /* GRPC_CORE_LIB_TRANSPORT_BYTE_STREAM_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_TRANSPORT_BYTE_STREAM_H */ diff --git a/src/core/lib/transport/connectivity_state.h b/src/core/lib/transport/connectivity_state.h index 1796a540a79..c0ba1881484 100644 --- a/src/core/lib/transport/connectivity_state.h +++ b/src/core/lib/transport/connectivity_state.h @@ -92,4 +92,4 @@ bool grpc_connectivity_state_notify_on_state_change( } #endif -#endif /* GRPC_CORE_LIB_TRANSPORT_CONNECTIVITY_STATE_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_TRANSPORT_CONNECTIVITY_STATE_H */ diff --git a/src/core/lib/transport/error_utils.h b/src/core/lib/transport/error_utils.h index 2c97f9f0bc9..b4f9df4bf1a 100644 --- a/src/core/lib/transport/error_utils.h +++ b/src/core/lib/transport/error_utils.h @@ -48,4 +48,4 @@ bool grpc_error_has_clear_grpc_status(grpc_error *error); } #endif -#endif /* GRPC_CORE_LIB_TRANSPORT_ERROR_UTILS_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_TRANSPORT_ERROR_UTILS_H */ diff --git a/src/core/lib/transport/pid_controller.h b/src/core/lib/transport/pid_controller.h index 17feabfd393..80899e9a20f 100644 --- a/src/core/lib/transport/pid_controller.h +++ b/src/core/lib/transport/pid_controller.h @@ -67,4 +67,4 @@ double grpc_pid_controller_last(grpc_pid_controller *pid_controller); } #endif -#endif /* GRPC_CORE_LIB_TRANSPORT_PID_CONTROLLER_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_TRANSPORT_PID_CONTROLLER_H */ diff --git a/src/core/lib/transport/service_config.h b/src/core/lib/transport/service_config.h index c485f524723..9c430936274 100644 --- a/src/core/lib/transport/service_config.h +++ b/src/core/lib/transport/service_config.h @@ -67,4 +67,4 @@ void* grpc_method_config_table_get(grpc_exec_ctx* exec_ctx, } #endif -#endif /* GRPC_CORE_LIB_TRANSPORT_SERVICE_CONFIG_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_TRANSPORT_SERVICE_CONFIG_H */ diff --git a/src/core/lib/transport/status_conversion.h b/src/core/lib/transport/status_conversion.h index fd58a82cb74..8ef91aecfea 100644 --- a/src/core/lib/transport/status_conversion.h +++ b/src/core/lib/transport/status_conversion.h @@ -41,4 +41,4 @@ int grpc_status_to_http2_status(grpc_status_code status); } #endif -#endif /* GRPC_CORE_LIB_TRANSPORT_STATUS_CONVERSION_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_TRANSPORT_STATUS_CONVERSION_H */ diff --git a/src/core/lib/transport/timeout_encoding.h b/src/core/lib/transport/timeout_encoding.h index 25cb6639595..91cdf0f728e 100644 --- a/src/core/lib/transport/timeout_encoding.h +++ b/src/core/lib/transport/timeout_encoding.h @@ -40,4 +40,4 @@ int grpc_http2_decode_timeout(grpc_slice text, grpc_millis *timeout); } #endif -#endif /* GRPC_CORE_LIB_TRANSPORT_TIMEOUT_ENCODING_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_TRANSPORT_TIMEOUT_ENCODING_H */ diff --git a/src/core/lib/transport/transport_impl.h b/src/core/lib/transport/transport_impl.h index 41d34d39542..445fb41ab16 100644 --- a/src/core/lib/transport/transport_impl.h +++ b/src/core/lib/transport/transport_impl.h @@ -77,4 +77,4 @@ struct grpc_transport { } #endif -#endif /* GRPC_CORE_LIB_TRANSPORT_TRANSPORT_IMPL_H */ \ No newline at end of file +#endif /* GRPC_CORE_LIB_TRANSPORT_TRANSPORT_IMPL_H */ diff --git a/src/core/tsi/gts_transport_security.h b/src/core/tsi/gts_transport_security.h index b988c3f8616..9590038ed00 100644 --- a/src/core/tsi/gts_transport_security.h +++ b/src/core/tsi/gts_transport_security.h @@ -42,4 +42,4 @@ gts_shared_resource *gts_get_shared_resource(void); } #endif -#endif /* GRPC_CORE_TSI_GTS_TRANSPORT_SECURITY_H */ \ No newline at end of file +#endif /* GRPC_CORE_TSI_GTS_TRANSPORT_SECURITY_H */ diff --git a/src/php/tests/qps/client.php b/src/php/tests/qps/client.php index a785d831b44..08904054eb3 100644 --- a/src/php/tests/qps/client.php +++ b/src/php/tests/qps/client.php @@ -37,6 +37,7 @@ */ require dirname(__FILE__).'/vendor/autoload.php'; +require dirname(__FILE__).'/histogram.php'; /** * Assertion function that always exits with an error code if the assertion is @@ -63,19 +64,19 @@ function hardAssertIfStatusOk($status) } /* Start the actual client */ - -function qps_client_main($proxy_address) { - echo "Initiating php client\n"; +function qps_client_main($proxy_address, $server_ind) { + echo "[php-client] Initiating php client\n"; $proxystubopts = []; $proxystubopts['credentials'] = Grpc\ChannelCredentials::createInsecure(); $proxystub = new Grpc\Testing\ProxyClientServiceClient($proxy_address, $proxystubopts); list($config, $status) = $proxystub->GetConfig(new Grpc\Testing\Void())->wait(); hardAssertIfStatusOk($status); - hardAssert($config->getClientChannels() == 1, "Only 1 channel supported"); hardAssert($config->getOutstandingRpcsPerChannel() == 1, "Only 1 outstanding RPC supported"); - echo "Got configuration from proxy, target is " . $config->getServerTargets()[0] . "\n"; + echo "[php-client] Got configuration from proxy, target is '$server_ind'th server" . $config->getServerTargets()[$server_ind] . "\n"; + $histres = $config->getHistogramParams()->getResolution(); + $histmax = $config->getHistogramParams()->getMaxPossible(); $stubopts = []; if ($config->getSecurityParams()) { @@ -93,10 +94,10 @@ function qps_client_main($proxy_address) { } else { $stubopts['credentials'] = Grpc\ChannelCredentials::createInsecure(); } - echo "Initiating php benchmarking client\n"; + echo "[php-client] Initiating php benchmarking client\n"; $stub = new Grpc\Testing\BenchmarkServiceClient( - $config->getServerTargets()[0], $stubopts); + $config->getServerTargets()[$server_ind], $stubopts); $req = new Grpc\Testing\SimpleRequest(); $req->setResponseType(Grpc\Testing\PayloadType::COMPRESSABLE); @@ -115,8 +116,11 @@ function qps_client_main($proxy_address) { } else { $poisson = false; } - $metric = new Grpc\Testing\ProxyStat; - $telemetry = $proxystub->ReportTime(); + $histogram = new Histogram($histres, $histmax); + $histogram->clean(); + $count = 0; + $histogram_result = new Grpc\Testing\HistogramData; + $telehist = $proxystub->ReportHist(); if ($config->getRpcType() == Grpc\Testing\RpcType::UNARY) { while (1) { if ($poisson) { @@ -126,8 +130,20 @@ function qps_client_main($proxy_address) { $startreq = microtime(true); list($resp,$status) = $stub->UnaryCall($req)->wait(); hardAssertIfStatusOk($status); - $metric->setLatency(microtime(true)-$startreq); - $telemetry->write($metric); + $histogram->add((microtime(true)-$startreq)*1e9); + $count += 1; + if ($count == 2000) { + $contents = $histogram->contents(); + $histogram_result->setBucket($contents); + $histogram_result->setMinSeen($histogram->minimum()); + $histogram_result->setMaxSeen($histogram->maximum()); + $histogram_result->setSum($histogram->sum()); + $histogram_result->setSumOfSquares($histogram->sum_of_squares()); + $histogram_result->setCount($histogram->count()); + $telehist->write($histogram_result); + $histogram->clean(); + $count = 0; + } } } else { $stream = $stub->StreamingCall(); @@ -139,8 +155,20 @@ function qps_client_main($proxy_address) { $startreq = microtime(true); $stream->write($req); $resp = $stream->read(); - $metric->setLatency(microtime(true)-$startreq); - $telemetry->write($metric); + $histogram->add((microtime(true)-$startreq)*1e9); + $count += 1; + if ($count == 2000) { + $contents = $histogram->contents(); + $histogram_result->setBucket($contents); + $histogram_result->setMinSeen($histogram->minimum()); + $histogram_result->setMaxSeen($histogram->maximum()); + $histogram_result->setSum($histogram->sum()); + $histogram_result->setSumOfSquares($histogram->sum_of_squares()); + $histogram_result->setCount($histogram->count()); + $telehist->write($histogram_result); + $histogram->clean(); + $count = 0; + } } } } @@ -148,4 +176,4 @@ function qps_client_main($proxy_address) { ini_set('display_startup_errors', 1); ini_set('display_errors', 1); error_reporting(-1); -qps_client_main($argv[1]); +qps_client_main($argv[1], $argv[2]); diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Core/Stats.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Core/Stats.php new file mode 100644 index 00000000000..f9c710cd4e0 --- /dev/null +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Core/Stats.php @@ -0,0 +1,33 @@ +internalAddGeneratedFile(hex2bin( + "0a97020a1f7372632f70726f746f2f677270632f636f72652f7374617473" . + "2e70726f746f1209677270632e636f726522260a064275636b6574120d0a" . + "057374617274180120012801120d0a05636f756e74180220012804222f0a" . + "09486973746f6772616d12220a076275636b65747318012003280b32112e" . + "677270632e636f72652e4275636b6574225b0a064d6574726963120c0a04" . + "6e616d65180120012809120f0a05636f756e74180a20012804480012290a" . + "09686973746f6772616d180b2001280b32142e677270632e636f72652e48" . + "6973746f6772616d480042070a0576616c7565222b0a0553746174731222" . + "0a076d65747269637318012003280b32112e677270632e636f72652e4d65" . + "74726963620670726f746f33" + )); + + static::$is_initialized = true; + } +} + diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Control.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Control.php index efca18a0cb3..9b3a7529ec7 100644 --- a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Control.php +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Control.php @@ -17,108 +17,119 @@ class Control \GPBMetadata\Src\Proto\Grpc\Testing\Payloads::initOnce(); \GPBMetadata\Src\Proto\Grpc\Testing\Stats::initOnce(); $pool->internalAddGeneratedFile(hex2bin( - "0add170a247372632f70726f746f2f677270632f74657374696e672f636f" . - "6e74726f6c2e70726f746f120c677270632e74657374696e671a25737263" . - "2f70726f746f2f677270632f74657374696e672f7061796c6f6164732e70" . - "726f746f1a227372632f70726f746f2f677270632f74657374696e672f73" . - "746174732e70726f746f22250a0d506f6973736f6e506172616d7312140a" . - "0c6f6666657265645f6c6f616418012001280122120a10436c6f7365644c" . - "6f6f70506172616d73227b0a0a4c6f6164506172616d7312350a0b636c6f" . - "7365645f6c6f6f7018012001280b321e2e677270632e74657374696e672e" . - "436c6f7365644c6f6f70506172616d734800122e0a07706f6973736f6e18" . - "022001280b321b2e677270632e74657374696e672e506f6973736f6e5061" . - "72616d73480042060a046c6f616422430a0e536563757269747950617261" . - "6d7312130a0b7573655f746573745f6361180120012808121c0a14736572" . - "7665725f686f73745f6f76657272696465180220012809224d0a0a436861" . - "6e6e656c417267120c0a046e616d6518012001280912130a097374725f76" . - "616c7565180220012809480012130a09696e745f76616c75651803200128" . - "05480042070a0576616c756522a0040a0c436c69656e74436f6e66696712" . - "160a0e7365727665725f74617267657473180120032809122d0a0b636c69" . - "656e745f7479706518022001280e32182e677270632e74657374696e672e" . - "436c69656e745479706512350a0f73656375726974795f706172616d7318" . - "032001280b321c2e677270632e74657374696e672e536563757269747950" . - "6172616d7312240a1c6f75747374616e64696e675f727063735f7065725f" . - "6368616e6e656c18042001280512170a0f636c69656e745f6368616e6e65" . - "6c73180520012805121c0a146173796e635f636c69656e745f7468726561" . - "647318072001280512270a087270635f7479706518082001280e32152e67" . - "7270632e74657374696e672e52706354797065122d0a0b6c6f61645f7061" . - "72616d73180a2001280b32182e677270632e74657374696e672e4c6f6164" . - "506172616d7312330a0e7061796c6f61645f636f6e666967180b2001280b" . - "321b2e677270632e74657374696e672e5061796c6f6164436f6e66696712" . - "370a10686973746f6772616d5f706172616d73180c2001280b321d2e6772" . - "70632e74657374696e672e486973746f6772616d506172616d7312110a09" . - "636f72655f6c697374180d2003280512120a0a636f72655f6c696d697418" . - "0e2001280512180a106f746865725f636c69656e745f617069180f200128" . - "09122e0a0c6368616e6e656c5f6172677318102003280b32182e67727063" . - "2e74657374696e672e4368616e6e656c41726722380a0c436c69656e7453" . - "746174757312280a05737461747318012001280b32192e677270632e7465" . - "7374696e672e436c69656e74537461747322150a044d61726b120d0a0572" . - "6573657418012001280822680a0a436c69656e7441726773122b0a057365" . - "74757018012001280b321a2e677270632e74657374696e672e436c69656e" . - "74436f6e666967480012220a046d61726b18022001280b32122e67727063" . - "2e74657374696e672e4d61726b480042090a076172677479706522b4020a" . - "0c536572766572436f6e666967122d0a0b7365727665725f747970651801" . - "2001280e32182e677270632e74657374696e672e53657276657254797065" . - "12350a0f73656375726974795f706172616d7318022001280b321c2e6772" . - "70632e74657374696e672e5365637572697479506172616d73120c0a0470" . - "6f7274180420012805121c0a146173796e635f7365727665725f74687265" . - "61647318072001280512120a0a636f72655f6c696d697418082001280512" . - "330a0e7061796c6f61645f636f6e66696718092001280b321b2e67727063" . - "2e74657374696e672e5061796c6f6164436f6e66696712110a09636f7265" . - "5f6c697374180a2003280512180a106f746865725f7365727665725f6170" . - "69180b20012809121c0a137265736f757263655f71756f74615f73697a65" . - "18e9072001280522680a0a53657276657241726773122b0a057365747570" . - "18012001280b321a2e677270632e74657374696e672e536572766572436f" . - "6e666967480012220a046d61726b18022001280b32122e677270632e7465" . - "7374696e672e4d61726b480042090a076172677479706522550a0c536572" . - "76657253746174757312280a05737461747318012001280b32192e677270" . - "632e74657374696e672e5365727665725374617473120c0a04706f727418" . - "0220012805120d0a05636f726573180320012805220d0a0b436f72655265" . - "7175657374221d0a0c436f7265526573706f6e7365120d0a05636f726573" . - "18012001280522060a04566f696422fd010a085363656e6172696f120c0a" . - "046e616d6518012001280912310a0d636c69656e745f636f6e6669671802" . - "2001280b321a2e677270632e74657374696e672e436c69656e74436f6e66" . - "696712130a0b6e756d5f636c69656e747318032001280512310a0d736572" . - "7665725f636f6e66696718042001280b321a2e677270632e74657374696e" . - "672e536572766572436f6e66696712130a0b6e756d5f7365727665727318" . - "052001280512160a0e7761726d75705f7365636f6e647318062001280512" . - "190a1162656e63686d61726b5f7365636f6e647318072001280512200a18" . - "737061776e5f6c6f63616c5f776f726b65725f636f756e74180820012805" . - "22360a095363656e6172696f7312290a097363656e6172696f7318012003" . - "280b32162e677270632e74657374696e672e5363656e6172696f22f8020a" . - "155363656e6172696f526573756c7453756d6d617279120b0a0371707318" . - "0120012801121b0a137170735f7065725f7365727665725f636f72651802" . - "20012801121a0a127365727665725f73797374656d5f74696d6518032001" . - "280112180a107365727665725f757365725f74696d65180420012801121a" . - "0a12636c69656e745f73797374656d5f74696d6518052001280112180a10" . - "636c69656e745f757365725f74696d6518062001280112120a0a6c617465" . - "6e63795f353018072001280112120a0a6c6174656e63795f393018082001" . - "280112120a0a6c6174656e63795f393518092001280112120a0a6c617465" . - "6e63795f3939180a2001280112130a0b6c6174656e63795f393939180b20" . - "01280112180a107365727665725f6370755f7573616765180c2001280112" . - "260a1e7375636365737366756c5f72657175657374735f7065725f736563" . - "6f6e64180d2001280112220a1a6661696c65645f72657175657374735f70" . - "65725f7365636f6e64180e200128012283030a0e5363656e6172696f5265" . - "73756c7412280a087363656e6172696f18012001280b32162e677270632e" . - "74657374696e672e5363656e6172696f122e0a096c6174656e6369657318" . - "022001280b321b2e677270632e74657374696e672e486973746f6772616d" . - "44617461122f0a0c636c69656e745f737461747318032003280b32192e67" . - "7270632e74657374696e672e436c69656e745374617473122f0a0c736572" . - "7665725f737461747318042003280b32192e677270632e74657374696e67" . - "2e536572766572537461747312140a0c7365727665725f636f7265731805" . - "2003280512340a0773756d6d61727918062001280b32232e677270632e74" . - "657374696e672e5363656e6172696f526573756c7453756d6d6172791216" . - "0a0e636c69656e745f7375636365737318072003280812160a0e73657276" . - "65725f7375636365737318082003280812390a0f726571756573745f7265" . - "73756c747318092003280b32202e677270632e74657374696e672e526571" . - "75657374526573756c74436f756e742a410a0a436c69656e745479706512" . - "0f0a0b53594e435f434c49454e54100012100a0c4153594e435f434c4945" . - "4e54100112100a0c4f544845525f434c49454e5410022a5b0a0a53657276" . - "657254797065120f0a0b53594e435f534552564552100012100a0c415359" . - "4e435f534552564552100112180a144153594e435f47454e455249435f53" . - "4552564552100212100a0c4f544845525f53455256455210032a230a0752" . - "70635479706512090a05554e4152591000120d0a0953545245414d494e47" . - "1001620670726f746f33" + "0aa21a0a247372632f70726f746f2f677270632f74657374696e672f636f" . + "6e74726f6c2e70726f746f120c677270632e74657374696e671a22737263" . + "2f70726f746f2f677270632f74657374696e672f73746174732e70726f74" . + "6f22250a0d506f6973736f6e506172616d7312140a0c6f6666657265645f" . + "6c6f616418012001280122120a10436c6f7365644c6f6f70506172616d73" . + "227b0a0a4c6f6164506172616d7312350a0b636c6f7365645f6c6f6f7018" . + "012001280b321e2e677270632e74657374696e672e436c6f7365644c6f6f" . + "70506172616d734800122e0a07706f6973736f6e18022001280b321b2e67" . + "7270632e74657374696e672e506f6973736f6e506172616d73480042060a" . + "046c6f616422560a0e5365637572697479506172616d7312130a0b757365" . + "5f746573745f6361180120012808121c0a147365727665725f686f73745f" . + "6f7665727269646518022001280912110a09637265645f74797065180320" . + "012809224d0a0a4368616e6e656c417267120c0a046e616d651801200128" . + "0912130a097374725f76616c7565180220012809480012130a09696e745f" . + "76616c7565180320012805480042070a0576616c756522d5040a0c436c69" . + "656e74436f6e66696712160a0e7365727665725f74617267657473180120" . + "032809122d0a0b636c69656e745f7479706518022001280e32182e677270" . + "632e74657374696e672e436c69656e745479706512350a0f736563757269" . + "74795f706172616d7318032001280b321c2e677270632e74657374696e67" . + "2e5365637572697479506172616d7312240a1c6f75747374616e64696e67" . + "5f727063735f7065725f6368616e6e656c18042001280512170a0f636c69" . + "656e745f6368616e6e656c73180520012805121c0a146173796e635f636c" . + "69656e745f7468726561647318072001280512270a087270635f74797065" . + "18082001280e32152e677270632e74657374696e672e5270635479706512" . + "2d0a0b6c6f61645f706172616d73180a2001280b32182e677270632e7465" . + "7374696e672e4c6f6164506172616d7312330a0e7061796c6f61645f636f" . + "6e666967180b2001280b321b2e677270632e74657374696e672e5061796c" . + "6f6164436f6e66696712370a10686973746f6772616d5f706172616d7318" . + "0c2001280b321d2e677270632e74657374696e672e486973746f6772616d" . + "506172616d7312110a09636f72655f6c697374180d2003280512120a0a63" . + "6f72655f6c696d6974180e2001280512180a106f746865725f636c69656e" . + "745f617069180f20012809122e0a0c6368616e6e656c5f61726773181020" . + "03280b32182e677270632e74657374696e672e4368616e6e656c41726712" . + "160a0e746872656164735f7065725f6371181120012805121b0a136d6573" . + "73616765735f7065725f73747265616d18122001280522380a0c436c6965" . + "6e7453746174757312280a05737461747318012001280b32192e67727063" . + "2e74657374696e672e436c69656e74537461747322150a044d61726b120d" . + "0a05726573657418012001280822680a0a436c69656e7441726773122b0a" . + "05736574757018012001280b321a2e677270632e74657374696e672e436c" . + "69656e74436f6e666967480012220a046d61726b18022001280b32122e67" . + "7270632e74657374696e672e4d61726b480042090a076172677479706522" . + "fd020a0c536572766572436f6e666967122d0a0b7365727665725f747970" . + "6518012001280e32182e677270632e74657374696e672e53657276657254" . + "79706512350a0f73656375726974795f706172616d7318022001280b321c" . + "2e677270632e74657374696e672e5365637572697479506172616d73120c" . + "0a04706f7274180420012805121c0a146173796e635f7365727665725f74" . + "68726561647318072001280512120a0a636f72655f6c696d697418082001" . + "280512330a0e7061796c6f61645f636f6e66696718092001280b321b2e67" . + "7270632e74657374696e672e5061796c6f6164436f6e66696712110a0963" . + "6f72655f6c697374180a2003280512180a106f746865725f736572766572" . + "5f617069180b2001280912160a0e746872656164735f7065725f6371180c" . + "20012805121c0a137265736f757263655f71756f74615f73697a6518e907" . + "20012805122f0a0c6368616e6e656c5f6172677318ea072003280b32182e" . + "677270632e74657374696e672e4368616e6e656c41726722680a0a536572" . + "76657241726773122b0a05736574757018012001280b321a2e677270632e" . + "74657374696e672e536572766572436f6e666967480012220a046d61726b" . + "18022001280b32122e677270632e74657374696e672e4d61726b48004209" . + "0a076172677479706522550a0c53657276657253746174757312280a0573" . + "7461747318012001280b32192e677270632e74657374696e672e53657276" . + "65725374617473120c0a04706f7274180220012805120d0a05636f726573" . + "180320012805220d0a0b436f726552657175657374221d0a0c436f726552" . + "6573706f6e7365120d0a05636f72657318012001280522060a04566f6964" . + "22fd010a085363656e6172696f120c0a046e616d6518012001280912310a" . + "0d636c69656e745f636f6e66696718022001280b321a2e677270632e7465" . + "7374696e672e436c69656e74436f6e66696712130a0b6e756d5f636c6965" . + "6e747318032001280512310a0d7365727665725f636f6e66696718042001" . + "280b321a2e677270632e74657374696e672e536572766572436f6e666967" . + "12130a0b6e756d5f7365727665727318052001280512160a0e7761726d75" . + "705f7365636f6e647318062001280512190a1162656e63686d61726b5f73" . + "65636f6e647318072001280512200a18737061776e5f6c6f63616c5f776f" . + "726b65725f636f756e7418082001280522360a095363656e6172696f7312" . + "290a097363656e6172696f7318012003280b32162e677270632e74657374" . + "696e672e5363656e6172696f2284040a155363656e6172696f526573756c" . + "7453756d6d617279120b0a03717073180120012801121b0a137170735f70" . + "65725f7365727665725f636f7265180220012801121a0a12736572766572" . + "5f73797374656d5f74696d6518032001280112180a107365727665725f75" . + "7365725f74696d65180420012801121a0a12636c69656e745f7379737465" . + "6d5f74696d6518052001280112180a10636c69656e745f757365725f7469" . + "6d6518062001280112120a0a6c6174656e63795f35301807200128011212" . + "0a0a6c6174656e63795f393018082001280112120a0a6c6174656e63795f" . + "393518092001280112120a0a6c6174656e63795f3939180a200128011213" . + "0a0b6c6174656e63795f393939180b2001280112180a107365727665725f" . + "6370755f7573616765180c2001280112260a1e7375636365737366756c5f" . + "72657175657374735f7065725f7365636f6e64180d2001280112220a1a66" . + "61696c65645f72657175657374735f7065725f7365636f6e64180e200128" . + "0112200a18636c69656e745f706f6c6c735f7065725f7265717565737418" . + "0f2001280112200a187365727665725f706f6c6c735f7065725f72657175" . + "65737418102001280112220a1a7365727665725f717565726965735f7065" . + "725f6370755f73656318112001280112220a1a636c69656e745f71756572" . + "6965735f7065725f6370755f7365631812200128012283030a0e5363656e" . + "6172696f526573756c7412280a087363656e6172696f18012001280b3216" . + "2e677270632e74657374696e672e5363656e6172696f122e0a096c617465" . + "6e6369657318022001280b321b2e677270632e74657374696e672e486973" . + "746f6772616d44617461122f0a0c636c69656e745f737461747318032003" . + "280b32192e677270632e74657374696e672e436c69656e74537461747312" . + "2f0a0c7365727665725f737461747318042003280b32192e677270632e74" . + "657374696e672e536572766572537461747312140a0c7365727665725f63" . + "6f72657318052003280512340a0773756d6d61727918062001280b32232e" . + "677270632e74657374696e672e5363656e6172696f526573756c7453756d" . + "6d61727912160a0e636c69656e745f737563636573731807200328081216" . + "0a0e7365727665725f7375636365737318082003280812390a0f72657175" . + "6573745f726573756c747318092003280b32202e677270632e7465737469" . + "6e672e52657175657374526573756c74436f756e742a410a0a436c69656e" . + "7454797065120f0a0b53594e435f434c49454e54100012100a0c4153594e" . + "435f434c49454e54100112100a0c4f544845525f434c49454e5410022a5b" . + "0a0a53657276657254797065120f0a0b53594e435f534552564552100012" . + "100a0c4153594e435f534552564552100112180a144153594e435f47454e" . + "455249435f534552564552100212100a0c4f544845525f53455256455210" . + "032a720a075270635479706512090a05554e4152591000120d0a09535452" . + "45414d494e47100112190a1553545245414d494e475f46524f4d5f434c49" . + "454e54100212190a1553545245414d494e475f46524f4d5f534552564552" . + "100312170a1353545245414d494e475f424f54485f574159531004620670" . + "726f746f33" )); static::$is_initialized = true; diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/ProxyService.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/ProxyService.php index e35944e1d82..e07f73679ea 100644 --- a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/ProxyService.php +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/ProxyService.php @@ -15,17 +15,20 @@ class ProxyService return; } \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); + \GPBMetadata\Src\Proto\Grpc\Testing\Stats::initOnce(); $pool->internalAddGeneratedFile(hex2bin( - "0a97020a2a7372632f70726f746f2f677270632f74657374696e672f7072" . + "0ad6020a2a7372632f70726f746f2f677270632f74657374696e672f7072" . "6f78792d736572766963652e70726f746f120c677270632e74657374696e" . - "671a247372632f70726f746f2f677270632f74657374696e672f636f6e74" . - "726f6c2e70726f746f221c0a0950726f787953746174120f0a076c617465" . - "6e6379180120012801328e010a1250726f7879436c69656e745365727669" . - "6365123b0a09476574436f6e66696712122e677270632e74657374696e67" . - "2e566f69641a1a2e677270632e74657374696e672e436c69656e74436f6e" . - "666967123b0a0a5265706f727454696d6512172e677270632e7465737469" . - "6e672e50726f7879537461741a122e677270632e74657374696e672e566f" . - "69642801620670726f746f33" + "671a227372632f70726f746f2f677270632f74657374696e672f73746174" . + "732e70726f746f221c0a0950726f787953746174120f0a076c6174656e63" . + "7918012001280132cf010a1250726f7879436c69656e7453657276696365" . + "123b0a09476574436f6e66696712122e677270632e74657374696e672e56" . + "6f69641a1a2e677270632e74657374696e672e436c69656e74436f6e6669" . + "67123b0a0a5265706f727454696d6512172e677270632e74657374696e67" . + "2e50726f7879537461741a122e677270632e74657374696e672e566f6964" . + "2801123f0a0a5265706f727448697374121b2e677270632e74657374696e" . + "672e486973746f6772616d446174611a122e677270632e74657374696e67" . + "2e566f69642801620670726f746f33" )); static::$is_initialized = true; diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Services.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Services.php index 7a9439a5b93..e4029182c74 100644 --- a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Services.php +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Services.php @@ -16,27 +16,40 @@ class Services } \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); + \GPBMetadata\Src\Proto\Grpc\Testing\Stats::initOnce(); $pool->internalAddGeneratedFile(hex2bin( - "0ad1040a257372632f70726f746f2f677270632f74657374696e672f7365" . - "7276696365732e70726f746f120c677270632e74657374696e671a257372" . - "632f70726f746f2f677270632f74657374696e672f6d657373616765732e" . - "70726f746f1a247372632f70726f746f2f677270632f74657374696e672f" . - "636f6e74726f6c2e70726f746f32aa010a1042656e63686d61726b536572" . - "7669636512460a09556e61727943616c6c121b2e677270632e7465737469" . - "6e672e53696d706c65526571756573741a1c2e677270632e74657374696e" . - "672e53696d706c65526573706f6e7365124e0a0d53747265616d696e6743" . - "616c6c121b2e677270632e74657374696e672e53696d706c655265717565" . - "73741a1c2e677270632e74657374696e672e53696d706c65526573706f6e" . - "7365280130013297020a0d576f726b65725365727669636512450a095275" . - "6e53657276657212182e677270632e74657374696e672e53657276657241" . - "7267731a1a2e677270632e74657374696e672e5365727665725374617475" . - "732801300112450a0952756e436c69656e7412182e677270632e74657374" . - "696e672e436c69656e74417267731a1a2e677270632e74657374696e672e" . - "436c69656e745374617475732801300112420a09436f7265436f756e7412" . - "192e677270632e74657374696e672e436f7265526571756573741a1a2e67" . - "7270632e74657374696e672e436f7265526573706f6e736512340a0a5175" . - "6974576f726b657212122e677270632e74657374696e672e566f69641a12" . - "2e677270632e74657374696e672e566f6964620670726f746f33" + "0aaa070a257372632f70726f746f2f677270632f74657374696e672f7365" . + "7276696365732e70726f746f120c677270632e74657374696e671a247372" . + "632f70726f746f2f677270632f74657374696e672f636f6e74726f6c2e70" . + "726f746f1a227372632f70726f746f2f677270632f74657374696e672f73" . + "746174732e70726f746f32a6030a1042656e63686d61726b536572766963" . + "6512460a09556e61727943616c6c121b2e677270632e74657374696e672e" . + "53696d706c65526571756573741a1c2e677270632e74657374696e672e53" . + "696d706c65526573706f6e7365124e0a0d53747265616d696e6743616c6c" . + "121b2e677270632e74657374696e672e53696d706c65526571756573741a" . + "1c2e677270632e74657374696e672e53696d706c65526573706f6e736528" . + "01300112520a1353747265616d696e6746726f6d436c69656e74121b2e67" . + "7270632e74657374696e672e53696d706c65526571756573741a1c2e6772" . + "70632e74657374696e672e53696d706c65526573706f6e7365280112520a" . + "1353747265616d696e6746726f6d536572766572121b2e677270632e7465" . + "7374696e672e53696d706c65526571756573741a1c2e677270632e746573" . + "74696e672e53696d706c65526573706f6e7365300112520a115374726561" . + "6d696e67426f746857617973121b2e677270632e74657374696e672e5369" . + "6d706c65526571756573741a1c2e677270632e74657374696e672e53696d" . + "706c65526573706f6e7365280130013297020a0d576f726b657253657276" . + "69636512450a0952756e53657276657212182e677270632e74657374696e" . + "672e536572766572417267731a1a2e677270632e74657374696e672e5365" . + "727665725374617475732801300112450a0952756e436c69656e7412182e" . + "677270632e74657374696e672e436c69656e74417267731a1a2e67727063" . + "2e74657374696e672e436c69656e745374617475732801300112420a0943" . + "6f7265436f756e7412192e677270632e74657374696e672e436f72655265" . + "71756573741a1a2e677270632e74657374696e672e436f7265526573706f" . + "6e736512340a0a51756974576f726b657212122e677270632e7465737469" . + "6e672e566f69641a122e677270632e74657374696e672e566f6964325e0a" . + "185265706f72745170735363656e6172696f5365727669636512420a0e52" . + "65706f72745363656e6172696f121c2e677270632e74657374696e672e53" . + "63656e6172696f526573756c741a122e677270632e74657374696e672e56" . + "6f6964620670726f746f33" )); static::$is_initialized = true; diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Stats.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Stats.php index 99c0000a52c..3d23b75dfa0 100644 --- a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Stats.php +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Stats.php @@ -14,28 +14,33 @@ class Stats if (static::$is_initialized == true) { return; } + \GPBMetadata\Src\Proto\Grpc\Core\Stats::initOnce(); $pool->internalAddGeneratedFile(hex2bin( - "0adf040a227372632f70726f746f2f677270632f74657374696e672f7374" . - "6174732e70726f746f120c677270632e74657374696e67227a0a0b536572" . - "766572537461747312140a0c74696d655f656c6170736564180120012801" . - "12110a0974696d655f7573657218022001280112130a0b74696d655f7379" . - "7374656d18032001280112160a0e746f74616c5f6370755f74696d651804" . - "2001280412150a0d69646c655f6370755f74696d65180520012804223b0a" . - "0f486973746f6772616d506172616d7312120a0a7265736f6c7574696f6e" . - "18012001280112140a0c6d61785f706f737369626c651802200128012277" . - "0a0d486973746f6772616d44617461120e0a066275636b65741801200328" . - "0d12100a086d696e5f7365656e18022001280112100a086d61785f736565" . - "6e180320012801120b0a0373756d18042001280112160a0e73756d5f6f66" . - "5f73717561726573180520012801120d0a05636f756e7418062001280122" . - "380a1252657175657374526573756c74436f756e7412130a0b7374617475" . - "735f636f6465180120012805120d0a05636f756e7418022001280322b601" . - "0a0b436c69656e745374617473122e0a096c6174656e6369657318012001" . - "280b321b2e677270632e74657374696e672e486973746f6772616d446174" . - "6112140a0c74696d655f656c617073656418022001280112110a0974696d" . - "655f7573657218032001280112130a0b74696d655f73797374656d180420" . - "01280112390a0f726571756573745f726573756c747318052003280b3220" . - "2e677270632e74657374696e672e52657175657374526573756c74436f75" . - "6e74620670726f746f33" + "0ada050a227372632f70726f746f2f677270632f74657374696e672f7374" . + "6174732e70726f746f120c677270632e74657374696e6722b7010a0b5365" . + "72766572537461747312140a0c74696d655f656c61707365641801200128" . + "0112110a0974696d655f7573657218022001280112130a0b74696d655f73" . + "797374656d18032001280112160a0e746f74616c5f6370755f74696d6518" . + "042001280412150a0d69646c655f6370755f74696d651805200128041215" . + "0a0d63715f706f6c6c5f636f756e7418062001280412240a0a636f72655f" . + "737461747318072001280b32102e677270632e636f72652e537461747322" . + "3b0a0f486973746f6772616d506172616d7312120a0a7265736f6c757469" . + "6f6e18012001280112140a0c6d61785f706f737369626c65180220012801" . + "22770a0d486973746f6772616d44617461120e0a066275636b6574180120" . + "03280d12100a086d696e5f7365656e18022001280112100a086d61785f73" . + "65656e180320012801120b0a0373756d18042001280112160a0e73756d5f" . + "6f665f73717561726573180520012801120d0a05636f756e741806200128" . + "0122380a1252657175657374526573756c74436f756e7412130a0b737461" . + "7475735f636f6465180120012805120d0a05636f756e7418022001280322" . + "f3010a0b436c69656e745374617473122e0a096c6174656e636965731801" . + "2001280b321b2e677270632e74657374696e672e486973746f6772616d44" . + "61746112140a0c74696d655f656c617073656418022001280112110a0974" . + "696d655f7573657218032001280112130a0b74696d655f73797374656d18" . + "042001280112390a0f726571756573745f726573756c747318052003280b" . + "32202e677270632e74657374696e672e52657175657374526573756c7443" . + "6f756e7412150a0d63715f706f6c6c5f636f756e7418062001280412240a" . + "0a636f72655f737461747318072001280b32102e677270632e636f72652e" . + "5374617473620670726f746f33" )); static::$is_initialized = true; diff --git a/src/php/tests/qps/generated_code/Grpc/Core/Bucket.php b/src/php/tests/qps/generated_code/Grpc/Core/Bucket.php new file mode 100644 index 00000000000..897d6271c28 --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Core/Bucket.php @@ -0,0 +1,75 @@ +grpc.core.Bucket + */ +class Bucket extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field double start = 1; + */ + private $start = 0.0; + /** + * Generated from protobuf field uint64 count = 2; + */ + private $count = 0; + + public function __construct() { + \GPBMetadata\Src\Proto\Grpc\Core\Stats::initOnce(); + parent::__construct(); + } + + /** + * Generated from protobuf field double start = 1; + * @return float + */ + public function getStart() + { + return $this->start; + } + + /** + * Generated from protobuf field double start = 1; + * @param float $var + * @return $this + */ + public function setStart($var) + { + GPBUtil::checkDouble($var); + $this->start = $var; + + return $this; + } + + /** + * Generated from protobuf field uint64 count = 2; + * @return int|string + */ + public function getCount() + { + return $this->count; + } + + /** + * Generated from protobuf field uint64 count = 2; + * @param int|string $var + * @return $this + */ + public function setCount($var) + { + GPBUtil::checkUint64($var); + $this->count = $var; + + return $this; + } + +} + diff --git a/src/php/tests/qps/generated_code/Grpc/Core/Histogram.php b/src/php/tests/qps/generated_code/Grpc/Core/Histogram.php new file mode 100644 index 00000000000..1902be8e4ac --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Core/Histogram.php @@ -0,0 +1,49 @@ +grpc.core.Histogram + */ +class Histogram extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field repeated .grpc.core.Bucket buckets = 1; + */ + private $buckets; + + public function __construct() { + \GPBMetadata\Src\Proto\Grpc\Core\Stats::initOnce(); + parent::__construct(); + } + + /** + * Generated from protobuf field repeated .grpc.core.Bucket buckets = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBuckets() + { + return $this->buckets; + } + + /** + * Generated from protobuf field repeated .grpc.core.Bucket buckets = 1; + * @param \Grpc\Core\Bucket[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBuckets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Core\Bucket::class); + $this->buckets = $arr; + + return $this; + } + +} + diff --git a/src/php/tests/qps/generated_code/Grpc/Core/Metric.php b/src/php/tests/qps/generated_code/Grpc/Core/Metric.php new file mode 100644 index 00000000000..c3581b7d21b --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Core/Metric.php @@ -0,0 +1,102 @@ +grpc.core.Metric + */ +class Metric extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string name = 1; + */ + private $name = ''; + protected $value; + + public function __construct() { + \GPBMetadata\Src\Proto\Grpc\Core\Stats::initOnce(); + parent::__construct(); + } + + /** + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Generated from protobuf field uint64 count = 10; + * @return int|string + */ + public function getCount() + { + return $this->readOneof(10); + } + + /** + * Generated from protobuf field uint64 count = 10; + * @param int|string $var + * @return $this + */ + public function setCount($var) + { + GPBUtil::checkUint64($var); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * Generated from protobuf field .grpc.core.Histogram histogram = 11; + * @return \Grpc\Core\Histogram + */ + public function getHistogram() + { + return $this->readOneof(11); + } + + /** + * Generated from protobuf field .grpc.core.Histogram histogram = 11; + * @param \Grpc\Core\Histogram $var + * @return $this + */ + public function setHistogram($var) + { + GPBUtil::checkMessage($var, \Grpc\Core\Histogram::class); + $this->writeOneof(11, $var); + + return $this; + } + + /** + * @return string + */ + public function getValue() + { + return $this->whichOneof("value"); + } + +} + diff --git a/src/php/tests/qps/generated_code/Grpc/Core/Stats.php b/src/php/tests/qps/generated_code/Grpc/Core/Stats.php new file mode 100644 index 00000000000..e6f3fb08992 --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Core/Stats.php @@ -0,0 +1,49 @@ +grpc.core.Stats + */ +class Stats extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field repeated .grpc.core.Metric metrics = 1; + */ + private $metrics; + + public function __construct() { + \GPBMetadata\Src\Proto\Grpc\Core\Stats::initOnce(); + parent::__construct(); + } + + /** + * Generated from protobuf field repeated .grpc.core.Metric metrics = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMetrics() + { + return $this->metrics; + } + + /** + * Generated from protobuf field repeated .grpc.core.Metric metrics = 1; + * @param \Grpc\Core\Metric[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMetrics($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Core\Metric::class); + $this->metrics = $arr; + + return $this; + } + +} + diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/BenchmarkServiceClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/BenchmarkServiceClient.php index ddf750a94fc..fa3e1479091 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/BenchmarkServiceClient.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/BenchmarkServiceClient.php @@ -18,17 +18,19 @@ // // An integration test service that covers all the method signature permutations // of unary/streaming requests/responses. -namespace Grpc\Testing { +namespace Grpc\Testing; - class BenchmarkServiceClient extends \Grpc\BaseStub { +/** + */ +class BenchmarkServiceClient extends \Grpc\BaseStub { /** * @param string $hostname hostname * @param array $opts channel options - * @param Grpc\Channel $channel (optional) re-use channel object + * @param \Grpc\Channel $channel (optional) re-use channel object */ public function __construct($hostname, $opts, $channel = null) { - parent::__construct($hostname, $opts, $channel); + parent::__construct($hostname, $opts, $channel); } /** @@ -40,24 +42,62 @@ namespace Grpc\Testing { */ public function UnaryCall(\Grpc\Testing\SimpleRequest $argument, $metadata = [], $options = []) { - return $this->_simpleRequest('/grpc.testing.BenchmarkService/UnaryCall', - $argument, - ['\Grpc\Testing\SimpleResponse', 'decode'], - $metadata, $options); + return $this->_simpleRequest('/grpc.testing.BenchmarkService/UnaryCall', + $argument, + ['\Grpc\Testing\SimpleResponse', 'decode'], + $metadata, $options); } /** - * One request followed by one response. - * The server returns the client payload as-is. + * Repeated sequence of one request followed by one response. + * Should be called streaming ping-pong + * The server returns the client payload as-is on each response * @param array $metadata metadata * @param array $options call options */ public function StreamingCall($metadata = [], $options = []) { - return $this->_bidiRequest('/grpc.testing.BenchmarkService/StreamingCall', - ['\Grpc\Testing\SimpleResponse','decode'], - $metadata, $options); + return $this->_bidiRequest('/grpc.testing.BenchmarkService/StreamingCall', + ['\Grpc\Testing\SimpleResponse','decode'], + $metadata, $options); } - } + /** + * Single-sided unbounded streaming from client to server + * The server returns the client payload as-is once the client does WritesDone + * @param array $metadata metadata + * @param array $options call options + */ + public function StreamingFromClient($metadata = [], $options = []) { + return $this->_clientStreamRequest('/grpc.testing.BenchmarkService/StreamingFromClient', + ['\Grpc\Testing\SimpleResponse','decode'], + $metadata, $options); + } + + /** + * Single-sided unbounded streaming from server to client + * The server repeatedly returns the client payload as-is + * @param \Grpc\Testing\SimpleRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function StreamingFromServer(\Grpc\Testing\SimpleRequest $argument, + $metadata = [], $options = []) { + return $this->_serverStreamRequest('/grpc.testing.BenchmarkService/StreamingFromServer', + $argument, + ['\Grpc\Testing\SimpleResponse', 'decode'], + $metadata, $options); + } + + /** + * Two-sided unbounded streaming between server to client + * Both sides send the content of their own choice to the other + * @param array $metadata metadata + * @param array $options call options + */ + public function StreamingBothWays($metadata = [], $options = []) { + return $this->_bidiRequest('/grpc.testing.BenchmarkService/StreamingBothWays', + ['\Grpc\Testing\SimpleResponse','decode'], + $metadata, $options); + } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/BoolValue.php b/src/php/tests/qps/generated_code/Grpc/Testing/BoolValue.php index f0497accfb2..7eb364b7a0b 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/BoolValue.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/BoolValue.php @@ -9,22 +9,18 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * TODO(dgq): Go back to using well-known types once
  * https://github.com/grpc/grpc/issues/6980 has been fixed.
  * import "google/protobuf/wrappers.proto";
- * 
* - * Protobuf type grpc.testing.BoolValue + * Generated from protobuf message grpc.testing.BoolValue */ class BoolValue extends \Google\Protobuf\Internal\Message { /** - *
      * The bool value.
-     * 
* - * bool value = 1; + * Generated from protobuf field bool value = 1; */ private $value = false; @@ -34,11 +30,10 @@ class BoolValue extends \Google\Protobuf\Internal\Message } /** - *
      * The bool value.
-     * 
* - * bool value = 1; + * Generated from protobuf field bool value = 1; + * @return bool */ public function getValue() { @@ -46,16 +41,18 @@ class BoolValue extends \Google\Protobuf\Internal\Message } /** - *
      * The bool value.
-     * 
* - * bool value = 1; + * Generated from protobuf field bool value = 1; + * @param bool $var + * @return $this */ public function setValue($var) { GPBUtil::checkBool($var); $this->value = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ByteBufferParams.php b/src/php/tests/qps/generated_code/Grpc/Testing/ByteBufferParams.php index 0057d387488..0511026ba74 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ByteBufferParams.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ByteBufferParams.php @@ -9,16 +9,16 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type grpc.testing.ByteBufferParams + * Generated from protobuf message grpc.testing.ByteBufferParams */ class ByteBufferParams extends \Google\Protobuf\Internal\Message { /** - * int32 req_size = 1; + * Generated from protobuf field int32 req_size = 1; */ private $req_size = 0; /** - * int32 resp_size = 2; + * Generated from protobuf field int32 resp_size = 2; */ private $resp_size = 0; @@ -28,7 +28,8 @@ class ByteBufferParams extends \Google\Protobuf\Internal\Message } /** - * int32 req_size = 1; + * Generated from protobuf field int32 req_size = 1; + * @return int */ public function getReqSize() { @@ -36,16 +37,21 @@ class ByteBufferParams extends \Google\Protobuf\Internal\Message } /** - * int32 req_size = 1; + * Generated from protobuf field int32 req_size = 1; + * @param int $var + * @return $this */ public function setReqSize($var) { GPBUtil::checkInt32($var); $this->req_size = $var; + + return $this; } /** - * int32 resp_size = 2; + * Generated from protobuf field int32 resp_size = 2; + * @return int */ public function getRespSize() { @@ -53,12 +59,16 @@ class ByteBufferParams extends \Google\Protobuf\Internal\Message } /** - * int32 resp_size = 2; + * Generated from protobuf field int32 resp_size = 2; + * @param int $var + * @return $this */ public function setRespSize($var) { GPBUtil::checkInt32($var); $this->resp_size = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ChannelArg.php b/src/php/tests/qps/generated_code/Grpc/Testing/ChannelArg.php index d2fe3ae5ffc..5c5fb861a40 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ChannelArg.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ChannelArg.php @@ -9,12 +9,12 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type grpc.testing.ChannelArg + * Generated from protobuf message grpc.testing.ChannelArg */ class ChannelArg extends \Google\Protobuf\Internal\Message { /** - * string name = 1; + * Generated from protobuf field string name = 1; */ private $name = ''; protected $value; @@ -25,7 +25,8 @@ class ChannelArg extends \Google\Protobuf\Internal\Message } /** - * string name = 1; + * Generated from protobuf field string name = 1; + * @return string */ public function getName() { @@ -33,16 +34,21 @@ class ChannelArg extends \Google\Protobuf\Internal\Message } /** - * string name = 1; + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this */ public function setName($var) { GPBUtil::checkString($var, True); $this->name = $var; + + return $this; } /** - * string str_value = 2; + * Generated from protobuf field string str_value = 2; + * @return string */ public function getStrValue() { @@ -50,16 +56,21 @@ class ChannelArg extends \Google\Protobuf\Internal\Message } /** - * string str_value = 2; + * Generated from protobuf field string str_value = 2; + * @param string $var + * @return $this */ public function setStrValue($var) { GPBUtil::checkString($var, True); $this->writeOneof(2, $var); + + return $this; } /** - * int32 int_value = 3; + * Generated from protobuf field int32 int_value = 3; + * @return int */ public function getIntValue() { @@ -67,14 +78,21 @@ class ChannelArg extends \Google\Protobuf\Internal\Message } /** - * int32 int_value = 3; + * Generated from protobuf field int32 int_value = 3; + * @param int $var + * @return $this */ public function setIntValue($var) { GPBUtil::checkInt32($var); $this->writeOneof(3, $var); + + return $this; } + /** + * @return string + */ public function getValue() { return $this->whichOneof("value"); diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ClientArgs.php b/src/php/tests/qps/generated_code/Grpc/Testing/ClientArgs.php index c878c5a7bc0..ee3fd46f0f6 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ClientArgs.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ClientArgs.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type grpc.testing.ClientArgs + * Generated from protobuf message grpc.testing.ClientArgs */ class ClientArgs extends \Google\Protobuf\Internal\Message { @@ -21,7 +21,8 @@ class ClientArgs extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.ClientConfig setup = 1; + * Generated from protobuf field .grpc.testing.ClientConfig setup = 1; + * @return \Grpc\Testing\ClientConfig */ public function getSetup() { @@ -29,16 +30,21 @@ class ClientArgs extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.ClientConfig setup = 1; + * Generated from protobuf field .grpc.testing.ClientConfig setup = 1; + * @param \Grpc\Testing\ClientConfig $var + * @return $this */ - public function setSetup(&$var) + public function setSetup($var) { GPBUtil::checkMessage($var, \Grpc\Testing\ClientConfig::class); $this->writeOneof(1, $var); + + return $this; } /** - * .grpc.testing.Mark mark = 2; + * Generated from protobuf field .grpc.testing.Mark mark = 2; + * @return \Grpc\Testing\Mark */ public function getMark() { @@ -46,14 +52,21 @@ class ClientArgs extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.Mark mark = 2; + * Generated from protobuf field .grpc.testing.Mark mark = 2; + * @param \Grpc\Testing\Mark $var + * @return $this */ - public function setMark(&$var) + public function setMark($var) { GPBUtil::checkMessage($var, \Grpc\Testing\Mark::class); $this->writeOneof(2, $var); + + return $this; } + /** + * @return string + */ public function getArgtype() { return $this->whichOneof("argtype"); diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ClientConfig.php b/src/php/tests/qps/generated_code/Grpc/Testing/ClientConfig.php index 52d6a75fb0e..f7bc21587c9 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ClientConfig.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ClientConfig.php @@ -9,96 +9,94 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type grpc.testing.ClientConfig + * Generated from protobuf message grpc.testing.ClientConfig */ class ClientConfig extends \Google\Protobuf\Internal\Message { /** - *
      * List of targets to connect to. At least one target needs to be specified.
-     * 
* - * repeated string server_targets = 1; + * Generated from protobuf field repeated string server_targets = 1; */ private $server_targets; /** - * .grpc.testing.ClientType client_type = 2; + * Generated from protobuf field .grpc.testing.ClientType client_type = 2; */ private $client_type = 0; /** - * .grpc.testing.SecurityParams security_params = 3; + * Generated from protobuf field .grpc.testing.SecurityParams security_params = 3; */ private $security_params = null; /** - *
      * How many concurrent RPCs to start for each channel.
      * For synchronous client, use a separate thread for each outstanding RPC.
-     * 
* - * int32 outstanding_rpcs_per_channel = 4; + * Generated from protobuf field int32 outstanding_rpcs_per_channel = 4; */ private $outstanding_rpcs_per_channel = 0; /** - *
      * Number of independent client channels to create.
      * i-th channel will connect to server_target[i % server_targets.size()]
-     * 
* - * int32 client_channels = 5; + * Generated from protobuf field int32 client_channels = 5; */ private $client_channels = 0; /** - *
      * Only for async client. Number of threads to use to start/manage RPCs.
-     * 
* - * int32 async_client_threads = 7; + * Generated from protobuf field int32 async_client_threads = 7; */ private $async_client_threads = 0; /** - * .grpc.testing.RpcType rpc_type = 8; + * Generated from protobuf field .grpc.testing.RpcType rpc_type = 8; */ private $rpc_type = 0; /** - *
      * The requested load for the entire client (aggregated over all the threads).
-     * 
* - * .grpc.testing.LoadParams load_params = 10; + * Generated from protobuf field .grpc.testing.LoadParams load_params = 10; */ private $load_params = null; /** - * .grpc.testing.PayloadConfig payload_config = 11; + * Generated from protobuf field .grpc.testing.PayloadConfig payload_config = 11; */ private $payload_config = null; /** - * .grpc.testing.HistogramParams histogram_params = 12; + * Generated from protobuf field .grpc.testing.HistogramParams histogram_params = 12; */ private $histogram_params = null; /** - *
      * Specify the cores we should run the client on, if desired
-     * 
* - * repeated int32 core_list = 13; + * Generated from protobuf field repeated int32 core_list = 13; */ private $core_list; /** - * int32 core_limit = 14; + * Generated from protobuf field int32 core_limit = 14; */ private $core_limit = 0; /** - *
      * If we use an OTHER_CLIENT client_type, this string gives more detail
-     * 
* - * string other_client_api = 15; + * Generated from protobuf field string other_client_api = 15; */ private $other_client_api = ''; /** - * repeated .grpc.testing.ChannelArg channel_args = 16; + * Generated from protobuf field repeated .grpc.testing.ChannelArg channel_args = 16; */ private $channel_args; + /** + * Number of threads that share each completion queue + * + * Generated from protobuf field int32 threads_per_cq = 17; + */ + private $threads_per_cq = 0; + /** + * Number of messages on a stream before it gets finished/restarted + * + * Generated from protobuf field int32 messages_per_stream = 18; + */ + private $messages_per_stream = 0; public function __construct() { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); @@ -106,11 +104,10 @@ class ClientConfig extends \Google\Protobuf\Internal\Message } /** - *
      * List of targets to connect to. At least one target needs to be specified.
-     * 
* - * repeated string server_targets = 1; + * Generated from protobuf field repeated string server_targets = 1; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getServerTargets() { @@ -118,20 +115,23 @@ class ClientConfig extends \Google\Protobuf\Internal\Message } /** - *
      * List of targets to connect to. At least one target needs to be specified.
-     * 
* - * repeated string server_targets = 1; + * Generated from protobuf field repeated string server_targets = 1; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ - public function setServerTargets(&$var) + public function setServerTargets($var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->server_targets = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->server_targets = $arr; + + return $this; } /** - * .grpc.testing.ClientType client_type = 2; + * Generated from protobuf field .grpc.testing.ClientType client_type = 2; + * @return int */ public function getClientType() { @@ -139,16 +139,21 @@ class ClientConfig extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.ClientType client_type = 2; + * Generated from protobuf field .grpc.testing.ClientType client_type = 2; + * @param int $var + * @return $this */ public function setClientType($var) { GPBUtil::checkEnum($var, \Grpc\Testing\ClientType::class); $this->client_type = $var; + + return $this; } /** - * .grpc.testing.SecurityParams security_params = 3; + * Generated from protobuf field .grpc.testing.SecurityParams security_params = 3; + * @return \Grpc\Testing\SecurityParams */ public function getSecurityParams() { @@ -156,21 +161,24 @@ class ClientConfig extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.SecurityParams security_params = 3; + * Generated from protobuf field .grpc.testing.SecurityParams security_params = 3; + * @param \Grpc\Testing\SecurityParams $var + * @return $this */ - public function setSecurityParams(&$var) + public function setSecurityParams($var) { GPBUtil::checkMessage($var, \Grpc\Testing\SecurityParams::class); $this->security_params = $var; + + return $this; } /** - *
      * How many concurrent RPCs to start for each channel.
      * For synchronous client, use a separate thread for each outstanding RPC.
-     * 
* - * int32 outstanding_rpcs_per_channel = 4; + * Generated from protobuf field int32 outstanding_rpcs_per_channel = 4; + * @return int */ public function getOutstandingRpcsPerChannel() { @@ -178,26 +186,27 @@ class ClientConfig extends \Google\Protobuf\Internal\Message } /** - *
      * How many concurrent RPCs to start for each channel.
      * For synchronous client, use a separate thread for each outstanding RPC.
-     * 
* - * int32 outstanding_rpcs_per_channel = 4; + * Generated from protobuf field int32 outstanding_rpcs_per_channel = 4; + * @param int $var + * @return $this */ public function setOutstandingRpcsPerChannel($var) { GPBUtil::checkInt32($var); $this->outstanding_rpcs_per_channel = $var; + + return $this; } /** - *
      * Number of independent client channels to create.
      * i-th channel will connect to server_target[i % server_targets.size()]
-     * 
* - * int32 client_channels = 5; + * Generated from protobuf field int32 client_channels = 5; + * @return int */ public function getClientChannels() { @@ -205,25 +214,26 @@ class ClientConfig extends \Google\Protobuf\Internal\Message } /** - *
      * Number of independent client channels to create.
      * i-th channel will connect to server_target[i % server_targets.size()]
-     * 
* - * int32 client_channels = 5; + * Generated from protobuf field int32 client_channels = 5; + * @param int $var + * @return $this */ public function setClientChannels($var) { GPBUtil::checkInt32($var); $this->client_channels = $var; + + return $this; } /** - *
      * Only for async client. Number of threads to use to start/manage RPCs.
-     * 
* - * int32 async_client_threads = 7; + * Generated from protobuf field int32 async_client_threads = 7; + * @return int */ public function getAsyncClientThreads() { @@ -231,20 +241,23 @@ class ClientConfig extends \Google\Protobuf\Internal\Message } /** - *
      * Only for async client. Number of threads to use to start/manage RPCs.
-     * 
* - * int32 async_client_threads = 7; + * Generated from protobuf field int32 async_client_threads = 7; + * @param int $var + * @return $this */ public function setAsyncClientThreads($var) { GPBUtil::checkInt32($var); $this->async_client_threads = $var; + + return $this; } /** - * .grpc.testing.RpcType rpc_type = 8; + * Generated from protobuf field .grpc.testing.RpcType rpc_type = 8; + * @return int */ public function getRpcType() { @@ -252,20 +265,23 @@ class ClientConfig extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.RpcType rpc_type = 8; + * Generated from protobuf field .grpc.testing.RpcType rpc_type = 8; + * @param int $var + * @return $this */ public function setRpcType($var) { GPBUtil::checkEnum($var, \Grpc\Testing\RpcType::class); $this->rpc_type = $var; + + return $this; } /** - *
      * The requested load for the entire client (aggregated over all the threads).
-     * 
* - * .grpc.testing.LoadParams load_params = 10; + * Generated from protobuf field .grpc.testing.LoadParams load_params = 10; + * @return \Grpc\Testing\LoadParams */ public function getLoadParams() { @@ -273,20 +289,23 @@ class ClientConfig extends \Google\Protobuf\Internal\Message } /** - *
      * The requested load for the entire client (aggregated over all the threads).
-     * 
* - * .grpc.testing.LoadParams load_params = 10; + * Generated from protobuf field .grpc.testing.LoadParams load_params = 10; + * @param \Grpc\Testing\LoadParams $var + * @return $this */ - public function setLoadParams(&$var) + public function setLoadParams($var) { GPBUtil::checkMessage($var, \Grpc\Testing\LoadParams::class); $this->load_params = $var; + + return $this; } /** - * .grpc.testing.PayloadConfig payload_config = 11; + * Generated from protobuf field .grpc.testing.PayloadConfig payload_config = 11; + * @return \Grpc\Testing\PayloadConfig */ public function getPayloadConfig() { @@ -294,16 +313,21 @@ class ClientConfig extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.PayloadConfig payload_config = 11; + * Generated from protobuf field .grpc.testing.PayloadConfig payload_config = 11; + * @param \Grpc\Testing\PayloadConfig $var + * @return $this */ - public function setPayloadConfig(&$var) + public function setPayloadConfig($var) { GPBUtil::checkMessage($var, \Grpc\Testing\PayloadConfig::class); $this->payload_config = $var; + + return $this; } /** - * .grpc.testing.HistogramParams histogram_params = 12; + * Generated from protobuf field .grpc.testing.HistogramParams histogram_params = 12; + * @return \Grpc\Testing\HistogramParams */ public function getHistogramParams() { @@ -311,20 +335,23 @@ class ClientConfig extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.HistogramParams histogram_params = 12; + * Generated from protobuf field .grpc.testing.HistogramParams histogram_params = 12; + * @param \Grpc\Testing\HistogramParams $var + * @return $this */ - public function setHistogramParams(&$var) + public function setHistogramParams($var) { GPBUtil::checkMessage($var, \Grpc\Testing\HistogramParams::class); $this->histogram_params = $var; + + return $this; } /** - *
      * Specify the cores we should run the client on, if desired
-     * 
* - * repeated int32 core_list = 13; + * Generated from protobuf field repeated int32 core_list = 13; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getCoreList() { @@ -332,20 +359,23 @@ class ClientConfig extends \Google\Protobuf\Internal\Message } /** - *
      * Specify the cores we should run the client on, if desired
-     * 
* - * repeated int32 core_list = 13; + * Generated from protobuf field repeated int32 core_list = 13; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ - public function setCoreList(&$var) + public function setCoreList($var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); - $this->core_list = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->core_list = $arr; + + return $this; } /** - * int32 core_limit = 14; + * Generated from protobuf field int32 core_limit = 14; + * @return int */ public function getCoreLimit() { @@ -353,20 +383,23 @@ class ClientConfig extends \Google\Protobuf\Internal\Message } /** - * int32 core_limit = 14; + * Generated from protobuf field int32 core_limit = 14; + * @param int $var + * @return $this */ public function setCoreLimit($var) { GPBUtil::checkInt32($var); $this->core_limit = $var; + + return $this; } /** - *
      * If we use an OTHER_CLIENT client_type, this string gives more detail
-     * 
* - * string other_client_api = 15; + * Generated from protobuf field string other_client_api = 15; + * @return string */ public function getOtherClientApi() { @@ -374,20 +407,23 @@ class ClientConfig extends \Google\Protobuf\Internal\Message } /** - *
      * If we use an OTHER_CLIENT client_type, this string gives more detail
-     * 
* - * string other_client_api = 15; + * Generated from protobuf field string other_client_api = 15; + * @param string $var + * @return $this */ public function setOtherClientApi($var) { GPBUtil::checkString($var, True); $this->other_client_api = $var; + + return $this; } /** - * repeated .grpc.testing.ChannelArg channel_args = 16; + * Generated from protobuf field repeated .grpc.testing.ChannelArg channel_args = 16; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getChannelArgs() { @@ -395,12 +431,68 @@ class ClientConfig extends \Google\Protobuf\Internal\Message } /** - * repeated .grpc.testing.ChannelArg channel_args = 16; + * Generated from protobuf field repeated .grpc.testing.ChannelArg channel_args = 16; + * @param \Grpc\Testing\ChannelArg[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setChannelArgs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Testing\ChannelArg::class); + $this->channel_args = $arr; + + return $this; + } + + /** + * Number of threads that share each completion queue + * + * Generated from protobuf field int32 threads_per_cq = 17; + * @return int + */ + public function getThreadsPerCq() + { + return $this->threads_per_cq; + } + + /** + * Number of threads that share each completion queue + * + * Generated from protobuf field int32 threads_per_cq = 17; + * @param int $var + * @return $this + */ + public function setThreadsPerCq($var) + { + GPBUtil::checkInt32($var); + $this->threads_per_cq = $var; + + return $this; + } + + /** + * Number of messages on a stream before it gets finished/restarted + * + * Generated from protobuf field int32 messages_per_stream = 18; + * @return int + */ + public function getMessagesPerStream() + { + return $this->messages_per_stream; + } + + /** + * Number of messages on a stream before it gets finished/restarted + * + * Generated from protobuf field int32 messages_per_stream = 18; + * @param int $var + * @return $this */ - public function setChannelArgs(&$var) + public function setMessagesPerStream($var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Testing\ChannelArg::class); - $this->channel_args = $var; + GPBUtil::checkInt32($var); + $this->messages_per_stream = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ClientStats.php b/src/php/tests/qps/generated_code/Grpc/Testing/ClientStats.php index 8b9a0c33a46..f2a76217917 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ClientStats.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ClientStats.php @@ -9,42 +9,48 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type grpc.testing.ClientStats + * Generated from protobuf message grpc.testing.ClientStats */ class ClientStats extends \Google\Protobuf\Internal\Message { /** - *
      * Latency histogram. Data points are in nanoseconds.
-     * 
* - * .grpc.testing.HistogramData latencies = 1; + * Generated from protobuf field .grpc.testing.HistogramData latencies = 1; */ private $latencies = null; /** - *
      * See ServerStats for details.
-     * 
* - * double time_elapsed = 2; + * Generated from protobuf field double time_elapsed = 2; */ private $time_elapsed = 0.0; /** - * double time_user = 3; + * Generated from protobuf field double time_user = 3; */ private $time_user = 0.0; /** - * double time_system = 4; + * Generated from protobuf field double time_system = 4; */ private $time_system = 0.0; /** - *
      * Number of failed requests (one row per status code seen)
-     * 
* - * repeated .grpc.testing.RequestResultCount request_results = 5; + * Generated from protobuf field repeated .grpc.testing.RequestResultCount request_results = 5; */ private $request_results; + /** + * Number of polls called inside completion queue + * + * Generated from protobuf field uint64 cq_poll_count = 6; + */ + private $cq_poll_count = 0; + /** + * Core library stats + * + * Generated from protobuf field .grpc.core.Stats core_stats = 7; + */ + private $core_stats = null; public function __construct() { \GPBMetadata\Src\Proto\Grpc\Testing\Stats::initOnce(); @@ -52,11 +58,10 @@ class ClientStats extends \Google\Protobuf\Internal\Message } /** - *
      * Latency histogram. Data points are in nanoseconds.
-     * 
* - * .grpc.testing.HistogramData latencies = 1; + * Generated from protobuf field .grpc.testing.HistogramData latencies = 1; + * @return \Grpc\Testing\HistogramData */ public function getLatencies() { @@ -64,24 +69,25 @@ class ClientStats extends \Google\Protobuf\Internal\Message } /** - *
      * Latency histogram. Data points are in nanoseconds.
-     * 
* - * .grpc.testing.HistogramData latencies = 1; + * Generated from protobuf field .grpc.testing.HistogramData latencies = 1; + * @param \Grpc\Testing\HistogramData $var + * @return $this */ - public function setLatencies(&$var) + public function setLatencies($var) { GPBUtil::checkMessage($var, \Grpc\Testing\HistogramData::class); $this->latencies = $var; + + return $this; } /** - *
      * See ServerStats for details.
-     * 
* - * double time_elapsed = 2; + * Generated from protobuf field double time_elapsed = 2; + * @return float */ public function getTimeElapsed() { @@ -89,20 +95,23 @@ class ClientStats extends \Google\Protobuf\Internal\Message } /** - *
      * See ServerStats for details.
-     * 
* - * double time_elapsed = 2; + * Generated from protobuf field double time_elapsed = 2; + * @param float $var + * @return $this */ public function setTimeElapsed($var) { GPBUtil::checkDouble($var); $this->time_elapsed = $var; + + return $this; } /** - * double time_user = 3; + * Generated from protobuf field double time_user = 3; + * @return float */ public function getTimeUser() { @@ -110,16 +119,21 @@ class ClientStats extends \Google\Protobuf\Internal\Message } /** - * double time_user = 3; + * Generated from protobuf field double time_user = 3; + * @param float $var + * @return $this */ public function setTimeUser($var) { GPBUtil::checkDouble($var); $this->time_user = $var; + + return $this; } /** - * double time_system = 4; + * Generated from protobuf field double time_system = 4; + * @return float */ public function getTimeSystem() { @@ -127,20 +141,23 @@ class ClientStats extends \Google\Protobuf\Internal\Message } /** - * double time_system = 4; + * Generated from protobuf field double time_system = 4; + * @param float $var + * @return $this */ public function setTimeSystem($var) { GPBUtil::checkDouble($var); $this->time_system = $var; + + return $this; } /** - *
      * Number of failed requests (one row per status code seen)
-     * 
* - * repeated .grpc.testing.RequestResultCount request_results = 5; + * Generated from protobuf field repeated .grpc.testing.RequestResultCount request_results = 5; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getRequestResults() { @@ -148,16 +165,70 @@ class ClientStats extends \Google\Protobuf\Internal\Message } /** - *
      * Number of failed requests (one row per status code seen)
-     * 
* - * repeated .grpc.testing.RequestResultCount request_results = 5; + * Generated from protobuf field repeated .grpc.testing.RequestResultCount request_results = 5; + * @param \Grpc\Testing\RequestResultCount[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ - public function setRequestResults(&$var) + public function setRequestResults($var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Testing\RequestResultCount::class); - $this->request_results = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Testing\RequestResultCount::class); + $this->request_results = $arr; + + return $this; + } + + /** + * Number of polls called inside completion queue + * + * Generated from protobuf field uint64 cq_poll_count = 6; + * @return int|string + */ + public function getCqPollCount() + { + return $this->cq_poll_count; + } + + /** + * Number of polls called inside completion queue + * + * Generated from protobuf field uint64 cq_poll_count = 6; + * @param int|string $var + * @return $this + */ + public function setCqPollCount($var) + { + GPBUtil::checkUint64($var); + $this->cq_poll_count = $var; + + return $this; + } + + /** + * Core library stats + * + * Generated from protobuf field .grpc.core.Stats core_stats = 7; + * @return \Grpc\Core\Stats + */ + public function getCoreStats() + { + return $this->core_stats; + } + + /** + * Core library stats + * + * Generated from protobuf field .grpc.core.Stats core_stats = 7; + * @param \Grpc\Core\Stats $var + * @return $this + */ + public function setCoreStats($var) + { + GPBUtil::checkMessage($var, \Grpc\Core\Stats::class); + $this->core_stats = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ClientStatus.php b/src/php/tests/qps/generated_code/Grpc/Testing/ClientStatus.php index a59f87a9628..3ea40c4dfa0 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ClientStatus.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ClientStatus.php @@ -9,12 +9,12 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type grpc.testing.ClientStatus + * Generated from protobuf message grpc.testing.ClientStatus */ class ClientStatus extends \Google\Protobuf\Internal\Message { /** - * .grpc.testing.ClientStats stats = 1; + * Generated from protobuf field .grpc.testing.ClientStats stats = 1; */ private $stats = null; @@ -24,7 +24,8 @@ class ClientStatus extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.ClientStats stats = 1; + * Generated from protobuf field .grpc.testing.ClientStats stats = 1; + * @return \Grpc\Testing\ClientStats */ public function getStats() { @@ -32,12 +33,16 @@ class ClientStatus extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.ClientStats stats = 1; + * Generated from protobuf field .grpc.testing.ClientStats stats = 1; + * @param \Grpc\Testing\ClientStats $var + * @return $this */ - public function setStats(&$var) + public function setStats($var) { GPBUtil::checkMessage($var, \Grpc\Testing\ClientStats::class); $this->stats = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ClientType.php b/src/php/tests/qps/generated_code/Grpc/Testing/ClientType.php index 4f59da992f9..d1df4f19436 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ClientType.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ClientType.php @@ -5,29 +5,25 @@ namespace Grpc\Testing; /** - * Protobuf enum grpc.testing.ClientType + * Protobuf enum Grpc\Testing\ClientType */ class ClientType { /** - *
      * Many languages support a basic distinction between using
      * sync or async client, and this allows the specification
-     * 
* - * SYNC_CLIENT = 0; + * Generated from protobuf enum SYNC_CLIENT = 0; */ const SYNC_CLIENT = 0; /** - * ASYNC_CLIENT = 1; + * Generated from protobuf enum ASYNC_CLIENT = 1; */ const ASYNC_CLIENT = 1; /** - *
      * used for some language-specific variants
-     * 
* - * OTHER_CLIENT = 2; + * Generated from protobuf enum OTHER_CLIENT = 2; */ const OTHER_CLIENT = 2; } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ClosedLoopParams.php b/src/php/tests/qps/generated_code/Grpc/Testing/ClosedLoopParams.php index 53f2948af28..2772836f13d 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ClosedLoopParams.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ClosedLoopParams.php @@ -9,12 +9,10 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Once an RPC finishes, immediately start a new one.
  * No configuration parameters needed.
- * 
* - * Protobuf type grpc.testing.ClosedLoopParams + * Generated from protobuf message grpc.testing.ClosedLoopParams */ class ClosedLoopParams extends \Google\Protobuf\Internal\Message { diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ComplexProtoParams.php b/src/php/tests/qps/generated_code/Grpc/Testing/ComplexProtoParams.php index 6d990f1b064..b9013cdb300 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ComplexProtoParams.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ComplexProtoParams.php @@ -9,12 +9,10 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * TODO (vpai): Fill this in once the details of complex, representative
  *              protos are decided
- * 
* - * Protobuf type grpc.testing.ComplexProtoParams + * Generated from protobuf message grpc.testing.ComplexProtoParams */ class ComplexProtoParams extends \Google\Protobuf\Internal\Message { diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/CoreRequest.php b/src/php/tests/qps/generated_code/Grpc/Testing/CoreRequest.php index 2e078b3fcdb..7772572f1c5 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/CoreRequest.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/CoreRequest.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type grpc.testing.CoreRequest + * Generated from protobuf message grpc.testing.CoreRequest */ class CoreRequest extends \Google\Protobuf\Internal\Message { diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/CoreResponse.php b/src/php/tests/qps/generated_code/Grpc/Testing/CoreResponse.php index 85cb3418ada..e0b40ee3001 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/CoreResponse.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/CoreResponse.php @@ -9,16 +9,14 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type grpc.testing.CoreResponse + * Generated from protobuf message grpc.testing.CoreResponse */ class CoreResponse extends \Google\Protobuf\Internal\Message { /** - *
      * Number of cores available on the server
-     * 
* - * int32 cores = 1; + * Generated from protobuf field int32 cores = 1; */ private $cores = 0; @@ -28,11 +26,10 @@ class CoreResponse extends \Google\Protobuf\Internal\Message } /** - *
      * Number of cores available on the server
-     * 
* - * int32 cores = 1; + * Generated from protobuf field int32 cores = 1; + * @return int */ public function getCores() { @@ -40,16 +37,18 @@ class CoreResponse extends \Google\Protobuf\Internal\Message } /** - *
      * Number of cores available on the server
-     * 
* - * int32 cores = 1; + * Generated from protobuf field int32 cores = 1; + * @param int $var + * @return $this */ public function setCores($var) { GPBUtil::checkInt32($var); $this->cores = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/EchoStatus.php b/src/php/tests/qps/generated_code/Grpc/Testing/EchoStatus.php index 27340fb0efe..6a6623a042d 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/EchoStatus.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/EchoStatus.php @@ -9,21 +9,19 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * A protobuf representation for grpc status. This is used by test
  * clients to specify a status that the server should attempt to return.
- * 
* - * Protobuf type grpc.testing.EchoStatus + * Generated from protobuf message grpc.testing.EchoStatus */ class EchoStatus extends \Google\Protobuf\Internal\Message { /** - * int32 code = 1; + * Generated from protobuf field int32 code = 1; */ private $code = 0; /** - * string message = 2; + * Generated from protobuf field string message = 2; */ private $message = ''; @@ -33,7 +31,8 @@ class EchoStatus extends \Google\Protobuf\Internal\Message } /** - * int32 code = 1; + * Generated from protobuf field int32 code = 1; + * @return int */ public function getCode() { @@ -41,16 +40,21 @@ class EchoStatus extends \Google\Protobuf\Internal\Message } /** - * int32 code = 1; + * Generated from protobuf field int32 code = 1; + * @param int $var + * @return $this */ public function setCode($var) { GPBUtil::checkInt32($var); $this->code = $var; + + return $this; } /** - * string message = 2; + * Generated from protobuf field string message = 2; + * @return string */ public function getMessage() { @@ -58,12 +62,16 @@ class EchoStatus extends \Google\Protobuf\Internal\Message } /** - * string message = 2; + * Generated from protobuf field string message = 2; + * @param string $var + * @return $this */ public function setMessage($var) { GPBUtil::checkString($var, True); $this->message = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/HistogramData.php b/src/php/tests/qps/generated_code/Grpc/Testing/HistogramData.php index 056da6e5de5..136eac75e28 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/HistogramData.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/HistogramData.php @@ -9,36 +9,34 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Histogram data based on grpc/support/histogram.c
- * 
* - * Protobuf type grpc.testing.HistogramData + * Generated from protobuf message grpc.testing.HistogramData */ class HistogramData extends \Google\Protobuf\Internal\Message { /** - * repeated uint32 bucket = 1; + * Generated from protobuf field repeated uint32 bucket = 1; */ private $bucket; /** - * double min_seen = 2; + * Generated from protobuf field double min_seen = 2; */ private $min_seen = 0.0; /** - * double max_seen = 3; + * Generated from protobuf field double max_seen = 3; */ private $max_seen = 0.0; /** - * double sum = 4; + * Generated from protobuf field double sum = 4; */ private $sum = 0.0; /** - * double sum_of_squares = 5; + * Generated from protobuf field double sum_of_squares = 5; */ private $sum_of_squares = 0.0; /** - * double count = 6; + * Generated from protobuf field double count = 6; */ private $count = 0.0; @@ -48,7 +46,8 @@ class HistogramData extends \Google\Protobuf\Internal\Message } /** - * repeated uint32 bucket = 1; + * Generated from protobuf field repeated uint32 bucket = 1; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getBucket() { @@ -56,16 +55,21 @@ class HistogramData extends \Google\Protobuf\Internal\Message } /** - * repeated uint32 bucket = 1; + * Generated from protobuf field repeated uint32 bucket = 1; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ - public function setBucket(&$var) + public function setBucket($var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::UINT32); - $this->bucket = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::UINT32); + $this->bucket = $arr; + + return $this; } /** - * double min_seen = 2; + * Generated from protobuf field double min_seen = 2; + * @return float */ public function getMinSeen() { @@ -73,16 +77,21 @@ class HistogramData extends \Google\Protobuf\Internal\Message } /** - * double min_seen = 2; + * Generated from protobuf field double min_seen = 2; + * @param float $var + * @return $this */ public function setMinSeen($var) { GPBUtil::checkDouble($var); $this->min_seen = $var; + + return $this; } /** - * double max_seen = 3; + * Generated from protobuf field double max_seen = 3; + * @return float */ public function getMaxSeen() { @@ -90,16 +99,21 @@ class HistogramData extends \Google\Protobuf\Internal\Message } /** - * double max_seen = 3; + * Generated from protobuf field double max_seen = 3; + * @param float $var + * @return $this */ public function setMaxSeen($var) { GPBUtil::checkDouble($var); $this->max_seen = $var; + + return $this; } /** - * double sum = 4; + * Generated from protobuf field double sum = 4; + * @return float */ public function getSum() { @@ -107,16 +121,21 @@ class HistogramData extends \Google\Protobuf\Internal\Message } /** - * double sum = 4; + * Generated from protobuf field double sum = 4; + * @param float $var + * @return $this */ public function setSum($var) { GPBUtil::checkDouble($var); $this->sum = $var; + + return $this; } /** - * double sum_of_squares = 5; + * Generated from protobuf field double sum_of_squares = 5; + * @return float */ public function getSumOfSquares() { @@ -124,16 +143,21 @@ class HistogramData extends \Google\Protobuf\Internal\Message } /** - * double sum_of_squares = 5; + * Generated from protobuf field double sum_of_squares = 5; + * @param float $var + * @return $this */ public function setSumOfSquares($var) { GPBUtil::checkDouble($var); $this->sum_of_squares = $var; + + return $this; } /** - * double count = 6; + * Generated from protobuf field double count = 6; + * @return float */ public function getCount() { @@ -141,12 +165,16 @@ class HistogramData extends \Google\Protobuf\Internal\Message } /** - * double count = 6; + * Generated from protobuf field double count = 6; + * @param float $var + * @return $this */ public function setCount($var) { GPBUtil::checkDouble($var); $this->count = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/HistogramParams.php b/src/php/tests/qps/generated_code/Grpc/Testing/HistogramParams.php index 836c94b01d8..1a1b484f144 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/HistogramParams.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/HistogramParams.php @@ -9,28 +9,22 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Histogram params based on grpc/support/histogram.c
- * 
* - * Protobuf type grpc.testing.HistogramParams + * Generated from protobuf message grpc.testing.HistogramParams */ class HistogramParams extends \Google\Protobuf\Internal\Message { /** - *
      * first bucket is [0, 1 + resolution)
-     * 
* - * double resolution = 1; + * Generated from protobuf field double resolution = 1; */ private $resolution = 0.0; /** - *
      * use enough buckets to allow this value
-     * 
* - * double max_possible = 2; + * Generated from protobuf field double max_possible = 2; */ private $max_possible = 0.0; @@ -40,11 +34,10 @@ class HistogramParams extends \Google\Protobuf\Internal\Message } /** - *
      * first bucket is [0, 1 + resolution)
-     * 
* - * double resolution = 1; + * Generated from protobuf field double resolution = 1; + * @return float */ public function getResolution() { @@ -52,24 +45,25 @@ class HistogramParams extends \Google\Protobuf\Internal\Message } /** - *
      * first bucket is [0, 1 + resolution)
-     * 
* - * double resolution = 1; + * Generated from protobuf field double resolution = 1; + * @param float $var + * @return $this */ public function setResolution($var) { GPBUtil::checkDouble($var); $this->resolution = $var; + + return $this; } /** - *
      * use enough buckets to allow this value
-     * 
* - * double max_possible = 2; + * Generated from protobuf field double max_possible = 2; + * @return float */ public function getMaxPossible() { @@ -77,16 +71,18 @@ class HistogramParams extends \Google\Protobuf\Internal\Message } /** - *
      * use enough buckets to allow this value
-     * 
* - * double max_possible = 2; + * Generated from protobuf field double max_possible = 2; + * @param float $var + * @return $this */ public function setMaxPossible($var) { GPBUtil::checkDouble($var); $this->max_possible = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/LoadParams.php b/src/php/tests/qps/generated_code/Grpc/Testing/LoadParams.php index 1f32e49c8aa..04c345f2421 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/LoadParams.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/LoadParams.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type grpc.testing.LoadParams + * Generated from protobuf message grpc.testing.LoadParams */ class LoadParams extends \Google\Protobuf\Internal\Message { @@ -21,7 +21,8 @@ class LoadParams extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.ClosedLoopParams closed_loop = 1; + * Generated from protobuf field .grpc.testing.ClosedLoopParams closed_loop = 1; + * @return \Grpc\Testing\ClosedLoopParams */ public function getClosedLoop() { @@ -29,16 +30,21 @@ class LoadParams extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.ClosedLoopParams closed_loop = 1; + * Generated from protobuf field .grpc.testing.ClosedLoopParams closed_loop = 1; + * @param \Grpc\Testing\ClosedLoopParams $var + * @return $this */ - public function setClosedLoop(&$var) + public function setClosedLoop($var) { GPBUtil::checkMessage($var, \Grpc\Testing\ClosedLoopParams::class); $this->writeOneof(1, $var); + + return $this; } /** - * .grpc.testing.PoissonParams poisson = 2; + * Generated from protobuf field .grpc.testing.PoissonParams poisson = 2; + * @return \Grpc\Testing\PoissonParams */ public function getPoisson() { @@ -46,14 +52,21 @@ class LoadParams extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.PoissonParams poisson = 2; + * Generated from protobuf field .grpc.testing.PoissonParams poisson = 2; + * @param \Grpc\Testing\PoissonParams $var + * @return $this */ - public function setPoisson(&$var) + public function setPoisson($var) { GPBUtil::checkMessage($var, \Grpc\Testing\PoissonParams::class); $this->writeOneof(2, $var); + + return $this; } + /** + * @return string + */ public function getLoad() { return $this->whichOneof("load"); diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/Mark.php b/src/php/tests/qps/generated_code/Grpc/Testing/Mark.php index ce006efacd8..be058d51be8 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/Mark.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/Mark.php @@ -9,20 +9,16 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Request current stats
- * 
* - * Protobuf type grpc.testing.Mark + * Generated from protobuf message grpc.testing.Mark */ class Mark extends \Google\Protobuf\Internal\Message { /** - *
      * if true, the stats will be reset after taking their snapshot.
-     * 
* - * bool reset = 1; + * Generated from protobuf field bool reset = 1; */ private $reset = false; @@ -32,11 +28,10 @@ class Mark extends \Google\Protobuf\Internal\Message } /** - *
      * if true, the stats will be reset after taking their snapshot.
-     * 
* - * bool reset = 1; + * Generated from protobuf field bool reset = 1; + * @return bool */ public function getReset() { @@ -44,16 +39,18 @@ class Mark extends \Google\Protobuf\Internal\Message } /** - *
      * if true, the stats will be reset after taking their snapshot.
-     * 
* - * bool reset = 1; + * Generated from protobuf field bool reset = 1; + * @param bool $var + * @return $this */ public function setReset($var) { GPBUtil::checkBool($var); $this->reset = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/Payload.php b/src/php/tests/qps/generated_code/Grpc/Testing/Payload.php index d17c271af74..ad97890c93f 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/Payload.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/Payload.php @@ -9,29 +9,23 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * A block of data, to simply increase gRPC message size.
- * 
* - * Protobuf type grpc.testing.Payload + * Generated from protobuf message grpc.testing.Payload */ class Payload extends \Google\Protobuf\Internal\Message { /** - *
      * DEPRECATED, don't use. To be removed shortly.
      * The type of data in body.
-     * 
* - * .grpc.testing.PayloadType type = 1; + * Generated from protobuf field .grpc.testing.PayloadType type = 1; */ private $type = 0; /** - *
      * Primary contents of payload.
-     * 
* - * bytes body = 2; + * Generated from protobuf field bytes body = 2; */ private $body = ''; @@ -41,12 +35,11 @@ class Payload extends \Google\Protobuf\Internal\Message } /** - *
      * DEPRECATED, don't use. To be removed shortly.
      * The type of data in body.
-     * 
* - * .grpc.testing.PayloadType type = 1; + * Generated from protobuf field .grpc.testing.PayloadType type = 1; + * @return int */ public function getType() { @@ -54,25 +47,26 @@ class Payload extends \Google\Protobuf\Internal\Message } /** - *
      * DEPRECATED, don't use. To be removed shortly.
      * The type of data in body.
-     * 
* - * .grpc.testing.PayloadType type = 1; + * Generated from protobuf field .grpc.testing.PayloadType type = 1; + * @param int $var + * @return $this */ public function setType($var) { GPBUtil::checkEnum($var, \Grpc\Testing\PayloadType::class); $this->type = $var; + + return $this; } /** - *
      * Primary contents of payload.
-     * 
* - * bytes body = 2; + * Generated from protobuf field bytes body = 2; + * @return string */ public function getBody() { @@ -80,16 +74,18 @@ class Payload extends \Google\Protobuf\Internal\Message } /** - *
      * Primary contents of payload.
-     * 
* - * bytes body = 2; + * Generated from protobuf field bytes body = 2; + * @param string $var + * @return $this */ public function setBody($var) { GPBUtil::checkString($var, False); $this->body = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/PayloadConfig.php b/src/php/tests/qps/generated_code/Grpc/Testing/PayloadConfig.php index a2fe7109ba7..748f52da82d 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/PayloadConfig.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/PayloadConfig.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type grpc.testing.PayloadConfig + * Generated from protobuf message grpc.testing.PayloadConfig */ class PayloadConfig extends \Google\Protobuf\Internal\Message { @@ -21,7 +21,8 @@ class PayloadConfig extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.ByteBufferParams bytebuf_params = 1; + * Generated from protobuf field .grpc.testing.ByteBufferParams bytebuf_params = 1; + * @return \Grpc\Testing\ByteBufferParams */ public function getBytebufParams() { @@ -29,16 +30,21 @@ class PayloadConfig extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.ByteBufferParams bytebuf_params = 1; + * Generated from protobuf field .grpc.testing.ByteBufferParams bytebuf_params = 1; + * @param \Grpc\Testing\ByteBufferParams $var + * @return $this */ - public function setBytebufParams(&$var) + public function setBytebufParams($var) { GPBUtil::checkMessage($var, \Grpc\Testing\ByteBufferParams::class); $this->writeOneof(1, $var); + + return $this; } /** - * .grpc.testing.SimpleProtoParams simple_params = 2; + * Generated from protobuf field .grpc.testing.SimpleProtoParams simple_params = 2; + * @return \Grpc\Testing\SimpleProtoParams */ public function getSimpleParams() { @@ -46,16 +52,21 @@ class PayloadConfig extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.SimpleProtoParams simple_params = 2; + * Generated from protobuf field .grpc.testing.SimpleProtoParams simple_params = 2; + * @param \Grpc\Testing\SimpleProtoParams $var + * @return $this */ - public function setSimpleParams(&$var) + public function setSimpleParams($var) { GPBUtil::checkMessage($var, \Grpc\Testing\SimpleProtoParams::class); $this->writeOneof(2, $var); + + return $this; } /** - * .grpc.testing.ComplexProtoParams complex_params = 3; + * Generated from protobuf field .grpc.testing.ComplexProtoParams complex_params = 3; + * @return \Grpc\Testing\ComplexProtoParams */ public function getComplexParams() { @@ -63,14 +74,21 @@ class PayloadConfig extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.ComplexProtoParams complex_params = 3; + * Generated from protobuf field .grpc.testing.ComplexProtoParams complex_params = 3; + * @param \Grpc\Testing\ComplexProtoParams $var + * @return $this */ - public function setComplexParams(&$var) + public function setComplexParams($var) { GPBUtil::checkMessage($var, \Grpc\Testing\ComplexProtoParams::class); $this->writeOneof(3, $var); + + return $this; } + /** + * @return string + */ public function getPayload() { return $this->whichOneof("payload"); diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/PayloadType.php b/src/php/tests/qps/generated_code/Grpc/Testing/PayloadType.php index 189ef034b47..d8df1af7982 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/PayloadType.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/PayloadType.php @@ -5,21 +5,17 @@ namespace Grpc\Testing; /** - *
  * DEPRECATED, don't use. To be removed shortly.
  * The type of payload that should be returned.
- * 
* - * Protobuf enum grpc.testing.PayloadType + * Protobuf enum Grpc\Testing\PayloadType */ class PayloadType { /** - *
      * Compressable text format.
-     * 
* - * COMPRESSABLE = 0; + * Generated from protobuf enum COMPRESSABLE = 0; */ const COMPRESSABLE = 0; } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/PoissonParams.php b/src/php/tests/qps/generated_code/Grpc/Testing/PoissonParams.php index d64edd45f03..6a4047f2ece 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/PoissonParams.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/PoissonParams.php @@ -9,21 +9,17 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Parameters of poisson process distribution, which is a good representation
  * of activity coming in from independent identical stationary sources.
- * 
* - * Protobuf type grpc.testing.PoissonParams + * Generated from protobuf message grpc.testing.PoissonParams */ class PoissonParams extends \Google\Protobuf\Internal\Message { /** - *
      * The rate of arrivals (a.k.a. lambda parameter of the exp distribution).
-     * 
* - * double offered_load = 1; + * Generated from protobuf field double offered_load = 1; */ private $offered_load = 0.0; @@ -33,11 +29,10 @@ class PoissonParams extends \Google\Protobuf\Internal\Message } /** - *
      * The rate of arrivals (a.k.a. lambda parameter of the exp distribution).
-     * 
* - * double offered_load = 1; + * Generated from protobuf field double offered_load = 1; + * @return float */ public function getOfferedLoad() { @@ -45,16 +40,18 @@ class PoissonParams extends \Google\Protobuf\Internal\Message } /** - *
      * The rate of arrivals (a.k.a. lambda parameter of the exp distribution).
-     * 
* - * double offered_load = 1; + * Generated from protobuf field double offered_load = 1; + * @param float $var + * @return $this */ public function setOfferedLoad($var) { GPBUtil::checkDouble($var); $this->offered_load = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ProxyClientServiceClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/ProxyClientServiceClient.php index a6da2e7aefe..5510b57064f 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ProxyClientServiceClient.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ProxyClientServiceClient.php @@ -16,17 +16,19 @@ // See the License for the specific language governing permissions and // limitations under the License. // -namespace Grpc\Testing { +namespace Grpc\Testing; - class ProxyClientServiceClient extends \Grpc\BaseStub { +/** + */ +class ProxyClientServiceClient extends \Grpc\BaseStub { /** * @param string $hostname hostname * @param array $opts channel options - * @param Grpc\Channel $channel (optional) re-use channel object + * @param \Grpc\Channel $channel (optional) re-use channel object */ public function __construct($hostname, $opts, $channel = null) { - parent::__construct($hostname, $opts, $channel); + parent::__construct($hostname, $opts, $channel); } /** @@ -36,10 +38,10 @@ namespace Grpc\Testing { */ public function GetConfig(\Grpc\Testing\Void $argument, $metadata = [], $options = []) { - return $this->_simpleRequest('/grpc.testing.ProxyClientService/GetConfig', - $argument, - ['\Grpc\Testing\ClientConfig', 'decode'], - $metadata, $options); + return $this->_simpleRequest('/grpc.testing.ProxyClientService/GetConfig', + $argument, + ['\Grpc\Testing\ClientConfig', 'decode'], + $metadata, $options); } /** @@ -47,11 +49,19 @@ namespace Grpc\Testing { * @param array $options call options */ public function ReportTime($metadata = [], $options = []) { - return $this->_clientStreamRequest('/grpc.testing.ProxyClientService/ReportTime', - ['\Grpc\Testing\Void','decode'], - $metadata, $options); + return $this->_clientStreamRequest('/grpc.testing.ProxyClientService/ReportTime', + ['\Grpc\Testing\Void','decode'], + $metadata, $options); } - } + /** + * @param array $metadata metadata + * @param array $options call options + */ + public function ReportHist($metadata = [], $options = []) { + return $this->_clientStreamRequest('/grpc.testing.ProxyClientService/ReportHist', + ['\Grpc\Testing\Void','decode'], + $metadata, $options); + } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ProxyStat.php b/src/php/tests/qps/generated_code/Grpc/Testing/ProxyStat.php index ed43be99cef..6fab6115342 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ProxyStat.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ProxyStat.php @@ -9,12 +9,12 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type grpc.testing.ProxyStat + * Generated from protobuf message grpc.testing.ProxyStat */ class ProxyStat extends \Google\Protobuf\Internal\Message { /** - * double latency = 1; + * Generated from protobuf field double latency = 1; */ private $latency = 0.0; @@ -24,7 +24,8 @@ class ProxyStat extends \Google\Protobuf\Internal\Message } /** - * double latency = 1; + * Generated from protobuf field double latency = 1; + * @return float */ public function getLatency() { @@ -32,12 +33,16 @@ class ProxyStat extends \Google\Protobuf\Internal\Message } /** - * double latency = 1; + * Generated from protobuf field double latency = 1; + * @param float $var + * @return $this */ public function setLatency($var) { GPBUtil::checkDouble($var); $this->latency = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ReconnectInfo.php b/src/php/tests/qps/generated_code/Grpc/Testing/ReconnectInfo.php index dfaaa606c3b..cd728705fa4 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ReconnectInfo.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ReconnectInfo.php @@ -9,22 +9,20 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * For reconnect interop test only.
  * Server tells client whether its reconnects are following the spec and the
  * reconnect backoffs it saw.
- * 
* - * Protobuf type grpc.testing.ReconnectInfo + * Generated from protobuf message grpc.testing.ReconnectInfo */ class ReconnectInfo extends \Google\Protobuf\Internal\Message { /** - * bool passed = 1; + * Generated from protobuf field bool passed = 1; */ private $passed = false; /** - * repeated int32 backoff_ms = 2; + * Generated from protobuf field repeated int32 backoff_ms = 2; */ private $backoff_ms; @@ -34,7 +32,8 @@ class ReconnectInfo extends \Google\Protobuf\Internal\Message } /** - * bool passed = 1; + * Generated from protobuf field bool passed = 1; + * @return bool */ public function getPassed() { @@ -42,16 +41,21 @@ class ReconnectInfo extends \Google\Protobuf\Internal\Message } /** - * bool passed = 1; + * Generated from protobuf field bool passed = 1; + * @param bool $var + * @return $this */ public function setPassed($var) { GPBUtil::checkBool($var); $this->passed = $var; + + return $this; } /** - * repeated int32 backoff_ms = 2; + * Generated from protobuf field repeated int32 backoff_ms = 2; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getBackoffMs() { @@ -59,12 +63,16 @@ class ReconnectInfo extends \Google\Protobuf\Internal\Message } /** - * repeated int32 backoff_ms = 2; + * Generated from protobuf field repeated int32 backoff_ms = 2; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ - public function setBackoffMs(&$var) + public function setBackoffMs($var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); - $this->backoff_ms = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->backoff_ms = $arr; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ReconnectParams.php b/src/php/tests/qps/generated_code/Grpc/Testing/ReconnectParams.php index 97158557836..f91dc410cb5 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ReconnectParams.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ReconnectParams.php @@ -9,17 +9,15 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * For reconnect interop test only.
  * Client tells server what reconnection parameters it used.
- * 
* - * Protobuf type grpc.testing.ReconnectParams + * Generated from protobuf message grpc.testing.ReconnectParams */ class ReconnectParams extends \Google\Protobuf\Internal\Message { /** - * int32 max_reconnect_backoff_ms = 1; + * Generated from protobuf field int32 max_reconnect_backoff_ms = 1; */ private $max_reconnect_backoff_ms = 0; @@ -29,7 +27,8 @@ class ReconnectParams extends \Google\Protobuf\Internal\Message } /** - * int32 max_reconnect_backoff_ms = 1; + * Generated from protobuf field int32 max_reconnect_backoff_ms = 1; + * @return int */ public function getMaxReconnectBackoffMs() { @@ -37,12 +36,16 @@ class ReconnectParams extends \Google\Protobuf\Internal\Message } /** - * int32 max_reconnect_backoff_ms = 1; + * Generated from protobuf field int32 max_reconnect_backoff_ms = 1; + * @param int $var + * @return $this */ public function setMaxReconnectBackoffMs($var) { GPBUtil::checkInt32($var); $this->max_reconnect_backoff_ms = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ReportQpsScenarioServiceClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/ReportQpsScenarioServiceClient.php new file mode 100644 index 00000000000..72d44ffc667 --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ReportQpsScenarioServiceClient.php @@ -0,0 +1,50 @@ +_simpleRequest('/grpc.testing.ReportQpsScenarioService/ReportScenario', + $argument, + ['\Grpc\Testing\Void', 'decode'], + $metadata, $options); + } + +} diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/RequestResultCount.php b/src/php/tests/qps/generated_code/Grpc/Testing/RequestResultCount.php index 1be42b2ac91..75fa6cafe28 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/RequestResultCount.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/RequestResultCount.php @@ -9,16 +9,16 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type grpc.testing.RequestResultCount + * Generated from protobuf message grpc.testing.RequestResultCount */ class RequestResultCount extends \Google\Protobuf\Internal\Message { /** - * int32 status_code = 1; + * Generated from protobuf field int32 status_code = 1; */ private $status_code = 0; /** - * int64 count = 2; + * Generated from protobuf field int64 count = 2; */ private $count = 0; @@ -28,7 +28,8 @@ class RequestResultCount extends \Google\Protobuf\Internal\Message } /** - * int32 status_code = 1; + * Generated from protobuf field int32 status_code = 1; + * @return int */ public function getStatusCode() { @@ -36,16 +37,21 @@ class RequestResultCount extends \Google\Protobuf\Internal\Message } /** - * int32 status_code = 1; + * Generated from protobuf field int32 status_code = 1; + * @param int $var + * @return $this */ public function setStatusCode($var) { GPBUtil::checkInt32($var); $this->status_code = $var; + + return $this; } /** - * int64 count = 2; + * Generated from protobuf field int64 count = 2; + * @return int|string */ public function getCount() { @@ -53,12 +59,16 @@ class RequestResultCount extends \Google\Protobuf\Internal\Message } /** - * int64 count = 2; + * Generated from protobuf field int64 count = 2; + * @param int|string $var + * @return $this */ public function setCount($var) { GPBUtil::checkInt64($var); $this->count = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ResponseParameters.php b/src/php/tests/qps/generated_code/Grpc/Testing/ResponseParameters.php index b7a8e5ece71..b2f0a827fe0 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ResponseParameters.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ResponseParameters.php @@ -9,40 +9,32 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Configuration for a particular response.
- * 
* - * Protobuf type grpc.testing.ResponseParameters + * Generated from protobuf message grpc.testing.ResponseParameters */ class ResponseParameters extends \Google\Protobuf\Internal\Message { /** - *
      * Desired payload sizes in responses from the server.
-     * 
* - * int32 size = 1; + * Generated from protobuf field int32 size = 1; */ private $size = 0; /** - *
      * Desired interval between consecutive responses in the response stream in
      * microseconds.
-     * 
* - * int32 interval_us = 2; + * Generated from protobuf field int32 interval_us = 2; */ private $interval_us = 0; /** - *
      * Whether to request the server to compress the response. This field is
      * "nullable" in order to interoperate seamlessly with clients not able to
      * implement the full compression tests by introspecting the call to verify
      * the response's compression status.
-     * 
* - * .grpc.testing.BoolValue compressed = 3; + * Generated from protobuf field .grpc.testing.BoolValue compressed = 3; */ private $compressed = null; @@ -52,11 +44,10 @@ class ResponseParameters extends \Google\Protobuf\Internal\Message } /** - *
      * Desired payload sizes in responses from the server.
-     * 
* - * int32 size = 1; + * Generated from protobuf field int32 size = 1; + * @return int */ public function getSize() { @@ -64,25 +55,26 @@ class ResponseParameters extends \Google\Protobuf\Internal\Message } /** - *
      * Desired payload sizes in responses from the server.
-     * 
* - * int32 size = 1; + * Generated from protobuf field int32 size = 1; + * @param int $var + * @return $this */ public function setSize($var) { GPBUtil::checkInt32($var); $this->size = $var; + + return $this; } /** - *
      * Desired interval between consecutive responses in the response stream in
      * microseconds.
-     * 
* - * int32 interval_us = 2; + * Generated from protobuf field int32 interval_us = 2; + * @return int */ public function getIntervalUs() { @@ -90,28 +82,29 @@ class ResponseParameters extends \Google\Protobuf\Internal\Message } /** - *
      * Desired interval between consecutive responses in the response stream in
      * microseconds.
-     * 
* - * int32 interval_us = 2; + * Generated from protobuf field int32 interval_us = 2; + * @param int $var + * @return $this */ public function setIntervalUs($var) { GPBUtil::checkInt32($var); $this->interval_us = $var; + + return $this; } /** - *
      * Whether to request the server to compress the response. This field is
      * "nullable" in order to interoperate seamlessly with clients not able to
      * implement the full compression tests by introspecting the call to verify
      * the response's compression status.
-     * 
* - * .grpc.testing.BoolValue compressed = 3; + * Generated from protobuf field .grpc.testing.BoolValue compressed = 3; + * @return \Grpc\Testing\BoolValue */ public function getCompressed() { @@ -119,19 +112,21 @@ class ResponseParameters extends \Google\Protobuf\Internal\Message } /** - *
      * Whether to request the server to compress the response. This field is
      * "nullable" in order to interoperate seamlessly with clients not able to
      * implement the full compression tests by introspecting the call to verify
      * the response's compression status.
-     * 
* - * .grpc.testing.BoolValue compressed = 3; + * Generated from protobuf field .grpc.testing.BoolValue compressed = 3; + * @param \Grpc\Testing\BoolValue $var + * @return $this */ - public function setCompressed(&$var) + public function setCompressed($var) { GPBUtil::checkMessage($var, \Grpc\Testing\BoolValue::class); $this->compressed = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/RpcType.php b/src/php/tests/qps/generated_code/Grpc/Testing/RpcType.php index 2e664fff477..73a66490ea9 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/RpcType.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/RpcType.php @@ -5,17 +5,29 @@ namespace Grpc\Testing; /** - * Protobuf enum grpc.testing.RpcType + * Protobuf enum Grpc\Testing\RpcType */ class RpcType { /** - * UNARY = 0; + * Generated from protobuf enum UNARY = 0; */ const UNARY = 0; /** - * STREAMING = 1; + * Generated from protobuf enum STREAMING = 1; */ const STREAMING = 1; + /** + * Generated from protobuf enum STREAMING_FROM_CLIENT = 2; + */ + const STREAMING_FROM_CLIENT = 2; + /** + * Generated from protobuf enum STREAMING_FROM_SERVER = 3; + */ + const STREAMING_FROM_SERVER = 3; + /** + * Generated from protobuf enum STREAMING_BOTH_WAYS = 4; + */ + const STREAMING_BOTH_WAYS = 4; } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/Scenario.php b/src/php/tests/qps/generated_code/Grpc/Testing/Scenario.php index 136ed299ea8..9ec284b71f2 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/Scenario.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/Scenario.php @@ -9,76 +9,58 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * A single performance scenario: input to qps_json_driver
- * 
* - * Protobuf type grpc.testing.Scenario + * Generated from protobuf message grpc.testing.Scenario */ class Scenario extends \Google\Protobuf\Internal\Message { /** - *
      * Human readable name for this scenario
-     * 
* - * string name = 1; + * Generated from protobuf field string name = 1; */ private $name = ''; /** - *
      * Client configuration
-     * 
* - * .grpc.testing.ClientConfig client_config = 2; + * Generated from protobuf field .grpc.testing.ClientConfig client_config = 2; */ private $client_config = null; /** - *
      * Number of clients to start for the test
-     * 
* - * int32 num_clients = 3; + * Generated from protobuf field int32 num_clients = 3; */ private $num_clients = 0; /** - *
      * Server configuration
-     * 
* - * .grpc.testing.ServerConfig server_config = 4; + * Generated from protobuf field .grpc.testing.ServerConfig server_config = 4; */ private $server_config = null; /** - *
      * Number of servers to start for the test
-     * 
* - * int32 num_servers = 5; + * Generated from protobuf field int32 num_servers = 5; */ private $num_servers = 0; /** - *
      * Warmup period, in seconds
-     * 
* - * int32 warmup_seconds = 6; + * Generated from protobuf field int32 warmup_seconds = 6; */ private $warmup_seconds = 0; /** - *
      * Benchmark time, in seconds
-     * 
* - * int32 benchmark_seconds = 7; + * Generated from protobuf field int32 benchmark_seconds = 7; */ private $benchmark_seconds = 0; /** - *
      * Number of workers to spawn locally (usually zero)
-     * 
* - * int32 spawn_local_worker_count = 8; + * Generated from protobuf field int32 spawn_local_worker_count = 8; */ private $spawn_local_worker_count = 0; @@ -88,11 +70,10 @@ class Scenario extends \Google\Protobuf\Internal\Message } /** - *
      * Human readable name for this scenario
-     * 
* - * string name = 1; + * Generated from protobuf field string name = 1; + * @return string */ public function getName() { @@ -100,24 +81,25 @@ class Scenario extends \Google\Protobuf\Internal\Message } /** - *
      * Human readable name for this scenario
-     * 
* - * string name = 1; + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this */ public function setName($var) { GPBUtil::checkString($var, True); $this->name = $var; + + return $this; } /** - *
      * Client configuration
-     * 
* - * .grpc.testing.ClientConfig client_config = 2; + * Generated from protobuf field .grpc.testing.ClientConfig client_config = 2; + * @return \Grpc\Testing\ClientConfig */ public function getClientConfig() { @@ -125,24 +107,25 @@ class Scenario extends \Google\Protobuf\Internal\Message } /** - *
      * Client configuration
-     * 
* - * .grpc.testing.ClientConfig client_config = 2; + * Generated from protobuf field .grpc.testing.ClientConfig client_config = 2; + * @param \Grpc\Testing\ClientConfig $var + * @return $this */ - public function setClientConfig(&$var) + public function setClientConfig($var) { GPBUtil::checkMessage($var, \Grpc\Testing\ClientConfig::class); $this->client_config = $var; + + return $this; } /** - *
      * Number of clients to start for the test
-     * 
* - * int32 num_clients = 3; + * Generated from protobuf field int32 num_clients = 3; + * @return int */ public function getNumClients() { @@ -150,24 +133,25 @@ class Scenario extends \Google\Protobuf\Internal\Message } /** - *
      * Number of clients to start for the test
-     * 
* - * int32 num_clients = 3; + * Generated from protobuf field int32 num_clients = 3; + * @param int $var + * @return $this */ public function setNumClients($var) { GPBUtil::checkInt32($var); $this->num_clients = $var; + + return $this; } /** - *
      * Server configuration
-     * 
* - * .grpc.testing.ServerConfig server_config = 4; + * Generated from protobuf field .grpc.testing.ServerConfig server_config = 4; + * @return \Grpc\Testing\ServerConfig */ public function getServerConfig() { @@ -175,24 +159,25 @@ class Scenario extends \Google\Protobuf\Internal\Message } /** - *
      * Server configuration
-     * 
* - * .grpc.testing.ServerConfig server_config = 4; + * Generated from protobuf field .grpc.testing.ServerConfig server_config = 4; + * @param \Grpc\Testing\ServerConfig $var + * @return $this */ - public function setServerConfig(&$var) + public function setServerConfig($var) { GPBUtil::checkMessage($var, \Grpc\Testing\ServerConfig::class); $this->server_config = $var; + + return $this; } /** - *
      * Number of servers to start for the test
-     * 
* - * int32 num_servers = 5; + * Generated from protobuf field int32 num_servers = 5; + * @return int */ public function getNumServers() { @@ -200,24 +185,25 @@ class Scenario extends \Google\Protobuf\Internal\Message } /** - *
      * Number of servers to start for the test
-     * 
* - * int32 num_servers = 5; + * Generated from protobuf field int32 num_servers = 5; + * @param int $var + * @return $this */ public function setNumServers($var) { GPBUtil::checkInt32($var); $this->num_servers = $var; + + return $this; } /** - *
      * Warmup period, in seconds
-     * 
* - * int32 warmup_seconds = 6; + * Generated from protobuf field int32 warmup_seconds = 6; + * @return int */ public function getWarmupSeconds() { @@ -225,24 +211,25 @@ class Scenario extends \Google\Protobuf\Internal\Message } /** - *
      * Warmup period, in seconds
-     * 
* - * int32 warmup_seconds = 6; + * Generated from protobuf field int32 warmup_seconds = 6; + * @param int $var + * @return $this */ public function setWarmupSeconds($var) { GPBUtil::checkInt32($var); $this->warmup_seconds = $var; + + return $this; } /** - *
      * Benchmark time, in seconds
-     * 
* - * int32 benchmark_seconds = 7; + * Generated from protobuf field int32 benchmark_seconds = 7; + * @return int */ public function getBenchmarkSeconds() { @@ -250,24 +237,25 @@ class Scenario extends \Google\Protobuf\Internal\Message } /** - *
      * Benchmark time, in seconds
-     * 
* - * int32 benchmark_seconds = 7; + * Generated from protobuf field int32 benchmark_seconds = 7; + * @param int $var + * @return $this */ public function setBenchmarkSeconds($var) { GPBUtil::checkInt32($var); $this->benchmark_seconds = $var; + + return $this; } /** - *
      * Number of workers to spawn locally (usually zero)
-     * 
* - * int32 spawn_local_worker_count = 8; + * Generated from protobuf field int32 spawn_local_worker_count = 8; + * @return int */ public function getSpawnLocalWorkerCount() { @@ -275,16 +263,18 @@ class Scenario extends \Google\Protobuf\Internal\Message } /** - *
      * Number of workers to spawn locally (usually zero)
-     * 
* - * int32 spawn_local_worker_count = 8; + * Generated from protobuf field int32 spawn_local_worker_count = 8; + * @param int $var + * @return $this */ public function setSpawnLocalWorkerCount($var) { GPBUtil::checkInt32($var); $this->spawn_local_worker_count = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ScenarioResult.php b/src/php/tests/qps/generated_code/Grpc/Testing/ScenarioResult.php index 809cd96244d..31d9a39a1fc 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ScenarioResult.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ScenarioResult.php @@ -9,80 +9,62 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Results of a single benchmark scenario.
- * 
* - * Protobuf type grpc.testing.ScenarioResult + * Generated from protobuf message grpc.testing.ScenarioResult */ class ScenarioResult extends \Google\Protobuf\Internal\Message { /** - *
      * Inputs used to run the scenario.
-     * 
* - * .grpc.testing.Scenario scenario = 1; + * Generated from protobuf field .grpc.testing.Scenario scenario = 1; */ private $scenario = null; /** - *
      * Histograms from all clients merged into one histogram.
-     * 
* - * .grpc.testing.HistogramData latencies = 2; + * Generated from protobuf field .grpc.testing.HistogramData latencies = 2; */ private $latencies = null; /** - *
      * Client stats for each client
-     * 
* - * repeated .grpc.testing.ClientStats client_stats = 3; + * Generated from protobuf field repeated .grpc.testing.ClientStats client_stats = 3; */ private $client_stats; /** - *
      * Server stats for each server
-     * 
* - * repeated .grpc.testing.ServerStats server_stats = 4; + * Generated from protobuf field repeated .grpc.testing.ServerStats server_stats = 4; */ private $server_stats; /** - *
      * Number of cores available to each server
-     * 
* - * repeated int32 server_cores = 5; + * Generated from protobuf field repeated int32 server_cores = 5; */ private $server_cores; /** - *
      * An after-the-fact computed summary
-     * 
* - * .grpc.testing.ScenarioResultSummary summary = 6; + * Generated from protobuf field .grpc.testing.ScenarioResultSummary summary = 6; */ private $summary = null; /** - *
      * Information on success or failure of each worker
-     * 
* - * repeated bool client_success = 7; + * Generated from protobuf field repeated bool client_success = 7; */ private $client_success; /** - * repeated bool server_success = 8; + * Generated from protobuf field repeated bool server_success = 8; */ private $server_success; /** - *
      * Number of failed requests (one row per status code seen)
-     * 
* - * repeated .grpc.testing.RequestResultCount request_results = 9; + * Generated from protobuf field repeated .grpc.testing.RequestResultCount request_results = 9; */ private $request_results; @@ -92,11 +74,10 @@ class ScenarioResult extends \Google\Protobuf\Internal\Message } /** - *
      * Inputs used to run the scenario.
-     * 
* - * .grpc.testing.Scenario scenario = 1; + * Generated from protobuf field .grpc.testing.Scenario scenario = 1; + * @return \Grpc\Testing\Scenario */ public function getScenario() { @@ -104,24 +85,25 @@ class ScenarioResult extends \Google\Protobuf\Internal\Message } /** - *
      * Inputs used to run the scenario.
-     * 
* - * .grpc.testing.Scenario scenario = 1; + * Generated from protobuf field .grpc.testing.Scenario scenario = 1; + * @param \Grpc\Testing\Scenario $var + * @return $this */ - public function setScenario(&$var) + public function setScenario($var) { GPBUtil::checkMessage($var, \Grpc\Testing\Scenario::class); $this->scenario = $var; + + return $this; } /** - *
      * Histograms from all clients merged into one histogram.
-     * 
* - * .grpc.testing.HistogramData latencies = 2; + * Generated from protobuf field .grpc.testing.HistogramData latencies = 2; + * @return \Grpc\Testing\HistogramData */ public function getLatencies() { @@ -129,24 +111,25 @@ class ScenarioResult extends \Google\Protobuf\Internal\Message } /** - *
      * Histograms from all clients merged into one histogram.
-     * 
* - * .grpc.testing.HistogramData latencies = 2; + * Generated from protobuf field .grpc.testing.HistogramData latencies = 2; + * @param \Grpc\Testing\HistogramData $var + * @return $this */ - public function setLatencies(&$var) + public function setLatencies($var) { GPBUtil::checkMessage($var, \Grpc\Testing\HistogramData::class); $this->latencies = $var; + + return $this; } /** - *
      * Client stats for each client
-     * 
* - * repeated .grpc.testing.ClientStats client_stats = 3; + * Generated from protobuf field repeated .grpc.testing.ClientStats client_stats = 3; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getClientStats() { @@ -154,24 +137,25 @@ class ScenarioResult extends \Google\Protobuf\Internal\Message } /** - *
      * Client stats for each client
-     * 
* - * repeated .grpc.testing.ClientStats client_stats = 3; + * Generated from protobuf field repeated .grpc.testing.ClientStats client_stats = 3; + * @param \Grpc\Testing\ClientStats[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ - public function setClientStats(&$var) + public function setClientStats($var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Testing\ClientStats::class); - $this->client_stats = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Testing\ClientStats::class); + $this->client_stats = $arr; + + return $this; } /** - *
      * Server stats for each server
-     * 
* - * repeated .grpc.testing.ServerStats server_stats = 4; + * Generated from protobuf field repeated .grpc.testing.ServerStats server_stats = 4; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getServerStats() { @@ -179,24 +163,25 @@ class ScenarioResult extends \Google\Protobuf\Internal\Message } /** - *
      * Server stats for each server
-     * 
* - * repeated .grpc.testing.ServerStats server_stats = 4; + * Generated from protobuf field repeated .grpc.testing.ServerStats server_stats = 4; + * @param \Grpc\Testing\ServerStats[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ - public function setServerStats(&$var) + public function setServerStats($var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Testing\ServerStats::class); - $this->server_stats = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Testing\ServerStats::class); + $this->server_stats = $arr; + + return $this; } /** - *
      * Number of cores available to each server
-     * 
* - * repeated int32 server_cores = 5; + * Generated from protobuf field repeated int32 server_cores = 5; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getServerCores() { @@ -204,24 +189,25 @@ class ScenarioResult extends \Google\Protobuf\Internal\Message } /** - *
      * Number of cores available to each server
-     * 
* - * repeated int32 server_cores = 5; + * Generated from protobuf field repeated int32 server_cores = 5; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ - public function setServerCores(&$var) + public function setServerCores($var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); - $this->server_cores = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->server_cores = $arr; + + return $this; } /** - *
      * An after-the-fact computed summary
-     * 
* - * .grpc.testing.ScenarioResultSummary summary = 6; + * Generated from protobuf field .grpc.testing.ScenarioResultSummary summary = 6; + * @return \Grpc\Testing\ScenarioResultSummary */ public function getSummary() { @@ -229,24 +215,25 @@ class ScenarioResult extends \Google\Protobuf\Internal\Message } /** - *
      * An after-the-fact computed summary
-     * 
* - * .grpc.testing.ScenarioResultSummary summary = 6; + * Generated from protobuf field .grpc.testing.ScenarioResultSummary summary = 6; + * @param \Grpc\Testing\ScenarioResultSummary $var + * @return $this */ - public function setSummary(&$var) + public function setSummary($var) { GPBUtil::checkMessage($var, \Grpc\Testing\ScenarioResultSummary::class); $this->summary = $var; + + return $this; } /** - *
      * Information on success or failure of each worker
-     * 
* - * repeated bool client_success = 7; + * Generated from protobuf field repeated bool client_success = 7; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getClientSuccess() { @@ -254,20 +241,23 @@ class ScenarioResult extends \Google\Protobuf\Internal\Message } /** - *
      * Information on success or failure of each worker
-     * 
* - * repeated bool client_success = 7; + * Generated from protobuf field repeated bool client_success = 7; + * @param bool[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ - public function setClientSuccess(&$var) + public function setClientSuccess($var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::BOOL); - $this->client_success = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::BOOL); + $this->client_success = $arr; + + return $this; } /** - * repeated bool server_success = 8; + * Generated from protobuf field repeated bool server_success = 8; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getServerSuccess() { @@ -275,20 +265,23 @@ class ScenarioResult extends \Google\Protobuf\Internal\Message } /** - * repeated bool server_success = 8; + * Generated from protobuf field repeated bool server_success = 8; + * @param bool[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ - public function setServerSuccess(&$var) + public function setServerSuccess($var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::BOOL); - $this->server_success = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::BOOL); + $this->server_success = $arr; + + return $this; } /** - *
      * Number of failed requests (one row per status code seen)
-     * 
* - * repeated .grpc.testing.RequestResultCount request_results = 9; + * Generated from protobuf field repeated .grpc.testing.RequestResultCount request_results = 9; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getRequestResults() { @@ -296,16 +289,18 @@ class ScenarioResult extends \Google\Protobuf\Internal\Message } /** - *
      * Number of failed requests (one row per status code seen)
-     * 
* - * repeated .grpc.testing.RequestResultCount request_results = 9; + * Generated from protobuf field repeated .grpc.testing.RequestResultCount request_results = 9; + * @param \Grpc\Testing\RequestResultCount[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ - public function setRequestResults(&$var) + public function setRequestResults($var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Testing\RequestResultCount::class); - $this->request_results = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Testing\RequestResultCount::class); + $this->request_results = $arr; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ScenarioResultSummary.php b/src/php/tests/qps/generated_code/Grpc/Testing/ScenarioResultSummary.php index 7520cff78e8..f7f1c987b53 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ScenarioResultSummary.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ScenarioResultSummary.php @@ -9,107 +9,107 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Basic summary that can be computed from ClientStats and ServerStats
  * once the scenario has finished.
- * 
* - * Protobuf type grpc.testing.ScenarioResultSummary + * Generated from protobuf message grpc.testing.ScenarioResultSummary */ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message { /** - *
      * Total number of operations per second over all clients.
-     * 
* - * double qps = 1; + * Generated from protobuf field double qps = 1; */ private $qps = 0.0; /** - *
      * QPS per one server core.
-     * 
* - * double qps_per_server_core = 2; + * Generated from protobuf field double qps_per_server_core = 2; */ private $qps_per_server_core = 0.0; /** - *
-     * server load based on system_time (0.85 => 85%)
-     * 
+ * server load based on system_time (0.85 => 85%) * - * double server_system_time = 3; + * Generated from protobuf field double server_system_time = 3; */ private $server_system_time = 0.0; /** - *
-     * server load based on user_time (0.85 => 85%)
-     * 
+ * server load based on user_time (0.85 => 85%) * - * double server_user_time = 4; + * Generated from protobuf field double server_user_time = 4; */ private $server_user_time = 0.0; /** - *
-     * client load based on system_time (0.85 => 85%)
-     * 
+ * client load based on system_time (0.85 => 85%) * - * double client_system_time = 5; + * Generated from protobuf field double client_system_time = 5; */ private $client_system_time = 0.0; /** - *
-     * client load based on user_time (0.85 => 85%)
-     * 
+ * client load based on user_time (0.85 => 85%) * - * double client_user_time = 6; + * Generated from protobuf field double client_user_time = 6; */ private $client_user_time = 0.0; /** - *
      * X% latency percentiles (in nanoseconds)
-     * 
* - * double latency_50 = 7; + * Generated from protobuf field double latency_50 = 7; */ private $latency_50 = 0.0; /** - * double latency_90 = 8; + * Generated from protobuf field double latency_90 = 8; */ private $latency_90 = 0.0; /** - * double latency_95 = 9; + * Generated from protobuf field double latency_95 = 9; */ private $latency_95 = 0.0; /** - * double latency_99 = 10; + * Generated from protobuf field double latency_99 = 10; */ private $latency_99 = 0.0; /** - * double latency_999 = 11; + * Generated from protobuf field double latency_999 = 11; */ private $latency_999 = 0.0; /** - *
      * server cpu usage percentage
-     * 
* - * double server_cpu_usage = 12; + * Generated from protobuf field double server_cpu_usage = 12; */ private $server_cpu_usage = 0.0; /** - *
      * Number of requests that succeeded/failed
-     * 
* - * double successful_requests_per_second = 13; + * Generated from protobuf field double successful_requests_per_second = 13; */ private $successful_requests_per_second = 0.0; /** - * double failed_requests_per_second = 14; + * Generated from protobuf field double failed_requests_per_second = 14; */ private $failed_requests_per_second = 0.0; + /** + * Number of polls called inside completion queue per request + * + * Generated from protobuf field double client_polls_per_request = 15; + */ + private $client_polls_per_request = 0.0; + /** + * Generated from protobuf field double server_polls_per_request = 16; + */ + private $server_polls_per_request = 0.0; + /** + * Queries per CPU-sec over all servers or clients + * + * Generated from protobuf field double server_queries_per_cpu_sec = 17; + */ + private $server_queries_per_cpu_sec = 0.0; + /** + * Generated from protobuf field double client_queries_per_cpu_sec = 18; + */ + private $client_queries_per_cpu_sec = 0.0; public function __construct() { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); @@ -117,11 +117,10 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - *
      * Total number of operations per second over all clients.
-     * 
* - * double qps = 1; + * Generated from protobuf field double qps = 1; + * @return float */ public function getQps() { @@ -129,24 +128,25 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - *
      * Total number of operations per second over all clients.
-     * 
* - * double qps = 1; + * Generated from protobuf field double qps = 1; + * @param float $var + * @return $this */ public function setQps($var) { GPBUtil::checkDouble($var); $this->qps = $var; + + return $this; } /** - *
      * QPS per one server core.
-     * 
* - * double qps_per_server_core = 2; + * Generated from protobuf field double qps_per_server_core = 2; + * @return float */ public function getQpsPerServerCore() { @@ -154,24 +154,25 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - *
      * QPS per one server core.
-     * 
* - * double qps_per_server_core = 2; + * Generated from protobuf field double qps_per_server_core = 2; + * @param float $var + * @return $this */ public function setQpsPerServerCore($var) { GPBUtil::checkDouble($var); $this->qps_per_server_core = $var; + + return $this; } /** - *
-     * server load based on system_time (0.85 => 85%)
-     * 
+ * server load based on system_time (0.85 => 85%) * - * double server_system_time = 3; + * Generated from protobuf field double server_system_time = 3; + * @return float */ public function getServerSystemTime() { @@ -179,24 +180,25 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - *
-     * server load based on system_time (0.85 => 85%)
-     * 
+ * server load based on system_time (0.85 => 85%) * - * double server_system_time = 3; + * Generated from protobuf field double server_system_time = 3; + * @param float $var + * @return $this */ public function setServerSystemTime($var) { GPBUtil::checkDouble($var); $this->server_system_time = $var; + + return $this; } /** - *
-     * server load based on user_time (0.85 => 85%)
-     * 
+ * server load based on user_time (0.85 => 85%) * - * double server_user_time = 4; + * Generated from protobuf field double server_user_time = 4; + * @return float */ public function getServerUserTime() { @@ -204,24 +206,25 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - *
-     * server load based on user_time (0.85 => 85%)
-     * 
+ * server load based on user_time (0.85 => 85%) * - * double server_user_time = 4; + * Generated from protobuf field double server_user_time = 4; + * @param float $var + * @return $this */ public function setServerUserTime($var) { GPBUtil::checkDouble($var); $this->server_user_time = $var; + + return $this; } /** - *
-     * client load based on system_time (0.85 => 85%)
-     * 
+ * client load based on system_time (0.85 => 85%) * - * double client_system_time = 5; + * Generated from protobuf field double client_system_time = 5; + * @return float */ public function getClientSystemTime() { @@ -229,24 +232,25 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - *
-     * client load based on system_time (0.85 => 85%)
-     * 
+ * client load based on system_time (0.85 => 85%) * - * double client_system_time = 5; + * Generated from protobuf field double client_system_time = 5; + * @param float $var + * @return $this */ public function setClientSystemTime($var) { GPBUtil::checkDouble($var); $this->client_system_time = $var; + + return $this; } /** - *
-     * client load based on user_time (0.85 => 85%)
-     * 
+ * client load based on user_time (0.85 => 85%) * - * double client_user_time = 6; + * Generated from protobuf field double client_user_time = 6; + * @return float */ public function getClientUserTime() { @@ -254,24 +258,25 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - *
-     * client load based on user_time (0.85 => 85%)
-     * 
+ * client load based on user_time (0.85 => 85%) * - * double client_user_time = 6; + * Generated from protobuf field double client_user_time = 6; + * @param float $var + * @return $this */ public function setClientUserTime($var) { GPBUtil::checkDouble($var); $this->client_user_time = $var; + + return $this; } /** - *
      * X% latency percentiles (in nanoseconds)
-     * 
* - * double latency_50 = 7; + * Generated from protobuf field double latency_50 = 7; + * @return float */ public function getLatency50() { @@ -279,20 +284,23 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - *
      * X% latency percentiles (in nanoseconds)
-     * 
* - * double latency_50 = 7; + * Generated from protobuf field double latency_50 = 7; + * @param float $var + * @return $this */ public function setLatency50($var) { GPBUtil::checkDouble($var); $this->latency_50 = $var; + + return $this; } /** - * double latency_90 = 8; + * Generated from protobuf field double latency_90 = 8; + * @return float */ public function getLatency90() { @@ -300,16 +308,21 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - * double latency_90 = 8; + * Generated from protobuf field double latency_90 = 8; + * @param float $var + * @return $this */ public function setLatency90($var) { GPBUtil::checkDouble($var); $this->latency_90 = $var; + + return $this; } /** - * double latency_95 = 9; + * Generated from protobuf field double latency_95 = 9; + * @return float */ public function getLatency95() { @@ -317,16 +330,21 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - * double latency_95 = 9; + * Generated from protobuf field double latency_95 = 9; + * @param float $var + * @return $this */ public function setLatency95($var) { GPBUtil::checkDouble($var); $this->latency_95 = $var; + + return $this; } /** - * double latency_99 = 10; + * Generated from protobuf field double latency_99 = 10; + * @return float */ public function getLatency99() { @@ -334,16 +352,21 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - * double latency_99 = 10; + * Generated from protobuf field double latency_99 = 10; + * @param float $var + * @return $this */ public function setLatency99($var) { GPBUtil::checkDouble($var); $this->latency_99 = $var; + + return $this; } /** - * double latency_999 = 11; + * Generated from protobuf field double latency_999 = 11; + * @return float */ public function getLatency999() { @@ -351,20 +374,23 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - * double latency_999 = 11; + * Generated from protobuf field double latency_999 = 11; + * @param float $var + * @return $this */ public function setLatency999($var) { GPBUtil::checkDouble($var); $this->latency_999 = $var; + + return $this; } /** - *
      * server cpu usage percentage
-     * 
* - * double server_cpu_usage = 12; + * Generated from protobuf field double server_cpu_usage = 12; + * @return float */ public function getServerCpuUsage() { @@ -372,24 +398,25 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - *
      * server cpu usage percentage
-     * 
* - * double server_cpu_usage = 12; + * Generated from protobuf field double server_cpu_usage = 12; + * @param float $var + * @return $this */ public function setServerCpuUsage($var) { GPBUtil::checkDouble($var); $this->server_cpu_usage = $var; + + return $this; } /** - *
      * Number of requests that succeeded/failed
-     * 
* - * double successful_requests_per_second = 13; + * Generated from protobuf field double successful_requests_per_second = 13; + * @return float */ public function getSuccessfulRequestsPerSecond() { @@ -397,20 +424,23 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - *
      * Number of requests that succeeded/failed
-     * 
* - * double successful_requests_per_second = 13; + * Generated from protobuf field double successful_requests_per_second = 13; + * @param float $var + * @return $this */ public function setSuccessfulRequestsPerSecond($var) { GPBUtil::checkDouble($var); $this->successful_requests_per_second = $var; + + return $this; } /** - * double failed_requests_per_second = 14; + * Generated from protobuf field double failed_requests_per_second = 14; + * @return float */ public function getFailedRequestsPerSecond() { @@ -418,12 +448,112 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - * double failed_requests_per_second = 14; + * Generated from protobuf field double failed_requests_per_second = 14; + * @param float $var + * @return $this */ public function setFailedRequestsPerSecond($var) { GPBUtil::checkDouble($var); $this->failed_requests_per_second = $var; + + return $this; + } + + /** + * Number of polls called inside completion queue per request + * + * Generated from protobuf field double client_polls_per_request = 15; + * @return float + */ + public function getClientPollsPerRequest() + { + return $this->client_polls_per_request; + } + + /** + * Number of polls called inside completion queue per request + * + * Generated from protobuf field double client_polls_per_request = 15; + * @param float $var + * @return $this + */ + public function setClientPollsPerRequest($var) + { + GPBUtil::checkDouble($var); + $this->client_polls_per_request = $var; + + return $this; + } + + /** + * Generated from protobuf field double server_polls_per_request = 16; + * @return float + */ + public function getServerPollsPerRequest() + { + return $this->server_polls_per_request; + } + + /** + * Generated from protobuf field double server_polls_per_request = 16; + * @param float $var + * @return $this + */ + public function setServerPollsPerRequest($var) + { + GPBUtil::checkDouble($var); + $this->server_polls_per_request = $var; + + return $this; + } + + /** + * Queries per CPU-sec over all servers or clients + * + * Generated from protobuf field double server_queries_per_cpu_sec = 17; + * @return float + */ + public function getServerQueriesPerCpuSec() + { + return $this->server_queries_per_cpu_sec; + } + + /** + * Queries per CPU-sec over all servers or clients + * + * Generated from protobuf field double server_queries_per_cpu_sec = 17; + * @param float $var + * @return $this + */ + public function setServerQueriesPerCpuSec($var) + { + GPBUtil::checkDouble($var); + $this->server_queries_per_cpu_sec = $var; + + return $this; + } + + /** + * Generated from protobuf field double client_queries_per_cpu_sec = 18; + * @return float + */ + public function getClientQueriesPerCpuSec() + { + return $this->client_queries_per_cpu_sec; + } + + /** + * Generated from protobuf field double client_queries_per_cpu_sec = 18; + * @param float $var + * @return $this + */ + public function setClientQueriesPerCpuSec($var) + { + GPBUtil::checkDouble($var); + $this->client_queries_per_cpu_sec = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/Scenarios.php b/src/php/tests/qps/generated_code/Grpc/Testing/Scenarios.php index 278f555b760..2146b4776e2 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/Scenarios.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/Scenarios.php @@ -9,16 +9,14 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * A set of scenarios to be run with qps_json_driver
- * 
* - * Protobuf type grpc.testing.Scenarios + * Generated from protobuf message grpc.testing.Scenarios */ class Scenarios extends \Google\Protobuf\Internal\Message { /** - * repeated .grpc.testing.Scenario scenarios = 1; + * Generated from protobuf field repeated .grpc.testing.Scenario scenarios = 1; */ private $scenarios; @@ -28,7 +26,8 @@ class Scenarios extends \Google\Protobuf\Internal\Message } /** - * repeated .grpc.testing.Scenario scenarios = 1; + * Generated from protobuf field repeated .grpc.testing.Scenario scenarios = 1; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getScenarios() { @@ -36,12 +35,16 @@ class Scenarios extends \Google\Protobuf\Internal\Message } /** - * repeated .grpc.testing.Scenario scenarios = 1; + * Generated from protobuf field repeated .grpc.testing.Scenario scenarios = 1; + * @param \Grpc\Testing\Scenario[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ - public function setScenarios(&$var) + public function setScenarios($var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Testing\Scenario::class); - $this->scenarios = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Testing\Scenario::class); + $this->scenarios = $arr; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/SecurityParams.php b/src/php/tests/qps/generated_code/Grpc/Testing/SecurityParams.php index 27a5b95cc94..8ce623a4bc1 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/SecurityParams.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/SecurityParams.php @@ -9,22 +9,24 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * presence of SecurityParams implies use of TLS
- * 
* - * Protobuf type grpc.testing.SecurityParams + * Generated from protobuf message grpc.testing.SecurityParams */ class SecurityParams extends \Google\Protobuf\Internal\Message { /** - * bool use_test_ca = 1; + * Generated from protobuf field bool use_test_ca = 1; */ private $use_test_ca = false; /** - * string server_host_override = 2; + * Generated from protobuf field string server_host_override = 2; */ private $server_host_override = ''; + /** + * Generated from protobuf field string cred_type = 3; + */ + private $cred_type = ''; public function __construct() { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); @@ -32,7 +34,8 @@ class SecurityParams extends \Google\Protobuf\Internal\Message } /** - * bool use_test_ca = 1; + * Generated from protobuf field bool use_test_ca = 1; + * @return bool */ public function getUseTestCa() { @@ -40,16 +43,21 @@ class SecurityParams extends \Google\Protobuf\Internal\Message } /** - * bool use_test_ca = 1; + * Generated from protobuf field bool use_test_ca = 1; + * @param bool $var + * @return $this */ public function setUseTestCa($var) { GPBUtil::checkBool($var); $this->use_test_ca = $var; + + return $this; } /** - * string server_host_override = 2; + * Generated from protobuf field string server_host_override = 2; + * @return string */ public function getServerHostOverride() { @@ -57,12 +65,38 @@ class SecurityParams extends \Google\Protobuf\Internal\Message } /** - * string server_host_override = 2; + * Generated from protobuf field string server_host_override = 2; + * @param string $var + * @return $this */ public function setServerHostOverride($var) { GPBUtil::checkString($var, True); $this->server_host_override = $var; + + return $this; + } + + /** + * Generated from protobuf field string cred_type = 3; + * @return string + */ + public function getCredType() + { + return $this->cred_type; + } + + /** + * Generated from protobuf field string cred_type = 3; + * @param string $var + * @return $this + */ + public function setCredType($var) + { + GPBUtil::checkString($var, True); + $this->cred_type = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ServerArgs.php b/src/php/tests/qps/generated_code/Grpc/Testing/ServerArgs.php index 0d84b80124a..acf7e18b6da 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ServerArgs.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ServerArgs.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type grpc.testing.ServerArgs + * Generated from protobuf message grpc.testing.ServerArgs */ class ServerArgs extends \Google\Protobuf\Internal\Message { @@ -21,7 +21,8 @@ class ServerArgs extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.ServerConfig setup = 1; + * Generated from protobuf field .grpc.testing.ServerConfig setup = 1; + * @return \Grpc\Testing\ServerConfig */ public function getSetup() { @@ -29,16 +30,21 @@ class ServerArgs extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.ServerConfig setup = 1; + * Generated from protobuf field .grpc.testing.ServerConfig setup = 1; + * @param \Grpc\Testing\ServerConfig $var + * @return $this */ - public function setSetup(&$var) + public function setSetup($var) { GPBUtil::checkMessage($var, \Grpc\Testing\ServerConfig::class); $this->writeOneof(1, $var); + + return $this; } /** - * .grpc.testing.Mark mark = 2; + * Generated from protobuf field .grpc.testing.Mark mark = 2; + * @return \Grpc\Testing\Mark */ public function getMark() { @@ -46,14 +52,21 @@ class ServerArgs extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.Mark mark = 2; + * Generated from protobuf field .grpc.testing.Mark mark = 2; + * @param \Grpc\Testing\Mark $var + * @return $this */ - public function setMark(&$var) + public function setMark($var) { GPBUtil::checkMessage($var, \Grpc\Testing\Mark::class); $this->writeOneof(2, $var); + + return $this; } + /** + * @return string + */ public function getArgtype() { return $this->whichOneof("argtype"); diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ServerConfig.php b/src/php/tests/qps/generated_code/Grpc/Testing/ServerConfig.php index e2bcede48cb..8bd4c69566b 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ServerConfig.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ServerConfig.php @@ -9,77 +9,73 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type grpc.testing.ServerConfig + * Generated from protobuf message grpc.testing.ServerConfig */ class ServerConfig extends \Google\Protobuf\Internal\Message { /** - * .grpc.testing.ServerType server_type = 1; + * Generated from protobuf field .grpc.testing.ServerType server_type = 1; */ private $server_type = 0; /** - * .grpc.testing.SecurityParams security_params = 2; + * Generated from protobuf field .grpc.testing.SecurityParams security_params = 2; */ private $security_params = null; /** - *
      * Port on which to listen. Zero means pick unused port.
-     * 
* - * int32 port = 4; + * Generated from protobuf field int32 port = 4; */ private $port = 0; /** - *
      * Only for async server. Number of threads used to serve the requests.
-     * 
* - * int32 async_server_threads = 7; + * Generated from protobuf field int32 async_server_threads = 7; */ private $async_server_threads = 0; /** - *
      * Specify the number of cores to limit server to, if desired
-     * 
* - * int32 core_limit = 8; + * Generated from protobuf field int32 core_limit = 8; */ private $core_limit = 0; /** - *
      * payload config, used in generic server.
      * Note this must NOT be used in proto (non-generic) servers. For proto servers,
      * 'response sizes' must be configured from the 'response_size' field of the
      * 'SimpleRequest' objects in RPC requests.
-     * 
* - * .grpc.testing.PayloadConfig payload_config = 9; + * Generated from protobuf field .grpc.testing.PayloadConfig payload_config = 9; */ private $payload_config = null; /** - *
      * Specify the cores we should run the server on, if desired
-     * 
* - * repeated int32 core_list = 10; + * Generated from protobuf field repeated int32 core_list = 10; */ private $core_list; /** - *
      * If we use an OTHER_SERVER client_type, this string gives more detail
-     * 
* - * string other_server_api = 11; + * Generated from protobuf field string other_server_api = 11; */ private $other_server_api = ''; /** - *
+     * Number of threads that share each completion queue
+     *
+     * Generated from protobuf field int32 threads_per_cq = 12;
+     */
+    private $threads_per_cq = 0;
+    /**
      * Buffer pool size (no buffer pool specified if unset)
-     * 
* - * int32 resource_quota_size = 1001; + * Generated from protobuf field int32 resource_quota_size = 1001; */ private $resource_quota_size = 0; + /** + * Generated from protobuf field repeated .grpc.testing.ChannelArg channel_args = 1002; + */ + private $channel_args; public function __construct() { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); @@ -87,7 +83,8 @@ class ServerConfig extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.ServerType server_type = 1; + * Generated from protobuf field .grpc.testing.ServerType server_type = 1; + * @return int */ public function getServerType() { @@ -95,16 +92,21 @@ class ServerConfig extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.ServerType server_type = 1; + * Generated from protobuf field .grpc.testing.ServerType server_type = 1; + * @param int $var + * @return $this */ public function setServerType($var) { GPBUtil::checkEnum($var, \Grpc\Testing\ServerType::class); $this->server_type = $var; + + return $this; } /** - * .grpc.testing.SecurityParams security_params = 2; + * Generated from protobuf field .grpc.testing.SecurityParams security_params = 2; + * @return \Grpc\Testing\SecurityParams */ public function getSecurityParams() { @@ -112,20 +114,23 @@ class ServerConfig extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.SecurityParams security_params = 2; + * Generated from protobuf field .grpc.testing.SecurityParams security_params = 2; + * @param \Grpc\Testing\SecurityParams $var + * @return $this */ - public function setSecurityParams(&$var) + public function setSecurityParams($var) { GPBUtil::checkMessage($var, \Grpc\Testing\SecurityParams::class); $this->security_params = $var; + + return $this; } /** - *
      * Port on which to listen. Zero means pick unused port.
-     * 
* - * int32 port = 4; + * Generated from protobuf field int32 port = 4; + * @return int */ public function getPort() { @@ -133,24 +138,25 @@ class ServerConfig extends \Google\Protobuf\Internal\Message } /** - *
      * Port on which to listen. Zero means pick unused port.
-     * 
* - * int32 port = 4; + * Generated from protobuf field int32 port = 4; + * @param int $var + * @return $this */ public function setPort($var) { GPBUtil::checkInt32($var); $this->port = $var; + + return $this; } /** - *
      * Only for async server. Number of threads used to serve the requests.
-     * 
* - * int32 async_server_threads = 7; + * Generated from protobuf field int32 async_server_threads = 7; + * @return int */ public function getAsyncServerThreads() { @@ -158,24 +164,25 @@ class ServerConfig extends \Google\Protobuf\Internal\Message } /** - *
      * Only for async server. Number of threads used to serve the requests.
-     * 
* - * int32 async_server_threads = 7; + * Generated from protobuf field int32 async_server_threads = 7; + * @param int $var + * @return $this */ public function setAsyncServerThreads($var) { GPBUtil::checkInt32($var); $this->async_server_threads = $var; + + return $this; } /** - *
      * Specify the number of cores to limit server to, if desired
-     * 
* - * int32 core_limit = 8; + * Generated from protobuf field int32 core_limit = 8; + * @return int */ public function getCoreLimit() { @@ -183,27 +190,28 @@ class ServerConfig extends \Google\Protobuf\Internal\Message } /** - *
      * Specify the number of cores to limit server to, if desired
-     * 
* - * int32 core_limit = 8; + * Generated from protobuf field int32 core_limit = 8; + * @param int $var + * @return $this */ public function setCoreLimit($var) { GPBUtil::checkInt32($var); $this->core_limit = $var; + + return $this; } /** - *
      * payload config, used in generic server.
      * Note this must NOT be used in proto (non-generic) servers. For proto servers,
      * 'response sizes' must be configured from the 'response_size' field of the
      * 'SimpleRequest' objects in RPC requests.
-     * 
* - * .grpc.testing.PayloadConfig payload_config = 9; + * Generated from protobuf field .grpc.testing.PayloadConfig payload_config = 9; + * @return \Grpc\Testing\PayloadConfig */ public function getPayloadConfig() { @@ -211,27 +219,28 @@ class ServerConfig extends \Google\Protobuf\Internal\Message } /** - *
      * payload config, used in generic server.
      * Note this must NOT be used in proto (non-generic) servers. For proto servers,
      * 'response sizes' must be configured from the 'response_size' field of the
      * 'SimpleRequest' objects in RPC requests.
-     * 
* - * .grpc.testing.PayloadConfig payload_config = 9; + * Generated from protobuf field .grpc.testing.PayloadConfig payload_config = 9; + * @param \Grpc\Testing\PayloadConfig $var + * @return $this */ - public function setPayloadConfig(&$var) + public function setPayloadConfig($var) { GPBUtil::checkMessage($var, \Grpc\Testing\PayloadConfig::class); $this->payload_config = $var; + + return $this; } /** - *
      * Specify the cores we should run the server on, if desired
-     * 
* - * repeated int32 core_list = 10; + * Generated from protobuf field repeated int32 core_list = 10; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getCoreList() { @@ -239,24 +248,25 @@ class ServerConfig extends \Google\Protobuf\Internal\Message } /** - *
      * Specify the cores we should run the server on, if desired
-     * 
* - * repeated int32 core_list = 10; + * Generated from protobuf field repeated int32 core_list = 10; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ - public function setCoreList(&$var) + public function setCoreList($var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); - $this->core_list = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->core_list = $arr; + + return $this; } /** - *
      * If we use an OTHER_SERVER client_type, this string gives more detail
-     * 
* - * string other_server_api = 11; + * Generated from protobuf field string other_server_api = 11; + * @return string */ public function getOtherServerApi() { @@ -264,24 +274,51 @@ class ServerConfig extends \Google\Protobuf\Internal\Message } /** - *
      * If we use an OTHER_SERVER client_type, this string gives more detail
-     * 
* - * string other_server_api = 11; + * Generated from protobuf field string other_server_api = 11; + * @param string $var + * @return $this */ public function setOtherServerApi($var) { GPBUtil::checkString($var, True); $this->other_server_api = $var; + + return $this; + } + + /** + * Number of threads that share each completion queue + * + * Generated from protobuf field int32 threads_per_cq = 12; + * @return int + */ + public function getThreadsPerCq() + { + return $this->threads_per_cq; + } + + /** + * Number of threads that share each completion queue + * + * Generated from protobuf field int32 threads_per_cq = 12; + * @param int $var + * @return $this + */ + public function setThreadsPerCq($var) + { + GPBUtil::checkInt32($var); + $this->threads_per_cq = $var; + + return $this; } /** - *
      * Buffer pool size (no buffer pool specified if unset)
-     * 
* - * int32 resource_quota_size = 1001; + * Generated from protobuf field int32 resource_quota_size = 1001; + * @return int */ public function getResourceQuotaSize() { @@ -289,16 +326,40 @@ class ServerConfig extends \Google\Protobuf\Internal\Message } /** - *
      * Buffer pool size (no buffer pool specified if unset)
-     * 
* - * int32 resource_quota_size = 1001; + * Generated from protobuf field int32 resource_quota_size = 1001; + * @param int $var + * @return $this */ public function setResourceQuotaSize($var) { GPBUtil::checkInt32($var); $this->resource_quota_size = $var; + + return $this; + } + + /** + * Generated from protobuf field repeated .grpc.testing.ChannelArg channel_args = 1002; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getChannelArgs() + { + return $this->channel_args; + } + + /** + * Generated from protobuf field repeated .grpc.testing.ChannelArg channel_args = 1002; + * @param \Grpc\Testing\ChannelArg[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setChannelArgs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Testing\ChannelArg::class); + $this->channel_args = $arr; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ServerStats.php b/src/php/tests/qps/generated_code/Grpc/Testing/ServerStats.php index 98b2af764c9..aea2cb0fce3 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ServerStats.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ServerStats.php @@ -9,51 +9,53 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type grpc.testing.ServerStats + * Generated from protobuf message grpc.testing.ServerStats */ class ServerStats extends \Google\Protobuf\Internal\Message { /** - *
      * wall clock time change in seconds since last reset
-     * 
* - * double time_elapsed = 1; + * Generated from protobuf field double time_elapsed = 1; */ private $time_elapsed = 0.0; /** - *
      * change in user time (in seconds) used by the server since last reset
-     * 
* - * double time_user = 2; + * Generated from protobuf field double time_user = 2; */ private $time_user = 0.0; /** - *
      * change in server time (in seconds) used by the server process and all
      * threads since last reset
-     * 
* - * double time_system = 3; + * Generated from protobuf field double time_system = 3; */ private $time_system = 0.0; /** - *
      * change in total cpu time of the server (data from proc/stat)
-     * 
* - * uint64 total_cpu_time = 4; + * Generated from protobuf field uint64 total_cpu_time = 4; */ private $total_cpu_time = 0; /** - *
      * change in idle time of the server (data from proc/stat)
-     * 
* - * uint64 idle_cpu_time = 5; + * Generated from protobuf field uint64 idle_cpu_time = 5; */ private $idle_cpu_time = 0; + /** + * Number of polls called inside completion queue + * + * Generated from protobuf field uint64 cq_poll_count = 6; + */ + private $cq_poll_count = 0; + /** + * Core library stats + * + * Generated from protobuf field .grpc.core.Stats core_stats = 7; + */ + private $core_stats = null; public function __construct() { \GPBMetadata\Src\Proto\Grpc\Testing\Stats::initOnce(); @@ -61,11 +63,10 @@ class ServerStats extends \Google\Protobuf\Internal\Message } /** - *
      * wall clock time change in seconds since last reset
-     * 
* - * double time_elapsed = 1; + * Generated from protobuf field double time_elapsed = 1; + * @return float */ public function getTimeElapsed() { @@ -73,24 +74,25 @@ class ServerStats extends \Google\Protobuf\Internal\Message } /** - *
      * wall clock time change in seconds since last reset
-     * 
* - * double time_elapsed = 1; + * Generated from protobuf field double time_elapsed = 1; + * @param float $var + * @return $this */ public function setTimeElapsed($var) { GPBUtil::checkDouble($var); $this->time_elapsed = $var; + + return $this; } /** - *
      * change in user time (in seconds) used by the server since last reset
-     * 
* - * double time_user = 2; + * Generated from protobuf field double time_user = 2; + * @return float */ public function getTimeUser() { @@ -98,25 +100,26 @@ class ServerStats extends \Google\Protobuf\Internal\Message } /** - *
      * change in user time (in seconds) used by the server since last reset
-     * 
* - * double time_user = 2; + * Generated from protobuf field double time_user = 2; + * @param float $var + * @return $this */ public function setTimeUser($var) { GPBUtil::checkDouble($var); $this->time_user = $var; + + return $this; } /** - *
      * change in server time (in seconds) used by the server process and all
      * threads since last reset
-     * 
* - * double time_system = 3; + * Generated from protobuf field double time_system = 3; + * @return float */ public function getTimeSystem() { @@ -124,25 +127,26 @@ class ServerStats extends \Google\Protobuf\Internal\Message } /** - *
      * change in server time (in seconds) used by the server process and all
      * threads since last reset
-     * 
* - * double time_system = 3; + * Generated from protobuf field double time_system = 3; + * @param float $var + * @return $this */ public function setTimeSystem($var) { GPBUtil::checkDouble($var); $this->time_system = $var; + + return $this; } /** - *
      * change in total cpu time of the server (data from proc/stat)
-     * 
* - * uint64 total_cpu_time = 4; + * Generated from protobuf field uint64 total_cpu_time = 4; + * @return int|string */ public function getTotalCpuTime() { @@ -150,24 +154,25 @@ class ServerStats extends \Google\Protobuf\Internal\Message } /** - *
      * change in total cpu time of the server (data from proc/stat)
-     * 
* - * uint64 total_cpu_time = 4; + * Generated from protobuf field uint64 total_cpu_time = 4; + * @param int|string $var + * @return $this */ public function setTotalCpuTime($var) { GPBUtil::checkUint64($var); $this->total_cpu_time = $var; + + return $this; } /** - *
      * change in idle time of the server (data from proc/stat)
-     * 
* - * uint64 idle_cpu_time = 5; + * Generated from protobuf field uint64 idle_cpu_time = 5; + * @return int|string */ public function getIdleCpuTime() { @@ -175,16 +180,70 @@ class ServerStats extends \Google\Protobuf\Internal\Message } /** - *
      * change in idle time of the server (data from proc/stat)
-     * 
* - * uint64 idle_cpu_time = 5; + * Generated from protobuf field uint64 idle_cpu_time = 5; + * @param int|string $var + * @return $this */ public function setIdleCpuTime($var) { GPBUtil::checkUint64($var); $this->idle_cpu_time = $var; + + return $this; + } + + /** + * Number of polls called inside completion queue + * + * Generated from protobuf field uint64 cq_poll_count = 6; + * @return int|string + */ + public function getCqPollCount() + { + return $this->cq_poll_count; + } + + /** + * Number of polls called inside completion queue + * + * Generated from protobuf field uint64 cq_poll_count = 6; + * @param int|string $var + * @return $this + */ + public function setCqPollCount($var) + { + GPBUtil::checkUint64($var); + $this->cq_poll_count = $var; + + return $this; + } + + /** + * Core library stats + * + * Generated from protobuf field .grpc.core.Stats core_stats = 7; + * @return \Grpc\Core\Stats + */ + public function getCoreStats() + { + return $this->core_stats; + } + + /** + * Core library stats + * + * Generated from protobuf field .grpc.core.Stats core_stats = 7; + * @param \Grpc\Core\Stats $var + * @return $this + */ + public function setCoreStats($var) + { + GPBUtil::checkMessage($var, \Grpc\Core\Stats::class); + $this->core_stats = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ServerStatus.php b/src/php/tests/qps/generated_code/Grpc/Testing/ServerStatus.php index d293f03fbdf..04f2ca7c4ae 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ServerStatus.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ServerStatus.php @@ -9,28 +9,24 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type grpc.testing.ServerStatus + * Generated from protobuf message grpc.testing.ServerStatus */ class ServerStatus extends \Google\Protobuf\Internal\Message { /** - * .grpc.testing.ServerStats stats = 1; + * Generated from protobuf field .grpc.testing.ServerStats stats = 1; */ private $stats = null; /** - *
      * the port bound by the server
-     * 
* - * int32 port = 2; + * Generated from protobuf field int32 port = 2; */ private $port = 0; /** - *
      * Number of cores available to the server
-     * 
* - * int32 cores = 3; + * Generated from protobuf field int32 cores = 3; */ private $cores = 0; @@ -40,7 +36,8 @@ class ServerStatus extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.ServerStats stats = 1; + * Generated from protobuf field .grpc.testing.ServerStats stats = 1; + * @return \Grpc\Testing\ServerStats */ public function getStats() { @@ -48,20 +45,23 @@ class ServerStatus extends \Google\Protobuf\Internal\Message } /** - * .grpc.testing.ServerStats stats = 1; + * Generated from protobuf field .grpc.testing.ServerStats stats = 1; + * @param \Grpc\Testing\ServerStats $var + * @return $this */ - public function setStats(&$var) + public function setStats($var) { GPBUtil::checkMessage($var, \Grpc\Testing\ServerStats::class); $this->stats = $var; + + return $this; } /** - *
      * the port bound by the server
-     * 
* - * int32 port = 2; + * Generated from protobuf field int32 port = 2; + * @return int */ public function getPort() { @@ -69,24 +69,25 @@ class ServerStatus extends \Google\Protobuf\Internal\Message } /** - *
      * the port bound by the server
-     * 
* - * int32 port = 2; + * Generated from protobuf field int32 port = 2; + * @param int $var + * @return $this */ public function setPort($var) { GPBUtil::checkInt32($var); $this->port = $var; + + return $this; } /** - *
      * Number of cores available to the server
-     * 
* - * int32 cores = 3; + * Generated from protobuf field int32 cores = 3; + * @return int */ public function getCores() { @@ -94,16 +95,18 @@ class ServerStatus extends \Google\Protobuf\Internal\Message } /** - *
      * Number of cores available to the server
-     * 
* - * int32 cores = 3; + * Generated from protobuf field int32 cores = 3; + * @param int $var + * @return $this */ public function setCores($var) { GPBUtil::checkInt32($var); $this->cores = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ServerType.php b/src/php/tests/qps/generated_code/Grpc/Testing/ServerType.php index 605c83c3f76..4110e91c18a 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ServerType.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ServerType.php @@ -5,28 +5,26 @@ namespace Grpc\Testing; /** - * Protobuf enum grpc.testing.ServerType + * Protobuf enum Grpc\Testing\ServerType */ class ServerType { /** - * SYNC_SERVER = 0; + * Generated from protobuf enum SYNC_SERVER = 0; */ const SYNC_SERVER = 0; /** - * ASYNC_SERVER = 1; + * Generated from protobuf enum ASYNC_SERVER = 1; */ const ASYNC_SERVER = 1; /** - * ASYNC_GENERIC_SERVER = 2; + * Generated from protobuf enum ASYNC_GENERIC_SERVER = 2; */ const ASYNC_GENERIC_SERVER = 2; /** - *
      * used for some language-specific variants
-     * 
* - * OTHER_SERVER = 3; + * Generated from protobuf enum OTHER_SERVER = 3; */ const OTHER_SERVER = 3; } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/SimpleProtoParams.php b/src/php/tests/qps/generated_code/Grpc/Testing/SimpleProtoParams.php index 29834a3be71..507db598f03 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/SimpleProtoParams.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/SimpleProtoParams.php @@ -9,16 +9,16 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type grpc.testing.SimpleProtoParams + * Generated from protobuf message grpc.testing.SimpleProtoParams */ class SimpleProtoParams extends \Google\Protobuf\Internal\Message { /** - * int32 req_size = 1; + * Generated from protobuf field int32 req_size = 1; */ private $req_size = 0; /** - * int32 resp_size = 2; + * Generated from protobuf field int32 resp_size = 2; */ private $resp_size = 0; @@ -28,7 +28,8 @@ class SimpleProtoParams extends \Google\Protobuf\Internal\Message } /** - * int32 req_size = 1; + * Generated from protobuf field int32 req_size = 1; + * @return int */ public function getReqSize() { @@ -36,16 +37,21 @@ class SimpleProtoParams extends \Google\Protobuf\Internal\Message } /** - * int32 req_size = 1; + * Generated from protobuf field int32 req_size = 1; + * @param int $var + * @return $this */ public function setReqSize($var) { GPBUtil::checkInt32($var); $this->req_size = $var; + + return $this; } /** - * int32 resp_size = 2; + * Generated from protobuf field int32 resp_size = 2; + * @return int */ public function getRespSize() { @@ -53,12 +59,16 @@ class SimpleProtoParams extends \Google\Protobuf\Internal\Message } /** - * int32 resp_size = 2; + * Generated from protobuf field int32 resp_size = 2; + * @param int $var + * @return $this */ public function setRespSize($var) { GPBUtil::checkInt32($var); $this->resp_size = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/SimpleRequest.php b/src/php/tests/qps/generated_code/Grpc/Testing/SimpleRequest.php index f84c95319f4..e0c2d2d94ce 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/SimpleRequest.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/SimpleRequest.php @@ -9,81 +9,63 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Unary request.
- * 
* - * Protobuf type grpc.testing.SimpleRequest + * Generated from protobuf message grpc.testing.SimpleRequest */ class SimpleRequest extends \Google\Protobuf\Internal\Message { /** - *
      * DEPRECATED, don't use. To be removed shortly.
      * Desired payload type in the response from the server.
      * If response_type is RANDOM, server randomly chooses one from other formats.
-     * 
* - * .grpc.testing.PayloadType response_type = 1; + * Generated from protobuf field .grpc.testing.PayloadType response_type = 1; */ private $response_type = 0; /** - *
      * Desired payload size in the response from the server.
-     * 
* - * int32 response_size = 2; + * Generated from protobuf field int32 response_size = 2; */ private $response_size = 0; /** - *
      * Optional input payload sent along with the request.
-     * 
* - * .grpc.testing.Payload payload = 3; + * Generated from protobuf field .grpc.testing.Payload payload = 3; */ private $payload = null; /** - *
      * Whether SimpleResponse should include username.
-     * 
* - * bool fill_username = 4; + * Generated from protobuf field bool fill_username = 4; */ private $fill_username = false; /** - *
      * Whether SimpleResponse should include OAuth scope.
-     * 
* - * bool fill_oauth_scope = 5; + * Generated from protobuf field bool fill_oauth_scope = 5; */ private $fill_oauth_scope = false; /** - *
      * Whether to request the server to compress the response. This field is
      * "nullable" in order to interoperate seamlessly with clients not able to
      * implement the full compression tests by introspecting the call to verify
      * the response's compression status.
-     * 
* - * .grpc.testing.BoolValue response_compressed = 6; + * Generated from protobuf field .grpc.testing.BoolValue response_compressed = 6; */ private $response_compressed = null; /** - *
      * Whether server should return a given status
-     * 
* - * .grpc.testing.EchoStatus response_status = 7; + * Generated from protobuf field .grpc.testing.EchoStatus response_status = 7; */ private $response_status = null; /** - *
      * Whether the server should expect this request to be compressed.
-     * 
* - * .grpc.testing.BoolValue expect_compressed = 8; + * Generated from protobuf field .grpc.testing.BoolValue expect_compressed = 8; */ private $expect_compressed = null; @@ -93,13 +75,12 @@ class SimpleRequest extends \Google\Protobuf\Internal\Message } /** - *
      * DEPRECATED, don't use. To be removed shortly.
      * Desired payload type in the response from the server.
      * If response_type is RANDOM, server randomly chooses one from other formats.
-     * 
* - * .grpc.testing.PayloadType response_type = 1; + * Generated from protobuf field .grpc.testing.PayloadType response_type = 1; + * @return int */ public function getResponseType() { @@ -107,26 +88,27 @@ class SimpleRequest extends \Google\Protobuf\Internal\Message } /** - *
      * DEPRECATED, don't use. To be removed shortly.
      * Desired payload type in the response from the server.
      * If response_type is RANDOM, server randomly chooses one from other formats.
-     * 
* - * .grpc.testing.PayloadType response_type = 1; + * Generated from protobuf field .grpc.testing.PayloadType response_type = 1; + * @param int $var + * @return $this */ public function setResponseType($var) { GPBUtil::checkEnum($var, \Grpc\Testing\PayloadType::class); $this->response_type = $var; + + return $this; } /** - *
      * Desired payload size in the response from the server.
-     * 
* - * int32 response_size = 2; + * Generated from protobuf field int32 response_size = 2; + * @return int */ public function getResponseSize() { @@ -134,24 +116,25 @@ class SimpleRequest extends \Google\Protobuf\Internal\Message } /** - *
      * Desired payload size in the response from the server.
-     * 
* - * int32 response_size = 2; + * Generated from protobuf field int32 response_size = 2; + * @param int $var + * @return $this */ public function setResponseSize($var) { GPBUtil::checkInt32($var); $this->response_size = $var; + + return $this; } /** - *
      * Optional input payload sent along with the request.
-     * 
* - * .grpc.testing.Payload payload = 3; + * Generated from protobuf field .grpc.testing.Payload payload = 3; + * @return \Grpc\Testing\Payload */ public function getPayload() { @@ -159,24 +142,25 @@ class SimpleRequest extends \Google\Protobuf\Internal\Message } /** - *
      * Optional input payload sent along with the request.
-     * 
* - * .grpc.testing.Payload payload = 3; + * Generated from protobuf field .grpc.testing.Payload payload = 3; + * @param \Grpc\Testing\Payload $var + * @return $this */ - public function setPayload(&$var) + public function setPayload($var) { GPBUtil::checkMessage($var, \Grpc\Testing\Payload::class); $this->payload = $var; + + return $this; } /** - *
      * Whether SimpleResponse should include username.
-     * 
* - * bool fill_username = 4; + * Generated from protobuf field bool fill_username = 4; + * @return bool */ public function getFillUsername() { @@ -184,24 +168,25 @@ class SimpleRequest extends \Google\Protobuf\Internal\Message } /** - *
      * Whether SimpleResponse should include username.
-     * 
* - * bool fill_username = 4; + * Generated from protobuf field bool fill_username = 4; + * @param bool $var + * @return $this */ public function setFillUsername($var) { GPBUtil::checkBool($var); $this->fill_username = $var; + + return $this; } /** - *
      * Whether SimpleResponse should include OAuth scope.
-     * 
* - * bool fill_oauth_scope = 5; + * Generated from protobuf field bool fill_oauth_scope = 5; + * @return bool */ public function getFillOauthScope() { @@ -209,27 +194,28 @@ class SimpleRequest extends \Google\Protobuf\Internal\Message } /** - *
      * Whether SimpleResponse should include OAuth scope.
-     * 
* - * bool fill_oauth_scope = 5; + * Generated from protobuf field bool fill_oauth_scope = 5; + * @param bool $var + * @return $this */ public function setFillOauthScope($var) { GPBUtil::checkBool($var); $this->fill_oauth_scope = $var; + + return $this; } /** - *
      * Whether to request the server to compress the response. This field is
      * "nullable" in order to interoperate seamlessly with clients not able to
      * implement the full compression tests by introspecting the call to verify
      * the response's compression status.
-     * 
* - * .grpc.testing.BoolValue response_compressed = 6; + * Generated from protobuf field .grpc.testing.BoolValue response_compressed = 6; + * @return \Grpc\Testing\BoolValue */ public function getResponseCompressed() { @@ -237,27 +223,28 @@ class SimpleRequest extends \Google\Protobuf\Internal\Message } /** - *
      * Whether to request the server to compress the response. This field is
      * "nullable" in order to interoperate seamlessly with clients not able to
      * implement the full compression tests by introspecting the call to verify
      * the response's compression status.
-     * 
* - * .grpc.testing.BoolValue response_compressed = 6; + * Generated from protobuf field .grpc.testing.BoolValue response_compressed = 6; + * @param \Grpc\Testing\BoolValue $var + * @return $this */ - public function setResponseCompressed(&$var) + public function setResponseCompressed($var) { GPBUtil::checkMessage($var, \Grpc\Testing\BoolValue::class); $this->response_compressed = $var; + + return $this; } /** - *
      * Whether server should return a given status
-     * 
* - * .grpc.testing.EchoStatus response_status = 7; + * Generated from protobuf field .grpc.testing.EchoStatus response_status = 7; + * @return \Grpc\Testing\EchoStatus */ public function getResponseStatus() { @@ -265,24 +252,25 @@ class SimpleRequest extends \Google\Protobuf\Internal\Message } /** - *
      * Whether server should return a given status
-     * 
* - * .grpc.testing.EchoStatus response_status = 7; + * Generated from protobuf field .grpc.testing.EchoStatus response_status = 7; + * @param \Grpc\Testing\EchoStatus $var + * @return $this */ - public function setResponseStatus(&$var) + public function setResponseStatus($var) { GPBUtil::checkMessage($var, \Grpc\Testing\EchoStatus::class); $this->response_status = $var; + + return $this; } /** - *
      * Whether the server should expect this request to be compressed.
-     * 
* - * .grpc.testing.BoolValue expect_compressed = 8; + * Generated from protobuf field .grpc.testing.BoolValue expect_compressed = 8; + * @return \Grpc\Testing\BoolValue */ public function getExpectCompressed() { @@ -290,16 +278,18 @@ class SimpleRequest extends \Google\Protobuf\Internal\Message } /** - *
      * Whether the server should expect this request to be compressed.
-     * 
* - * .grpc.testing.BoolValue expect_compressed = 8; + * Generated from protobuf field .grpc.testing.BoolValue expect_compressed = 8; + * @param \Grpc\Testing\BoolValue $var + * @return $this */ - public function setExpectCompressed(&$var) + public function setExpectCompressed($var) { GPBUtil::checkMessage($var, \Grpc\Testing\BoolValue::class); $this->expect_compressed = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/SimpleResponse.php b/src/php/tests/qps/generated_code/Grpc/Testing/SimpleResponse.php index ccc628ec4c0..d49f33746e2 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/SimpleResponse.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/SimpleResponse.php @@ -9,37 +9,29 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Unary response, as configured by the request.
- * 
* - * Protobuf type grpc.testing.SimpleResponse + * Generated from protobuf message grpc.testing.SimpleResponse */ class SimpleResponse extends \Google\Protobuf\Internal\Message { /** - *
      * Payload to increase message size.
-     * 
* - * .grpc.testing.Payload payload = 1; + * Generated from protobuf field .grpc.testing.Payload payload = 1; */ private $payload = null; /** - *
      * The user the request came from, for verifying authentication was
      * successful when the client expected it.
-     * 
* - * string username = 2; + * Generated from protobuf field string username = 2; */ private $username = ''; /** - *
      * OAuth scope.
-     * 
* - * string oauth_scope = 3; + * Generated from protobuf field string oauth_scope = 3; */ private $oauth_scope = ''; @@ -49,11 +41,10 @@ class SimpleResponse extends \Google\Protobuf\Internal\Message } /** - *
      * Payload to increase message size.
-     * 
* - * .grpc.testing.Payload payload = 1; + * Generated from protobuf field .grpc.testing.Payload payload = 1; + * @return \Grpc\Testing\Payload */ public function getPayload() { @@ -61,25 +52,26 @@ class SimpleResponse extends \Google\Protobuf\Internal\Message } /** - *
      * Payload to increase message size.
-     * 
* - * .grpc.testing.Payload payload = 1; + * Generated from protobuf field .grpc.testing.Payload payload = 1; + * @param \Grpc\Testing\Payload $var + * @return $this */ - public function setPayload(&$var) + public function setPayload($var) { GPBUtil::checkMessage($var, \Grpc\Testing\Payload::class); $this->payload = $var; + + return $this; } /** - *
      * The user the request came from, for verifying authentication was
      * successful when the client expected it.
-     * 
* - * string username = 2; + * Generated from protobuf field string username = 2; + * @return string */ public function getUsername() { @@ -87,25 +79,26 @@ class SimpleResponse extends \Google\Protobuf\Internal\Message } /** - *
      * The user the request came from, for verifying authentication was
      * successful when the client expected it.
-     * 
* - * string username = 2; + * Generated from protobuf field string username = 2; + * @param string $var + * @return $this */ public function setUsername($var) { GPBUtil::checkString($var, True); $this->username = $var; + + return $this; } /** - *
      * OAuth scope.
-     * 
* - * string oauth_scope = 3; + * Generated from protobuf field string oauth_scope = 3; + * @return string */ public function getOauthScope() { @@ -113,16 +106,18 @@ class SimpleResponse extends \Google\Protobuf\Internal\Message } /** - *
      * OAuth scope.
-     * 
* - * string oauth_scope = 3; + * Generated from protobuf field string oauth_scope = 3; + * @param string $var + * @return $this */ public function setOauthScope($var) { GPBUtil::checkString($var, True); $this->oauth_scope = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/StreamingInputCallRequest.php b/src/php/tests/qps/generated_code/Grpc/Testing/StreamingInputCallRequest.php index d7bbc707799..a7460af83a3 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/StreamingInputCallRequest.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/StreamingInputCallRequest.php @@ -9,31 +9,25 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Client-streaming request.
- * 
* - * Protobuf type grpc.testing.StreamingInputCallRequest + * Generated from protobuf message grpc.testing.StreamingInputCallRequest */ class StreamingInputCallRequest extends \Google\Protobuf\Internal\Message { /** - *
      * Optional input payload sent along with the request.
-     * 
* - * .grpc.testing.Payload payload = 1; + * Generated from protobuf field .grpc.testing.Payload payload = 1; */ private $payload = null; /** - *
      * Whether the server should expect this request to be compressed. This field
      * is "nullable" in order to interoperate seamlessly with servers not able to
      * implement the full compression tests by introspecting the call to verify
      * the request's compression status.
-     * 
* - * .grpc.testing.BoolValue expect_compressed = 2; + * Generated from protobuf field .grpc.testing.BoolValue expect_compressed = 2; */ private $expect_compressed = null; @@ -43,11 +37,10 @@ class StreamingInputCallRequest extends \Google\Protobuf\Internal\Message } /** - *
      * Optional input payload sent along with the request.
-     * 
* - * .grpc.testing.Payload payload = 1; + * Generated from protobuf field .grpc.testing.Payload payload = 1; + * @return \Grpc\Testing\Payload */ public function getPayload() { @@ -55,27 +48,28 @@ class StreamingInputCallRequest extends \Google\Protobuf\Internal\Message } /** - *
      * Optional input payload sent along with the request.
-     * 
* - * .grpc.testing.Payload payload = 1; + * Generated from protobuf field .grpc.testing.Payload payload = 1; + * @param \Grpc\Testing\Payload $var + * @return $this */ - public function setPayload(&$var) + public function setPayload($var) { GPBUtil::checkMessage($var, \Grpc\Testing\Payload::class); $this->payload = $var; + + return $this; } /** - *
      * Whether the server should expect this request to be compressed. This field
      * is "nullable" in order to interoperate seamlessly with servers not able to
      * implement the full compression tests by introspecting the call to verify
      * the request's compression status.
-     * 
* - * .grpc.testing.BoolValue expect_compressed = 2; + * Generated from protobuf field .grpc.testing.BoolValue expect_compressed = 2; + * @return \Grpc\Testing\BoolValue */ public function getExpectCompressed() { @@ -83,19 +77,21 @@ class StreamingInputCallRequest extends \Google\Protobuf\Internal\Message } /** - *
      * Whether the server should expect this request to be compressed. This field
      * is "nullable" in order to interoperate seamlessly with servers not able to
      * implement the full compression tests by introspecting the call to verify
      * the request's compression status.
-     * 
* - * .grpc.testing.BoolValue expect_compressed = 2; + * Generated from protobuf field .grpc.testing.BoolValue expect_compressed = 2; + * @param \Grpc\Testing\BoolValue $var + * @return $this */ - public function setExpectCompressed(&$var) + public function setExpectCompressed($var) { GPBUtil::checkMessage($var, \Grpc\Testing\BoolValue::class); $this->expect_compressed = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/StreamingInputCallResponse.php b/src/php/tests/qps/generated_code/Grpc/Testing/StreamingInputCallResponse.php index fdd1d0dbf8a..41f3893aa3f 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/StreamingInputCallResponse.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/StreamingInputCallResponse.php @@ -9,20 +9,16 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Client-streaming response.
- * 
* - * Protobuf type grpc.testing.StreamingInputCallResponse + * Generated from protobuf message grpc.testing.StreamingInputCallResponse */ class StreamingInputCallResponse extends \Google\Protobuf\Internal\Message { /** - *
      * Aggregated size of payloads received from the client.
-     * 
* - * int32 aggregated_payload_size = 1; + * Generated from protobuf field int32 aggregated_payload_size = 1; */ private $aggregated_payload_size = 0; @@ -32,11 +28,10 @@ class StreamingInputCallResponse extends \Google\Protobuf\Internal\Message } /** - *
      * Aggregated size of payloads received from the client.
-     * 
* - * int32 aggregated_payload_size = 1; + * Generated from protobuf field int32 aggregated_payload_size = 1; + * @return int */ public function getAggregatedPayloadSize() { @@ -44,16 +39,18 @@ class StreamingInputCallResponse extends \Google\Protobuf\Internal\Message } /** - *
      * Aggregated size of payloads received from the client.
-     * 
* - * int32 aggregated_payload_size = 1; + * Generated from protobuf field int32 aggregated_payload_size = 1; + * @param int $var + * @return $this */ public function setAggregatedPayloadSize($var) { GPBUtil::checkInt32($var); $this->aggregated_payload_size = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/StreamingOutputCallRequest.php b/src/php/tests/qps/generated_code/Grpc/Testing/StreamingOutputCallRequest.php index 2aab5fadad7..69d9cecffa7 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/StreamingOutputCallRequest.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/StreamingOutputCallRequest.php @@ -9,48 +9,38 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Server-streaming request.
- * 
* - * Protobuf type grpc.testing.StreamingOutputCallRequest + * Generated from protobuf message grpc.testing.StreamingOutputCallRequest */ class StreamingOutputCallRequest extends \Google\Protobuf\Internal\Message { /** - *
      * DEPRECATED, don't use. To be removed shortly.
      * Desired payload type in the response from the server.
      * If response_type is RANDOM, the payload from each response in the stream
      * might be of different types. This is to simulate a mixed type of payload
      * stream.
-     * 
* - * .grpc.testing.PayloadType response_type = 1; + * Generated from protobuf field .grpc.testing.PayloadType response_type = 1; */ private $response_type = 0; /** - *
      * Configuration for each expected response message.
-     * 
* - * repeated .grpc.testing.ResponseParameters response_parameters = 2; + * Generated from protobuf field repeated .grpc.testing.ResponseParameters response_parameters = 2; */ private $response_parameters; /** - *
      * Optional input payload sent along with the request.
-     * 
* - * .grpc.testing.Payload payload = 3; + * Generated from protobuf field .grpc.testing.Payload payload = 3; */ private $payload = null; /** - *
      * Whether server should return a given status
-     * 
* - * .grpc.testing.EchoStatus response_status = 7; + * Generated from protobuf field .grpc.testing.EchoStatus response_status = 7; */ private $response_status = null; @@ -60,15 +50,14 @@ class StreamingOutputCallRequest extends \Google\Protobuf\Internal\Message } /** - *
      * DEPRECATED, don't use. To be removed shortly.
      * Desired payload type in the response from the server.
      * If response_type is RANDOM, the payload from each response in the stream
      * might be of different types. This is to simulate a mixed type of payload
      * stream.
-     * 
* - * .grpc.testing.PayloadType response_type = 1; + * Generated from protobuf field .grpc.testing.PayloadType response_type = 1; + * @return int */ public function getResponseType() { @@ -76,28 +65,29 @@ class StreamingOutputCallRequest extends \Google\Protobuf\Internal\Message } /** - *
      * DEPRECATED, don't use. To be removed shortly.
      * Desired payload type in the response from the server.
      * If response_type is RANDOM, the payload from each response in the stream
      * might be of different types. This is to simulate a mixed type of payload
      * stream.
-     * 
* - * .grpc.testing.PayloadType response_type = 1; + * Generated from protobuf field .grpc.testing.PayloadType response_type = 1; + * @param int $var + * @return $this */ public function setResponseType($var) { GPBUtil::checkEnum($var, \Grpc\Testing\PayloadType::class); $this->response_type = $var; + + return $this; } /** - *
      * Configuration for each expected response message.
-     * 
* - * repeated .grpc.testing.ResponseParameters response_parameters = 2; + * Generated from protobuf field repeated .grpc.testing.ResponseParameters response_parameters = 2; + * @return \Google\Protobuf\Internal\RepeatedField */ public function getResponseParameters() { @@ -105,24 +95,25 @@ class StreamingOutputCallRequest extends \Google\Protobuf\Internal\Message } /** - *
      * Configuration for each expected response message.
-     * 
* - * repeated .grpc.testing.ResponseParameters response_parameters = 2; + * Generated from protobuf field repeated .grpc.testing.ResponseParameters response_parameters = 2; + * @param \Grpc\Testing\ResponseParameters[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this */ - public function setResponseParameters(&$var) + public function setResponseParameters($var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Testing\ResponseParameters::class); - $this->response_parameters = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Testing\ResponseParameters::class); + $this->response_parameters = $arr; + + return $this; } /** - *
      * Optional input payload sent along with the request.
-     * 
* - * .grpc.testing.Payload payload = 3; + * Generated from protobuf field .grpc.testing.Payload payload = 3; + * @return \Grpc\Testing\Payload */ public function getPayload() { @@ -130,24 +121,25 @@ class StreamingOutputCallRequest extends \Google\Protobuf\Internal\Message } /** - *
      * Optional input payload sent along with the request.
-     * 
* - * .grpc.testing.Payload payload = 3; + * Generated from protobuf field .grpc.testing.Payload payload = 3; + * @param \Grpc\Testing\Payload $var + * @return $this */ - public function setPayload(&$var) + public function setPayload($var) { GPBUtil::checkMessage($var, \Grpc\Testing\Payload::class); $this->payload = $var; + + return $this; } /** - *
      * Whether server should return a given status
-     * 
* - * .grpc.testing.EchoStatus response_status = 7; + * Generated from protobuf field .grpc.testing.EchoStatus response_status = 7; + * @return \Grpc\Testing\EchoStatus */ public function getResponseStatus() { @@ -155,16 +147,18 @@ class StreamingOutputCallRequest extends \Google\Protobuf\Internal\Message } /** - *
      * Whether server should return a given status
-     * 
* - * .grpc.testing.EchoStatus response_status = 7; + * Generated from protobuf field .grpc.testing.EchoStatus response_status = 7; + * @param \Grpc\Testing\EchoStatus $var + * @return $this */ - public function setResponseStatus(&$var) + public function setResponseStatus($var) { GPBUtil::checkMessage($var, \Grpc\Testing\EchoStatus::class); $this->response_status = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/StreamingOutputCallResponse.php b/src/php/tests/qps/generated_code/Grpc/Testing/StreamingOutputCallResponse.php index c06c78c9d8f..52315bb4995 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/StreamingOutputCallResponse.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/StreamingOutputCallResponse.php @@ -9,20 +9,16 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - *
  * Server-streaming response, as configured by the request and parameters.
- * 
* - * Protobuf type grpc.testing.StreamingOutputCallResponse + * Generated from protobuf message grpc.testing.StreamingOutputCallResponse */ class StreamingOutputCallResponse extends \Google\Protobuf\Internal\Message { /** - *
      * Payload to increase response size.
-     * 
* - * .grpc.testing.Payload payload = 1; + * Generated from protobuf field .grpc.testing.Payload payload = 1; */ private $payload = null; @@ -32,11 +28,10 @@ class StreamingOutputCallResponse extends \Google\Protobuf\Internal\Message } /** - *
      * Payload to increase response size.
-     * 
* - * .grpc.testing.Payload payload = 1; + * Generated from protobuf field .grpc.testing.Payload payload = 1; + * @return \Grpc\Testing\Payload */ public function getPayload() { @@ -44,16 +39,18 @@ class StreamingOutputCallResponse extends \Google\Protobuf\Internal\Message } /** - *
      * Payload to increase response size.
-     * 
* - * .grpc.testing.Payload payload = 1; + * Generated from protobuf field .grpc.testing.Payload payload = 1; + * @param \Grpc\Testing\Payload $var + * @return $this */ - public function setPayload(&$var) + public function setPayload($var) { GPBUtil::checkMessage($var, \Grpc\Testing\Payload::class); $this->payload = $var; + + return $this; } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/Void.php b/src/php/tests/qps/generated_code/Grpc/Testing/Void.php index 38c100845a0..623021d99b9 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/Void.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/Void.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** - * Protobuf type grpc.testing.Void + * Generated from protobuf message grpc.testing.Void */ class Void extends \Google\Protobuf\Internal\Message { diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/WorkerServiceClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/WorkerServiceClient.php index 959d839c80a..98c244ff9dc 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/WorkerServiceClient.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/WorkerServiceClient.php @@ -18,17 +18,19 @@ // // An integration test service that covers all the method signature permutations // of unary/streaming requests/responses. -namespace Grpc\Testing { +namespace Grpc\Testing; - class WorkerServiceClient extends \Grpc\BaseStub { +/** + */ +class WorkerServiceClient extends \Grpc\BaseStub { /** * @param string $hostname hostname * @param array $opts channel options - * @param Grpc\Channel $channel (optional) re-use channel object + * @param \Grpc\Channel $channel (optional) re-use channel object */ public function __construct($hostname, $opts, $channel = null) { - parent::__construct($hostname, $opts, $channel); + parent::__construct($hostname, $opts, $channel); } /** @@ -42,9 +44,9 @@ namespace Grpc\Testing { * @param array $options call options */ public function RunServer($metadata = [], $options = []) { - return $this->_bidiRequest('/grpc.testing.WorkerService/RunServer', - ['\Grpc\Testing\ServerStatus','decode'], - $metadata, $options); + return $this->_bidiRequest('/grpc.testing.WorkerService/RunServer', + ['\Grpc\Testing\ServerStatus','decode'], + $metadata, $options); } /** @@ -58,9 +60,9 @@ namespace Grpc\Testing { * @param array $options call options */ public function RunClient($metadata = [], $options = []) { - return $this->_bidiRequest('/grpc.testing.WorkerService/RunClient', - ['\Grpc\Testing\ClientStatus','decode'], - $metadata, $options); + return $this->_bidiRequest('/grpc.testing.WorkerService/RunClient', + ['\Grpc\Testing\ClientStatus','decode'], + $metadata, $options); } /** @@ -71,10 +73,10 @@ namespace Grpc\Testing { */ public function CoreCount(\Grpc\Testing\CoreRequest $argument, $metadata = [], $options = []) { - return $this->_simpleRequest('/grpc.testing.WorkerService/CoreCount', - $argument, - ['\Grpc\Testing\CoreResponse', 'decode'], - $metadata, $options); + return $this->_simpleRequest('/grpc.testing.WorkerService/CoreCount', + $argument, + ['\Grpc\Testing\CoreResponse', 'decode'], + $metadata, $options); } /** @@ -85,12 +87,10 @@ namespace Grpc\Testing { */ public function QuitWorker(\Grpc\Testing\Void $argument, $metadata = [], $options = []) { - return $this->_simpleRequest('/grpc.testing.WorkerService/QuitWorker', - $argument, - ['\Grpc\Testing\Void', 'decode'], - $metadata, $options); + return $this->_simpleRequest('/grpc.testing.WorkerService/QuitWorker', + $argument, + ['\Grpc\Testing\Void', 'decode'], + $metadata, $options); } - } - } diff --git a/src/php/tests/qps/histogram.php b/src/php/tests/qps/histogram.php new file mode 100644 index 00000000000..c11a67c6186 --- /dev/null +++ b/src/php/tests/qps/histogram.php @@ -0,0 +1,93 @@ +multiplier)); + } + + public function __construct($resolution, $max_possible) { + $this->resolution = $resolution; + $this->max_possible = $max_possible; + $this->sum = 0; + $this->sum_of_squares = 0; + $this->multiplier = 1+$resolution; + $this->count = 0; + $this->min_seen = $max_possible; + $this->max_seen = 0; + $this->buckets = array_fill(0, $this->bucket_for($max_possible)+1, 0); + } + + public function add($value) { + $this->sum += $value; + $this->sum_of_squares += $value * $value; + $this->count += 1; + if ($value < $this->min_seen) { + $this->min_seen = $value; + } + if ($value > $this->max_seen) { + $this->max_seen = $value; + } + $this->buckets[$this->bucket_for($value)] += 1; + } + + public function minimum() { + return $this->min_seen; + } + + public function maximum() { + return $this->max_seen; + } + + public function sum() { + return $this->sum; + } + + public function sum_of_squares() { + return $this->sum_of_squares; + } + + public function count() { + return $this->count; + } + + public function contents() { + return $this->buckets; + } + + public function clean() { + $this->sum = 0; + $this->sum_of_squares = 0; + $this->count = 0; + $this->min_seen = $this->max_possible; + $this->max_seen = 0; + $this->buckets = array_fill(0, $this->bucket_for($this->max_possible)+1, 0); + } +} diff --git a/src/proto/grpc/testing/proxy-service.proto b/src/proto/grpc/testing/proxy-service.proto index 8d0a9498c02..deaabd13651 100644 --- a/src/proto/grpc/testing/proxy-service.proto +++ b/src/proto/grpc/testing/proxy-service.proto @@ -15,6 +15,7 @@ syntax = "proto3"; import "src/proto/grpc/testing/control.proto"; +import "src/proto/grpc/testing/stats.proto"; package grpc.testing; @@ -25,5 +26,6 @@ message ProxyStat { service ProxyClientService { rpc GetConfig(Void) returns (ClientConfig); rpc ReportTime(stream ProxyStat) returns (Void); + rpc ReportHist(stream HistogramData) returns (Void); } diff --git a/src/ruby/qps/histogram.rb b/src/ruby/qps/histogram.rb index 1a27e172180..e48fb842be4 100644 --- a/src/ruby/qps/histogram.rb +++ b/src/ruby/qps/histogram.rb @@ -16,6 +16,8 @@ # Histogram class for use in performance testing and measurement +require 'thread' + class Histogram # Determine the bucket index for a given value # @param {number} value The value to check @@ -27,6 +29,7 @@ class Histogram # @param {number} resolution The resolution of the histogram # @param {number} max_possible The maximum value for the histogram def initialize(resolution, max_possible) + @lock = Mutex.new @resolution=resolution @max_possible=max_possible @sum=0 @@ -70,4 +73,16 @@ class Histogram def contents @buckets end + + def merge(hist) + @lock.synchronize do + @min_seen = hist.min_seen + @max_seen = hist.max_seen + @sum += hist.sum + @sum_of_squares += hist.sum_of_squares + @count += hist.count + received_bucket = hist.bucket.to_a + @buckets = @buckets.map.with_index{ |m,i| m + received_bucket[i].to_i } + end + end end diff --git a/src/ruby/qps/proxy-worker.rb b/src/ruby/qps/proxy-worker.rb index ae7006e7d60..fc5db50c1c8 100755 --- a/src/ruby/qps/proxy-worker.rb +++ b/src/ruby/qps/proxy-worker.rb @@ -41,32 +41,49 @@ class ProxyBenchmarkClientServiceImpl < Grpc::Testing::ProxyClientService::Servi @histmax = config.histogram_params.max_possible @histogram = Histogram.new(@histres, @histmax) @start_time = Time.now - # TODO(vjpai): Support multiple client channels by spawning off a PHP client per channel - if @use_c_ext - puts "Use protobuf c extension" - command = "php -d extension=" + File.expand_path(File.dirname(__FILE__)) + "/../../php/tests/qps/vendor/google/protobuf/php/ext/google/protobuf/modules/protobuf.so " + "-d extension=" + File.expand_path(File.dirname(__FILE__)) + "/../../php/ext/grpc/modules/grpc.so " + File.expand_path(File.dirname(__FILE__)) + "/../../php/tests/qps/client.php " + @mytarget - else - puts "Use protobuf php extension" - command = "php -d extension=" + File.expand_path(File.dirname(__FILE__)) + "/../../php/ext/grpc/modules/grpc.so " + File.expand_path(File.dirname(__FILE__)) + "/../../php/tests/qps/client.php " + @mytarget - end - puts "Starting command: " + command - @php_pid = spawn(command) + @php_pid = Array.new(@config.client_channels) + (0..@config.client_channels-1).each do |chan| + Thread.new { + if @use_c_ext + puts "Use protobuf c extension" + command = "php -d extension=" + File.expand_path(File.dirname(__FILE__)) + + "/../../php/tests/qps/vendor/google/protobuf/php/ext/google/protobuf/modules/protobuf.so " + + "-d extension=" + File.expand_path(File.dirname(__FILE__)) + "/../../php/ext/grpc/modules/grpc.so " + + File.expand_path(File.dirname(__FILE__)) + "/../../php/tests/qps/client.php " + @mytarget + " #{chan%@config.server_targets.length}" + else + puts "Use protobuf php extension" + command = "php -d extension=" + File.expand_path(File.dirname(__FILE__)) + "/../../php/ext/grpc/modules/grpc.so " + + File.expand_path(File.dirname(__FILE__)) + "/../../php/tests/qps/client.php " + @mytarget + " #{chan%@config.server_targets.length}" + end + puts "[ruby proxy] Starting #{chan}th php-client command use c protobuf #{@use_c_ext}: " + command + @php_pid[chan] = spawn(command) + while true + sleep + end + } + end end def stop - Process.kill("TERM", @php_pid) - Process.wait(@php_pid) + (0..@config.client_channels-1).each do |chan| + Process.kill("TERM", @php_pid[chan]) + Process.wait(@php_pid[chan]) + end end def get_config(_args, _call) - puts "Answering get_config" @config end def report_time(call) - puts "Starting a time reporting stream" call.each_remote_read do |lat| @histogram.add((lat.latency)*1e9) end Grpc::Testing::Void.new end + def report_hist(call) + call.each_remote_read do |lat| + @histogram.merge(lat) + end + Grpc::Testing::Void.new + end def mark(reset) lat = Grpc::Testing::HistogramData.new( bucket: @histogram.contents, @@ -135,7 +152,7 @@ def proxymain opts.on('--driver_port PORT', '') do |v| options['driver_port'] = v end - opts.on("-c", "--[no-]c_proto_ext", "Use protobuf C-extention") do |c| + opts.on("-c", "--[no-]use_protobuf_c_extension", "Use protobuf C-extention") do |c| options[:c_ext] = c end end.parse! @@ -143,7 +160,8 @@ def proxymain # Configure any errors with client or server child threads to surface Thread.abort_on_exception = true - s = GRPC::RpcServer.new + # Make sure proxy_server can handle the large number of calls in benchmarks + s = GRPC::RpcServer.new(pool_size: 1024) port = s.add_http2_port("0.0.0.0:" + options['driver_port'].to_s, :this_port_is_insecure) bmc = ProxyBenchmarkClientServiceImpl.new(port, options[:c_ext]) diff --git a/src/ruby/qps/src/proto/grpc/testing/proxy-service_pb.rb b/src/ruby/qps/src/proto/grpc/testing/proxy-service_pb.rb index d238198cca3..583b2ea6558 100644 --- a/src/ruby/qps/src/proto/grpc/testing/proxy-service_pb.rb +++ b/src/ruby/qps/src/proto/grpc/testing/proxy-service_pb.rb @@ -4,6 +4,7 @@ require 'google/protobuf' require 'src/proto/grpc/testing/control_pb' +require 'src/proto/grpc/testing/stats_pb' Google::Protobuf::DescriptorPool.generated_pool.build do add_message "grpc.testing.ProxyStat" do optional :latency, :double, 1 diff --git a/src/ruby/qps/src/proto/grpc/testing/proxy-service_services_pb.rb b/src/ruby/qps/src/proto/grpc/testing/proxy-service_services_pb.rb index 484cf05f92f..e7bb59b8a09 100644 --- a/src/ruby/qps/src/proto/grpc/testing/proxy-service_services_pb.rb +++ b/src/ruby/qps/src/proto/grpc/testing/proxy-service_services_pb.rb @@ -32,6 +32,7 @@ module Grpc rpc :GetConfig, Void, ClientConfig rpc :ReportTime, stream(ProxyStat), Void + rpc :ReportHist, stream(HistogramData), Void end Stub = Service.rpc_stub_class diff --git a/test/core/surface/init_test.c b/test/core/surface/init_test.c index a9e80575af1..b835a2a8843 100644 --- a/test/core/surface/init_test.c +++ b/test/core/surface/init_test.c @@ -53,7 +53,7 @@ static void test_plugin() { } static void test_repeatedly() { - for (int i = 0; i < 100000; i++) { + for (int i = 0; i < 1000; i++) { grpc_init(); grpc_shutdown(); } diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index f938aea40eb..a14b4d5295c 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -102,14 +102,23 @@ class Verifier { explicit Verifier(bool spin) : spin_(spin) {} // Expect sets the expected ok value for a specific tag Verifier& Expect(int i, bool expect_ok) { - expectations_[tag(i)] = expect_ok; + return ExpectUnless(i, expect_ok, false); + } + // ExpectUnless sets the expected ok value for a specific tag + // unless the tag was already marked seen (as a result of ExpectMaybe) + Verifier& ExpectUnless(int i, bool expect_ok, bool seen) { + if (!seen) { + expectations_[tag(i)] = expect_ok; + } return *this; } - // AcceptOnce sets the expected ok value for a specific tag, but does not + // ExpectMaybe sets the expected ok value for a specific tag, but does not // require it to appear // If it does, sets *seen to true - Verifier& AcceptOnce(int i, bool expect_ok, bool* seen) { - maybe_expectations_[tag(i)] = MaybeExpect{expect_ok, seen}; + Verifier& ExpectMaybe(int i, bool expect_ok, bool* seen) { + if (!*seen) { + maybe_expectations_[tag(i)] = MaybeExpect{expect_ok, seen}; + } return *this; } @@ -569,13 +578,13 @@ TEST_P(AsyncEnd2endTest, SimpleClientStreamingWithCoalescingApi) { Verifier(GetParam().disable_blocking) .Expect(2, true) - .AcceptOnce(3, true, &seen3) + .ExpectMaybe(3, true, &seen3) .Verify(cq_.get()); srv_stream.Read(&recv_request, tag(4)); Verifier(GetParam().disable_blocking) - .AcceptOnce(3, true, &seen3) + .ExpectUnless(3, true, seen3) .Expect(4, true) .Verify(cq_.get()); @@ -602,7 +611,6 @@ TEST_P(AsyncEnd2endTest, SimpleClientStreamingWithCoalescingApi) { EXPECT_EQ(send_response.message(), recv_response.message()); EXPECT_TRUE(recv_status.ok()); - EXPECT_TRUE(seen3); } // One ping, two pongs. @@ -853,13 +861,13 @@ TEST_P(AsyncEnd2endTest, SimpleBidiStreamingWithCoalescingApiWAF) { Verifier(GetParam().disable_blocking) .Expect(2, true) - .AcceptOnce(3, true, &seen3) + .ExpectMaybe(3, true, &seen3) .Verify(cq_.get()); srv_stream.Read(&recv_request, tag(4)); Verifier(GetParam().disable_blocking) - .AcceptOnce(3, true, &seen3) + .ExpectUnless(3, true, seen3) .Expect(4, true) .Verify(cq_.get()); EXPECT_EQ(send_request.message(), recv_request.message()); @@ -880,7 +888,6 @@ TEST_P(AsyncEnd2endTest, SimpleBidiStreamingWithCoalescingApiWAF) { Verifier(GetParam().disable_blocking).Expect(8, true).Verify(cq_.get()); EXPECT_TRUE(recv_status.ok()); - EXPECT_TRUE(seen3); } // One ping, one pong. Using server:WriteLast api @@ -910,13 +917,13 @@ TEST_P(AsyncEnd2endTest, SimpleBidiStreamingWithCoalescingApiWL) { Verifier(GetParam().disable_blocking) .Expect(2, true) - .AcceptOnce(3, true, &seen3) + .ExpectMaybe(3, true, &seen3) .Verify(cq_.get()); srv_stream.Read(&recv_request, tag(4)); Verifier(GetParam().disable_blocking) - .AcceptOnce(3, true, &seen3) + .ExpectUnless(3, true, seen3) .Expect(4, true) .Verify(cq_.get()); EXPECT_EQ(send_request.message(), recv_request.message()); @@ -939,7 +946,6 @@ TEST_P(AsyncEnd2endTest, SimpleBidiStreamingWithCoalescingApiWL) { Verifier(GetParam().disable_blocking).Expect(9, true).Verify(cq_.get()); EXPECT_TRUE(recv_status.ok()); - EXPECT_TRUE(seen3); } // Metadata tests diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index 7fbaf63492e..abf755b3935 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -226,6 +226,7 @@ class Client { } virtual void DestroyMultithreading() = 0; + virtual void InitThreadFunc(size_t thread_idx) = 0; virtual bool ThreadFunc(HistogramEntry* histogram, size_t thread_idx) = 0; void SetupLoadTest(const ClientConfig& config, size_t num_threads) { @@ -299,13 +300,18 @@ class Client { Thread& operator=(const Thread&); void ThreadFunc() { + int wait_loop = 0; while (!gpr_event_wait( &client_->start_requests_, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_seconds(1, GPR_TIMESPAN)))) { - gpr_log(GPR_INFO, "Waiting for benchmark to start"); + gpr_time_from_seconds(20, GPR_TIMESPAN)))) { + gpr_log(GPR_INFO, "%" PRIdPTR ": Waiting for benchmark to start (%d)", + idx_, wait_loop); + wait_loop++; } + client_->InitThreadFunc(idx_); + for (;;) { // run the loop body HistogramEntry entry; @@ -380,6 +386,13 @@ class ClientImpl : public Client { config.server_targets(i % config.server_targets_size()), config, create_stub_, i); } + std::vector> connecting_threads; + for (auto& c : channels_) { + connecting_threads.emplace_back(c.WaitForReady()); + } + for (auto& t : connecting_threads) { + t->join(); + } ClientRequestCreator create_req(&request_, config.payload_config()); @@ -414,14 +427,19 @@ class ClientImpl : public Client { !config.security_params().use_test_ca(), std::shared_ptr(), args); gpr_log(GPR_INFO, "Connecting to %s", target.c_str()); - GPR_ASSERT(channel_->WaitForConnected( - gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_seconds(300, GPR_TIMESPAN)))); stub_ = create_stub(channel_); } Channel* get_channel() { return channel_.get(); } StubType* get_stub() { return stub_.get(); } + std::unique_ptr WaitForReady() { + return std::unique_ptr(new std::thread([this]() { + GPR_ASSERT(channel_->WaitForConnected( + gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_seconds(10, GPR_TIMESPAN)))); + })); + } + private: void set_channel_args(const ClientConfig& config, ChannelArguments* args) { for (auto channel_arg : config.channel_args()) { diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index f5807da81e3..9ed4e0b3552 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -236,6 +236,7 @@ class AsyncClient : public ClientImpl { this->EndThreads(); // this needed for resolution } + void InitThreadFunc(size_t thread_idx) override final {} bool ThreadFunc(HistogramEntry* entry, size_t thread_idx) override final { void* got_tag; bool ok; diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 5d212f1acc0..94554a46b20 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -103,6 +103,8 @@ class SynchronousUnaryClient final : public SynchronousClient { } ~SynchronousUnaryClient() {} + void InitThreadFunc(size_t thread_idx) override {} + bool ThreadFunc(HistogramEntry* entry, size_t thread_idx) override { if (!WaitToIssue(thread_idx)) { return true; @@ -174,13 +176,7 @@ class SynchronousStreamingPingPongClient final grpc::ClientReaderWriter> { public: SynchronousStreamingPingPongClient(const ClientConfig& config) - : SynchronousStreamingClient(config) { - for (size_t thread_idx = 0; thread_idx < num_threads_; thread_idx++) { - auto* stub = channels_[thread_idx % channels_.size()].get_stub(); - stream_[thread_idx] = stub->StreamingCall(&context_[thread_idx]); - messages_issued_[thread_idx] = 0; - } - } + : SynchronousStreamingClient(config) {} ~SynchronousStreamingPingPongClient() { std::vector cleanup_threads; for (size_t i = 0; i < num_threads_; i++) { @@ -196,6 +192,12 @@ class SynchronousStreamingPingPongClient final } } + void InitThreadFunc(size_t thread_idx) override { + auto* stub = channels_[thread_idx % channels_.size()].get_stub(); + stream_[thread_idx] = stub->StreamingCall(&context_[thread_idx]); + messages_issued_[thread_idx] = 0; + } + bool ThreadFunc(HistogramEntry* entry, size_t thread_idx) override { if (!WaitToIssue(thread_idx)) { return true; @@ -228,14 +230,7 @@ class SynchronousStreamingFromClientClient final : public SynchronousStreamingClient> { public: SynchronousStreamingFromClientClient(const ClientConfig& config) - : SynchronousStreamingClient(config), last_issue_(num_threads_) { - for (size_t thread_idx = 0; thread_idx < num_threads_; thread_idx++) { - auto* stub = channels_[thread_idx % channels_.size()].get_stub(); - stream_[thread_idx] = stub->StreamingFromClient(&context_[thread_idx], - &responses_[thread_idx]); - last_issue_[thread_idx] = UsageTimer::Now(); - } - } + : SynchronousStreamingClient(config), last_issue_(num_threads_) {} ~SynchronousStreamingFromClientClient() { std::vector cleanup_threads; for (size_t i = 0; i < num_threads_; i++) { @@ -251,6 +246,13 @@ class SynchronousStreamingFromClientClient final } } + void InitThreadFunc(size_t thread_idx) override { + auto* stub = channels_[thread_idx % channels_.size()].get_stub(); + stream_[thread_idx] = stub->StreamingFromClient(&context_[thread_idx], + &responses_[thread_idx]); + last_issue_[thread_idx] = UsageTimer::Now(); + } + bool ThreadFunc(HistogramEntry* entry, size_t thread_idx) override { // Figure out how to make histogram sensible if this is rate-paced if (!WaitToIssue(thread_idx)) { @@ -279,13 +281,12 @@ class SynchronousStreamingFromServerClient final : public SynchronousStreamingClient> { public: SynchronousStreamingFromServerClient(const ClientConfig& config) - : SynchronousStreamingClient(config), last_recv_(num_threads_) { - for (size_t thread_idx = 0; thread_idx < num_threads_; thread_idx++) { - auto* stub = channels_[thread_idx % channels_.size()].get_stub(); - stream_[thread_idx] = - stub->StreamingFromServer(&context_[thread_idx], request_); - last_recv_[thread_idx] = UsageTimer::Now(); - } + : SynchronousStreamingClient(config), last_recv_(num_threads_) {} + void InitThreadFunc(size_t thread_idx) override { + auto* stub = channels_[thread_idx % channels_.size()].get_stub(); + stream_[thread_idx] = + stub->StreamingFromServer(&context_[thread_idx], request_); + last_recv_[thread_idx] = UsageTimer::Now(); } bool ThreadFunc(HistogramEntry* entry, size_t thread_idx) override { GPR_TIMER_SCOPE("SynchronousStreamingFromServerClient::ThreadFunc", 0); @@ -311,12 +312,7 @@ class SynchronousStreamingBothWaysClient final grpc::ClientReaderWriter> { public: SynchronousStreamingBothWaysClient(const ClientConfig& config) - : SynchronousStreamingClient(config) { - for (size_t thread_idx = 0; thread_idx < num_threads_; thread_idx++) { - auto* stub = channels_[thread_idx % channels_.size()].get_stub(); - stream_[thread_idx] = stub->StreamingBothWays(&context_[thread_idx]); - } - } + : SynchronousStreamingClient(config) {} ~SynchronousStreamingBothWaysClient() { std::vector cleanup_threads; for (size_t i = 0; i < num_threads_; i++) { @@ -332,6 +328,10 @@ class SynchronousStreamingBothWaysClient final } } + void InitThreadFunc(size_t thread_idx) override { + auto* stub = channels_[thread_idx % channels_.size()].get_stub(); + stream_[thread_idx] = stub->StreamingBothWays(&context_[thread_idx]); + } bool ThreadFunc(HistogramEntry* entry, size_t thread_idx) override { // TODO (vjpai): Do this return true; diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core index b8514fe3114..c8fd2ee48b2 100644 --- a/tools/doxygen/Doxyfile.core +++ b/tools/doxygen/Doxyfile.core @@ -772,6 +772,7 @@ doc/connection-backoff-interop-test-description.md \ doc/connection-backoff.md \ doc/connectivity-semantics-and-api.md \ doc/core/grpc-error.md \ +doc/core/moving-to-c++.md \ doc/core/pending_api_cleanups.md \ doc/cpp-style-guide.md \ doc/environment_variables.md \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index e6d242554a9..8435178d2e2 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -772,6 +772,7 @@ doc/connection-backoff-interop-test-description.md \ doc/connection-backoff.md \ doc/connectivity-semantics-and-api.md \ doc/core/grpc-error.md \ +doc/core/moving-to-c++.md \ doc/core/pending_api_cleanups.md \ doc/cpp-style-guide.md \ doc/environment_variables.md \ diff --git a/tools/internal_ci/helper_scripts/prepare_build_linux_rc b/tools/internal_ci/helper_scripts/prepare_build_linux_rc index 2ade8dac51f..ea2a17f2bcf 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_linux_rc +++ b/tools/internal_ci/helper_scripts/prepare_build_linux_rc @@ -32,11 +32,4 @@ PYTHONWARNINGS=ignore XDG_CACHE_HOME=/tmp/xdg-cache-home sudo -E pip install cov # Download Docker images from DockerHub export DOCKERHUB_ORGANIZATION=grpctesting -# If this is a PR using RUN_TESTS_FLAGS var, then add flags to filter tests -if [ -n "$KOKORO_GITHUB_PULL_REQUEST_NUMBER" ] && [ -n "$RUN_TESTS_FLAGS" ]; then - sudo apt-get install -y jq - ghprbTargetBranch=$(curl -s https://api.github.com/repos/grpc/grpc/pulls/$KOKORO_GITHUB_PULL_REQUEST_NUMBER | jq -r .base.ref) - export RUN_TESTS_FLAGS="$RUN_TESTS_FLAGS --filter_pr_tests --base_branch origin/$ghprbTargetBranch" -fi - git submodule update --init diff --git a/tools/internal_ci/helper_scripts/prepare_build_macos_rc b/tools/internal_ci/helper_scripts/prepare_build_macos_rc index b6cc43e0ab0..8f2056096dc 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_macos_rc +++ b/tools/internal_ci/helper_scripts/prepare_build_macos_rc @@ -40,11 +40,12 @@ pip install google-api-python-client --user python export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json # If this is a PR using RUN_TESTS_FLAGS var, then add flags to filter tests -if [ -n "$KOKORO_GITHUB_PULL_REQUEST_NUMBER" ] && [ -n "$RUN_TESTS_FLAGS" ]; then - brew install jq - ghprbTargetBranch=$(curl -s https://api.github.com/repos/grpc/grpc/pulls/$KOKORO_GITHUB_PULL_REQUEST_NUMBER | jq -r .base.ref) - export RUN_TESTS_FLAGS="$RUN_TESTS_FLAGS --filter_pr_tests --base_branch origin/$ghprbTargetBranch" -fi +# TODO(matt-kwong): enable after fixing brew issue +# if [ -n "$KOKORO_GITHUB_PULL_REQUEST_NUMBER" ] && [ -n "$RUN_TESTS_FLAGS" ]; then +# brew install jq +# ghprbTargetBranch=$(curl -s https://api.github.com/repos/grpc/grpc/pulls/$KOKORO_GITHUB_PULL_REQUEST_NUMBER | jq -r .base.ref) +# export RUN_TESTS_FLAGS="$RUN_TESTS_FLAGS --filter_pr_tests --base_branch origin/$ghprbTargetBranch" +# fi set +ex # rvm script is very verbose and exits with errorcode source $HOME/.rvm/scripts/rvm diff --git a/tools/internal_ci/linux/grpc_interop_badserver_python.sh b/tools/internal_ci/linux/grpc_interop_badserver_python.sh deleted file mode 100755 index c2bd4e79ac1..00000000000 --- a/tools/internal_ci/linux/grpc_interop_badserver_python.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2017 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -ex - -export LANG=en_US.UTF-8 - -# Enter the gRPC repo root -cd $(dirname $0)/../../.. - -source tools/internal_ci/helper_scripts/prepare_build_linux_rc -source tools/internal_ci/helper_scripts/prepare_build_interop_rc - -tools/run_tests/run_interop_tests.py -l python --use_docker --http2_server_interop - diff --git a/tools/internal_ci/linux/grpc_interop_tocloud.cfg b/tools/internal_ci/linux/grpc_interop_tocloud.cfg index 2803616007a..13aec15770b 100644 --- a/tools/internal_ci/linux/grpc_interop_tocloud.cfg +++ b/tools/internal_ci/linux/grpc_interop_tocloud.cfg @@ -15,8 +15,7 @@ # Config file for the internal CI (in protobuf text format) # Location of the continuous shell script in repository. -build_file: "grpc/tools/internal_ci/linux/grpc_interop_tocloud.sh" -# grpc_interop tests can take 6+ hours to complete. +build_file: "grpc/tools/internal_ci/linux/grpc_run_interop_tests.sh" timeout_mins: 60 action { define_artifacts { @@ -24,3 +23,8 @@ action { regex: "github/grpc/reports/**" } } + +env_vars { + key: "RUN_TESTS_FLAGS" + value: "-l all -s all --use_docker --http2_interop --internal_ci -t -j 12 --bq_result_table interop_results" +} diff --git a/tools/internal_ci/linux/grpc_interop_toprod.cfg b/tools/internal_ci/linux/grpc_interop_toprod.cfg index 903480a3d18..8d025c4f60d 100644 --- a/tools/internal_ci/linux/grpc_interop_toprod.cfg +++ b/tools/internal_ci/linux/grpc_interop_toprod.cfg @@ -15,8 +15,7 @@ # Config file for the internal CI (in protobuf text format) # Location of the continuous shell script in repository. -build_file: "grpc/tools/internal_ci/linux/grpc_interop_toprod.sh" -# grpc_interop tests can take 6+ hours to complete. +build_file: "grpc/tools/internal_ci/linux/grpc_run_interop_tests.sh" timeout_mins: 60 action { define_artifacts { @@ -25,3 +24,7 @@ action { } } +env_vars { + key: "RUN_TESTS_FLAGS" + value: "-l all --cloud_to_prod --cloud_to_prod_auth --prod_servers default gateway_v4 --use_docker --internal_ci -t -j 12 --bq_result_table interop_results" +} diff --git a/tools/internal_ci/linux/grpc_interop_toprod.sh b/tools/internal_ci/linux/grpc_interop_toprod.sh deleted file mode 100755 index 97a7d5d2393..00000000000 --- a/tools/internal_ci/linux/grpc_interop_toprod.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2017 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -ex - -export LANG=en_US.UTF-8 - -# Enter the gRPC repo root -cd $(dirname $0)/../../.. - -source tools/internal_ci/helper_scripts/prepare_build_linux_rc -source tools/internal_ci/helper_scripts/prepare_build_interop_rc - -tools/run_tests/run_interop_tests.py \ - -l all \ - --cloud_to_prod \ - --cloud_to_prod_auth \ - --prod_servers default gateway_v4 \ - --use_docker --internal_ci --allow_flakes -t -j 12 $@ - diff --git a/tools/internal_ci/linux/grpc_interop_badserver_java.sh b/tools/internal_ci/linux/grpc_run_interop_tests.sh similarity index 88% rename from tools/internal_ci/linux/grpc_interop_badserver_java.sh rename to tools/internal_ci/linux/grpc_run_interop_tests.sh index d25845ca507..1f4eda2d529 100755 --- a/tools/internal_ci/linux/grpc_interop_badserver_java.sh +++ b/tools/internal_ci/linux/grpc_run_interop_tests.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/bash # Copyright 2017 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,5 +23,4 @@ cd $(dirname $0)/../../.. source tools/internal_ci/helper_scripts/prepare_build_linux_rc source tools/internal_ci/helper_scripts/prepare_build_interop_rc -tools/run_tests/run_interop_tests.py -l java --use_docker --http2_server_interop - +tools/run_tests/run_interop_tests.py $RUN_TESTS_FLAGS diff --git a/tools/internal_ci/linux/grpc_run_tests_matrix.sh b/tools/internal_ci/linux/grpc_run_tests_matrix.sh index bd1430b7415..1018708f967 100755 --- a/tools/internal_ci/linux/grpc_run_tests_matrix.sh +++ b/tools/internal_ci/linux/grpc_run_tests_matrix.sh @@ -20,6 +20,13 @@ cd $(dirname $0)/../../.. source tools/internal_ci/helper_scripts/prepare_build_linux_rc +# If this is a PR using RUN_TESTS_FLAGS var, then add flags to filter tests +if [ -n "$KOKORO_GITHUB_PULL_REQUEST_NUMBER" ] && [ -n "$RUN_TESTS_FLAGS" ]; then + sudo apt-get install -y jq + ghprbTargetBranch=$(curl -s https://api.github.com/repos/grpc/grpc/pulls/$KOKORO_GITHUB_PULL_REQUEST_NUMBER | jq -r .base.ref) + export RUN_TESTS_FLAGS="$RUN_TESTS_FLAGS --filter_pr_tests --base_branch origin/$ghprbTargetBranch" +fi + tools/run_tests/run_tests_matrix.py $RUN_TESTS_FLAGS || FAILED="true" # Reveal leftover processes that might be left behind by the build diff --git a/tools/internal_ci/linux/grpc_interop_badserver_java.cfg b/tools/internal_ci/linux/pull_request/grpc_interop_tocloud.cfg similarity index 76% rename from tools/internal_ci/linux/grpc_interop_badserver_java.cfg rename to tools/internal_ci/linux/pull_request/grpc_interop_tocloud.cfg index dc2114273ea..cb18e8e8682 100644 --- a/tools/internal_ci/linux/grpc_interop_badserver_java.cfg +++ b/tools/internal_ci/linux/pull_request/grpc_interop_tocloud.cfg @@ -15,12 +15,16 @@ # Config file for the internal CI (in protobuf text format) # Location of the continuous shell script in repository. -build_file: "grpc/tools/internal_ci/linux/grpc_interop_badserver_java.sh" -# grpc_interop tests can take 6+ hours to complete. -timeout_mins: 480 +build_file: "grpc/tools/internal_ci/linux/grpc_run_interop_tests.sh" +timeout_mins: 60 action { define_artifacts { - regex: "**/report.xml" + regex: "**/sponge_log.xml" regex: "github/grpc/reports/**" } } + +env_vars { + key: "RUN_TESTS_FLAGS" + value: "-l all -s all --use_docker --http2_interop --internal_ci -t -j 12" +} diff --git a/tools/internal_ci/linux/grpc_interop_badserver_python.cfg b/tools/internal_ci/linux/pull_request/grpc_interop_toprod.cfg similarity index 72% rename from tools/internal_ci/linux/grpc_interop_badserver_python.cfg rename to tools/internal_ci/linux/pull_request/grpc_interop_toprod.cfg index ec738fcf74a..e141d9f6486 100644 --- a/tools/internal_ci/linux/grpc_interop_badserver_python.cfg +++ b/tools/internal_ci/linux/pull_request/grpc_interop_toprod.cfg @@ -15,12 +15,16 @@ # Config file for the internal CI (in protobuf text format) # Location of the continuous shell script in repository. -build_file: "grpc/tools/internal_ci/linux/grpc_interop_badserver_python.sh" -# grpc_interop tests can take 6+ hours to complete. -timeout_mins: 480 +build_file: "grpc/tools/internal_ci/linux/grpc_run_interop_tests.sh" +timeout_mins: 60 action { define_artifacts { - regex: "**/report.xml" + regex: "**/sponge_log.xml" regex: "github/grpc/reports/**" } } + +env_vars { + key: "RUN_TESTS_FLAGS" + value: "-l all --allow_flakes --cloud_to_prod --cloud_to_prod_auth --prod_servers default gateway_v4 --use_docker --internal_ci -t -j 12" +} diff --git a/tools/interop_matrix/README.md b/tools/interop_matrix/README.md index c2f354399f0..c0e9a33c5e4 100644 --- a/tools/interop_matrix/README.md +++ b/tools/interop_matrix/README.md @@ -47,7 +47,7 @@ For more details on each step, refer to sections below. ## Instructions for running test cases against GCR images - Run `tools/interop_matrix/run_interop_matrix_tests.py`. Useful options: - - `--release` specifies a git release tag. Defaults to `--release=master`. Make sure the GCR images with the tag have been created using `create_matrix_images.py` above. + - `--release` specifies a git release tag. Defaults to `--release=all`. Make sure the GCR images with the tag have been created using `create_matrix_images.py` above. - `--language` specifies a language. Defaults to `--language=all`. For example, To test all languages for all gRPC releases across all runtimes, do `tools/interop_matrix/run_interop_matrix_test.py --release=all`. - The output for all the test cases is recorded in a junit style xml file (default to 'report.xml'). diff --git a/tools/interop_matrix/create_testcases.sh b/tools/interop_matrix/create_testcases.sh index d06fb34ff9a..3d34b2ef25a 100755 --- a/tools/interop_matrix/create_testcases.sh +++ b/tools/interop_matrix/create_testcases.sh @@ -31,9 +31,12 @@ TESTCASES_DIR=${GRPC_ROOT}/tools/interop_matrix/testcases echo "Create '$LANG' test cases for gRPC release '${RELEASE:=master}'" +echo $client_lang # Invoke run_interop_test in manual mode. +# TODO(adelez): Add cloud_gateways when we figure out how to skip them if not +# running in GCE. ${GRPC_ROOT}/tools/run_tests/run_interop_tests.py -l $LANG --use_docker \ - --cloud_to_prod --manual_run + --cloud_to_prod --prod_servers default gateway_v4 --manual_run # Clean up function cleanup { @@ -52,11 +55,18 @@ function cleanup { [ -e "$CMDS_SH" ] && rm $CMDS_SH } trap cleanup EXIT +# TODO(adelez): add test auth tests but do not run if not testing on GCE. # Running the testcases as sanity unless we are asked to skip. [ -z "$SKIP_TEST" ] && (echo "Running test cases: $CMDS_SH"; sh $CMDS_SH) +# Convert c++ to cxx. +if [$LANG == "c++" ]; then +client_lang="cxx" +else +client_lang=$LANG +fi mkdir -p $TESTCASES_DIR -testcase=$TESTCASES_DIR/${LANG}__$RELEASE +testcase=$TESTCASES_DIR/${client_lang}__$RELEASE if [ -e $testcase ]; then echo "Updating: $testcase" diff $testcase $CMDS_SH || true diff --git a/tools/interop_matrix/run_interop_matrix_tests.py b/tools/interop_matrix/run_interop_matrix_tests.py index 4315c8277df..48c918d25d4 100755 --- a/tools/interop_matrix/run_interop_matrix_tests.py +++ b/tools/interop_matrix/run_interop_matrix_tests.py @@ -48,9 +48,8 @@ argp.add_argument('-j', '--jobs', default=multiprocessing.cpu_count(), type=int) argp.add_argument('--gcr_path', default='gcr.io/grpc-testing', help='Path of docker images in Google Container Registry') - argp.add_argument('--release', - default='master', + default='all', choices=['all', 'master'] + _RELEASES, help='Release tags to test. When testing all ' 'releases defined in client_matrix.py, use "all".') @@ -69,6 +68,13 @@ argp.add_argument('--report_file', default='report.xml', help='The result file to create.') +argp.add_argument('--allow_flakes', + default=False, + action='store_const', + const=True, + help=('Allow flaky tests to show as passing (re-runs failed ' + 'tests up to five times)')) + args = argp.parse_args() @@ -94,14 +100,15 @@ def find_all_images_for_lang(lang): for runtime in client_matrix.LANG_RUNTIME_MATRIX[lang]: image_path = '%s/grpc_interop_%s' % (args.gcr_path, runtime) output = subprocess.check_output(['gcloud', 'beta', 'container', 'images', - 'list-tags', '--format=json', image_path]) + 'list-tags', '--format=json', image_path]) docker_image_list = json.loads(output) # All images should have a single tag or no tag. + # TODO(adelez): Remove tagless images. tags = [i['tags'][0] for i in docker_image_list if i['tags']] jobset.message('START', 'Found images for %s: %s' % (image_path, tags), do_newline=True) skipped = len(docker_image_list) - len(tags) - jobset.message('START', 'Skipped images (no-tag/unknown-tag): %d' % skipped, + jobset.message('SKIPPED', 'Skipped images (no-tag/unknown-tag): %d' % skipped, do_newline=True) # Filter tags based on the releases. images[runtime] = [(tag,'%s:%s' % (image_path,tag)) for tag in tags if @@ -130,7 +137,8 @@ def find_test_cases(lang, release): spec = jobset.JobSpec(cmdline=line, shortname=shortname, timeout_seconds=_TEST_TIMEOUT, - shell=True) + shell=True, + flake_retries=5 if args.allow_flakes else 0) job_spec_list.append(spec) jobset.message('START', 'Loaded %s tests from %s' % (len(job_spec_list), testcases), @@ -148,6 +156,7 @@ def run_tests_for_lang(lang, runtime, images): images is a list of (, ) tuple. """ + total_num_failures = 0 for image_tuple in images: release, image = image_tuple jobset.message('START', 'Testing %s' % image, do_newline=True) @@ -161,6 +170,7 @@ def run_tests_for_lang(lang, runtime, images): maxjobs=args.jobs) if num_failures: jobset.message('FAILED', 'Some tests failed', do_newline=True) + total_num_failures += num_failures else: jobset.message('SUCCESS', 'All tests passed', do_newline=True) @@ -170,6 +180,9 @@ def run_tests_for_lang(lang, runtime, images): 'grpc_interop_matrix', '%s__%s %s'%(lang,runtime,release), str(uuid.uuid4())) + + return total_num_failures + _docker_images_cleanup = [] def cleanup(): @@ -180,9 +193,14 @@ def cleanup(): atexit.register(cleanup) languages = args.language if args.language != ['all'] else _LANGUAGES +total_num_failures = 0 for lang in languages: docker_images = find_all_images_for_lang(lang) for runtime in sorted(docker_images.keys()): - run_tests_for_lang(lang, runtime, docker_images[runtime]) + total_num_failures += run_tests_for_lang(lang, runtime, docker_images[runtime]) report_utils.create_xml_report_file(_xml_report_tree, args.report_file) + +if total_num_failures: + sys.exit(1) +sys.exit(0) diff --git a/tools/interop_matrix/testcases/cxx__master b/tools/interop_matrix/testcases/cxx__master index ccd28595301..e0fed53f088 100755 --- a/tools/interop_matrix/testcases/cxx__master +++ b/tools/interop_matrix/testcases/cxx__master @@ -1,5 +1,5 @@ #!/bin/bash -echo "Testing ${docker_image:=grpc_interop_cxx:1423f288-ac00-4f3a-9885-771258eecae3}" +echo "Testing ${docker_image:=grpc_interop_cxx:78de6f80-524d-4bc9-bfb2-f00c24ceafed}" docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=large_unary" docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=empty_unary" docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=ping_pong" @@ -9,3 +9,12 @@ docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=cancel_after_begin" docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=cancel_after_first_response" docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=timeout_on_sleeping_server" +docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=large_unary" +docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=empty_unary" +docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=ping_pong" +docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=empty_stream" +docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=client_streaming" +docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=server_streaming" +docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=cancel_after_begin" +docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=cancel_after_first_response" +docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=timeout_on_sleeping_server" diff --git a/tools/interop_matrix/testcases/go__master b/tools/interop_matrix/testcases/go__master index 2624c7f92c5..33b25d6a16b 100755 --- a/tools/interop_matrix/testcases/go__master +++ b/tools/interop_matrix/testcases/go__master @@ -1,5 +1,5 @@ #!/bin/bash -echo "Testing ${docker_image:=grpc_interop_go:41fffd01-a6c8-41b6-8136-c0aaa1ec2437}" +echo "Testing ${docker_image:=grpc_interop_go:dd8fbf3a-4964-4387-9997-5dadeea09835}" docker run -i --rm=true -w /go/src/google.golang.org/grpc/interop/client --net=host $docker_image bash -c "go run client.go --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=large_unary" docker run -i --rm=true -w /go/src/google.golang.org/grpc/interop/client --net=host $docker_image bash -c "go run client.go --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=empty_unary" docker run -i --rm=true -w /go/src/google.golang.org/grpc/interop/client --net=host $docker_image bash -c "go run client.go --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=ping_pong" @@ -9,3 +9,12 @@ docker run -i --rm=true -w /go/src/google.golang.org/grpc/interop/client --net=h docker run -i --rm=true -w /go/src/google.golang.org/grpc/interop/client --net=host $docker_image bash -c "go run client.go --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=cancel_after_begin" docker run -i --rm=true -w /go/src/google.golang.org/grpc/interop/client --net=host $docker_image bash -c "go run client.go --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=cancel_after_first_response" docker run -i --rm=true -w /go/src/google.golang.org/grpc/interop/client --net=host $docker_image bash -c "go run client.go --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=timeout_on_sleeping_server" +docker run -i --rm=true -w /go/src/google.golang.org/grpc/interop/client --net=host $docker_image bash -c "go run client.go --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=large_unary" +docker run -i --rm=true -w /go/src/google.golang.org/grpc/interop/client --net=host $docker_image bash -c "go run client.go --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=empty_unary" +docker run -i --rm=true -w /go/src/google.golang.org/grpc/interop/client --net=host $docker_image bash -c "go run client.go --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=ping_pong" +docker run -i --rm=true -w /go/src/google.golang.org/grpc/interop/client --net=host $docker_image bash -c "go run client.go --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=empty_stream" +docker run -i --rm=true -w /go/src/google.golang.org/grpc/interop/client --net=host $docker_image bash -c "go run client.go --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=client_streaming" +docker run -i --rm=true -w /go/src/google.golang.org/grpc/interop/client --net=host $docker_image bash -c "go run client.go --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=server_streaming" +docker run -i --rm=true -w /go/src/google.golang.org/grpc/interop/client --net=host $docker_image bash -c "go run client.go --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=cancel_after_begin" +docker run -i --rm=true -w /go/src/google.golang.org/grpc/interop/client --net=host $docker_image bash -c "go run client.go --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=cancel_after_first_response" +docker run -i --rm=true -w /go/src/google.golang.org/grpc/interop/client --net=host $docker_image bash -c "go run client.go --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=timeout_on_sleeping_server" diff --git a/tools/interop_matrix/testcases/java__master b/tools/interop_matrix/testcases/java__master index cf431646e9a..dbd87279a6d 100755 --- a/tools/interop_matrix/testcases/java__master +++ b/tools/interop_matrix/testcases/java__master @@ -1,5 +1,5 @@ #!/bin/bash -echo "Testing ${docker_image:=grpc_interop_java:ea528843-be34-4ff3-a136-e4609424e061}" +echo "Testing ${docker_image:=grpc_interop_java:a764b50c-1788-4387-9b9e-5cfa93927006}" docker run -i --rm=true -w /var/local/git/grpc/../grpc-java --net=host $docker_image bash -c "./run-test-client.sh --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=large_unary" docker run -i --rm=true -w /var/local/git/grpc/../grpc-java --net=host $docker_image bash -c "./run-test-client.sh --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=empty_unary" docker run -i --rm=true -w /var/local/git/grpc/../grpc-java --net=host $docker_image bash -c "./run-test-client.sh --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=ping_pong" @@ -9,3 +9,12 @@ docker run -i --rm=true -w /var/local/git/grpc/../grpc-java --net=host $docker_i docker run -i --rm=true -w /var/local/git/grpc/../grpc-java --net=host $docker_image bash -c "./run-test-client.sh --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=cancel_after_begin" docker run -i --rm=true -w /var/local/git/grpc/../grpc-java --net=host $docker_image bash -c "./run-test-client.sh --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=cancel_after_first_response" docker run -i --rm=true -w /var/local/git/grpc/../grpc-java --net=host $docker_image bash -c "./run-test-client.sh --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=timeout_on_sleeping_server" +docker run -i --rm=true -w /var/local/git/grpc/../grpc-java --net=host $docker_image bash -c "./run-test-client.sh --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=large_unary" +docker run -i --rm=true -w /var/local/git/grpc/../grpc-java --net=host $docker_image bash -c "./run-test-client.sh --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=empty_unary" +docker run -i --rm=true -w /var/local/git/grpc/../grpc-java --net=host $docker_image bash -c "./run-test-client.sh --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=ping_pong" +docker run -i --rm=true -w /var/local/git/grpc/../grpc-java --net=host $docker_image bash -c "./run-test-client.sh --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=empty_stream" +docker run -i --rm=true -w /var/local/git/grpc/../grpc-java --net=host $docker_image bash -c "./run-test-client.sh --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=client_streaming" +docker run -i --rm=true -w /var/local/git/grpc/../grpc-java --net=host $docker_image bash -c "./run-test-client.sh --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=server_streaming" +docker run -i --rm=true -w /var/local/git/grpc/../grpc-java --net=host $docker_image bash -c "./run-test-client.sh --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=cancel_after_begin" +docker run -i --rm=true -w /var/local/git/grpc/../grpc-java --net=host $docker_image bash -c "./run-test-client.sh --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=cancel_after_first_response" +docker run -i --rm=true -w /var/local/git/grpc/../grpc-java --net=host $docker_image bash -c "./run-test-client.sh --server_host=216.239.32.254 --server_host_override=grpc-test4.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=timeout_on_sleeping_server" diff --git a/tools/jenkins/run_full_performance.sh b/tools/jenkins/run_full_performance.sh index 9598fd77349..195cc68003d 100755 --- a/tools/jenkins/run_full_performance.sh +++ b/tools/jenkins/run_full_performance.sh @@ -21,7 +21,7 @@ cd $(dirname $0)/../.. # run 8core client vs 8core server tools/run_tests/run_performance_tests.py \ - -l c++ csharp node ruby java python go node_express php_protobuf_php php_protobuf_c \ + -l c++ csharp node ruby java python go node_express php7 php7_protobuf_c \ --netperf \ --category scalable \ --bq_result_table performance_test.performance_experiment \ diff --git a/tools/run_tests/performance/build_performance.sh b/tools/run_tests/performance/build_performance.sh index e46d4e00403..e7d8db8e3ea 100755 --- a/tools/run_tests/performance/build_performance.sh +++ b/tools/run_tests/performance/build_performance.sh @@ -31,6 +31,7 @@ then make CONFIG=${CONFIG} EMBED_OPENSSL=true EMBED_ZLIB=true qps_worker qps_json_driver -j8 fi +PHP_ALREADY_BUILT="" for language in $@ do case "$language" in @@ -43,6 +44,14 @@ do "go") tools/run_tests/performance/build_performance_go.sh ;; + "php7"|"php7_protobuf_c") + if [ -n "$PHP_ALREADY_BUILT" ]; then + echo "Skipping PHP build as already built by $PHP_ALREADY_BUILT" + else + PHP_ALREADY_BUILT=$language + tools/run_tests/performance/build_performance_php7.sh + fi + ;; "csharp") python tools/run_tests/run_tests.py -l $language -c $CONFIG --build_only -j 8 --compiler coreclr ;; diff --git a/tools/internal_ci/linux/grpc_interop_tocloud.sh b/tools/run_tests/performance/build_performance_php7.sh similarity index 66% rename from tools/internal_ci/linux/grpc_interop_tocloud.sh rename to tools/run_tests/performance/build_performance_php7.sh index e3ba25af5df..141c9fd1c81 100755 --- a/tools/internal_ci/linux/grpc_interop_tocloud.sh +++ b/tools/run_tests/performance/build_performance_php7.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/bash # Copyright 2017 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,12 +15,16 @@ set -ex -export LANG=en_US.UTF-8 - -# Enter the gRPC repo root cd $(dirname $0)/../../.. +CONFIG=${CONFIG:-opt} +python tools/run_tests/run_tests.py -l php7 -c $CONFIG --build_only -j 8 -source tools/internal_ci/helper_scripts/prepare_build_linux_rc -source tools/internal_ci/helper_scripts/prepare_build_interop_rc +# Set up all dependences needed for PHP QPS test +cd src/php/tests/qps +composer install +# Install protobuf C-extension for php +cd vendor/google/protobuf/php/ext/google/protobuf +phpize +./configure +make -tools/run_tests/run_interop_tests.py -l all -s all --use_docker --http2_interop --internal_ci -t -j 12 $@ diff --git a/tools/run_tests/performance/run_worker_php.sh b/tools/run_tests/performance/run_worker_php.sh index e524d5286d0..8c7ceef2ff7 100755 --- a/tools/run_tests/performance/run_worker_php.sh +++ b/tools/run_tests/performance/run_worker_php.sh @@ -17,17 +17,7 @@ source ~/.rvm/scripts/rvm set -ex cd $(dirname $0)/../../.. -repo=$(pwd) -# First set up all dependences needed for PHP QPS test -cd $repo -cd src/php/tests/qps -composer install -# Install protobuf C-extension for php -cd vendor/google/protobuf/php/ext/google/protobuf -phpize -./configure -make + # The proxy worker for PHP is implemented in Ruby -cd $repo ruby src/ruby/qps/proxy-worker.rb $@ diff --git a/tools/run_tests/performance/scenario_config.py b/tools/run_tests/performance/scenario_config.py index 5019358ab3e..8f01eb4b2aa 100644 --- a/tools/run_tests/performance/scenario_config.py +++ b/tools/run_tests/performance/scenario_config.py @@ -800,39 +800,54 @@ class RubyLanguage: return 'ruby' -class PhpLanguage: +class Php7Language: - def __init__(self, use_protobuf_c_extension=False): + def __init__(self, php7_protobuf_c=False): pass - self.use_protobuf_c_extension=use_protobuf_c_extension + self.php7_protobuf_c=php7_protobuf_c self.safename = str(self) def worker_cmdline(self): - if self.use_protobuf_c_extension: - return ['tools/run_tests/performance/run_worker_php.sh -c'] + if self.php7_protobuf_c: + return ['tools/run_tests/performance/run_worker_php.sh --use_protobuf_c_extension'] return ['tools/run_tests/performance/run_worker_php.sh'] def worker_port_offset(self): + if self.php7_protobuf_c: + return 900 return 800 def scenarios(self): - php_extension_mode='php_protobuf_php_extension' - if self.use_protobuf_c_extension: - php_extension_mode='php_protobuf_c_extension' + php7_extension_mode='php7_protobuf_php_extension' + if self.php7_protobuf_c: + php7_extension_mode='php7_protobuf_c_extension' yield _ping_pong_scenario( - '%s_to_cpp_protobuf_sync_unary_ping_pong' % php_extension_mode, + '%s_to_cpp_protobuf_sync_unary_ping_pong' % php7_extension_mode, rpc_type='UNARY', client_type='SYNC_CLIENT', server_type='SYNC_SERVER', server_language='c++', async_server_threads=1) yield _ping_pong_scenario( - '%s_to_cpp_protobuf_sync_streaming_ping_pong' % php_extension_mode, + '%s_to_cpp_protobuf_sync_streaming_ping_pong' % php7_extension_mode, rpc_type='STREAMING', client_type='SYNC_CLIENT', server_type='SYNC_SERVER', server_language='c++', async_server_threads=1) - def __str__(self): - return 'php' + # TODO(ddyihai): Investigate why when async_server_threads=1/CPU usage 340%, the QPS performs + # better than async_server_threads=0/CPU usage 490%. + yield _ping_pong_scenario( + '%s_to_cpp_protobuf_sync_unary_qps_unconstrained' % php7_extension_mode, + rpc_type='UNARY', client_type='SYNC_CLIENT', server_type='ASYNC_SERVER', + server_language='c++', outstanding=1, async_server_threads=1, unconstrained_client='sync') + yield _ping_pong_scenario( + '%s_to_cpp_protobuf_sync_streaming_qps_unconstrained' % php7_extension_mode, + rpc_type='STREAMING', client_type='SYNC_CLIENT', server_type='ASYNC_SERVER', + server_language='c++', outstanding=1, async_server_threads=1, unconstrained_client='sync') + + def __str__(self): + if self.php7_protobuf_c: + return 'php7_protobuf_c' + return 'php7' class JavaLanguage: @@ -1031,8 +1046,8 @@ LANGUAGES = { 'node' : NodeLanguage(), 'node_express': NodeExpressLanguage(), 'ruby' : RubyLanguage(), - 'php_protobuf_php' : PhpLanguage(), - 'php_protobuf_c' : PhpLanguage(use_protobuf_c_extension=True), + 'php7' : Php7Language(), + 'php7_protobuf_c' : Php7Language(php7_protobuf_c=True), 'java' : JavaLanguage(), 'python' : PythonLanguage(), 'go' : GoLanguage(), diff --git a/tools/run_tests/python_utils/jobset.py b/tools/run_tests/python_utils/jobset.py index d523095e703..658b814d81f 100755 --- a/tools/run_tests/python_utils/jobset.py +++ b/tools/run_tests/python_utils/jobset.py @@ -412,7 +412,7 @@ class Jobset(object): if current_cpu_cost + spec.cpu_cost <= self._maxjobs: if len(self._running) < self._maxjobs_cpu_agnostic: break - self.reap() + self.reap(spec.shortname, spec.cpu_cost) if self.cancelled(): return False job = Job(spec, self._newline_on_success, @@ -424,7 +424,7 @@ class Jobset(object): self.resultset[job.GetSpec().shortname] = [] return True - def reap(self): + def reap(self, waiting_for=None, waiting_for_cost=None): """Collect the dead jobs.""" while self._running: dead = set() @@ -452,8 +452,12 @@ class Jobset(object): sofar = now - self._start_time remaining = sofar / self._completed * (self._remaining + len(self._running)) rstr = 'ETA %.1f sec; %s' % (remaining, rstr) - message('WAITING', '%s%d jobs running, %d complete, %d failed' % ( - rstr, len(self._running), self._completed, self._failures)) + if waiting_for is not None: + wstr = ' next: %s @ %.2f cpu' % (waiting_for, waiting_for_cost) + else: + wstr = '' + message('WAITING', '%s%d jobs running, %d complete, %d failed (load %.2f)%s' % ( + rstr, len(self._running), self._completed, self._failures, self.cpu_cost(), wstr)) if platform_string() == 'windows': time.sleep(0.1) else: diff --git a/tools/run_tests/python_utils/upload_test_results.py b/tools/run_tests/python_utils/upload_test_results.py index 15e827769e1..ea97bc0aec1 100644 --- a/tools/run_tests/python_utils/upload_test_results.py +++ b/tools/run_tests/python_utils/upload_test_results.py @@ -51,6 +51,19 @@ _RESULTS_SCHEMA = [ ('cpu_measured', 'FLOAT', 'Actual CPU usage of test'), ('return_code', 'INTEGER', 'Exit code of test'), ] +_INTEROP_RESULTS_SCHEMA = [ + ('job_name', 'STRING', 'Name of Jenkins/Kokoro job'), + ('build_id', 'INTEGER', 'Build ID of Jenkins/Kokoro job'), + ('build_url', 'STRING', 'URL of Jenkins/Kokoro job'), + ('test_name', 'STRING', 'Unique test name combining client, server, and test_name'), + ('suite', 'STRING', 'Test suite: cloud_to_cloud, cloud_to_prod, or cloud_to_prod_auth'), + ('client', 'STRING', 'Client language'), + ('server', 'STRING', 'Server host name'), + ('test_case', 'STRING', 'Name of test case'), + ('result', 'STRING', 'Test result: PASSED, TIMEOUT, FAILED, or SKIPPED'), + ('timestamp', 'TIMESTAMP', 'Timestamp of test run'), + ('elapsed_time', 'FLOAT', 'How long test took to run'), +] def _get_build_metadata(test_results): @@ -114,3 +127,41 @@ def upload_results_to_bq(resultset, bq_table, args, platform): else: print('Error uploading result to bigquery, all attempts failed.') sys.exit(1) + + +def upload_interop_results_to_bq(resultset, bq_table, args): + """Upload interop test results to a BQ table. + + Args: + resultset: dictionary generated by jobset.run + bq_table: string name of table to create/upload results to in BQ + args: args in run_interop_tests.py, generated by argparse + """ + bq = big_query_utils.create_big_query() + big_query_utils.create_partitioned_table(bq, _PROJECT_ID, _DATASET_ID, bq_table, _INTEROP_RESULTS_SCHEMA, _DESCRIPTION, + partition_type=_PARTITION_TYPE, expiration_ms= _EXPIRATION_MS) + + for shortname, results in six.iteritems(resultset): + for result in results: + test_results = {} + _get_build_metadata(test_results) + test_results['elapsed_time'] = '%.2f' % result.elapsed_time + test_results['result'] = result.state + test_results['test_name'] = shortname + test_results['suite'] = shortname.split(':')[0] + test_results['client'] = shortname.split(':')[1] + test_results['server'] = shortname.split(':')[2] + test_results['test_case'] = shortname.split(':')[3] + test_results['timestamp'] = time.strftime('%Y-%m-%d %H:%M:%S') + row = big_query_utils.make_row(str(uuid.uuid4()), test_results) + # TODO(jtattermusch): rows are inserted one by one, very inefficient + max_retries = 3 + for attempt in range(max_retries): + if big_query_utils.insert_rows(bq, _PROJECT_ID, _DATASET_ID, bq_table, [row]): + break + else: + if attempt < max_retries - 1: + print('Error uploading result to bigquery, will retry.') + else: + print('Error uploading result to bigquery, all attempts failed.') + sys.exit(1) diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py index 1537641aee9..192f8e76eb4 100755 --- a/tools/run_tests/run_interop_tests.py +++ b/tools/run_tests/run_interop_tests.py @@ -35,6 +35,11 @@ import traceback import python_utils.dockerjob as dockerjob import python_utils.jobset as jobset import python_utils.report_utils as report_utils +# It's ok to not import because this is only necessary to upload results to BQ. +try: + from python_utils.upload_test_results import upload_interop_results_to_bq +except ImportError as e: + print(e) # Docker doesn't clean up after itself, so we do it on exit. atexit.register(lambda: subprocess.call(['stty', 'echo'])) @@ -956,6 +961,11 @@ argp.add_argument('--internal_ci', const=True, help=('Put reports into subdirectories to improve ' 'presentation of results by Internal CI.')) +argp.add_argument('--bq_result_table', + default='', + type=str, + nargs='?', + help='Upload test results to a specified BQ table.') args = argp.parse_args() servers = set(s for s in itertools.chain.from_iterable(_SERVERS @@ -1205,6 +1215,8 @@ try: num_failures, resultset = jobset.run(jobs, newline_on_success=True, maxjobs=args.jobs, skip_jobs=args.manual_run) + if args.bq_result_table and resultset: + upload_interop_results_to_bq(resultset, args.bq_result_table, args) if num_failures: jobset.message('FAILED', 'Some tests failed', do_newline=True) else: