diff --git a/BUILD b/BUILD index 7fcd4a55f5d..8be2c685cd8 100644 --- a/BUILD +++ b/BUILD @@ -551,7 +551,6 @@ grpc_cc_library( "src/core/lib/gprpp/global_config_generic.h", "src/core/lib/gprpp/host_port.h", "src/core/lib/gprpp/manual_constructor.h", - "src/core/lib/gprpp/map.h", "src/core/lib/gprpp/memory.h", "src/core/lib/gprpp/mpscq.h", "src/core/lib/gprpp/string_view.h", @@ -618,40 +617,12 @@ grpc_cc_library( ], ) -grpc_cc_library( - name = "inlined_vector", - external_deps = [ - "absl/container:inlined_vector", - ], - language = "c++", - public_hdrs = [ - "src/core/lib/gprpp/inlined_vector.h", - ], - deps = [ - "gpr_base", - ], -) - grpc_cc_library( name = "debug_location", language = "c++", public_hdrs = ["src/core/lib/gprpp/debug_location.h"], ) -grpc_cc_library( - name = "optional", - external_deps = [ - "absl/types:optional", - ], - language = "c++", - public_hdrs = [ - "src/core/lib/gprpp/optional.h", - ], - deps = [ - "gpr_base", - ], -) - grpc_cc_library( name = "orphanable", language = "c++", @@ -990,6 +961,8 @@ grpc_cc_library( ], external_deps = [ "madler_zlib", + "absl/container:inlined_vector", + "absl/types:optional", ], language = "c++", public_hdrs = GRPC_PUBLIC_HDRS, @@ -998,8 +971,6 @@ grpc_cc_library( "gpr_base", "grpc_codegen", "grpc_trace", - "inlined_vector", - "optional", "orphanable", "ref_counted", "ref_counted_ptr", @@ -1107,6 +1078,9 @@ grpc_cc_library( "src/core/ext/filters/client_channel/subchannel_interface.h", "src/core/ext/filters/client_channel/subchannel_pool_interface.h", ], + external_deps = [ + "absl/container:inlined_vector", + ], language = "c++", deps = [ "gpr_base", @@ -1114,7 +1088,6 @@ grpc_cc_library( "grpc_client_authority_filter", "grpc_deadline_filter", "grpc_health_upb", - "inlined_vector", "orphanable", "ref_counted", "ref_counted_ptr", diff --git a/BUILD.gn b/BUILD.gn index 6c3db9ac4b7..40dfa4bf46c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -156,7 +156,6 @@ config("grpc_config") { "src/core/lib/gprpp/host_port.cc", "src/core/lib/gprpp/host_port.h", "src/core/lib/gprpp/manual_constructor.h", - "src/core/lib/gprpp/map.h", "src/core/lib/gprpp/memory.h", "src/core/lib/gprpp/mpscq.cc", "src/core/lib/gprpp/mpscq.h", @@ -570,8 +569,6 @@ config("grpc_config") { "src/core/lib/debug/trace.h", "src/core/lib/gprpp/atomic.h", "src/core/lib/gprpp/debug_location.h", - "src/core/lib/gprpp/inlined_vector.h", - "src/core/lib/gprpp/optional.h", "src/core/lib/gprpp/orphanable.h", "src/core/lib/gprpp/ref_counted.h", "src/core/lib/gprpp/ref_counted_ptr.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 17ed31d4910..a82784d07db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -756,7 +756,6 @@ if(gRPC_BUILD_TESTS) add_dependencies(buildtests_cxx mock_test) add_dependencies(buildtests_cxx nonblocking_test) add_dependencies(buildtests_cxx noop-benchmark) - add_dependencies(buildtests_cxx optional_test) add_dependencies(buildtests_cxx orphanable_test) add_dependencies(buildtests_cxx out_of_bounds_bad_client_test) add_dependencies(buildtests_cxx pid_controller_test) @@ -12166,44 +12165,6 @@ target_link_libraries(noop-benchmark ) -endif() -if(gRPC_BUILD_TESTS) - -add_executable(optional_test - test/core/gprpp/optional_test.cc - third_party/googletest/googletest/src/gtest-all.cc - third_party/googletest/googlemock/src/gmock-all.cc -) - -target_include_directories(optional_test - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/include - ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} - ${_gRPC_SSL_INCLUDE_DIR} - ${_gRPC_UPB_GENERATED_DIR} - ${_gRPC_UPB_GRPC_GENERATED_DIR} - ${_gRPC_UPB_INCLUDE_DIR} - ${_gRPC_ZLIB_INCLUDE_DIR} - third_party/googletest/googletest/include - third_party/googletest/googletest - third_party/googletest/googlemock/include - third_party/googletest/googlemock - ${_gRPC_PROTO_GENS_DIR} -) - -target_link_libraries(optional_test - ${_gRPC_PROTOBUF_LIBRARIES} - ${_gRPC_ALLTARGETS_LIBRARIES} - grpc_test_util - grpc - gpr - address_sorting - upb - ${_gRPC_GFLAGS_LIBRARIES} -) - - endif() if(gRPC_BUILD_TESTS) diff --git a/Makefile b/Makefile index 883745259c5..1ccc7e99fd5 100644 --- a/Makefile +++ b/Makefile @@ -1251,7 +1251,6 @@ nanopb_fuzzer_response_test: $(BINDIR)/$(CONFIG)/nanopb_fuzzer_response_test nanopb_fuzzer_serverlist_test: $(BINDIR)/$(CONFIG)/nanopb_fuzzer_serverlist_test nonblocking_test: $(BINDIR)/$(CONFIG)/nonblocking_test noop-benchmark: $(BINDIR)/$(CONFIG)/noop-benchmark -optional_test: $(BINDIR)/$(CONFIG)/optional_test orphanable_test: $(BINDIR)/$(CONFIG)/orphanable_test out_of_bounds_bad_client_test: $(BINDIR)/$(CONFIG)/out_of_bounds_bad_client_test percent_decode_fuzzer: $(BINDIR)/$(CONFIG)/percent_decode_fuzzer @@ -1616,7 +1615,6 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/mock_test \ $(BINDIR)/$(CONFIG)/nonblocking_test \ $(BINDIR)/$(CONFIG)/noop-benchmark \ - $(BINDIR)/$(CONFIG)/optional_test \ $(BINDIR)/$(CONFIG)/orphanable_test \ $(BINDIR)/$(CONFIG)/out_of_bounds_bad_client_test \ $(BINDIR)/$(CONFIG)/pid_controller_test \ @@ -1774,7 +1772,6 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/mock_test \ $(BINDIR)/$(CONFIG)/nonblocking_test \ $(BINDIR)/$(CONFIG)/noop-benchmark \ - $(BINDIR)/$(CONFIG)/optional_test \ $(BINDIR)/$(CONFIG)/orphanable_test \ $(BINDIR)/$(CONFIG)/out_of_bounds_bad_client_test \ $(BINDIR)/$(CONFIG)/pid_controller_test \ @@ -2276,8 +2273,6 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/nonblocking_test || ( echo test nonblocking_test failed ; exit 1 ) $(E) "[RUN] Testing noop-benchmark" $(Q) $(BINDIR)/$(CONFIG)/noop-benchmark || ( echo test noop-benchmark failed ; exit 1 ) - $(E) "[RUN] Testing optional_test" - $(Q) $(BINDIR)/$(CONFIG)/optional_test || ( echo test optional_test failed ; exit 1 ) $(E) "[RUN] Testing orphanable_test" $(Q) $(BINDIR)/$(CONFIG)/orphanable_test || ( echo test orphanable_test failed ; exit 1 ) $(E) "[RUN] Testing out_of_bounds_bad_client_test" @@ -16213,49 +16208,6 @@ endif endif -OPTIONAL_TEST_SRC = \ - test/core/gprpp/optional_test.cc \ - -OPTIONAL_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(OPTIONAL_TEST_SRC)))) -ifeq ($(NO_SECURE),true) - -# You can't build secure targets if you don't have OpenSSL. - -$(BINDIR)/$(CONFIG)/optional_test: openssl_dep_error - -else - - - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.5.0+. - -$(BINDIR)/$(CONFIG)/optional_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/optional_test: $(PROTOBUF_DEP) $(OPTIONAL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(OPTIONAL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/optional_test - -endif - -endif - -$(OBJDIR)/$(CONFIG)/test/core/gprpp/optional_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a - -deps_optional_test: $(OPTIONAL_TEST_OBJS:.o=.dep) - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(OPTIONAL_TEST_OBJS:.o=.dep) -endif -endif - - ORPHANABLE_TEST_SRC = \ test/core/gprpp/orphanable_test.cc \ diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index ca226638154..560904729ad 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -299,7 +299,6 @@ libs: - src/core/lib/gprpp/global_config_generic.h - src/core/lib/gprpp/host_port.h - src/core/lib/gprpp/manual_constructor.h - - src/core/lib/gprpp/map.h - src/core/lib/gprpp/memory.h - src/core/lib/gprpp/mpscq.h - src/core/lib/gprpp/string_view.h @@ -548,8 +547,6 @@ libs: - src/core/lib/debug/trace.h - src/core/lib/gprpp/atomic.h - src/core/lib/gprpp/debug_location.h - - src/core/lib/gprpp/inlined_vector.h - - src/core/lib/gprpp/optional.h - src/core/lib/gprpp/orphanable.h - src/core/lib/gprpp/ref_counted.h - src/core/lib/gprpp/ref_counted_ptr.h @@ -1451,8 +1448,6 @@ libs: - src/core/lib/debug/trace.h - src/core/lib/gprpp/atomic.h - src/core/lib/gprpp/debug_location.h - - src/core/lib/gprpp/inlined_vector.h - - src/core/lib/gprpp/optional.h - src/core/lib/gprpp/orphanable.h - src/core/lib/gprpp/ref_counted.h - src/core/lib/gprpp/ref_counted_ptr.h @@ -6538,19 +6533,6 @@ targets: - benchmark benchmark: true defaults: benchmark -- name: optional_test - gtest: true - build: test - language: c++ - headers: [] - src: - - test/core/gprpp/optional_test.cc - deps: - - grpc_test_util - - grpc - - gpr - - address_sorting - - upb - name: orphanable_test gtest: true build: test diff --git a/doc/python/sphinx/conf.py b/doc/python/sphinx/conf.py index 49e5ecb1dcd..6e4bfab7d0e 100644 --- a/doc/python/sphinx/conf.py +++ b/doc/python/sphinx/conf.py @@ -28,13 +28,17 @@ sys.path.insert(0, os.path.join(PYTHON_FOLDER, 'grpcio_testing')) # -- Project information ----------------------------------------------------- project = 'gRPC Python' -copyright = '2018, The gRPC Authors' +copyright = '2020, The gRPC Authors' author = 'The gRPC Authors' # Import generated grpc_version after the path been modified import grpc_version -version = ".".join(grpc_version.VERSION.split(".")[:3]) +version = '.'.join(grpc_version.VERSION.split('.')[:3]) release = grpc_version.VERSION +if 'dev' in grpc_version.VERSION: + branch = 'master' +else: + branch = 'v%s.%s.x' % tuple(grpc_version.VERSION.split('.')[:2]) # -- General configuration --------------------------------------------------- @@ -100,3 +104,7 @@ epub_exclude_files = ['search.html'] # -- Options for todo extension ---------------------------------------------- todo_include_todos = True + +# -- Options for substitutions ----------------------------------------------- + +rst_epilog = '.. |grpc_types_link| replace:: https://github.com/grpc/grpc/blob/%s/include/grpc/impl/codegen/grpc_types.h' % branch diff --git a/doc/python/sphinx/glossary.rst b/doc/python/sphinx/glossary.rst index cae5f4a32e3..a4daa31d180 100644 --- a/doc/python/sphinx/glossary.rst +++ b/doc/python/sphinx/glossary.rst @@ -27,3 +27,24 @@ Glossary the returned object doesn't have restrictions (i.e. ``None`` allowed). The deserializer is invoked with inbound message bytes on both the server side and the client-side. + + wait_for_ready + If an RPC is issued but the channel is in the TRANSIENT_FAILURE or SHUTDOWN + states, the library cannot transmit the RPC at the moment. By default, the + gRPC library will fail such RPCs immediately. This is known as "fail fast." + RPCs will not fail as a result of the channel being in other states + (CONNECTING, READY, or IDLE). + + When the wait_for_ready option is specified, the library will queue RPCs + until the channel is READY. Any submitted RPCs may still fail before the + READY state is reached for other reasons, e.g., the client channel has been + shut down or the RPC's deadline has been reached. + + channel_arguments + A list of key-value pairs to configure the underlying gRPC Core channel or + server object. Channel arguments are meant for advanced usages and contain + experimental API (some may not labeled as experimental). Full list of + available channel arguments and documentation can be found under the + "grpc_arg_keys" section of "grpc_types.h" header file (|grpc_types_link|). + For example, if you want to disable TCP port reuse, you may construct + channel arguments like: ``options = (('grpc.so_reuseport', 0),)``. diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 612090f465c..b94955f47a4 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -418,12 +418,9 @@ Pod::Spec.new do |s| 'src/core/lib/gprpp/global_config_env.h', 'src/core/lib/gprpp/global_config_generic.h', 'src/core/lib/gprpp/host_port.h', - 'src/core/lib/gprpp/inlined_vector.h', 'src/core/lib/gprpp/manual_constructor.h', - 'src/core/lib/gprpp/map.h', 'src/core/lib/gprpp/memory.h', 'src/core/lib/gprpp/mpscq.h', - 'src/core/lib/gprpp/optional.h', 'src/core/lib/gprpp/orphanable.h', 'src/core/lib/gprpp/ref_counted.h', 'src/core/lib/gprpp/ref_counted_ptr.h', @@ -870,12 +867,9 @@ Pod::Spec.new do |s| 'src/core/lib/gprpp/global_config_env.h', 'src/core/lib/gprpp/global_config_generic.h', 'src/core/lib/gprpp/host_port.h', - 'src/core/lib/gprpp/inlined_vector.h', 'src/core/lib/gprpp/manual_constructor.h', - 'src/core/lib/gprpp/map.h', 'src/core/lib/gprpp/memory.h', 'src/core/lib/gprpp/mpscq.h', - 'src/core/lib/gprpp/optional.h', 'src/core/lib/gprpp/orphanable.h', 'src/core/lib/gprpp/ref_counted.h', 'src/core/lib/gprpp/ref_counted_ptr.h', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index b2595ac1ce4..d04fa0aaabc 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -610,13 +610,10 @@ Pod::Spec.new do |s| 'src/core/lib/gprpp/global_config_generic.h', 'src/core/lib/gprpp/host_port.cc', 'src/core/lib/gprpp/host_port.h', - 'src/core/lib/gprpp/inlined_vector.h', 'src/core/lib/gprpp/manual_constructor.h', - 'src/core/lib/gprpp/map.h', 'src/core/lib/gprpp/memory.h', 'src/core/lib/gprpp/mpscq.cc', 'src/core/lib/gprpp/mpscq.h', - 'src/core/lib/gprpp/optional.h', 'src/core/lib/gprpp/orphanable.h', 'src/core/lib/gprpp/ref_counted.h', 'src/core/lib/gprpp/ref_counted_ptr.h', @@ -1226,12 +1223,9 @@ Pod::Spec.new do |s| 'src/core/lib/gprpp/global_config_env.h', 'src/core/lib/gprpp/global_config_generic.h', 'src/core/lib/gprpp/host_port.h', - 'src/core/lib/gprpp/inlined_vector.h', 'src/core/lib/gprpp/manual_constructor.h', - 'src/core/lib/gprpp/map.h', 'src/core/lib/gprpp/memory.h', 'src/core/lib/gprpp/mpscq.h', - 'src/core/lib/gprpp/optional.h', 'src/core/lib/gprpp/orphanable.h', 'src/core/lib/gprpp/ref_counted.h', 'src/core/lib/gprpp/ref_counted_ptr.h', diff --git a/grpc.gemspec b/grpc.gemspec index c6faf7095f6..e2f6580651e 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -532,13 +532,10 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/gprpp/global_config_generic.h ) s.files += %w( src/core/lib/gprpp/host_port.cc ) s.files += %w( src/core/lib/gprpp/host_port.h ) - s.files += %w( src/core/lib/gprpp/inlined_vector.h ) s.files += %w( src/core/lib/gprpp/manual_constructor.h ) - s.files += %w( src/core/lib/gprpp/map.h ) s.files += %w( src/core/lib/gprpp/memory.h ) s.files += %w( src/core/lib/gprpp/mpscq.cc ) s.files += %w( src/core/lib/gprpp/mpscq.h ) - s.files += %w( src/core/lib/gprpp/optional.h ) s.files += %w( src/core/lib/gprpp/orphanable.h ) s.files += %w( src/core/lib/gprpp/ref_counted.h ) s.files += %w( src/core/lib/gprpp/ref_counted_ptr.h ) diff --git a/package.xml b/package.xml index adc859441ee..c5294e90da6 100644 --- a/package.xml +++ b/package.xml @@ -512,13 +512,10 @@ - - - diff --git a/src/core/ext/filters/client_channel/backend_metric.cc b/src/core/ext/filters/client_channel/backend_metric.cc index b36614f5b80..dbc296a39d4 100644 --- a/src/core/ext/filters/client_channel/backend_metric.cc +++ b/src/core/ext/filters/client_channel/backend_metric.cc @@ -26,12 +26,12 @@ namespace grpc_core { namespace { template -std::map ParseMap( +std::map ParseMap( udpa_data_orca_v1_OrcaLoadReport* msg, EntryType** (*entry_func)(udpa_data_orca_v1_OrcaLoadReport*, size_t*), upb_strview (*key_func)(const EntryType*), double (*value_func)(const EntryType*), Arena* arena) { - std::map result; + std::map result; size_t size; const auto* const* entries = entry_func(msg, &size); for (size_t i = 0; i < size; ++i) { diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index aea8e00a501..97fc16822ef 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -33,6 +34,9 @@ #include #include +#include "absl/container/inlined_vector.h" +#include "absl/types/optional.h" + #include "src/core/ext/filters/client_channel/backend_metric.h" #include "src/core/ext/filters/client_channel/backup_poller.h" #include "src/core/ext/filters/client_channel/global_subchannel_pool.h" @@ -52,9 +56,7 @@ #include "src/core/lib/channel/connected_channel.h" #include "src/core/lib/channel/status_util.h" #include "src/core/lib/gpr/string.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/manual_constructor.h" -#include "src/core/lib/gprpp/map.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/iomgr/polling_entity.h" @@ -293,7 +295,7 @@ class ChannelData { RefCountedPtr subchannel_pool_; OrphanablePtr resolving_lb_policy_; ConnectivityStateTracker state_tracker_; - grpc_core::UniquePtr health_check_service_name_; + std::string health_check_service_name_; RefCountedPtr saved_service_config_; bool received_first_resolver_result_ = false; // The number of SubchannelWrapper instances referencing a given Subchannel. @@ -305,8 +307,7 @@ class ChannelData { // Pending ConnectedSubchannel updates for each SubchannelWrapper. // Updates are queued here in the control plane work_serializer and then // applied in the data plane mutex when the picker is updated. - std::map, RefCountedPtr, - RefCountedPtrLess> + std::map, RefCountedPtr> pending_subchannel_updates_; // @@ -827,7 +828,7 @@ class CallData { // Note: We inline the cache for the first 3 send_message ops and use // dynamic allocation after that. This number was essentially picked // at random; it could be changed in the future to tune performance. - InlinedVector send_messages_; + absl::InlinedVector send_messages_; // send_trailing_metadata bool seen_send_trailing_metadata_ = false; grpc_linked_mdelem* send_trailing_metadata_storage_ = nullptr; @@ -849,7 +850,7 @@ class CallData { class ChannelData::SubchannelWrapper : public SubchannelInterface { public: SubchannelWrapper(ChannelData* chand, Subchannel* subchannel, - grpc_core::UniquePtr health_check_service_name) + std::string health_check_service_name) : SubchannelInterface(&grpc_client_channel_routing_trace), chand_(chand), subchannel_(subchannel), @@ -896,7 +897,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface { grpc_connectivity_state CheckConnectivityState() override { RefCountedPtr connected_subchannel; grpc_connectivity_state connectivity_state = - subchannel_->CheckConnectivityState(health_check_service_name_.get(), + subchannel_->CheckConnectivityState(health_check_service_name_, &connected_subchannel); MaybeUpdateConnectedSubchannel(std::move(connected_subchannel)); return connectivity_state; @@ -911,9 +912,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface { Ref(DEBUG_LOCATION, "WatcherWrapper"), initial_state); subchannel_->WatchConnectivityState( - initial_state, - grpc_core::UniquePtr( - gpr_strdup(health_check_service_name_.get())), + initial_state, health_check_service_name_, RefCountedPtr( watcher_wrapper)); } @@ -922,7 +921,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface { ConnectivityStateWatcherInterface* watcher) override { auto it = watcher_map_.find(watcher); GPR_ASSERT(it != watcher_map_.end()); - subchannel_->CancelConnectivityStateWatch(health_check_service_name_.get(), + subchannel_->CancelConnectivityStateWatch(health_check_service_name_, it->second); watcher_map_.erase(it); } @@ -935,14 +934,13 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface { return subchannel_->channel_args(); } - void UpdateHealthCheckServiceName( - grpc_core::UniquePtr health_check_service_name) { + void UpdateHealthCheckServiceName(std::string health_check_service_name) { if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) { gpr_log(GPR_INFO, "chand=%p: subchannel wrapper %p: updating health check service " "name from \"%s\" to \"%s\"", - chand_, this, health_check_service_name_.get(), - health_check_service_name.get()); + chand_, this, health_check_service_name_.c_str(), + health_check_service_name.c_str()); } for (auto& p : watcher_map_) { WatcherWrapper*& watcher_wrapper = p.second; @@ -957,13 +955,11 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface { // problem, we may be able to handle it by waiting for the new // watcher to report READY before we use it to replace the old one. WatcherWrapper* replacement = watcher_wrapper->MakeReplacement(); - subchannel_->CancelConnectivityStateWatch( - health_check_service_name_.get(), watcher_wrapper); + subchannel_->CancelConnectivityStateWatch(health_check_service_name_, + watcher_wrapper); watcher_wrapper = replacement; subchannel_->WatchConnectivityState( - replacement->last_seen_state(), - grpc_core::UniquePtr( - gpr_strdup(health_check_service_name.get())), + replacement->last_seen_state(), health_check_service_name, RefCountedPtr( replacement)); } @@ -1101,7 +1097,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface { ChannelData* chand_; Subchannel* subchannel_; - grpc_core::UniquePtr health_check_service_name_; + std::string health_check_service_name_; // Maps from the address of the watcher passed to us by the LB policy // to the address of the WrapperWatcher that we passed to the underlying // subchannel. This is needed so that when the LB policy calls @@ -1264,10 +1260,9 @@ class ChannelData::ClientChannelControlHelper const grpc_channel_args& args) override { bool inhibit_health_checking = grpc_channel_arg_get_bool( grpc_channel_args_find(&args, GRPC_ARG_INHIBIT_HEALTH_CHECKING), false); - grpc_core::UniquePtr health_check_service_name; + std::string health_check_service_name; if (!inhibit_health_checking) { - health_check_service_name.reset( - gpr_strdup(chand_->health_check_service_name_.get())); + health_check_service_name = chand_->health_check_service_name_; } static const char* args_to_remove[] = { GRPC_ARG_INHIBIT_HEALTH_CHECKING, @@ -1462,7 +1457,7 @@ void ChannelData::UpdateStateAndPickerLocked( std::unique_ptr picker) { // Clean the control plane when entering IDLE. if (picker_ == nullptr) { - health_check_service_name_.reset(); + health_check_service_name_.clear(); saved_service_config_.reset(); received_first_resolver_result_ = false; } @@ -1705,16 +1700,15 @@ bool ChannelData::ProcessResolverResultLocked( } // Save health check service name. if (service_config != nullptr) { - chand->health_check_service_name_.reset( - gpr_strdup(parsed_service_config->health_check_service_name())); + chand->health_check_service_name_ = + parsed_service_config->health_check_service_name(); } else { - chand->health_check_service_name_.reset(); + chand->health_check_service_name_.clear(); } // Update health check service name used by existing subchannel wrappers. for (auto* subchannel_wrapper : chand->subchannel_wrappers_) { subchannel_wrapper->UpdateHealthCheckServiceName( - grpc_core::UniquePtr( - gpr_strdup(chand->health_check_service_name_.get()))); + chand->health_check_service_name_); } // Save service config. chand->saved_service_config_ = std::move(service_config); @@ -1726,7 +1720,7 @@ bool ChannelData::ProcessResolverResultLocked( chand->received_first_resolver_result_ = true; RefCountedPtr retry_throttle_data; if (parsed_service_config != nullptr) { - Optional + absl::optional retry_throttle_config = parsed_service_config->retry_throttling(); if (retry_throttle_config.has_value()) { retry_throttle_data = diff --git a/src/core/ext/filters/client_channel/health/health_check_client.cc b/src/core/ext/filters/client_channel/health/health_check_client.cc index 5c4aa986e80..ba1bc26d293 100644 --- a/src/core/ext/filters/client_channel/health/health_check_client.cc +++ b/src/core/ext/filters/client_channel/health/health_check_client.cc @@ -44,7 +44,7 @@ TraceFlag grpc_health_check_client_trace(false, "health_check_client"); // HealthCheckClient::HealthCheckClient( - const char* service_name, + absl::string_view service_name, RefCountedPtr connected_subchannel, grpc_pollset_set* interested_parties, RefCountedPtr channelz_node, @@ -171,13 +171,14 @@ void HealthCheckClient::OnRetryTimer(void* arg, grpc_error* error) { namespace { -void EncodeRequest(const char* service_name, +void EncodeRequest(absl::string_view service_name, ManualConstructor* send_message) { upb::Arena arena; grpc_health_v1_HealthCheckRequest* request_struct = grpc_health_v1_HealthCheckRequest_new(arena.ptr()); grpc_health_v1_HealthCheckRequest_set_service( - request_struct, upb_strview_makez(service_name)); + request_struct, + upb_strview_make(service_name.data(), service_name.size())); size_t buf_length; char* buf = grpc_health_v1_HealthCheckRequest_serialize( request_struct, arena.ptr(), &buf_length); diff --git a/src/core/ext/filters/client_channel/health/health_check_client.h b/src/core/ext/filters/client_channel/health/health_check_client.h index f8b9ade5ab6..9b90e607631 100644 --- a/src/core/ext/filters/client_channel/health/health_check_client.h +++ b/src/core/ext/filters/client_channel/health/health_check_client.h @@ -21,6 +21,8 @@ #include +#include "absl/strings/string_view.h" + #include #include @@ -44,7 +46,7 @@ namespace grpc_core { class HealthCheckClient : public InternallyRefCounted { public: - HealthCheckClient(const char* service_name, + HealthCheckClient(absl::string_view service_name, RefCountedPtr connected_subchannel, grpc_pollset_set* interested_parties, RefCountedPtr channelz_node, @@ -150,7 +152,7 @@ class HealthCheckClient : public InternallyRefCounted { void SetHealthStatusLocked(grpc_connectivity_state state, const char* reason); // Requires holding mu_. - const char* service_name_; // Do not own. + absl::string_view service_name_; RefCountedPtr connected_subchannel_; grpc_pollset_set* interested_parties_; // Do not own. RefCountedPtr channelz_node_; diff --git a/src/core/ext/filters/client_channel/lb_policy.h b/src/core/ext/filters/client_channel/lb_policy.h index 4f269e9d383..9cdd1d478f5 100644 --- a/src/core/ext/filters/client_channel/lb_policy.h +++ b/src/core/ext/filters/client_channel/lb_policy.h @@ -27,7 +27,6 @@ #include "src/core/ext/filters/client_channel/server_address.h" #include "src/core/ext/filters/client_channel/service_config.h" #include "src/core/ext/filters/client_channel/subchannel_interface.h" -#include "src/core/lib/gprpp/map.h" #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/string_view.h" @@ -93,11 +92,11 @@ class LoadBalancingPolicy : public InternallyRefCounted { /// Application-specific requests cost metrics. Metric names are /// determined by the application. Each value is an absolute cost /// (e.g. 3487 bytes of storage) associated with the request. - std::map request_cost; + std::map request_cost; /// Application-specific resource utilization metrics. Metric names /// are determined by the application. Each value is expressed as a /// fraction of total resources available. - std::map utilization; + std::map utilization; }; /// Interface for accessing per-call state. diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc index 9f30e76c9a1..5a7a3840fa7 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc @@ -64,6 +64,8 @@ #include #include +#include "absl/container/inlined_vector.h" + #include #include #include @@ -555,7 +557,7 @@ ServerAddressList GrpcLb::Serverlist::GetServerAddressList( lb_token[0] = '\0'; } // Add address. - InlinedVector args_to_add; + absl::InlinedVector args_to_add; args_to_add.emplace_back(grpc_channel_arg_pointer_create( const_cast(GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN), lb_token, &lb_token_arg_vtable)); @@ -1273,7 +1275,7 @@ grpc_channel_args* BuildBalancerChannelArgs( GRPC_ARG_CHANNELZ_CHANNEL_NODE, }; // Channel args to add. - InlinedVector args_to_add; + absl::InlinedVector args_to_add; // The fake resolver response generator, which we use to inject // address updates into the LB channel. args_to_add.emplace_back( @@ -1595,7 +1597,7 @@ void GrpcLb::OnFallbackTimerLocked(grpc_error* error) { grpc_channel_args* GrpcLb::CreateChildPolicyArgsLocked( bool is_backend_from_grpclb_load_balancer) { - InlinedVector args_to_add; + absl::InlinedVector args_to_add; args_to_add.emplace_back(grpc_channel_arg_integer_create( const_cast(GRPC_ARG_ADDRESS_IS_BACKEND_FROM_GRPCLB_LOAD_BALANCER), is_backend_from_grpclb_load_balancer)); diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc index 414f8274317..92cf17ac751 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc @@ -22,6 +22,8 @@ #include +#include "absl/container/inlined_vector.h" + #include #include #include @@ -71,8 +73,8 @@ RefCountedPtr CreateTargetAuthorityTable( grpc_channel_args* ModifyGrpclbBalancerChannelArgs( const ServerAddressList& addresses, grpc_channel_args* args) { - InlinedVector args_to_remove; - InlinedVector args_to_add; + absl::InlinedVector args_to_remove; + absl::InlinedVector args_to_add; // Add arg for targets info table. RefCountedPtr target_authority_table = CreateTargetAuthorityTable(addresses); diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h index 4b1c0046bf0..f6e9440d3ee 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h @@ -23,7 +23,8 @@ #include -#include "src/core/lib/gprpp/inlined_vector.h" +#include "absl/container/inlined_vector.h" + #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/sync.h" @@ -40,7 +41,7 @@ class GrpcLbClientStats : public RefCounted { : token(std::move(token)), count(count) {} }; - typedef InlinedVector DroppedCallCounts; + typedef absl::InlinedVector DroppedCallCounts; void AddCallStarted(); void AddCallFinished(bool finished_with_client_failed_to_send, diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc index a5ab488ec55..56b71b69dfc 100644 --- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc @@ -160,7 +160,7 @@ class RoundRobin : public LoadBalancingPolicy { RoundRobin* parent_; size_t last_picked_index_; - InlinedVector, 10> subchannels_; + absl::InlinedVector, 10> subchannels_; }; void ShutdownLocked() override; diff --git a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h index 0fa4871b707..93c5deb7957 100644 --- a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +++ b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h @@ -25,6 +25,8 @@ #include +#include "absl/container/inlined_vector.h" + #include "src/core/ext/filters/client_channel/lb_policy_registry.h" #include "src/core/ext/filters/client_channel/server_address.h" // TODO(roth): Should not need the include of subchannel.h here, since @@ -33,7 +35,6 @@ #include "src/core/ext/filters/client_channel/subchannel_interface.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/debug/trace.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" @@ -172,7 +173,7 @@ class SubchannelData { template class SubchannelList : public InternallyRefCounted { public: - typedef InlinedVector SubchannelVector; + typedef absl::InlinedVector SubchannelVector; // The number of subchannels in the list. size_t num_subchannels() const { return subchannels_.size(); } @@ -370,7 +371,7 @@ SubchannelList::SubchannelList( GRPC_ARG_SERVICE_CONFIG}; // Create a subchannel for each address. for (size_t i = 0; i < addresses.size(); i++) { - InlinedVector args_to_add; + absl::InlinedVector args_to_add; const size_t subchannel_address_arg_index = args_to_add.size(); args_to_add.emplace_back( Subchannel::CreateSubchannelAddressArg(&addresses[i].address())); diff --git a/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc b/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc index 09e72ae72e0..5a59dc00226 100644 --- a/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +++ b/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc @@ -20,6 +20,7 @@ #include #include +#include "absl/container/inlined_vector.h" #include "absl/strings/str_cat.h" #include @@ -99,9 +100,8 @@ class WeightedTargetLb : public LoadBalancingPolicy { // ready state. The first element in the pair represents the end of a // range proportional to the child's weight. The start of the range // is the previous value in the vector and is 0 for the first element. - using PickerList = - InlinedVector>, - 1>; + using PickerList = absl::InlinedVector< + std::pair>, 1>; explicit WeightedPicker(PickerList pickers) : pickers_(std::move(pickers)) {} @@ -675,14 +675,15 @@ class WeightedTargetLbFactory : public LoadBalancingPolicyFactory { error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING( "field:weight error:must be of type number")); } else { - child_config->weight = - gpr_parse_nonnegative_int(it->second.string_value().c_str()); - if (child_config->weight == -1) { + int weight = gpr_parse_nonnegative_int(it->second.string_value().c_str()); + if (weight == -1) { error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING( "field:weight error:unparseable value")); - } else if (child_config->weight == 0) { + } else if (weight == 0) { error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING( "field:weight error:value must be greater than zero")); + } else { + child_config->weight = weight; } } // Child policy. diff --git a/src/core/ext/filters/client_channel/lb_policy_registry.cc b/src/core/ext/filters/client_channel/lb_policy_registry.cc index 498b158900e..806d6b3d8b4 100644 --- a/src/core/ext/filters/client_channel/lb_policy_registry.cc +++ b/src/core/ext/filters/client_channel/lb_policy_registry.cc @@ -22,8 +22,9 @@ #include +#include "absl/container/inlined_vector.h" + #include "src/core/lib/gpr/string.h" -#include "src/core/lib/gprpp/inlined_vector.h" namespace grpc_core { @@ -54,7 +55,8 @@ class RegistryState { } private: - InlinedVector, 10> factories_; + absl::InlinedVector, 10> + factories_; }; RegistryState* g_state = nullptr; diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc index de49ac76f6d..781941bdbb8 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc @@ -24,6 +24,8 @@ #include #include +#include "absl/container/inlined_vector.h" + #include #include @@ -249,7 +251,7 @@ std::string ChooseServiceConfig(char* service_config_choice_json, return ""; } const Json* service_config = nullptr; - InlinedVector error_list; + absl::InlinedVector error_list; for (const Json& choice : json.array_value()) { if (choice.type() != Json::Type::OBJECT) { error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING( @@ -352,7 +354,7 @@ void AresDnsResolver::OnResolvedLocked(grpc_error* error) { service_config_string, &result.service_config_error); } } - InlinedVector new_args; + absl::InlinedVector new_args; if (balancer_addresses_ != nullptr) { new_args.push_back( CreateGrpclbBalancerAddressesArg(balancer_addresses_.get())); diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc index 54c60072654..32784b0eded 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc @@ -26,6 +26,8 @@ #include #include +#include "absl/container/inlined_vector.h" + #include #include #include @@ -200,7 +202,7 @@ static void on_hostbyname_done_locked(void* arg, int status, int /*timeouts*/, } ServerAddressList& addresses = **address_list_ptr; for (size_t i = 0; hostent->h_addr_list[i] != nullptr; ++i) { - grpc_core::InlinedVector args_to_add; + absl::InlinedVector args_to_add; if (hr->is_balancer) { args_to_add.emplace_back( grpc_core::CreateGrpclbBalancerNameArg(hr->host)); diff --git a/src/core/ext/filters/client_channel/resolver_registry.cc b/src/core/ext/filters/client_channel/resolver_registry.cc index 718556a4c2a..c7f78389ac8 100644 --- a/src/core/ext/filters/client_channel/resolver_registry.cc +++ b/src/core/ext/filters/client_channel/resolver_registry.cc @@ -22,6 +22,8 @@ #include +#include "absl/container/inlined_vector.h" + #include #include #include @@ -90,7 +92,7 @@ class RegistryState { // more factories are needed and the additional allocations are // hurting performance (which is unlikely, since these allocations // only occur at gRPC initialization time). - InlinedVector, 10> factories_; + absl::InlinedVector, 10> factories_; grpc_core::UniquePtr default_prefix_; }; diff --git a/src/core/ext/filters/client_channel/resolver_registry.h b/src/core/ext/filters/client_channel/resolver_registry.h index 82025065494..bf34216b2cf 100644 --- a/src/core/ext/filters/client_channel/resolver_registry.h +++ b/src/core/ext/filters/client_channel/resolver_registry.h @@ -22,7 +22,6 @@ #include #include "src/core/ext/filters/client_channel/resolver_factory.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/iomgr/pollset_set.h" diff --git a/src/core/ext/filters/client_channel/resolver_result_parsing.cc b/src/core/ext/filters/client_channel/resolver_result_parsing.cc index d87890d1c97..0c23269c66a 100644 --- a/src/core/ext/filters/client_channel/resolver_result_parsing.cc +++ b/src/core/ext/filters/client_channel/resolver_result_parsing.cc @@ -24,6 +24,8 @@ #include #include +#include "absl/types/optional.h" + #include #include #include @@ -35,7 +37,6 @@ #include "src/core/lib/channel/status_util.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/gprpp/memory.h" -#include "src/core/lib/gprpp/optional.h" #include "src/core/lib/uri/uri_parser.h" // As per the retry design, we do not allow more than 5 retry attempts. @@ -283,13 +284,13 @@ grpc_error* ParseRetryThrottling( return GRPC_ERROR_CREATE_FROM_VECTOR("retryPolicy", &error_list); } -const char* ParseHealthCheckConfig(const Json& field, grpc_error** error) { +std::string ParseHealthCheckConfig(const Json& field, grpc_error** error) { GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE); - const char* service_name = nullptr; + std::string service_name; if (field.type() != Json::Type::OBJECT) { *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING( "field:healthCheckConfig error:should be of type object"); - return nullptr; + return service_name; } std::vector error_list; auto it = field.object_value().find("serviceName"); @@ -298,12 +299,9 @@ const char* ParseHealthCheckConfig(const Json& field, grpc_error** error) { error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING( "field:serviceName error:should be of type string")); } else { - service_name = it->second.string_value().c_str(); + service_name = it->second.string_value(); } } - if (!error_list.empty()) { - return nullptr; - } *error = GRPC_ERROR_CREATE_FROM_VECTOR("field:healthCheckConfig", &error_list); return service_name; @@ -318,8 +316,9 @@ ClientChannelServiceConfigParser::ParseGlobalParams(const Json& json, std::vector error_list; RefCountedPtr parsed_lb_config; std::string lb_policy_name; - Optional retry_throttling; - const char* health_check_service_name = nullptr; + absl::optional + retry_throttling; + std::string health_check_service_name; // Parse LB config. auto it = json.object_value().find("loadBalancingConfig"); if (it != json.object_value().end()) { @@ -386,7 +385,7 @@ ClientChannelServiceConfigParser::ParseGlobalParams(const Json& json, if (*error == GRPC_ERROR_NONE) { return absl::make_unique( std::move(parsed_lb_config), std::move(lb_policy_name), - retry_throttling, health_check_service_name); + retry_throttling, std::move(health_check_service_name)); } return nullptr; } @@ -396,7 +395,7 @@ ClientChannelServiceConfigParser::ParsePerMethodParams(const Json& json, grpc_error** error) { GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE); std::vector error_list; - Optional wait_for_ready; + absl::optional wait_for_ready; grpc_millis timeout = 0; std::unique_ptr retry_policy; // Parse waitForReady. diff --git a/src/core/ext/filters/client_channel/resolver_result_parsing.h b/src/core/ext/filters/client_channel/resolver_result_parsing.h index 1f928cfd551..c736a2ef91f 100644 --- a/src/core/ext/filters/client_channel/resolver_result_parsing.h +++ b/src/core/ext/filters/client_channel/resolver_result_parsing.h @@ -21,13 +21,14 @@ #include +#include "absl/types/optional.h" + #include "src/core/ext/filters/client_channel/lb_policy.h" #include "src/core/ext/filters/client_channel/lb_policy_factory.h" #include "src/core/ext/filters/client_channel/resolver.h" #include "src/core/ext/filters/client_channel/retry_throttle.h" #include "src/core/ext/filters/client_channel/service_config.h" #include "src/core/lib/channel/status_util.h" -#include "src/core/lib/gprpp/optional.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/exec_ctx.h" // for grpc_millis @@ -47,14 +48,14 @@ class ClientChannelGlobalParsedConfig : public ServiceConfig::ParsedConfig { ClientChannelGlobalParsedConfig( RefCountedPtr parsed_lb_config, std::string parsed_deprecated_lb_policy, - const Optional& retry_throttling, - const char* health_check_service_name) + const absl::optional& retry_throttling, + std::string health_check_service_name) : parsed_lb_config_(std::move(parsed_lb_config)), parsed_deprecated_lb_policy_(std::move(parsed_deprecated_lb_policy)), retry_throttling_(retry_throttling), health_check_service_name_(health_check_service_name) {} - Optional retry_throttling() const { + absl::optional retry_throttling() const { return retry_throttling_; } @@ -66,15 +67,15 @@ class ClientChannelGlobalParsedConfig : public ServiceConfig::ParsedConfig { return parsed_deprecated_lb_policy_; } - const char* health_check_service_name() const { + const std::string& health_check_service_name() const { return health_check_service_name_; } private: RefCountedPtr parsed_lb_config_; std::string parsed_deprecated_lb_policy_; - Optional retry_throttling_; - const char* health_check_service_name_; + absl::optional retry_throttling_; + std::string health_check_service_name_; }; class ClientChannelMethodParsedConfig : public ServiceConfig::ParsedConfig { @@ -88,7 +89,7 @@ class ClientChannelMethodParsedConfig : public ServiceConfig::ParsedConfig { }; ClientChannelMethodParsedConfig(grpc_millis timeout, - const Optional& wait_for_ready, + const absl::optional& wait_for_ready, std::unique_ptr retry_policy) : timeout_(timeout), wait_for_ready_(wait_for_ready), @@ -96,13 +97,13 @@ class ClientChannelMethodParsedConfig : public ServiceConfig::ParsedConfig { grpc_millis timeout() const { return timeout_; } - Optional wait_for_ready() const { return wait_for_ready_; } + absl::optional wait_for_ready() const { return wait_for_ready_; } const RetryPolicy* retry_policy() const { return retry_policy_.get(); } private: grpc_millis timeout_ = 0; - Optional wait_for_ready_; + absl::optional wait_for_ready_; std::unique_ptr retry_policy_; }; diff --git a/src/core/ext/filters/client_channel/resolving_lb_policy.cc b/src/core/ext/filters/client_channel/resolving_lb_policy.cc index 851c2f20e9a..f0c29ec0183 100644 --- a/src/core/ext/filters/client_channel/resolving_lb_policy.cc +++ b/src/core/ext/filters/client_channel/resolving_lb_policy.cc @@ -47,7 +47,6 @@ #include "src/core/lib/channel/connected_channel.h" #include "src/core/lib/channel/status_util.h" #include "src/core/lib/gpr/string.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/manual_constructor.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/iomgr.h" diff --git a/src/core/ext/filters/client_channel/resolving_lb_policy.h b/src/core/ext/filters/client_channel/resolving_lb_policy.h index ba53368f219..8a04491424f 100644 --- a/src/core/ext/filters/client_channel/resolving_lb_policy.h +++ b/src/core/ext/filters/client_channel/resolving_lb_policy.h @@ -21,13 +21,14 @@ #include +#include "absl/container/inlined_vector.h" + #include "src/core/ext/filters/client_channel/lb_policy.h" #include "src/core/ext/filters/client_channel/lb_policy_factory.h" #include "src/core/ext/filters/client_channel/resolver.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/debug/trace.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/iomgr/call_combiner.h" #include "src/core/lib/iomgr/closure.h" @@ -80,7 +81,7 @@ class ResolvingLoadBalancingPolicy : public LoadBalancingPolicy { void ResetBackoffLocked() override; private: - using TraceStringVector = InlinedVector; + using TraceStringVector = absl::InlinedVector; class ResolverResultHandler; class ResolvingControlHelper; diff --git a/src/core/ext/filters/client_channel/server_address.h b/src/core/ext/filters/client_channel/server_address.h index 10f49f2f344..f53dd3c7dd5 100644 --- a/src/core/ext/filters/client_channel/server_address.h +++ b/src/core/ext/filters/client_channel/server_address.h @@ -21,8 +21,9 @@ #include +#include "absl/container/inlined_vector.h" + #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/iomgr/resolve_address.h" namespace grpc_core { @@ -82,7 +83,7 @@ class ServerAddress { // ServerAddressList // -typedef InlinedVector ServerAddressList; +typedef absl::InlinedVector ServerAddressList; } // namespace grpc_core diff --git a/src/core/ext/filters/client_channel/service_config.cc b/src/core/ext/filters/client_channel/service_config.cc index f08ebe1a37d..04ef477204b 100644 --- a/src/core/ext/filters/client_channel/service_config.cc +++ b/src/core/ext/filters/client_channel/service_config.cc @@ -34,8 +34,8 @@ namespace grpc_core { namespace { -typedef InlinedVector, - ServiceConfig::kNumPreallocatedParsers> +typedef absl::InlinedVector, + ServiceConfig::kNumPreallocatedParsers> ServiceConfigParserList; ServiceConfigParserList* g_registered_parsers; } // namespace @@ -100,7 +100,7 @@ grpc_error* ServiceConfig::ParseGlobalParams() { grpc_error* ServiceConfig::ParseJsonMethodConfig(const Json& json) { // Parse method config with each registered parser. auto objs_vector = absl::make_unique(); - InlinedVector error_list; + std::vector error_list; for (size_t i = 0; i < g_registered_parsers->size(); i++) { grpc_error* parser_error = GRPC_ERROR_NONE; auto parsed_obj = diff --git a/src/core/ext/filters/client_channel/service_config.h b/src/core/ext/filters/client_channel/service_config.h index 3bba4ec1010..73157db50d3 100644 --- a/src/core/ext/filters/client_channel/service_config.h +++ b/src/core/ext/filters/client_channel/service_config.h @@ -21,10 +21,11 @@ #include +#include "absl/container/inlined_vector.h" + #include #include -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/error.h" @@ -89,7 +90,8 @@ class ServiceConfig : public RefCounted { }; static constexpr int kNumPreallocatedParsers = 4; - typedef InlinedVector, kNumPreallocatedParsers> + typedef absl::InlinedVector, + kNumPreallocatedParsers> ParsedConfigVector; /// When a service config is applied to a call in the client_channel_filter, @@ -175,7 +177,7 @@ class ServiceConfig : public RefCounted { std::string json_string_; Json json_; - InlinedVector, kNumPreallocatedParsers> + absl::InlinedVector, kNumPreallocatedParsers> parsed_global_configs_; // A map from the method name to the parsed config vector. Note that we are // using a raw pointer and not a unique pointer so that we can use the same @@ -186,7 +188,7 @@ class ServiceConfig : public RefCounted { const ParsedConfigVector* default_method_config_vector_ = nullptr; // Storage for all the vectors that are being used in // parsed_method_configs_table_. - InlinedVector, 32> + absl::InlinedVector, 32> parsed_method_config_vectors_storage_; }; diff --git a/src/core/ext/filters/client_channel/subchannel.cc b/src/core/ext/filters/client_channel/subchannel.cc index f350b2ec36a..62d2eff4fa1 100644 --- a/src/core/ext/filters/client_channel/subchannel.cc +++ b/src/core/ext/filters/client_channel/subchannel.cc @@ -424,11 +424,10 @@ void Subchannel::ConnectivityStateWatcherList::NotifyLocked( class Subchannel::HealthWatcherMap::HealthWatcher : public AsyncConnectivityStateWatcherInterface { public: - HealthWatcher(Subchannel* c, - grpc_core::UniquePtr health_check_service_name, + HealthWatcher(Subchannel* c, absl::string_view health_check_service_name, grpc_connectivity_state subchannel_state) : subchannel_(c), - health_check_service_name_(std::move(health_check_service_name)), + health_check_service_name_(std::string(health_check_service_name)), state_(subchannel_state == GRPC_CHANNEL_READY ? GRPC_CHANNEL_CONNECTING : subchannel_state) { GRPC_SUBCHANNEL_WEAK_REF(subchannel_, "health_watcher"); @@ -440,8 +439,8 @@ class Subchannel::HealthWatcherMap::HealthWatcher GRPC_SUBCHANNEL_WEAK_UNREF(subchannel_, "health_watcher"); } - const char* health_check_service_name() const { - return health_check_service_name_.get(); + absl::string_view health_check_service_name() const { + return health_check_service_name_; } grpc_connectivity_state state() const { return state_; } @@ -500,12 +499,12 @@ class Subchannel::HealthWatcherMap::HealthWatcher void StartHealthCheckingLocked() { GPR_ASSERT(health_check_client_ == nullptr); health_check_client_ = MakeOrphanable( - health_check_service_name_.get(), subchannel_->connected_subchannel_, + health_check_service_name_, subchannel_->connected_subchannel_, subchannel_->pollset_set_, subchannel_->channelz_node_, Ref()); } Subchannel* subchannel_; - grpc_core::UniquePtr health_check_service_name_; + std::string health_check_service_name_; OrphanablePtr health_check_client_; grpc_connectivity_state state_; ConnectivityStateWatcherList watcher_list_; @@ -517,18 +516,17 @@ class Subchannel::HealthWatcherMap::HealthWatcher void Subchannel::HealthWatcherMap::AddWatcherLocked( Subchannel* subchannel, grpc_connectivity_state initial_state, - grpc_core::UniquePtr health_check_service_name, + absl::string_view health_check_service_name, RefCountedPtr watcher) { // If the health check service name is not already present in the map, // add it. - auto it = map_.find(health_check_service_name.get()); + auto it = map_.find(health_check_service_name); HealthWatcher* health_watcher; if (it == map_.end()) { - const char* key = health_check_service_name.get(); auto w = MakeOrphanable( - subchannel, std::move(health_check_service_name), subchannel->state_); + subchannel, health_check_service_name, subchannel->state_); health_watcher = w.get(); - map_[key] = std::move(w); + map_[w->health_check_service_name()] = std::move(w); } else { health_watcher = it->second.get(); } @@ -537,7 +535,7 @@ void Subchannel::HealthWatcherMap::AddWatcherLocked( } void Subchannel::HealthWatcherMap::RemoveWatcherLocked( - const char* health_check_service_name, + absl::string_view health_check_service_name, ConnectivityStateWatcherInterface* watcher) { auto it = map_.find(health_check_service_name); GPR_ASSERT(it != map_.end()); @@ -555,7 +553,7 @@ void Subchannel::HealthWatcherMap::NotifyLocked(grpc_connectivity_state state) { grpc_connectivity_state Subchannel::HealthWatcherMap::CheckConnectivityStateLocked( - Subchannel* subchannel, const char* health_check_service_name) { + Subchannel* subchannel, absl::string_view health_check_service_name) { auto it = map_.find(health_check_service_name); if (it == map_.end()) { // If the health check service name is not found in the map, we're @@ -799,11 +797,11 @@ channelz::SubchannelNode* Subchannel::channelz_node() { } grpc_connectivity_state Subchannel::CheckConnectivityState( - const char* health_check_service_name, + absl::string_view health_check_service_name, RefCountedPtr* connected_subchannel) { MutexLock lock(&mu_); grpc_connectivity_state state; - if (health_check_service_name == nullptr) { + if (health_check_service_name.empty()) { state = state_; } else { state = health_watcher_map_.CheckConnectivityStateLocked( @@ -817,34 +815,33 @@ grpc_connectivity_state Subchannel::CheckConnectivityState( void Subchannel::WatchConnectivityState( grpc_connectivity_state initial_state, - grpc_core::UniquePtr health_check_service_name, + absl::string_view health_check_service_name, RefCountedPtr watcher) { MutexLock lock(&mu_); grpc_pollset_set* interested_parties = watcher->interested_parties(); if (interested_parties != nullptr) { grpc_pollset_set_add_pollset_set(pollset_set_, interested_parties); } - if (health_check_service_name == nullptr) { + if (health_check_service_name.empty()) { if (state_ != initial_state) { new AsyncWatcherNotifierLocked(watcher, this, state_); } watcher_list_.AddWatcherLocked(std::move(watcher)); } else { - health_watcher_map_.AddWatcherLocked(this, initial_state, - std::move(health_check_service_name), - std::move(watcher)); + health_watcher_map_.AddWatcherLocked( + this, initial_state, health_check_service_name, std::move(watcher)); } } void Subchannel::CancelConnectivityStateWatch( - const char* health_check_service_name, + absl::string_view health_check_service_name, ConnectivityStateWatcherInterface* watcher) { MutexLock lock(&mu_); grpc_pollset_set* interested_parties = watcher->interested_parties(); if (interested_parties != nullptr) { grpc_pollset_set_del_pollset_set(pollset_set_, interested_parties); } - if (health_check_service_name == nullptr) { + if (health_check_service_name.empty()) { watcher_list_.RemoveWatcherLocked(watcher); } else { health_watcher_map_.RemoveWatcherLocked(health_check_service_name, watcher); diff --git a/src/core/ext/filters/client_channel/subchannel.h b/src/core/ext/filters/client_channel/subchannel.h index 9478fa7340c..bc45c28dd36 100644 --- a/src/core/ext/filters/client_channel/subchannel.h +++ b/src/core/ext/filters/client_channel/subchannel.h @@ -23,6 +23,8 @@ #include +#include "absl/strings/string_view.h" + #include "src/core/ext/filters/client_channel/client_channel_channelz.h" #include "src/core/ext/filters/client_channel/connector.h" #include "src/core/ext/filters/client_channel/subchannel_pool_interface.h" @@ -30,7 +32,6 @@ #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/gpr/time_precise.h" #include "src/core/lib/gprpp/arena.h" -#include "src/core/lib/gprpp/map.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/sync.h" @@ -251,7 +252,7 @@ class Subchannel { // service name. // If the return value is GRPC_CHANNEL_READY, also sets *connected_subchannel. grpc_connectivity_state CheckConnectivityState( - const char* health_check_service_name, + absl::string_view health_check_service_name, RefCountedPtr* connected_subchannel); // Starts watching the subchannel's connectivity state. @@ -264,12 +265,12 @@ class Subchannel { // destroyed or when CancelConnectivityStateWatch() is called. void WatchConnectivityState( grpc_connectivity_state initial_state, - grpc_core::UniquePtr health_check_service_name, + absl::string_view health_check_service_name, RefCountedPtr watcher); // Cancels a connectivity state watch. // If the watcher has already been destroyed, this is a no-op. - void CancelConnectivityStateWatch(const char* health_check_service_name, + void CancelConnectivityStateWatch(absl::string_view health_check_service_name, ConnectivityStateWatcherInterface* watcher); // Attempt to connect to the backend. Has no effect if already connected. @@ -333,23 +334,24 @@ class Subchannel { public: void AddWatcherLocked( Subchannel* subchannel, grpc_connectivity_state initial_state, - grpc_core::UniquePtr health_check_service_name, + absl::string_view health_check_service_name, RefCountedPtr watcher); - void RemoveWatcherLocked(const char* health_check_service_name, + void RemoveWatcherLocked(absl::string_view health_check_service_name, ConnectivityStateWatcherInterface* watcher); // Notifies the watcher when the subchannel's state changes. void NotifyLocked(grpc_connectivity_state state); grpc_connectivity_state CheckConnectivityStateLocked( - Subchannel* subchannel, const char* health_check_service_name); + Subchannel* subchannel, absl::string_view health_check_service_name); void ShutdownLocked(); private: class HealthWatcher; - std::map, StringLess> map_; + // Key points to the health_check_service_name_ field in the value object. + std::map> map_; }; class ConnectedSubchannelStateWatcher; diff --git a/src/core/ext/filters/client_channel/xds/xds_api.cc b/src/core/ext/filters/client_channel/xds/xds_api.cc index 4be62a33cd0..08ba9f925a0 100644 --- a/src/core/ext/filters/client_channel/xds/xds_api.cc +++ b/src/core/ext/filters/client_channel/xds/xds_api.cc @@ -31,7 +31,6 @@ #include #include "src/core/ext/filters/client_channel/xds/xds_api.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/sockaddr_utils.h" diff --git a/src/core/ext/filters/client_channel/xds/xds_api.h b/src/core/ext/filters/client_channel/xds/xds_api.h index 9bd74c777f7..9117466fe84 100644 --- a/src/core/ext/filters/client_channel/xds/xds_api.h +++ b/src/core/ext/filters/client_channel/xds/xds_api.h @@ -25,6 +25,7 @@ #include +#include "absl/container/inlined_vector.h" #include "absl/types/optional.h" #include @@ -150,7 +151,7 @@ class XdsApi { } private: - InlinedVector priorities_; + absl::InlinedVector priorities_; }; // There are two phases of accessing this class's content: @@ -169,7 +170,7 @@ class XdsApi { const uint32_t parts_per_million; }; - using DropCategoryList = InlinedVector; + using DropCategoryList = absl::InlinedVector; void AddCategory(std::string name, uint32_t parts_per_million) { drop_category_list_.emplace_back( diff --git a/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc b/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc index 6a641714912..9caee17a852 100644 --- a/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +++ b/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc @@ -18,6 +18,8 @@ #include "src/core/ext/filters/client_channel/xds/xds_bootstrap.h" +#include + #include #include @@ -128,7 +130,7 @@ XdsBootstrap::XdsBootstrap(Json json, grpc_error** error) { "malformed JSON in bootstrap file"); return; } - InlinedVector error_list; + std::vector error_list; auto it = json.mutable_object()->find("xds_servers"); if (it == json.mutable_object()->end()) { error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING( @@ -155,7 +157,7 @@ XdsBootstrap::XdsBootstrap(Json json, grpc_error** error) { } grpc_error* XdsBootstrap::ParseXdsServerList(Json* json) { - InlinedVector error_list; + std::vector error_list; for (size_t i = 0; i < json->mutable_array()->size(); ++i) { Json& child = json->mutable_array()->at(i); if (child.type() != Json::Type::OBJECT) { @@ -173,7 +175,7 @@ grpc_error* XdsBootstrap::ParseXdsServerList(Json* json) { } grpc_error* XdsBootstrap::ParseXdsServer(Json* json, size_t idx) { - InlinedVector error_list; + std::vector error_list; servers_.emplace_back(); XdsServer& server = servers_[servers_.size() - 1]; auto it = json->mutable_object()->find("server_uri"); @@ -211,7 +213,7 @@ grpc_error* XdsBootstrap::ParseXdsServer(Json* json, size_t idx) { grpc_error* XdsBootstrap::ParseChannelCredsArray(Json* json, XdsServer* server) { - InlinedVector error_list; + std::vector error_list; for (size_t i = 0; i < json->mutable_array()->size(); ++i) { Json& child = json->mutable_array()->at(i); if (child.type() != Json::Type::OBJECT) { @@ -230,7 +232,7 @@ grpc_error* XdsBootstrap::ParseChannelCredsArray(Json* json, grpc_error* XdsBootstrap::ParseChannelCreds(Json* json, size_t idx, XdsServer* server) { - InlinedVector error_list; + std::vector error_list; ChannelCreds channel_creds; auto it = json->mutable_object()->find("type"); if (it == json->mutable_object()->end()) { @@ -268,7 +270,7 @@ grpc_error* XdsBootstrap::ParseChannelCreds(Json* json, size_t idx, } grpc_error* XdsBootstrap::ParseNode(Json* json) { - InlinedVector error_list; + std::vector error_list; node_ = absl::make_unique(); auto it = json->mutable_object()->find("id"); if (it != json->mutable_object()->end()) { @@ -312,7 +314,7 @@ grpc_error* XdsBootstrap::ParseNode(Json* json) { } grpc_error* XdsBootstrap::ParseLocality(Json* json) { - InlinedVector error_list; + std::vector error_list; auto it = json->mutable_object()->find("region"); if (it != json->mutable_object()->end()) { if (it->second.type() != Json::Type::STRING) { diff --git a/src/core/ext/filters/client_channel/xds/xds_bootstrap.h b/src/core/ext/filters/client_channel/xds/xds_bootstrap.h index d3b04ad922f..f3e49ba0e5a 100644 --- a/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +++ b/src/core/ext/filters/client_channel/xds/xds_bootstrap.h @@ -23,10 +23,10 @@ #include #include +#include "absl/container/inlined_vector.h" + #include -#include "src/core/lib/gprpp/inlined_vector.h" -#include "src/core/lib/gprpp/map.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/json/json.h" @@ -53,7 +53,7 @@ class XdsBootstrap { struct XdsServer { std::string server_uri; - InlinedVector channel_creds; + absl::InlinedVector channel_creds; }; // If *error is not GRPC_ERROR_NONE after returning, then there was an @@ -78,7 +78,7 @@ class XdsBootstrap { grpc_error* ParseNode(Json* json); grpc_error* ParseLocality(Json* json); - InlinedVector servers_; + absl::InlinedVector servers_; std::unique_ptr node_; }; diff --git a/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc b/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc index 52d226ce74b..c218db86a17 100644 --- a/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc +++ b/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc @@ -22,6 +22,8 @@ #include +#include "absl/container/inlined_vector.h" + #include #include #include @@ -39,8 +41,8 @@ namespace grpc_core { grpc_channel_args* ModifyXdsChannelArgs(grpc_channel_args* args) { - InlinedVector args_to_remove; - InlinedVector args_to_add; + absl::InlinedVector args_to_remove; + absl::InlinedVector args_to_add; // Substitute the channel credentials with a version without call // credentials: the load balancer is not necessarily trusted to handle // bearer token credentials. diff --git a/src/core/ext/filters/client_channel/xds/xds_client.cc b/src/core/ext/filters/client_channel/xds/xds_client.cc index 9a0e566e1e4..abfcc452526 100644 --- a/src/core/ext/filters/client_channel/xds/xds_client.cc +++ b/src/core/ext/filters/client_channel/xds/xds_client.cc @@ -22,6 +22,9 @@ #include #include +#include + +#include "absl/container/inlined_vector.h" #include "absl/strings/str_format.h" #include "absl/strings/str_join.h" @@ -44,7 +47,6 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/gpr/string.h" -#include "src/core/lib/gprpp/map.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" @@ -447,7 +449,7 @@ grpc_channel_args* BuildXdsChannelArgs(const grpc_channel_args& args) { GRPC_ARG_KEEPALIVE_TIME_MS, }; // Channel args to add. - InlinedVector args_to_add; + absl::InlinedVector args_to_add; // Keepalive interval. args_to_add.emplace_back(grpc_channel_arg_integer_create( const_cast(GRPC_ARG_KEEPALIVE_TIME_MS), 5000)); diff --git a/src/core/ext/filters/client_channel/xds/xds_client.h b/src/core/ext/filters/client_channel/xds/xds_client.h index 267a0fe9e19..ccdffc5f417 100644 --- a/src/core/ext/filters/client_channel/xds/xds_client.h +++ b/src/core/ext/filters/client_channel/xds/xds_client.h @@ -19,6 +19,7 @@ #include +#include #include #include "absl/types/optional.h" @@ -27,7 +28,6 @@ #include "src/core/ext/filters/client_channel/xds/xds_api.h" #include "src/core/ext/filters/client_channel/xds/xds_bootstrap.h" #include "src/core/ext/filters/client_channel/xds/xds_client_stats.h" -#include "src/core/lib/gprpp/map.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted.h" diff --git a/src/core/ext/filters/client_channel/xds/xds_client_stats.h b/src/core/ext/filters/client_channel/xds/xds_client_stats.h index cbeccd2279d..1539c9a4986 100644 --- a/src/core/ext/filters/client_channel/xds/xds_client_stats.h +++ b/src/core/ext/filters/client_channel/xds/xds_client_stats.h @@ -21,13 +21,14 @@ #include +#include + #include #include "src/core/lib/gprpp/atomic.h" -#include "src/core/lib/gprpp/inlined_vector.h" -#include "src/core/lib/gprpp/map.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/ref_counted.h" +#include "src/core/lib/gprpp/string_view.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/exec_ctx.h" diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc index 16a46953cfc..3124f3efa6e 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc @@ -277,6 +277,7 @@ typedef struct { /* maximum size of a frame */ size_t max_frame_size; bool use_true_binary_metadata; + bool is_end_of_stream; } framer_state; /* fills p (which is expected to be kDataFrameHeaderSize bytes long) @@ -315,17 +316,29 @@ static size_t current_frame_size(framer_state* st) { } /* finish a frame - fill in the previously reserved header */ -static void finish_frame(framer_state* st, int is_header_boundary, - int is_last_in_stream) { +static void finish_frame(framer_state* st, int is_header_boundary) { uint8_t type = 0xff; - type = st->is_first_frame ? GRPC_CHTTP2_FRAME_HEADER - : GRPC_CHTTP2_FRAME_CONTINUATION; - fill_header( - GRPC_SLICE_START_PTR(st->output->slices[st->header_idx]), type, - st->stream_id, current_frame_size(st), - static_cast( - (is_last_in_stream ? GRPC_CHTTP2_DATA_FLAG_END_STREAM : 0) | - (is_header_boundary ? GRPC_CHTTP2_DATA_FLAG_END_HEADERS : 0))); + type = + static_cast(st->is_first_frame ? GRPC_CHTTP2_FRAME_HEADER + : GRPC_CHTTP2_FRAME_CONTINUATION); + uint8_t flags = 0xff; + /* per the HTTP/2 spec: + A HEADERS frame carries the END_STREAM flag that signals the end of a + stream. However, a HEADERS frame with the END_STREAM flag set can be + followed by CONTINUATION frames on the same stream. Logically, the + CONTINUATION frames are part of the HEADERS frame. + Thus, we add the END_STREAM flag to the HEADER frame (the first frame). */ + flags = static_cast(st->is_first_frame && st->is_end_of_stream + ? GRPC_CHTTP2_DATA_FLAG_END_STREAM + : 0); + /* per the HTTP/2 spec: + A HEADERS frame without the END_HEADERS flag set MUST be followed by + a CONTINUATION frame for the same stream. + Thus, we add the END_HEADER flag to the last frame. */ + flags |= static_cast( + is_header_boundary ? GRPC_CHTTP2_DATA_FLAG_END_HEADERS : 0); + fill_header(GRPC_SLICE_START_PTR(st->output->slices[st->header_idx]), type, + st->stream_id, current_frame_size(st), flags); st->stats->framing_bytes += kDataFrameHeaderSize; st->is_first_frame = 0; } @@ -347,7 +360,7 @@ static void ensure_space(framer_state* st, size_t need_bytes) { if (GPR_LIKELY(current_frame_size(st) + need_bytes <= st->max_frame_size)) { return; } - finish_frame(st, 0, 0); + finish_frame(st, 0); begin_frame(st); } @@ -362,7 +375,7 @@ static void add_header_data(framer_state* st, grpc_slice slice) { } else { st->stats->header_bytes += remaining; grpc_slice_buffer_add(st->output, grpc_slice_split_head(&slice, remaining)); - finish_frame(st, 0, 0); + finish_frame(st, 0); begin_frame(st); add_header_data(st, slice); } @@ -841,6 +854,7 @@ void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor* c, st.stats = options->stats; st.max_frame_size = options->max_frame_size; st.use_true_binary_metadata = options->use_true_binary_metadata; + st.is_end_of_stream = options->is_eof; /* Encode a metadata batch; store the returned values, representing a metadata element that needs to be unreffed back into the metadata @@ -883,5 +897,5 @@ void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor* c, deadline_enc(c, deadline, &st); } - finish_frame(&st, 1, options->is_eof); + finish_frame(&st, 1); } diff --git a/src/core/lib/channel/channelz.h b/src/core/lib/channel/channelz.h index 73a9b57a45c..3bf2598414e 100644 --- a/src/core/lib/channel/channelz.h +++ b/src/core/lib/channel/channelz.h @@ -23,14 +23,15 @@ #include +#include #include +#include "absl/container/inlined_vector.h" + #include "src/core/lib/channel/channel_trace.h" #include "src/core/lib/gpr/time_precise.h" #include "src/core/lib/gprpp/atomic.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/manual_constructor.h" -#include "src/core/lib/gprpp/map.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/sync.h" @@ -167,7 +168,7 @@ class CallCountingHelper { void CollectData(CounterData* out); // Really zero-sized, but 0-sized arrays are illegal on MSVC. - InlinedVector per_cpu_counter_data_storage_; + absl::InlinedVector per_cpu_counter_data_storage_; size_t num_cores_ = 0; }; diff --git a/src/core/lib/channel/channelz_registry.cc b/src/core/lib/channel/channelz_registry.cc index 0964ffca2a1..43439363bf7 100644 --- a/src/core/lib/channel/channelz_registry.cc +++ b/src/core/lib/channel/channelz_registry.cc @@ -21,6 +21,8 @@ #include #include +#include "absl/container/inlined_vector.h" + #include "src/core/lib/channel/channel_trace.h" #include "src/core/lib/channel/channelz.h" #include "src/core/lib/channel/channelz_registry.h" @@ -82,7 +84,7 @@ RefCountedPtr ChannelzRegistry::InternalGet(intptr_t uuid) { std::string ChannelzRegistry::InternalGetTopChannels( intptr_t start_channel_id) { - InlinedVector, 10> top_level_channels; + absl::InlinedVector, 10> top_level_channels; RefCountedPtr node_after_pagination_limit; { MutexLock lock(&mu_); @@ -120,7 +122,7 @@ std::string ChannelzRegistry::InternalGetTopChannels( } std::string ChannelzRegistry::InternalGetServers(intptr_t start_server_id) { - InlinedVector, 10> servers; + absl::InlinedVector, 10> servers; RefCountedPtr node_after_pagination_limit; { MutexLock lock(&mu_); @@ -158,7 +160,7 @@ std::string ChannelzRegistry::InternalGetServers(intptr_t start_server_id) { } void ChannelzRegistry::InternalLogAllEntities() { - InlinedVector, 10> nodes; + absl::InlinedVector, 10> nodes; { MutexLock lock(&mu_); for (auto& p : node_map_) { diff --git a/src/core/lib/channel/channelz_registry.h b/src/core/lib/channel/channelz_registry.h index d777651c12f..ac6d442eff5 100644 --- a/src/core/lib/channel/channelz_registry.h +++ b/src/core/lib/channel/channelz_registry.h @@ -23,9 +23,10 @@ #include +#include + #include "src/core/lib/channel/channel_trace.h" #include "src/core/lib/channel/channelz.h" -#include "src/core/lib/gprpp/map.h" #include "src/core/lib/gprpp/sync.h" namespace grpc_core { diff --git a/src/core/lib/channel/handshaker.h b/src/core/lib/channel/handshaker.h index 4f064d901df..10b0631968f 100644 --- a/src/core/lib/channel/handshaker.h +++ b/src/core/lib/channel/handshaker.h @@ -21,12 +21,13 @@ #include +#include "absl/container/inlined_vector.h" + #include #include #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/closure.h" @@ -146,7 +147,8 @@ class HandshakeManager : public RefCounted { gpr_mu mu_; bool is_shutdown_ = false; // An array of handshakers added via grpc_handshake_manager_add(). - InlinedVector, HANDSHAKERS_INIT_SIZE> handshakers_; + absl::InlinedVector, HANDSHAKERS_INIT_SIZE> + handshakers_; // The index of the handshaker to invoke next and closure to invoke it. size_t index_ = 0; grpc_closure call_next_handshaker_; diff --git a/src/core/lib/channel/handshaker_registry.cc b/src/core/lib/channel/handshaker_registry.cc index 9ec458b210a..0e686af8992 100644 --- a/src/core/lib/channel/handshaker_registry.cc +++ b/src/core/lib/channel/handshaker_registry.cc @@ -18,9 +18,10 @@ #include +#include "absl/container/inlined_vector.h" + #include "src/core/lib/channel/handshaker_registry.h" #include "src/core/lib/gpr/alloc.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/memory.h" #include @@ -44,7 +45,7 @@ class HandshakerFactoryList { HandshakeManager* handshake_mgr); private: - InlinedVector, 2> factories_; + absl::InlinedVector, 2> factories_; }; HandshakerFactoryList* g_handshaker_factory_lists = nullptr; diff --git a/src/core/lib/gprpp/inlined_vector.h b/src/core/lib/gprpp/inlined_vector.h deleted file mode 100644 index 3cad99d3429..00000000000 --- a/src/core/lib/gprpp/inlined_vector.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * - * 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. - * - */ - -#ifndef GRPC_CORE_LIB_GPRPP_INLINED_VECTOR_H -#define GRPC_CORE_LIB_GPRPP_INLINED_VECTOR_H - -#include - -#include -#include - -#include "absl/container/inlined_vector.h" -#include "src/core/lib/gprpp/memory.h" - -namespace grpc_core { - -template > -using InlinedVector = absl::InlinedVector; - -} // namespace grpc_core - -#endif /* GRPC_CORE_LIB_GPRPP_INLINED_VECTOR_H */ diff --git a/src/core/lib/gprpp/map.h b/src/core/lib/gprpp/map.h deleted file mode 100644 index 033b861c77f..00000000000 --- a/src/core/lib/gprpp/map.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * - * 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. - * - */ - -#ifndef GRPC_CORE_LIB_GPRPP_MAP_H -#define GRPC_CORE_LIB_GPRPP_MAP_H - -#include - -#include - -#include - -#include "src/core/lib/gprpp/ref_counted_ptr.h" -#include "src/core/lib/gprpp/string_view.h" - -namespace grpc_core { - -struct StringLess { - bool operator()(const char* a, const char* b) const { - return strcmp(a, b) < 0; - } - bool operator()(const grpc_core::UniquePtr& a, - const grpc_core::UniquePtr& b) const { - return strcmp(a.get(), b.get()) < 0; - } - bool operator()(const StringView& a, const StringView& b) const { - const size_t min_size = std::min(a.size(), b.size()); - int c = strncmp(a.data(), b.data(), min_size); - if (c != 0) return c < 0; - return a.size() < b.size(); - } -}; - -template -struct RefCountedPtrLess { - bool operator()(const RefCountedPtr& p1, - const RefCountedPtr& p2) const { - return p1.get() < p2.get(); - } -}; - -} // namespace grpc_core - -#endif /* GRPC_CORE_LIB_GPRPP_MAP_H */ diff --git a/src/core/lib/gprpp/optional.h b/src/core/lib/gprpp/optional.h deleted file mode 100644 index f4535bb03a8..00000000000 --- a/src/core/lib/gprpp/optional.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * - * Copyright 2019 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. - * - */ - -#ifndef GRPC_CORE_LIB_GPRPP_OPTIONAL_H -#define GRPC_CORE_LIB_GPRPP_OPTIONAL_H - -#include - -#include "absl/types/optional.h" - -namespace grpc_core { - -template -using Optional = absl::optional; - -} // namespace grpc_core - -#endif /* GRPC_CORE_LIB_GPRPP_OPTIONAL_H */ diff --git a/src/core/lib/gprpp/ref_counted_ptr.h b/src/core/lib/gprpp/ref_counted_ptr.h index 4c5b46538a8..179491b22c2 100644 --- a/src/core/lib/gprpp/ref_counted_ptr.h +++ b/src/core/lib/gprpp/ref_counted_ptr.h @@ -182,6 +182,11 @@ inline RefCountedPtr MakeRefCounted(Args&&... args) { return RefCountedPtr(new T(std::forward(args)...)); } +template +bool operator<(const RefCountedPtr& p1, const RefCountedPtr& p2) { + return p1.get() < p2.get(); +} + } // namespace grpc_core #endif /* GRPC_CORE_LIB_GPRPP_REF_COUNTED_PTR_H */ diff --git a/src/core/lib/iomgr/buffer_list.h b/src/core/lib/iomgr/buffer_list.h index c2552ca26bf..f804f021a75 100644 --- a/src/core/lib/iomgr/buffer_list.h +++ b/src/core/lib/iomgr/buffer_list.h @@ -21,12 +21,13 @@ #include +#include "absl/types/optional.h" + #include "src/core/lib/iomgr/port.h" #include #include "src/core/lib/gprpp/memory.h" -#include "src/core/lib/gprpp/optional.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/internal_errqueue.h" @@ -34,52 +35,52 @@ namespace grpc_core { struct ConnectionMetrics { /* Delivery rate in Bytes/s. */ - Optional delivery_rate; + absl::optional delivery_rate; /* If the delivery rate is limited by the application, this is set to true. */ - Optional is_delivery_rate_app_limited; + absl::optional is_delivery_rate_app_limited; /* Total packets retransmitted. */ - Optional packet_retx; + absl::optional packet_retx; /* Total packets retransmitted spuriously. This metric is smaller than or equal to packet_retx. */ - Optional packet_spurious_retx; + absl::optional packet_spurious_retx; /* Total packets sent. */ - Optional packet_sent; + absl::optional packet_sent; /* Total packets delivered. */ - Optional packet_delivered; + absl::optional packet_delivered; /* Total packets delivered with ECE marked. This metric is smaller than or equal to packet_delivered. */ - Optional packet_delivered_ce; + absl::optional packet_delivered_ce; /* Total bytes lost so far. */ - Optional data_retx; + absl::optional data_retx; /* Total bytes sent so far. */ - Optional data_sent; + absl::optional data_sent; /* Total bytes in write queue but not sent. */ - Optional data_notsent; + absl::optional data_notsent; /* Pacing rate of the connection in Bps */ - Optional pacing_rate; + absl::optional pacing_rate; /* Minimum RTT observed in usec. */ - Optional min_rtt; + absl::optional min_rtt; /* Smoothed RTT in usec */ - Optional srtt; + absl::optional srtt; /* Send congestion window. */ - Optional congestion_window; + absl::optional congestion_window; /* Slow start threshold in packets. */ - Optional snd_ssthresh; + absl::optional snd_ssthresh; /* Maximum degree of reordering (i.e., maximum number of packets reodered) on the connection. */ - Optional reordering; + absl::optional reordering; /* Represents the number of recurring retransmissions of the first sequence that is not acknowledged yet. */ - Optional recurring_retrans; + absl::optional recurring_retrans; /* The cumulative time (in usec) that the transport protocol was busy sending data. */ - Optional busy_usec; + absl::optional busy_usec; /* The cumulative time (in usec) that the transport protocol was limited by the receive window size. */ - Optional rwnd_limited_usec; + absl::optional rwnd_limited_usec; /* The cumulative time (in usec) that the transport protocol was limited by the send buffer size. */ - Optional sndbuf_limited_usec; + absl::optional sndbuf_limited_usec; }; struct Timestamp { diff --git a/src/core/lib/iomgr/call_combiner.h b/src/core/lib/iomgr/call_combiner.h index d3f43cf547f..44acd9fe870 100644 --- a/src/core/lib/iomgr/call_combiner.h +++ b/src/core/lib/iomgr/call_combiner.h @@ -23,9 +23,10 @@ #include +#include "absl/container/inlined_vector.h" + #include -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/mpscq.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" @@ -208,7 +209,7 @@ class CallCombinerClosureList { // There are generally a maximum of 6 closures to run in the call // combiner, one for each pending op. - InlinedVector closures_; + absl::InlinedVector closures_; }; } // namespace grpc_core diff --git a/src/core/lib/iomgr/error.h b/src/core/lib/iomgr/error.h index 5c79aa78ae7..ac3ff876289 100644 --- a/src/core/lib/iomgr/error.h +++ b/src/core/lib/iomgr/error.h @@ -30,7 +30,6 @@ #include #include "src/core/lib/debug/trace.h" -#include "src/core/lib/gprpp/inlined_vector.h" /// Opaque representation of an error. /// See https://github.com/grpc/grpc/blob/master/doc/core/grpc-error.md for a diff --git a/src/core/lib/iomgr/udp_server.cc b/src/core/lib/iomgr/udp_server.cc index 0bfd22fc79c..ce3531f3378 100644 --- a/src/core/lib/iomgr/udp_server.cc +++ b/src/core/lib/iomgr/udp_server.cc @@ -44,6 +44,8 @@ #include #include +#include "absl/container/inlined_vector.h" + #include #include #include @@ -52,7 +54,6 @@ #include #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gpr/string.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/ev_posix.h" @@ -177,7 +178,7 @@ struct grpc_udp_server { int shutdown; /* An array of listeners */ - grpc_core::InlinedVector listeners; + absl::InlinedVector listeners; /* factory for use to create udp listeners */ GrpcUdpHandlerFactory* handler_factory; diff --git a/src/core/lib/security/credentials/composite/composite_credentials.h b/src/core/lib/security/credentials/composite/composite_credentials.h index 57967e1b6c9..6b9e9d114d8 100644 --- a/src/core/lib/security/credentials/composite/composite_credentials.h +++ b/src/core/lib/security/credentials/composite/composite_credentials.h @@ -23,7 +23,8 @@ #include -#include "src/core/lib/gprpp/inlined_vector.h" +#include "absl/container/inlined_vector.h" + #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/security/credentials/credentials.h" @@ -71,8 +72,7 @@ class grpc_composite_channel_credentials : public grpc_channel_credentials { class grpc_composite_call_credentials : public grpc_call_credentials { public: using CallCredentialsList = - grpc_core::InlinedVector, - 2>; + absl::InlinedVector, 2>; grpc_composite_call_credentials( grpc_core::RefCountedPtr creds1, diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc index c922d35b8d8..8191043db21 100644 --- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc @@ -23,6 +23,8 @@ #include +#include "absl/container/inlined_vector.h" + #include #include #include @@ -32,7 +34,6 @@ #include "absl/strings/str_format.h" #include "src/core/lib/gpr/string.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/load_file.h" @@ -669,7 +670,7 @@ grpc_error* ValidateStsCredentialsOptions( void operator()(grpc_uri* uri) { grpc_uri_destroy(uri); } }; *sts_url_out = nullptr; - InlinedVector error_list; + absl::InlinedVector error_list; std::unique_ptr sts_url( options->token_exchange_service_uri != nullptr ? grpc_uri_parse(options->token_exchange_service_uri, false) diff --git a/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h b/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h index c411fb2b96b..a5f032abec4 100644 --- a/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +++ b/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h @@ -23,7 +23,8 @@ #include -#include "src/core/lib/gprpp/inlined_vector.h" +#include "absl/container/inlined_vector.h" + #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/security/security_connector/ssl_utils.h" @@ -44,8 +45,7 @@ struct grpc_tls_error_details struct grpc_tls_key_materials_config : public grpc_core::RefCounted { public: - typedef grpc_core::InlinedVector - PemKeyCertPairList; + typedef absl::InlinedVector PemKeyCertPairList; /** Getters for member fields. **/ const char* pem_root_certs() const { return pem_root_certs_.get(); } diff --git a/src/core/lib/security/security_connector/load_system_roots_linux.cc b/src/core/lib/security/security_connector/load_system_roots_linux.cc index e97773f38b3..f7c6c2cec35 100644 --- a/src/core/lib/security/security_connector/load_system_roots_linux.cc +++ b/src/core/lib/security/security_connector/load_system_roots_linux.cc @@ -34,6 +34,8 @@ #include #include +#include "absl/container/inlined_vector.h" + #include #include #include @@ -41,7 +43,6 @@ #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/useful.h" #include "src/core/lib/gprpp/global_config.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/iomgr/load_file.h" GPR_GLOBAL_CONFIG_DEFINE_STRING(grpc_system_ssl_roots_dir, "", @@ -100,7 +101,7 @@ grpc_slice CreateRootCertsBundle(const char* certs_directory) { char path[MAXPATHLEN]; off_t size; }; - InlinedVector roots_filenames; + absl::InlinedVector roots_filenames; size_t total_bundle_size = 0; struct dirent* directory_entry; while ((directory_entry = readdir(ca_directory)) != nullptr) { diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc index e03bc6f1b5f..d22b52ad6fe 100644 --- a/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc @@ -274,18 +274,15 @@ struct registered_method { const char* method_arg, const char* host_arg, grpc_server_register_method_payload_handling payload_handling_arg, uint32_t flags_arg) - : method(gpr_strdup(method_arg)), - host(gpr_strdup(host_arg)), + : method(method_arg == nullptr ? "" : method_arg), + host(host_arg == nullptr ? "" : host_arg), payload_handling(payload_handling_arg), flags(flags_arg) {} - ~registered_method() { - gpr_free(method); - gpr_free(host); - } + ~registered_method() = default; - char* const method; - char* const host; + const std::string method; + const std::string host; const grpc_server_register_method_payload_handling payload_handling; const uint32_t flags; /* one request matcher per method */ @@ -1183,11 +1180,9 @@ void register_completion_queue(grpc_server* server, grpc_completion_queue* cq, server->cqs[n] = cq; } -int streq(const char* a, const char* b) { - if (a == nullptr && b == nullptr) return 1; - if (a == nullptr) return 0; - if (b == nullptr) return 0; - return 0 == strcmp(a, b); +bool streq(const std::string& a, const char* b) { + return (a.empty() && b == nullptr) || + ((b != nullptr) && !strcmp(a.c_str(), b)); } class ConnectivityWatcher @@ -1491,10 +1486,10 @@ void grpc_server_setup_transport( static_cast(gpr_zalloc(alloc)); for (rm = s->registered_methods; rm; rm = rm->next) { grpc_core::ExternallyManagedSlice host; - grpc_core::ExternallyManagedSlice method(rm->method); - const bool has_host = rm->host != nullptr; + grpc_core::ExternallyManagedSlice method(rm->method.c_str()); + const bool has_host = !rm->host.empty(); if (has_host) { - host = grpc_core::ExternallyManagedSlice(rm->host); + host = grpc_core::ExternallyManagedSlice(rm->host.c_str()); } hash = GRPC_MDSTR_KV_HASH(has_host ? host.Hash() : 0, method.Hash()); for (probes = 0; chand->registered_methods[(hash + probes) % slots] diff --git a/src/core/lib/transport/connectivity_state.h b/src/core/lib/transport/connectivity_state.h index 5ab62bed40c..ba9cc927e61 100644 --- a/src/core/lib/transport/connectivity_state.h +++ b/src/core/lib/transport/connectivity_state.h @@ -21,11 +21,12 @@ #include +#include + #include #include "src/core/lib/debug/trace.h" #include "src/core/lib/gprpp/atomic.h" -#include "src/core/lib/gprpp/map.h" #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/iomgr/closure.h" #include "src/core/lib/iomgr/exec_ctx.h" diff --git a/src/cpp/common/tls_credentials_options.cc b/src/cpp/common/tls_credentials_options.cc index c821e100f93..23d6495dd20 100644 --- a/src/cpp/common/tls_credentials_options.cc +++ b/src/cpp/common/tls_credentials_options.cc @@ -18,6 +18,9 @@ #include #include + +#include "absl/container/inlined_vector.h" + #include "src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h" #include "src/cpp/common/tls_credentials_options_util.h" @@ -111,7 +114,7 @@ void TlsCredentialReloadArg::set_key_materials( c_arg_->key_materials_config = grpc_tls_key_materials_config_create(); } /** Convert |pem_key_cert_pair_list| to an inlined vector of ssl pairs. **/ - ::grpc_core::InlinedVector<::grpc_core::PemKeyCertPair, 1> + ::absl::InlinedVector<::grpc_core::PemKeyCertPair, 1> c_pem_key_cert_pair_list; for (const auto& key_cert_pair : pem_key_cert_pair_list) { c_pem_key_cert_pair_list.emplace_back( @@ -128,7 +131,7 @@ void TlsCredentialReloadArg::set_key_materials_config( c_arg_->key_materials_config = nullptr; return; } - ::grpc_core::InlinedVector<::grpc_core::PemKeyCertPair, 1> + ::absl::InlinedVector<::grpc_core::PemKeyCertPair, 1> c_pem_key_cert_pair_list; for (const auto& key_cert_pair : key_materials_config->pem_key_cert_pair_list()) { diff --git a/src/cpp/common/tls_credentials_options_util.cc b/src/cpp/common/tls_credentials_options_util.cc index 59915e42f61..2211460e664 100644 --- a/src/cpp/common/tls_credentials_options_util.cc +++ b/src/cpp/common/tls_credentials_options_util.cc @@ -16,8 +16,10 @@ * */ -#include "src/cpp/common/tls_credentials_options_util.h" +#include "absl/container/inlined_vector.h" + #include +#include "src/cpp/common/tls_credentials_options_util.h" namespace grpc_impl { namespace experimental { @@ -35,7 +37,7 @@ grpc_tls_key_materials_config* ConvertToCKeyMaterialsConfig( } grpc_tls_key_materials_config* c_config = grpc_tls_key_materials_config_create(); - ::grpc_core::InlinedVector<::grpc_core::PemKeyCertPair, 1> + ::absl::InlinedVector<::grpc_core::PemKeyCertPair, 1> c_pem_key_cert_pair_list; for (const auto& key_cert_pair : config->pem_key_cert_pair_list()) { grpc_ssl_pem_key_cert_pair* ssl_pair = diff --git a/src/csharp/generate_proto_csharp.sh b/src/csharp/generate_proto_csharp.sh index 9c731f3924a..c7c45a77546 100755 --- a/src/csharp/generate_proto_csharp.sh +++ b/src/csharp/generate_proto_csharp.sh @@ -36,7 +36,7 @@ $PROTOC --plugin=$PLUGIN --csharp_out=$HEALTHCHECK_DIR --grpc_out=$HEALTHCHECK_D $PROTOC --plugin=$PLUGIN --csharp_out=$REFLECTION_DIR --grpc_out=$REFLECTION_DIR \ -I src/proto src/proto/grpc/reflection/v1alpha/reflection.proto -# Put grp/core/stats.proto in a subdirectory to avoid collision with grpc/testing/stats.proto +# Put grpc/core/stats.proto in a subdirectory to avoid collision with grpc/testing/stats.proto mkdir -p $TESTING_DIR/CoreStats $PROTOC --plugin=$PLUGIN --csharp_out=$TESTING_DIR/CoreStats --grpc_out=$TESTING_DIR/CoreStats \ -I src/proto src/proto/grpc/core/stats.proto diff --git a/src/php/README.md b/src/php/README.md index e589408b0c3..84ee8f7a2e9 100644 --- a/src/php/README.md +++ b/src/php/README.md @@ -275,12 +275,8 @@ $ composer install ### Client Stub -Generate client stub classes from `.proto` files - -```sh -$ cd grpc/src/php -$ ./bin/generate_proto_php.sh -``` +The generate client stub classes have already been generated from `.proto` files +by the `./bin/generate_proto_php.sh` script. ### Run test server diff --git a/src/php/bin/generate_proto_php.sh b/src/php/bin/generate_proto_php.sh index 0b09b85b415..1c943457ba1 100755 --- a/src/php/bin/generate_proto_php.sh +++ b/src/php/bin/generate_proto_php.sh @@ -16,16 +16,15 @@ set -e cd $(dirname $0)/../../.. -# TODO(jtattermusch): unlike for e.g. ruby and csharp, -# PHP runs the code generator as part of the build, so we cannot -# easily use bazel-built "protoc" and "grpc_php_plugin" binaries. -# TODO(jtattermusch): the generated code for qps tests -# is actually checked into the repository, but for other tests -# (e.g. interop or unit tests) it's not. This should made consistent. -protoc --proto_path=src/proto/math \ +# protoc and grpc_*_plugin binaries can be obtained by running +# $ bazel build @com_google_protobuf//:protoc //src/compiler:all +PROTOC=bazel-bin/external/com_google_protobuf/protoc +PLUGIN=protoc-gen-grpc=bazel-bin/src/compiler/grpc_php_plugin + +$PROTOC --proto_path=src/proto/math \ --php_out=src/php/tests/generated_code \ --grpc_out=src/php/tests/generated_code \ - --plugin=protoc-gen-grpc=bins/opt/grpc_php_plugin \ + --plugin=$PLUGIN \ src/proto/math/math.proto # replace the Empty message with EmptyMessage @@ -38,14 +37,23 @@ sed 's/grpc\.testing\.Empty/grpc\.testing\.EmptyMessage/g' \ src/proto/grpc/testing/test.proto > $output_file mv $output_file ./src/proto/grpc/testing/test.proto -protoc --proto_path=. \ +# interop test protos +$PROTOC --proto_path=. \ --php_out=src/php/tests/interop \ --grpc_out=src/php/tests/interop \ - --plugin=protoc-gen-grpc=bins/opt/grpc_php_plugin \ + --plugin=$PLUGIN \ src/proto/grpc/testing/messages.proto \ src/proto/grpc/testing/empty.proto \ src/proto/grpc/testing/test.proto +# qps test protos +$PROTOC --proto_path=. \ + --php_out=src/php/tests/qps/generated_code \ + --grpc_out=src/php/tests/qps/generated_code \ + --plugin=$PLUGIN \ + src/proto/grpc/core/stats.proto \ + src/proto/grpc/testing/{benchmark_service,compiler_test,control,echo_messages,empty,empty_service,messages,payloads,proxy-service,report_qps_scenario_service,stats,test,worker_service}.proto + # change it back sed 's/message EmptyMessage/message Empty/g' \ src/proto/grpc/testing/empty.proto > $output_file @@ -53,4 +61,3 @@ mv $output_file ./src/proto/grpc/testing/empty.proto sed 's/grpc\.testing\.EmptyMessage/grpc\.testing\.Empty/g' \ src/proto/grpc/testing/test.proto > $output_file mv $output_file ./src/proto/grpc/testing/test.proto - diff --git a/src/php/tests/generated_code/GPBMetadata/Math.php b/src/php/tests/generated_code/GPBMetadata/Math.php new file mode 100644 index 00000000000..07c886701b7 --- /dev/null +++ b/src/php/tests/generated_code/GPBMetadata/Math.php @@ -0,0 +1,36 @@ +internalAddGeneratedFile(hex2bin( + "0ae9020a0a6d6174682e70726f746f12046d617468222c0a074469764172" . + "677312100a086469766964656e64180120012803120f0a0764697669736f" . + "72180220012803222f0a084469765265706c7912100a0871756f7469656e" . + "7418012001280312110a0972656d61696e64657218022001280322180a07" . + "46696241726773120d0a056c696d697418012001280322120a034e756d12" . + "0b0a036e756d18012001280322190a084669625265706c79120d0a05636f" . + "756e7418012001280332a4010a044d61746812260a03446976120d2e6d61" . + "74682e446976417267731a0e2e6d6174682e4469765265706c792200122e" . + "0a074469764d616e79120d2e6d6174682e446976417267731a0e2e6d6174" . + "682e4469765265706c7922002801300112230a03466962120d2e6d617468" . + "2e466962417267731a092e6d6174682e4e756d22003001121f0a0353756d" . + "12092e6d6174682e4e756d1a092e6d6174682e4e756d2200280162067072" . + "6f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/src/php/tests/generated_code/Math/DivArgs.php b/src/php/tests/generated_code/Math/DivArgs.php new file mode 100644 index 00000000000..21fb1d7252f --- /dev/null +++ b/src/php/tests/generated_code/Math/DivArgs.php @@ -0,0 +1,85 @@ +math.DivArgs + */ +class DivArgs extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field int64 dividend = 1; + */ + protected $dividend = 0; + /** + * Generated from protobuf field int64 divisor = 2; + */ + protected $divisor = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $dividend + * @type int|string $divisor + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Math::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field int64 dividend = 1; + * @return int|string + */ + public function getDividend() + { + return $this->dividend; + } + + /** + * Generated from protobuf field int64 dividend = 1; + * @param int|string $var + * @return $this + */ + public function setDividend($var) + { + GPBUtil::checkInt64($var); + $this->dividend = $var; + + return $this; + } + + /** + * Generated from protobuf field int64 divisor = 2; + * @return int|string + */ + public function getDivisor() + { + return $this->divisor; + } + + /** + * Generated from protobuf field int64 divisor = 2; + * @param int|string $var + * @return $this + */ + public function setDivisor($var) + { + GPBUtil::checkInt64($var); + $this->divisor = $var; + + return $this; + } + +} + diff --git a/src/php/tests/generated_code/Math/DivReply.php b/src/php/tests/generated_code/Math/DivReply.php new file mode 100644 index 00000000000..c4d7575b209 --- /dev/null +++ b/src/php/tests/generated_code/Math/DivReply.php @@ -0,0 +1,85 @@ +math.DivReply + */ +class DivReply extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field int64 quotient = 1; + */ + protected $quotient = 0; + /** + * Generated from protobuf field int64 remainder = 2; + */ + protected $remainder = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $quotient + * @type int|string $remainder + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Math::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field int64 quotient = 1; + * @return int|string + */ + public function getQuotient() + { + return $this->quotient; + } + + /** + * Generated from protobuf field int64 quotient = 1; + * @param int|string $var + * @return $this + */ + public function setQuotient($var) + { + GPBUtil::checkInt64($var); + $this->quotient = $var; + + return $this; + } + + /** + * Generated from protobuf field int64 remainder = 2; + * @return int|string + */ + public function getRemainder() + { + return $this->remainder; + } + + /** + * Generated from protobuf field int64 remainder = 2; + * @param int|string $var + * @return $this + */ + public function setRemainder($var) + { + GPBUtil::checkInt64($var); + $this->remainder = $var; + + return $this; + } + +} + diff --git a/src/php/tests/generated_code/Math/FibArgs.php b/src/php/tests/generated_code/Math/FibArgs.php new file mode 100644 index 00000000000..39bb4fad2f9 --- /dev/null +++ b/src/php/tests/generated_code/Math/FibArgs.php @@ -0,0 +1,58 @@ +math.FibArgs + */ +class FibArgs extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field int64 limit = 1; + */ + protected $limit = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $limit + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Math::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field int64 limit = 1; + * @return int|string + */ + public function getLimit() + { + return $this->limit; + } + + /** + * Generated from protobuf field int64 limit = 1; + * @param int|string $var + * @return $this + */ + public function setLimit($var) + { + GPBUtil::checkInt64($var); + $this->limit = $var; + + return $this; + } + +} + diff --git a/src/php/tests/generated_code/Math/FibReply.php b/src/php/tests/generated_code/Math/FibReply.php new file mode 100644 index 00000000000..d9ad9cd41be --- /dev/null +++ b/src/php/tests/generated_code/Math/FibReply.php @@ -0,0 +1,58 @@ +math.FibReply + */ +class FibReply extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field int64 count = 1; + */ + protected $count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $count + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Math::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field int64 count = 1; + * @return int|string + */ + public function getCount() + { + return $this->count; + } + + /** + * Generated from protobuf field int64 count = 1; + * @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/EchoTestServiceClient.php b/src/php/tests/generated_code/Math/MathClient.php similarity index 52% rename from src/php/tests/qps/generated_code/Grpc/Testing/EchoTestServiceClient.php rename to src/php/tests/generated_code/Math/MathClient.php index b3dcf5b7af8..92c980afe16 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/EchoTestServiceClient.php +++ b/src/php/tests/generated_code/Math/MathClient.php @@ -16,11 +16,11 @@ // See the License for the specific language governing permissions and // limitations under the License. // -namespace Grpc\Testing; +namespace Math; /** */ -class EchoTestServiceClient extends \Grpc\BaseStub { +class MathClient extends \Grpc\BaseStub { /** * @param string $hostname hostname @@ -32,61 +32,59 @@ class EchoTestServiceClient extends \Grpc\BaseStub { } /** - * @param \Grpc\Testing\EchoRequest $argument input argument + * Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient + * and remainder. + * @param \Math\DivArgs $argument input argument * @param array $metadata metadata * @param array $options call options */ - public function Echo(\Grpc\Testing\EchoRequest $argument, + public function Div(\Math\DivArgs $argument, $metadata = [], $options = []) { - return $this->_simpleRequest('/grpc.testing.EchoTestService/Echo', + return $this->_simpleRequest('/math.Math/Div', $argument, - ['\Grpc\Testing\EchoResponse', 'decode'], + ['\Math\DivReply', 'decode'], $metadata, $options); } /** + * DivMany accepts an arbitrary number of division args from the client stream + * and sends back the results in the reply stream. The stream continues until + * the client closes its end; the server does the same after sending all the + * replies. The stream ends immediately if either end aborts. * @param array $metadata metadata * @param array $options call options */ - public function RequestStream($metadata = [], $options = []) { - return $this->_clientStreamRequest('/grpc.testing.EchoTestService/RequestStream', - ['\Grpc\Testing\EchoResponse','decode'], + public function DivMany($metadata = [], $options = []) { + return $this->_bidiRequest('/math.Math/DivMany', + ['\Math\DivReply','decode'], $metadata, $options); } /** - * @param \Grpc\Testing\EchoRequest $argument input argument + * Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib + * generates up to limit numbers; otherwise it continues until the call is + * canceled. Unlike Fib above, Fib has no final FibReply. + * @param \Math\FibArgs $argument input argument * @param array $metadata metadata * @param array $options call options */ - public function ResponseStream(\Grpc\Testing\EchoRequest $argument, + public function Fib(\Math\FibArgs $argument, $metadata = [], $options = []) { - return $this->_serverStreamRequest('/grpc.testing.EchoTestService/ResponseStream', + return $this->_serverStreamRequest('/math.Math/Fib', $argument, - ['\Grpc\Testing\EchoResponse', 'decode'], + ['\Math\Num', 'decode'], $metadata, $options); } /** + * Sum sums a stream of numbers, returning the final result once the stream + * is closed. * @param array $metadata metadata * @param array $options call options */ - public function BidiStream($metadata = [], $options = []) { - return $this->_bidiRequest('/grpc.testing.EchoTestService/BidiStream', - ['\Grpc\Testing\EchoResponse','decode'], - $metadata, $options); - } - - /** - * @param \Grpc\Testing\EchoRequest $argument input argument - * @param array $metadata metadata - * @param array $options call options - */ - public function Unimplemented(\Grpc\Testing\EchoRequest $argument, - $metadata = [], $options = []) { - return $this->_simpleRequest('/grpc.testing.EchoTestService/Unimplemented', - $argument, - ['\Grpc\Testing\EchoResponse', 'decode'], + public function Sum($metadata = [], $options = []) { + return $this->_clientStreamRequest('/math.Math/Sum', + ['\Math\Num','decode'], $metadata, $options); } diff --git a/src/php/tests/generated_code/Math/Num.php b/src/php/tests/generated_code/Math/Num.php new file mode 100644 index 00000000000..356b328b2cc --- /dev/null +++ b/src/php/tests/generated_code/Math/Num.php @@ -0,0 +1,58 @@ +math.Num + */ +class Num extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field int64 num = 1; + */ + protected $num = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $num + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Math::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field int64 num = 1; + * @return int|string + */ + public function getNum() + { + return $this->num; + } + + /** + * Generated from protobuf field int64 num = 1; + * @param int|string $var + * @return $this + */ + public function setNum($var) + { + GPBUtil::checkInt64($var); + $this->num = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/Messages.php b/src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/Messages.php new file mode 100644 index 00000000000..72c17046a24 --- /dev/null +++ b/src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/Messages.php @@ -0,0 +1,86 @@ +internalAddGeneratedFile(hex2bin( + "0ad70e0a257372632f70726f746f2f677270632f74657374696e672f6d65" . + "7373616765732e70726f746f120c677270632e74657374696e67221a0a09" . + "426f6f6c56616c7565120d0a0576616c756518012001280822400a075061" . + "796c6f616412270a047479706518012001280e32192e677270632e746573" . + "74696e672e5061796c6f616454797065120c0a04626f647918022001280c" . + "222b0a0a4563686f537461747573120c0a04636f6465180120012805120f" . + "0a076d6573736167651802200128092286030a0d53696d706c6552657175" . + "65737412300a0d726573706f6e73655f7479706518012001280e32192e67" . + "7270632e74657374696e672e5061796c6f61645479706512150a0d726573" . + "706f6e73655f73697a6518022001280512260a077061796c6f6164180320" . + "01280b32152e677270632e74657374696e672e5061796c6f616412150a0d" . + "66696c6c5f757365726e616d6518042001280812180a1066696c6c5f6f61" . + "7574685f73636f706518052001280812340a13726573706f6e73655f636f" . + "6d7072657373656418062001280b32172e677270632e74657374696e672e" . + "426f6f6c56616c756512310a0f726573706f6e73655f7374617475731807" . + "2001280b32182e677270632e74657374696e672e4563686f537461747573" . + "12320a116578706563745f636f6d7072657373656418082001280b32172e" . + "677270632e74657374696e672e426f6f6c56616c756512160a0e66696c6c" . + "5f7365727665725f6964180920012808121e0a1666696c6c5f677270636c" . + "625f726f7574655f74797065180a2001280822be010a0e53696d706c6552" . + "6573706f6e736512260a077061796c6f616418012001280b32152e677270" . + "632e74657374696e672e5061796c6f616412100a08757365726e616d6518" . + "022001280912130a0b6f617574685f73636f706518032001280912110a09" . + "7365727665725f696418042001280912380a11677270636c625f726f7574" . + "655f7479706518052001280e321d2e677270632e74657374696e672e4772" . + "70636c62526f7574655479706512100a08686f73746e616d651806200128" . + "0922770a1953747265616d696e67496e70757443616c6c52657175657374" . + "12260a077061796c6f616418012001280b32152e677270632e7465737469" . + "6e672e5061796c6f616412320a116578706563745f636f6d707265737365" . + "6418022001280b32172e677270632e74657374696e672e426f6f6c56616c" . + "7565223d0a1a53747265616d696e67496e70757443616c6c526573706f6e" . + "7365121f0a17616767726567617465645f7061796c6f61645f73697a6518" . + "012001280522640a12526573706f6e7365506172616d6574657273120c0a" . + "0473697a6518012001280512130a0b696e74657276616c5f757318022001" . + "2805122b0a0a636f6d7072657373656418032001280b32172e677270632e" . + "74657374696e672e426f6f6c56616c756522e8010a1a53747265616d696e" . + "674f757470757443616c6c5265717565737412300a0d726573706f6e7365" . + "5f7479706518012001280e32192e677270632e74657374696e672e506179" . + "6c6f616454797065123d0a13726573706f6e73655f706172616d65746572" . + "7318022003280b32202e677270632e74657374696e672e526573706f6e73" . + "65506172616d657465727312260a077061796c6f616418032001280b3215" . + "2e677270632e74657374696e672e5061796c6f616412310a0f726573706f" . + "6e73655f73746174757318072001280b32182e677270632e74657374696e" . + "672e4563686f53746174757322450a1b53747265616d696e674f75747075" . + "7443616c6c526573706f6e736512260a077061796c6f616418012001280b" . + "32152e677270632e74657374696e672e5061796c6f616422330a0f526563" . + "6f6e6e656374506172616d7312200a186d61785f7265636f6e6e6563745f" . + "6261636b6f66665f6d7318012001280522330a0d5265636f6e6e65637449" . + "6e666f120e0a0670617373656418012001280812120a0a6261636b6f6666" . + "5f6d7318022003280522410a184c6f616442616c616e6365725374617473" . + "5265717565737412100a086e756d5f7270637318012001280512130a0b74" . + "696d656f75745f73656318022001280522b3010a194c6f616442616c616e" . + "6365725374617473526573706f6e7365124d0a0c727063735f62795f7065" . + "657218012003280b32372e677270632e74657374696e672e4c6f61644261" . + "6c616e6365725374617473526573706f6e73652e52706373427950656572" . + "456e74727912140a0c6e756d5f6661696c757265731802200128051a310a" . + "0f52706373427950656572456e747279120b0a036b657918012001280912" . + "0d0a0576616c75651802200128053a0238012a1f0a0b5061796c6f616454" . + "79706512100a0c434f4d505245535341424c4510002a6f0a0f477270636c" . + "62526f75746554797065121d0a19475250434c425f524f5554455f545950" . + "455f554e4b4e4f574e1000121e0a1a475250434c425f524f5554455f5459" . + "50455f46414c4c4241434b1001121d0a19475250434c425f524f5554455f" . + "545950455f4241434b454e441002620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/GPBEmpty.php b/src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/PBEmpty.php similarity index 69% rename from src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/GPBEmpty.php rename to src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/PBEmpty.php index 7198f7da0c1..6118c2609c0 100644 --- a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/GPBEmpty.php +++ b/src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/PBEmpty.php @@ -4,7 +4,7 @@ namespace GPBMetadata\Src\Proto\Grpc\Testing; -class GPBEmpty +class PBEmpty { public static $is_initialized = false; @@ -15,10 +15,10 @@ class GPBEmpty return; } $pool->internalAddGeneratedFile(hex2bin( - "0a430a227372632f70726f746f2f677270632f74657374696e672f656d70" . - "74792e70726f746f120c677270632e74657374696e6722070a05456d7074" . - "79620670726f746f33" - )); + "0a4a0a227372632f70726f746f2f677270632f74657374696e672f656d70" . + "74792e70726f746f120c677270632e74657374696e67220e0a0c456d7074" . + "794d657373616765620670726f746f33" + ), true); static::$is_initialized = true; } diff --git a/src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/Test.php b/src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/Test.php new file mode 100644 index 00000000000..c3063340d00 --- /dev/null +++ b/src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/Test.php @@ -0,0 +1,66 @@ +internalAddGeneratedFile(hex2bin( + "0aca090a217372632f70726f746f2f677270632f74657374696e672f7465" . + "73742e70726f746f120c677270632e74657374696e671a257372632f7072" . + "6f746f2f677270632f74657374696e672f6d657373616765732e70726f74" . + "6f32e7050a0b546573745365727669636512430a09456d70747943616c6c" . + "121a2e677270632e74657374696e672e456d7074794d6573736167651a1a" . + "2e677270632e74657374696e672e456d7074794d65737361676512460a09" . + "556e61727943616c6c121b2e677270632e74657374696e672e53696d706c" . + "65526571756573741a1c2e677270632e74657374696e672e53696d706c65" . + "526573706f6e7365124f0a12436163686561626c65556e61727943616c6c" . + "121b2e677270632e74657374696e672e53696d706c65526571756573741a" . + "1c2e677270632e74657374696e672e53696d706c65526573706f6e736512" . + "6c0a1353747265616d696e674f757470757443616c6c12282e677270632e" . + "74657374696e672e53747265616d696e674f757470757443616c6c526571" . + "756573741a292e677270632e74657374696e672e53747265616d696e674f" . + "757470757443616c6c526573706f6e7365300112690a1253747265616d69" . + "6e67496e70757443616c6c12272e677270632e74657374696e672e537472" . + "65616d696e67496e70757443616c6c526571756573741a282e677270632e" . + "74657374696e672e53747265616d696e67496e70757443616c6c52657370" . + "6f6e7365280112690a0e46756c6c4475706c657843616c6c12282e677270" . + "632e74657374696e672e53747265616d696e674f757470757443616c6c52" . + "6571756573741a292e677270632e74657374696e672e53747265616d696e" . + "674f757470757443616c6c526573706f6e73652801300112690a0e48616c" . + "664475706c657843616c6c12282e677270632e74657374696e672e537472" . + "65616d696e674f757470757443616c6c526571756573741a292e67727063" . + "2e74657374696e672e53747265616d696e674f757470757443616c6c5265" . + "73706f6e736528013001124b0a11556e696d706c656d656e74656443616c" . + "6c121a2e677270632e74657374696e672e456d7074794d6573736167651a" . + "1a2e677270632e74657374696e672e456d7074794d65737361676532630a" . + "14556e696d706c656d656e74656453657276696365124b0a11556e696d70" . + "6c656d656e74656443616c6c121a2e677270632e74657374696e672e456d" . + "7074794d6573736167651a1a2e677270632e74657374696e672e456d7074" . + "794d6573736167653297010a105265636f6e6e6563745365727669636512" . + "420a055374617274121d2e677270632e74657374696e672e5265636f6e6e" . + "656374506172616d731a1a2e677270632e74657374696e672e456d707479" . + "4d657373616765123f0a0453746f70121a2e677270632e74657374696e67" . + "2e456d7074794d6573736167651a1b2e677270632e74657374696e672e52" . + "65636f6e6e656374496e666f327f0a184c6f616442616c616e6365725374" . + "6174735365727669636512630a0e476574436c69656e7453746174731226" . + "2e677270632e74657374696e672e4c6f616442616c616e63657253746174" . + "73526571756573741a272e677270632e74657374696e672e4c6f61644261" . + "6c616e6365725374617473526573706f6e73652200620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/src/php/tests/interop/Grpc/Testing/BoolValue.php b/src/php/tests/interop/Grpc/Testing/BoolValue.php new file mode 100644 index 00000000000..a1fd08d674d --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/BoolValue.php @@ -0,0 +1,69 @@ +grpc.testing.BoolValue + */ +class BoolValue extends \Google\Protobuf\Internal\Message +{ + /** + * The bool value. + * + * Generated from protobuf field bool value = 1; + */ + protected $value = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $value + * The bool value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * The bool value. + * + * Generated from protobuf field bool value = 1; + * @return bool + */ + public function getValue() + { + return $this->value; + } + + /** + * The bool value. + * + * 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/interop/Grpc/Testing/EchoStatus.php b/src/php/tests/interop/Grpc/Testing/EchoStatus.php new file mode 100644 index 00000000000..31fd6dd8995 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/EchoStatus.php @@ -0,0 +1,88 @@ +grpc.testing.EchoStatus + */ +class EchoStatus extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field int32 code = 1; + */ + protected $code = 0; + /** + * Generated from protobuf field string message = 2; + */ + protected $message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $code + * @type string $message + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field int32 code = 1; + * @return int + */ + public function getCode() + { + return $this->code; + } + + /** + * Generated from protobuf field int32 code = 1; + * @param int $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkInt32($var); + $this->code = $var; + + return $this; + } + + /** + * Generated from protobuf field string message = 2; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * 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/PBEmpty.php b/src/php/tests/interop/Grpc/Testing/EmptyMessage.php similarity index 57% rename from src/php/tests/qps/generated_code/Grpc/Testing/PBEmpty.php rename to src/php/tests/interop/Grpc/Testing/EmptyMessage.php index a1fe9df4544..66e49ab07d2 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/PBEmpty.php +++ b/src/php/tests/interop/Grpc/Testing/EmptyMessage.php @@ -16,14 +16,22 @@ use Google\Protobuf\Internal\GPBUtil; * rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { }; * }; * - * Generated from protobuf message grpc.testing.Empty + * Generated from protobuf message grpc.testing.EmptyMessage */ -class PBEmpty extends \Google\Protobuf\Internal\Message +class EmptyMessage extends \Google\Protobuf\Internal\Message { - public function __construct() { - \GPBMetadata\Src\Proto\Grpc\Testing\GPBEmpty::initOnce(); - parent::__construct(); + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\PBEmpty::initOnce(); + parent::__construct($data); } } diff --git a/src/php/tests/interop/Grpc/Testing/EmptyMessageMessage.php b/src/php/tests/interop/Grpc/Testing/EmptyMessageMessage.php new file mode 100644 index 00000000000..678b6ca9b22 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/EmptyMessageMessage.php @@ -0,0 +1,38 @@ +grpc.testing.EmptyMessageMessage + */ +class EmptyMessageMessage extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\PBEmpty::initOnce(); + parent::__construct($data); + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/GrpclbRouteType.php b/src/php/tests/interop/Grpc/Testing/GrpclbRouteType.php new file mode 100644 index 00000000000..f8bff1cb695 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/GrpclbRouteType.php @@ -0,0 +1,66 @@ +grpc.testing.GrpclbRouteType + */ +class GrpclbRouteType +{ + /** + * Server didn't detect the route that a client took to reach it. + * + * Generated from protobuf enum GRPCLB_ROUTE_TYPE_UNKNOWN = 0; + */ + const GRPCLB_ROUTE_TYPE_UNKNOWN = 0; + /** + * Indicates that a client reached a server via gRPCLB fallback. + * + * Generated from protobuf enum GRPCLB_ROUTE_TYPE_FALLBACK = 1; + */ + const GRPCLB_ROUTE_TYPE_FALLBACK = 1; + /** + * Indicates that a client reached a server as a gRPCLB-given backend. + * + * Generated from protobuf enum GRPCLB_ROUTE_TYPE_BACKEND = 2; + */ + const GRPCLB_ROUTE_TYPE_BACKEND = 2; + + private static $valueToName = [ + self::GRPCLB_ROUTE_TYPE_UNKNOWN => 'GRPCLB_ROUTE_TYPE_UNKNOWN', + self::GRPCLB_ROUTE_TYPE_FALLBACK => 'GRPCLB_ROUTE_TYPE_FALLBACK', + self::GRPCLB_ROUTE_TYPE_BACKEND => 'GRPCLB_ROUTE_TYPE_BACKEND', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/src/php/tests/interop/Grpc/Testing/LoadBalancerStatsRequest.php b/src/php/tests/interop/Grpc/Testing/LoadBalancerStatsRequest.php new file mode 100644 index 00000000000..02a15306688 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/LoadBalancerStatsRequest.php @@ -0,0 +1,99 @@ +grpc.testing.LoadBalancerStatsRequest + */ +class LoadBalancerStatsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Request stats for the next num_rpcs sent by client. + * + * Generated from protobuf field int32 num_rpcs = 1; + */ + protected $num_rpcs = 0; + /** + * If num_rpcs have not completed within timeout_sec, return partial results. + * + * Generated from protobuf field int32 timeout_sec = 2; + */ + protected $timeout_sec = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $num_rpcs + * Request stats for the next num_rpcs sent by client. + * @type int $timeout_sec + * If num_rpcs have not completed within timeout_sec, return partial results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Request stats for the next num_rpcs sent by client. + * + * Generated from protobuf field int32 num_rpcs = 1; + * @return int + */ + public function getNumRpcs() + { + return $this->num_rpcs; + } + + /** + * Request stats for the next num_rpcs sent by client. + * + * Generated from protobuf field int32 num_rpcs = 1; + * @param int $var + * @return $this + */ + public function setNumRpcs($var) + { + GPBUtil::checkInt32($var); + $this->num_rpcs = $var; + + return $this; + } + + /** + * If num_rpcs have not completed within timeout_sec, return partial results. + * + * Generated from protobuf field int32 timeout_sec = 2; + * @return int + */ + public function getTimeoutSec() + { + return $this->timeout_sec; + } + + /** + * If num_rpcs have not completed within timeout_sec, return partial results. + * + * Generated from protobuf field int32 timeout_sec = 2; + * @param int $var + * @return $this + */ + public function setTimeoutSec($var) + { + GPBUtil::checkInt32($var); + $this->timeout_sec = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/LoadBalancerStatsResponse.php b/src/php/tests/interop/Grpc/Testing/LoadBalancerStatsResponse.php new file mode 100644 index 00000000000..270189e1871 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/LoadBalancerStatsResponse.php @@ -0,0 +1,99 @@ +grpc.testing.LoadBalancerStatsResponse + */ +class LoadBalancerStatsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The number of completed RPCs for each peer. + * + * Generated from protobuf field map rpcs_by_peer = 1; + */ + private $rpcs_by_peer; + /** + * The number of RPCs that failed to record a remote peer. + * + * Generated from protobuf field int32 num_failures = 2; + */ + protected $num_failures = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\MapField $rpcs_by_peer + * The number of completed RPCs for each peer. + * @type int $num_failures + * The number of RPCs that failed to record a remote peer. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * The number of completed RPCs for each peer. + * + * Generated from protobuf field map rpcs_by_peer = 1; + * @return \Google\Protobuf\Internal\MapField + */ + public function getRpcsByPeer() + { + return $this->rpcs_by_peer; + } + + /** + * The number of completed RPCs for each peer. + * + * Generated from protobuf field map rpcs_by_peer = 1; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setRpcsByPeer($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT32); + $this->rpcs_by_peer = $arr; + + return $this; + } + + /** + * The number of RPCs that failed to record a remote peer. + * + * Generated from protobuf field int32 num_failures = 2; + * @return int + */ + public function getNumFailures() + { + return $this->num_failures; + } + + /** + * The number of RPCs that failed to record a remote peer. + * + * Generated from protobuf field int32 num_failures = 2; + * @param int $var + * @return $this + */ + public function setNumFailures($var) + { + GPBUtil::checkInt32($var); + $this->num_failures = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/LoadBalancerStatsServiceClient.php b/src/php/tests/interop/Grpc/Testing/LoadBalancerStatsServiceClient.php new file mode 100644 index 00000000000..129776d8a30 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/LoadBalancerStatsServiceClient.php @@ -0,0 +1,52 @@ +_simpleRequest('/grpc.testing.LoadBalancerStatsService/GetClientStats', + $argument, + ['\Grpc\Testing\LoadBalancerStatsResponse', 'decode'], + $metadata, $options); + } + +} diff --git a/src/php/tests/interop/Grpc/Testing/Payload.php b/src/php/tests/interop/Grpc/Testing/Payload.php new file mode 100644 index 00000000000..65a007e119e --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/Payload.php @@ -0,0 +1,101 @@ +grpc.testing.Payload + */ +class Payload extends \Google\Protobuf\Internal\Message +{ + /** + * The type of data in body. + * + * Generated from protobuf field .grpc.testing.PayloadType type = 1; + */ + protected $type = 0; + /** + * Primary contents of payload. + * + * Generated from protobuf field bytes body = 2; + */ + protected $body = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * The type of data in body. + * @type string $body + * Primary contents of payload. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * The type of data in body. + * + * Generated from protobuf field .grpc.testing.PayloadType type = 1; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The type of data in body. + * + * 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. + * + * Generated from protobuf field bytes body = 2; + * @return string + */ + public function getBody() + { + return $this->body; + } + + /** + * Primary contents of payload. + * + * 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/interop/Grpc/Testing/PayloadType.php b/src/php/tests/interop/Grpc/Testing/PayloadType.php new file mode 100644 index 00000000000..dc246b37891 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/PayloadType.php @@ -0,0 +1,47 @@ +grpc.testing.PayloadType + */ +class PayloadType +{ + /** + * Compressable text format. + * + * Generated from protobuf enum COMPRESSABLE = 0; + */ + const COMPRESSABLE = 0; + + private static $valueToName = [ + self::COMPRESSABLE => 'COMPRESSABLE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/src/php/tests/interop/Grpc/Testing/ReconnectInfo.php b/src/php/tests/interop/Grpc/Testing/ReconnectInfo.php new file mode 100644 index 00000000000..58ac838a859 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/ReconnectInfo.php @@ -0,0 +1,89 @@ +grpc.testing.ReconnectInfo + */ +class ReconnectInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field bool passed = 1; + */ + protected $passed = false; + /** + * Generated from protobuf field repeated int32 backoff_ms = 2; + */ + private $backoff_ms; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $passed + * @type int[]|\Google\Protobuf\Internal\RepeatedField $backoff_ms + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field bool passed = 1; + * @return bool + */ + public function getPassed() + { + return $this->passed; + } + + /** + * Generated from protobuf field bool passed = 1; + * @param bool $var + * @return $this + */ + public function setPassed($var) + { + GPBUtil::checkBool($var); + $this->passed = $var; + + return $this; + } + + /** + * Generated from protobuf field repeated int32 backoff_ms = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBackoffMs() + { + return $this->backoff_ms; + } + + /** + * Generated from protobuf field repeated int32 backoff_ms = 2; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBackoffMs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->backoff_ms = $arr; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/ReconnectParams.php b/src/php/tests/interop/Grpc/Testing/ReconnectParams.php new file mode 100644 index 00000000000..599b13db1d6 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/ReconnectParams.php @@ -0,0 +1,61 @@ +grpc.testing.ReconnectParams + */ +class ReconnectParams extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field int32 max_reconnect_backoff_ms = 1; + */ + protected $max_reconnect_backoff_ms = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $max_reconnect_backoff_ms + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field int32 max_reconnect_backoff_ms = 1; + * @return int + */ + public function getMaxReconnectBackoffMs() + { + return $this->max_reconnect_backoff_ms; + } + + /** + * 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/MetricsServiceClient.php b/src/php/tests/interop/Grpc/Testing/ReconnectServiceClient.php similarity index 61% rename from src/php/tests/qps/generated_code/Grpc/Testing/MetricsServiceClient.php rename to src/php/tests/interop/Grpc/Testing/ReconnectServiceClient.php index 491ccbce72e..50beca20e00 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/MetricsServiceClient.php +++ b/src/php/tests/interop/Grpc/Testing/ReconnectServiceClient.php @@ -16,17 +16,15 @@ // See the License for the specific language governing permissions and // limitations under the License. // -// Contains the definitions for a metrics service and the type of metrics -// exposed by the service. +// An integration test service that covers all the method signature permutations +// of unary/streaming requests/responses. // -// Currently, 'Gauge' (i.e a metric that represents the measured value of -// something at an instant of time) is the only metric type supported by the -// service. namespace Grpc\Testing; /** + * A service used to control reconnect server. */ -class MetricsServiceClient extends \Grpc\BaseStub { +class ReconnectServiceClient extends \Grpc\BaseStub { /** * @param string $hostname hostname @@ -38,31 +36,28 @@ class MetricsServiceClient extends \Grpc\BaseStub { } /** - * Returns the values of all the gauges that are currently being maintained by - * the service - * @param \Grpc\Testing\EmptyMessage $argument input argument + * @param \Grpc\Testing\ReconnectParams $argument input argument * @param array $metadata metadata * @param array $options call options */ - public function GetAllGauges(\Grpc\Testing\EmptyMessage $argument, + public function Start(\Grpc\Testing\ReconnectParams $argument, $metadata = [], $options = []) { - return $this->_serverStreamRequest('/grpc.testing.MetricsService/GetAllGauges', + return $this->_simpleRequest('/grpc.testing.ReconnectService/Start', $argument, - ['\Grpc\Testing\GaugeResponse', 'decode'], + ['\Grpc\Testing\EmptyMessage', 'decode'], $metadata, $options); } /** - * Returns the value of one gauge - * @param \Grpc\Testing\GaugeRequest $argument input argument + * @param \Grpc\Testing\EmptyMessage $argument input argument * @param array $metadata metadata * @param array $options call options */ - public function GetGauge(\Grpc\Testing\GaugeRequest $argument, + public function Stop(\Grpc\Testing\EmptyMessage $argument, $metadata = [], $options = []) { - return $this->_simpleRequest('/grpc.testing.MetricsService/GetGauge', + return $this->_simpleRequest('/grpc.testing.ReconnectService/Stop', $argument, - ['\Grpc\Testing\GaugeResponse', 'decode'], + ['\Grpc\Testing\ReconnectInfo', 'decode'], $metadata, $options); } diff --git a/src/php/tests/interop/Grpc/Testing/ResponseParameters.php b/src/php/tests/interop/Grpc/Testing/ResponseParameters.php new file mode 100644 index 00000000000..470349325c4 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/ResponseParameters.php @@ -0,0 +1,151 @@ +grpc.testing.ResponseParameters + */ +class ResponseParameters extends \Google\Protobuf\Internal\Message +{ + /** + * Desired payload sizes in responses from the server. + * + * Generated from protobuf field int32 size = 1; + */ + protected $size = 0; + /** + * Desired interval between consecutive responses in the response stream in + * microseconds. + * + * Generated from protobuf field int32 interval_us = 2; + */ + protected $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. + * + * Generated from protobuf field .grpc.testing.BoolValue compressed = 3; + */ + protected $compressed = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $size + * Desired payload sizes in responses from the server. + * @type int $interval_us + * Desired interval between consecutive responses in the response stream in + * microseconds. + * @type \Grpc\Testing\BoolValue $compressed + * 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. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Desired payload sizes in responses from the server. + * + * Generated from protobuf field int32 size = 1; + * @return int + */ + public function getSize() + { + return $this->size; + } + + /** + * Desired payload sizes in responses from the server. + * + * 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. + * + * Generated from protobuf field int32 interval_us = 2; + * @return int + */ + public function getIntervalUs() + { + return $this->interval_us; + } + + /** + * Desired interval between consecutive responses in the response stream in + * microseconds. + * + * 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. + * + * Generated from protobuf field .grpc.testing.BoolValue compressed = 3; + * @return \Grpc\Testing\BoolValue + */ + public function getCompressed() + { + return $this->compressed; + } + + /** + * 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. + * + * Generated from protobuf field .grpc.testing.BoolValue compressed = 3; + * @param \Grpc\Testing\BoolValue $var + * @return $this + */ + public function setCompressed($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\BoolValue::class); + $this->compressed = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/SimpleRequest.php b/src/php/tests/interop/Grpc/Testing/SimpleRequest.php new file mode 100644 index 00000000000..95393659811 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/SimpleRequest.php @@ -0,0 +1,389 @@ +grpc.testing.SimpleRequest + */ +class SimpleRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Desired payload type in the response from the server. + * If response_type is RANDOM, server randomly chooses one from other formats. + * + * Generated from protobuf field .grpc.testing.PayloadType response_type = 1; + */ + protected $response_type = 0; + /** + * Desired payload size in the response from the server. + * + * Generated from protobuf field int32 response_size = 2; + */ + protected $response_size = 0; + /** + * Optional input payload sent along with the request. + * + * Generated from protobuf field .grpc.testing.Payload payload = 3; + */ + protected $payload = null; + /** + * Whether SimpleResponse should include username. + * + * Generated from protobuf field bool fill_username = 4; + */ + protected $fill_username = false; + /** + * Whether SimpleResponse should include OAuth scope. + * + * Generated from protobuf field bool fill_oauth_scope = 5; + */ + protected $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. + * + * Generated from protobuf field .grpc.testing.BoolValue response_compressed = 6; + */ + protected $response_compressed = null; + /** + * Whether server should return a given status + * + * Generated from protobuf field .grpc.testing.EchoStatus response_status = 7; + */ + protected $response_status = null; + /** + * Whether the server should expect this request to be compressed. + * + * Generated from protobuf field .grpc.testing.BoolValue expect_compressed = 8; + */ + protected $expect_compressed = null; + /** + * Whether SimpleResponse should include server_id. + * + * Generated from protobuf field bool fill_server_id = 9; + */ + protected $fill_server_id = false; + /** + * Whether SimpleResponse should include grpclb_route_type. + * + * Generated from protobuf field bool fill_grpclb_route_type = 10; + */ + protected $fill_grpclb_route_type = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $response_type + * Desired payload type in the response from the server. + * If response_type is RANDOM, server randomly chooses one from other formats. + * @type int $response_size + * Desired payload size in the response from the server. + * @type \Grpc\Testing\Payload $payload + * Optional input payload sent along with the request. + * @type bool $fill_username + * Whether SimpleResponse should include username. + * @type bool $fill_oauth_scope + * Whether SimpleResponse should include OAuth scope. + * @type \Grpc\Testing\BoolValue $response_compressed + * 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. + * @type \Grpc\Testing\EchoStatus $response_status + * Whether server should return a given status + * @type \Grpc\Testing\BoolValue $expect_compressed + * Whether the server should expect this request to be compressed. + * @type bool $fill_server_id + * Whether SimpleResponse should include server_id. + * @type bool $fill_grpclb_route_type + * Whether SimpleResponse should include grpclb_route_type. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Desired payload type in the response from the server. + * If response_type is RANDOM, server randomly chooses one from other formats. + * + * Generated from protobuf field .grpc.testing.PayloadType response_type = 1; + * @return int + */ + public function getResponseType() + { + return $this->response_type; + } + + /** + * Desired payload type in the response from the server. + * If response_type is RANDOM, server randomly chooses one from other formats. + * + * 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. + * + * Generated from protobuf field int32 response_size = 2; + * @return int + */ + public function getResponseSize() + { + return $this->response_size; + } + + /** + * Desired payload size in the response from the server. + * + * 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. + * + * Generated from protobuf field .grpc.testing.Payload payload = 3; + * @return \Grpc\Testing\Payload + */ + public function getPayload() + { + return $this->payload; + } + + /** + * Optional input payload sent along with the request. + * + * Generated from protobuf field .grpc.testing.Payload payload = 3; + * @param \Grpc\Testing\Payload $var + * @return $this + */ + public function setPayload($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\Payload::class); + $this->payload = $var; + + return $this; + } + + /** + * Whether SimpleResponse should include username. + * + * Generated from protobuf field bool fill_username = 4; + * @return bool + */ + public function getFillUsername() + { + return $this->fill_username; + } + + /** + * Whether SimpleResponse should include username. + * + * 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. + * + * Generated from protobuf field bool fill_oauth_scope = 5; + * @return bool + */ + public function getFillOauthScope() + { + return $this->fill_oauth_scope; + } + + /** + * Whether SimpleResponse should include OAuth scope. + * + * 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. + * + * Generated from protobuf field .grpc.testing.BoolValue response_compressed = 6; + * @return \Grpc\Testing\BoolValue + */ + public function getResponseCompressed() + { + return $this->response_compressed; + } + + /** + * 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. + * + * Generated from protobuf field .grpc.testing.BoolValue response_compressed = 6; + * @param \Grpc\Testing\BoolValue $var + * @return $this + */ + public function setResponseCompressed($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\BoolValue::class); + $this->response_compressed = $var; + + return $this; + } + + /** + * Whether server should return a given status + * + * Generated from protobuf field .grpc.testing.EchoStatus response_status = 7; + * @return \Grpc\Testing\EchoStatus + */ + public function getResponseStatus() + { + return $this->response_status; + } + + /** + * Whether server should return a given status + * + * Generated from protobuf field .grpc.testing.EchoStatus response_status = 7; + * @param \Grpc\Testing\EchoStatus $var + * @return $this + */ + 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. + * + * Generated from protobuf field .grpc.testing.BoolValue expect_compressed = 8; + * @return \Grpc\Testing\BoolValue + */ + public function getExpectCompressed() + { + return $this->expect_compressed; + } + + /** + * Whether the server should expect this request to be compressed. + * + * Generated from protobuf field .grpc.testing.BoolValue expect_compressed = 8; + * @param \Grpc\Testing\BoolValue $var + * @return $this + */ + public function setExpectCompressed($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\BoolValue::class); + $this->expect_compressed = $var; + + return $this; + } + + /** + * Whether SimpleResponse should include server_id. + * + * Generated from protobuf field bool fill_server_id = 9; + * @return bool + */ + public function getFillServerId() + { + return $this->fill_server_id; + } + + /** + * Whether SimpleResponse should include server_id. + * + * Generated from protobuf field bool fill_server_id = 9; + * @param bool $var + * @return $this + */ + public function setFillServerId($var) + { + GPBUtil::checkBool($var); + $this->fill_server_id = $var; + + return $this; + } + + /** + * Whether SimpleResponse should include grpclb_route_type. + * + * Generated from protobuf field bool fill_grpclb_route_type = 10; + * @return bool + */ + public function getFillGrpclbRouteType() + { + return $this->fill_grpclb_route_type; + } + + /** + * Whether SimpleResponse should include grpclb_route_type. + * + * Generated from protobuf field bool fill_grpclb_route_type = 10; + * @param bool $var + * @return $this + */ + public function setFillGrpclbRouteType($var) + { + GPBUtil::checkBool($var); + $this->fill_grpclb_route_type = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/SimpleResponse.php b/src/php/tests/interop/Grpc/Testing/SimpleResponse.php new file mode 100644 index 00000000000..7121fc215ec --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/SimpleResponse.php @@ -0,0 +1,245 @@ +grpc.testing.SimpleResponse + */ +class SimpleResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Payload to increase message size. + * + * Generated from protobuf field .grpc.testing.Payload payload = 1; + */ + protected $payload = null; + /** + * The user the request came from, for verifying authentication was + * successful when the client expected it. + * + * Generated from protobuf field string username = 2; + */ + protected $username = ''; + /** + * OAuth scope. + * + * Generated from protobuf field string oauth_scope = 3; + */ + protected $oauth_scope = ''; + /** + * Server ID. This must be unique among different server instances, + * but the same across all RPC's made to a particular server instance. + * + * Generated from protobuf field string server_id = 4; + */ + protected $server_id = ''; + /** + * gRPCLB Path. + * + * Generated from protobuf field .grpc.testing.GrpclbRouteType grpclb_route_type = 5; + */ + protected $grpclb_route_type = 0; + /** + * Server hostname. + * + * Generated from protobuf field string hostname = 6; + */ + protected $hostname = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grpc\Testing\Payload $payload + * Payload to increase message size. + * @type string $username + * The user the request came from, for verifying authentication was + * successful when the client expected it. + * @type string $oauth_scope + * OAuth scope. + * @type string $server_id + * Server ID. This must be unique among different server instances, + * but the same across all RPC's made to a particular server instance. + * @type int $grpclb_route_type + * gRPCLB Path. + * @type string $hostname + * Server hostname. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Payload to increase message size. + * + * Generated from protobuf field .grpc.testing.Payload payload = 1; + * @return \Grpc\Testing\Payload + */ + public function getPayload() + { + return $this->payload; + } + + /** + * Payload to increase message size. + * + * Generated from protobuf field .grpc.testing.Payload payload = 1; + * @param \Grpc\Testing\Payload $var + * @return $this + */ + 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. + * + * Generated from protobuf field string username = 2; + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * The user the request came from, for verifying authentication was + * successful when the client expected it. + * + * 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. + * + * Generated from protobuf field string oauth_scope = 3; + * @return string + */ + public function getOauthScope() + { + return $this->oauth_scope; + } + + /** + * OAuth scope. + * + * 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; + } + + /** + * Server ID. This must be unique among different server instances, + * but the same across all RPC's made to a particular server instance. + * + * Generated from protobuf field string server_id = 4; + * @return string + */ + public function getServerId() + { + return $this->server_id; + } + + /** + * Server ID. This must be unique among different server instances, + * but the same across all RPC's made to a particular server instance. + * + * Generated from protobuf field string server_id = 4; + * @param string $var + * @return $this + */ + public function setServerId($var) + { + GPBUtil::checkString($var, True); + $this->server_id = $var; + + return $this; + } + + /** + * gRPCLB Path. + * + * Generated from protobuf field .grpc.testing.GrpclbRouteType grpclb_route_type = 5; + * @return int + */ + public function getGrpclbRouteType() + { + return $this->grpclb_route_type; + } + + /** + * gRPCLB Path. + * + * Generated from protobuf field .grpc.testing.GrpclbRouteType grpclb_route_type = 5; + * @param int $var + * @return $this + */ + public function setGrpclbRouteType($var) + { + GPBUtil::checkEnum($var, \Grpc\Testing\GrpclbRouteType::class); + $this->grpclb_route_type = $var; + + return $this; + } + + /** + * Server hostname. + * + * Generated from protobuf field string hostname = 6; + * @return string + */ + public function getHostname() + { + return $this->hostname; + } + + /** + * Server hostname. + * + * Generated from protobuf field string hostname = 6; + * @param string $var + * @return $this + */ + public function setHostname($var) + { + GPBUtil::checkString($var, True); + $this->hostname = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/StreamingInputCallRequest.php b/src/php/tests/interop/Grpc/Testing/StreamingInputCallRequest.php new file mode 100644 index 00000000000..00c754b946b --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/StreamingInputCallRequest.php @@ -0,0 +1,113 @@ +grpc.testing.StreamingInputCallRequest + */ +class StreamingInputCallRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional input payload sent along with the request. + * + * Generated from protobuf field .grpc.testing.Payload payload = 1; + */ + protected $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. + * + * Generated from protobuf field .grpc.testing.BoolValue expect_compressed = 2; + */ + protected $expect_compressed = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grpc\Testing\Payload $payload + * Optional input payload sent along with the request. + * @type \Grpc\Testing\BoolValue $expect_compressed + * 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. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Optional input payload sent along with the request. + * + * Generated from protobuf field .grpc.testing.Payload payload = 1; + * @return \Grpc\Testing\Payload + */ + public function getPayload() + { + return $this->payload; + } + + /** + * Optional input payload sent along with the request. + * + * Generated from protobuf field .grpc.testing.Payload payload = 1; + * @param \Grpc\Testing\Payload $var + * @return $this + */ + 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. + * + * Generated from protobuf field .grpc.testing.BoolValue expect_compressed = 2; + * @return \Grpc\Testing\BoolValue + */ + public function getExpectCompressed() + { + return $this->expect_compressed; + } + + /** + * 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. + * + * Generated from protobuf field .grpc.testing.BoolValue expect_compressed = 2; + * @param \Grpc\Testing\BoolValue $var + * @return $this + */ + public function setExpectCompressed($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\BoolValue::class); + $this->expect_compressed = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/StreamingInputCallResponse.php b/src/php/tests/interop/Grpc/Testing/StreamingInputCallResponse.php new file mode 100644 index 00000000000..f7ff87c1fb1 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/StreamingInputCallResponse.php @@ -0,0 +1,67 @@ +grpc.testing.StreamingInputCallResponse + */ +class StreamingInputCallResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Aggregated size of payloads received from the client. + * + * Generated from protobuf field int32 aggregated_payload_size = 1; + */ + protected $aggregated_payload_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $aggregated_payload_size + * Aggregated size of payloads received from the client. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Aggregated size of payloads received from the client. + * + * Generated from protobuf field int32 aggregated_payload_size = 1; + * @return int + */ + public function getAggregatedPayloadSize() + { + return $this->aggregated_payload_size; + } + + /** + * Aggregated size of payloads received from the client. + * + * 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/interop/Grpc/Testing/StreamingOutputCallRequest.php b/src/php/tests/interop/Grpc/Testing/StreamingOutputCallRequest.php new file mode 100644 index 00000000000..552e96d7ae2 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/StreamingOutputCallRequest.php @@ -0,0 +1,181 @@ +grpc.testing.StreamingOutputCallRequest + */ +class StreamingOutputCallRequest extends \Google\Protobuf\Internal\Message +{ + /** + * 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. + * + * Generated from protobuf field .grpc.testing.PayloadType response_type = 1; + */ + protected $response_type = 0; + /** + * Configuration for each expected response message. + * + * Generated from protobuf field repeated .grpc.testing.ResponseParameters response_parameters = 2; + */ + private $response_parameters; + /** + * Optional input payload sent along with the request. + * + * Generated from protobuf field .grpc.testing.Payload payload = 3; + */ + protected $payload = null; + /** + * Whether server should return a given status + * + * Generated from protobuf field .grpc.testing.EchoStatus response_status = 7; + */ + protected $response_status = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $response_type + * 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. + * @type \Grpc\Testing\ResponseParameters[]|\Google\Protobuf\Internal\RepeatedField $response_parameters + * Configuration for each expected response message. + * @type \Grpc\Testing\Payload $payload + * Optional input payload sent along with the request. + * @type \Grpc\Testing\EchoStatus $response_status + * Whether server should return a given status + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * 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. + * + * Generated from protobuf field .grpc.testing.PayloadType response_type = 1; + * @return int + */ + public function getResponseType() + { + return $this->response_type; + } + + /** + * 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. + * + * 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. + * + * Generated from protobuf field repeated .grpc.testing.ResponseParameters response_parameters = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResponseParameters() + { + return $this->response_parameters; + } + + /** + * Configuration for each expected response message. + * + * 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) + { + $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. + * + * Generated from protobuf field .grpc.testing.Payload payload = 3; + * @return \Grpc\Testing\Payload + */ + public function getPayload() + { + return $this->payload; + } + + /** + * Optional input payload sent along with the request. + * + * Generated from protobuf field .grpc.testing.Payload payload = 3; + * @param \Grpc\Testing\Payload $var + * @return $this + */ + public function setPayload($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\Payload::class); + $this->payload = $var; + + return $this; + } + + /** + * Whether server should return a given status + * + * Generated from protobuf field .grpc.testing.EchoStatus response_status = 7; + * @return \Grpc\Testing\EchoStatus + */ + public function getResponseStatus() + { + return $this->response_status; + } + + /** + * Whether server should return a given status + * + * Generated from protobuf field .grpc.testing.EchoStatus response_status = 7; + * @param \Grpc\Testing\EchoStatus $var + * @return $this + */ + public function setResponseStatus($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\EchoStatus::class); + $this->response_status = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/StreamingOutputCallResponse.php b/src/php/tests/interop/Grpc/Testing/StreamingOutputCallResponse.php new file mode 100644 index 00000000000..b28b906ce93 --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/StreamingOutputCallResponse.php @@ -0,0 +1,67 @@ +grpc.testing.StreamingOutputCallResponse + */ +class StreamingOutputCallResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Payload to increase response size. + * + * Generated from protobuf field .grpc.testing.Payload payload = 1; + */ + protected $payload = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grpc\Testing\Payload $payload + * Payload to increase response size. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Payload to increase response size. + * + * Generated from protobuf field .grpc.testing.Payload payload = 1; + * @return \Grpc\Testing\Payload + */ + public function getPayload() + { + return $this->payload; + } + + /** + * Payload to increase response size. + * + * Generated from protobuf field .grpc.testing.Payload payload = 1; + * @param \Grpc\Testing\Payload $var + * @return $this + */ + public function setPayload($var) + { + GPBUtil::checkMessage($var, \Grpc\Testing\Payload::class); + $this->payload = $var; + + return $this; + } + +} + diff --git a/src/php/tests/interop/Grpc/Testing/TestServiceClient.php b/src/php/tests/interop/Grpc/Testing/TestServiceClient.php new file mode 100644 index 00000000000..e6fef125b8b --- /dev/null +++ b/src/php/tests/interop/Grpc/Testing/TestServiceClient.php @@ -0,0 +1,152 @@ +_simpleRequest('/grpc.testing.TestService/EmptyCall', + $argument, + ['\Grpc\Testing\EmptyMessage', 'decode'], + $metadata, $options); + } + + /** + * One request followed by one response. + * @param \Grpc\Testing\SimpleRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function UnaryCall(\Grpc\Testing\SimpleRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grpc.testing.TestService/UnaryCall', + $argument, + ['\Grpc\Testing\SimpleResponse', 'decode'], + $metadata, $options); + } + + /** + * One request followed by one response. Response has cache control + * headers set such that a caching HTTP proxy (such as GFE) can + * satisfy subsequent requests. + * @param \Grpc\Testing\SimpleRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function CacheableUnaryCall(\Grpc\Testing\SimpleRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grpc.testing.TestService/CacheableUnaryCall', + $argument, + ['\Grpc\Testing\SimpleResponse', 'decode'], + $metadata, $options); + } + + /** + * One request followed by a sequence of responses (streamed download). + * The server returns the payload with client desired type and sizes. + * @param \Grpc\Testing\StreamingOutputCallRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function StreamingOutputCall(\Grpc\Testing\StreamingOutputCallRequest $argument, + $metadata = [], $options = []) { + return $this->_serverStreamRequest('/grpc.testing.TestService/StreamingOutputCall', + $argument, + ['\Grpc\Testing\StreamingOutputCallResponse', 'decode'], + $metadata, $options); + } + + /** + * A sequence of requests followed by one response (streamed upload). + * The server returns the aggregated size of client payload as the result. + * @param array $metadata metadata + * @param array $options call options + */ + public function StreamingInputCall($metadata = [], $options = []) { + return $this->_clientStreamRequest('/grpc.testing.TestService/StreamingInputCall', + ['\Grpc\Testing\StreamingInputCallResponse','decode'], + $metadata, $options); + } + + /** + * A sequence of requests with each request served by the server immediately. + * As one request could lead to multiple responses, this interface + * demonstrates the idea of full duplexing. + * @param array $metadata metadata + * @param array $options call options + */ + public function FullDuplexCall($metadata = [], $options = []) { + return $this->_bidiRequest('/grpc.testing.TestService/FullDuplexCall', + ['\Grpc\Testing\StreamingOutputCallResponse','decode'], + $metadata, $options); + } + + /** + * A sequence of requests followed by a sequence of responses. + * The server buffers all the client requests and then serves them in order. A + * stream of responses are returned to the client when the server starts with + * first request. + * @param array $metadata metadata + * @param array $options call options + */ + public function HalfDuplexCall($metadata = [], $options = []) { + return $this->_bidiRequest('/grpc.testing.TestService/HalfDuplexCall', + ['\Grpc\Testing\StreamingOutputCallResponse','decode'], + $metadata, $options); + } + + /** + * The test server will not implement this method. It will be used + * to test the behavior when clients call unimplemented methods. + * @param \Grpc\Testing\EmptyMessage $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function UnimplementedCall(\Grpc\Testing\EmptyMessage $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/grpc.testing.TestService/UnimplementedCall', + $argument, + ['\Grpc\Testing\EmptyMessage', 'decode'], + $metadata, $options); + } + +} diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/UnimplementedEchoServiceClient.php b/src/php/tests/interop/Grpc/Testing/UnimplementedServiceClient.php similarity index 68% rename from src/php/tests/qps/generated_code/Grpc/Testing/UnimplementedEchoServiceClient.php rename to src/php/tests/interop/Grpc/Testing/UnimplementedServiceClient.php index fee0daa70c7..2c1d921bfcc 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/UnimplementedEchoServiceClient.php +++ b/src/php/tests/interop/Grpc/Testing/UnimplementedServiceClient.php @@ -2,7 +2,7 @@ // GENERATED CODE -- DO NOT EDIT! // Original file comments: -// Copyright 2015 gRPC authors. +// Copyright 2015-2016 gRPC authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,11 +16,16 @@ // See the License for the specific language governing permissions and // limitations under the License. // +// An integration test service that covers all the method signature permutations +// of unary/streaming requests/responses. +// namespace Grpc\Testing; /** + * A simple service NOT implemented at servers so clients can test for + * that case. */ -class UnimplementedEchoServiceClient extends \Grpc\BaseStub { +class UnimplementedServiceClient extends \Grpc\BaseStub { /** * @param string $hostname hostname @@ -32,15 +37,16 @@ class UnimplementedEchoServiceClient extends \Grpc\BaseStub { } /** - * @param \Grpc\Testing\EchoRequest $argument input argument + * A call that no server should implement + * @param \Grpc\Testing\EmptyMessage $argument input argument * @param array $metadata metadata * @param array $options call options */ - public function Unimplemented(\Grpc\Testing\EchoRequest $argument, + public function UnimplementedCall(\Grpc\Testing\EmptyMessage $argument, $metadata = [], $options = []) { - return $this->_simpleRequest('/grpc.testing.UnimplementedEchoService/Unimplemented', + return $this->_simpleRequest('/grpc.testing.UnimplementedService/UnimplementedCall', $argument, - ['\Grpc\Testing\EchoResponse', 'decode'], + ['\Grpc\Testing\EmptyMessage', 'decode'], $metadata, $options); } 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 index f9c710cd4e0..36aaad2884b 100644 --- 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 @@ -25,7 +25,7 @@ class Stats "6973746f6772616d480042070a0576616c7565222b0a0553746174731222" . "0a076d65747269637318012003280b32112e677270632e636f72652e4d65" . "74726963620670726f746f33" - )); + ), true); static::$is_initialized = true; } diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/BenchmarkService.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/BenchmarkService.php index 906f6a2d846..ead856ba901 100644 --- a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/BenchmarkService.php +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/BenchmarkService.php @@ -33,7 +33,7 @@ class BenchmarkService "6f746857617973121b2e677270632e74657374696e672e53696d706c6552" . "6571756573741a1c2e677270632e74657374696e672e53696d706c655265" . "73706f6e736528013001620670726f746f33" - )); + ), true); static::$is_initialized = true; } diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/CompilerTest.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/CompilerTest.php index 2c4fe92f052..3eb7acd5729 100644 --- a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/CompilerTest.php +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/CompilerTest.php @@ -29,7 +29,7 @@ class CompilerTest "6573706f6e73652801300132450a08536572766963654212390a084d6574" . "686f64423112152e677270632e74657374696e672e526571756573741a16" . "2e677270632e74657374696e672e526573706f6e7365620670726f746f33" - )); + ), true); 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 2319bcd0213..b92e61bf25a 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,7 +17,7 @@ class Control \GPBMetadata\Src\Proto\Grpc\Testing\Payloads::initOnce(); \GPBMetadata\Src\Proto\Grpc\Testing\Stats::initOnce(); $pool->internalAddGeneratedFile(hex2bin( - "0abc1a0a247372632f70726f746f2f677270632f74657374696e672f636f" . + "0acd1b0a247372632f70726f746f2f677270632f74657374696e672f636f" . "6e74726f6c2e70726f746f120c677270632e74657374696e671a22737263" . "2f70726f746f2f677270632f74657374696e672f73746174732e70726f74" . "6f22250a0d506f6973736f6e506172616d7312140a0c6f6666657265645f" . @@ -31,7 +31,7 @@ class Control "6f7665727269646518022001280912110a09637265645f74797065180320" . "012809224d0a0a4368616e6e656c417267120c0a046e616d651801200128" . "0912130a097374725f76616c7565180220012809480012130a09696e745f" . - "76616c7565180320012805480042070a0576616c756522ef040a0c436c69" . + "76616c7565180320012805480042070a0576616c756522bc050a0c436c69" . "656e74436f6e66696712160a0e7365727665725f74617267657473180120" . "032809122d0a0b636c69656e745f7479706518022001280e32182e677270" . "632e74657374696e672e436c69656e745479706512350a0f736563757269" . @@ -52,86 +52,90 @@ class Control "03280b32182e677270632e74657374696e672e4368616e6e656c41726712" . "160a0e746872656164735f7065725f6371181120012805121b0a136d6573" . "73616765735f7065725f73747265616d18122001280512180a107573655f" . - "636f616c657363655f61706918132001280822380a0c436c69656e745374" . + "636f616c657363655f61706918132001280812310a296d656469616e5f6c" . + "6174656e63795f636f6c6c656374696f6e5f696e74657276616c5f6d696c" . + "6c697318142001280512180a10636c69656e745f70726f63657373657318" . + "152001280522380a0c436c69656e7453746174757312280a057374617473" . + "18012001280b32192e677270632e74657374696e672e436c69656e745374" . + "61747322150a044d61726b120d0a05726573657418012001280822680a0a" . + "436c69656e7441726773122b0a05736574757018012001280b321a2e6772" . + "70632e74657374696e672e436c69656e74436f6e666967480012220a046d" . + "61726b18022001280b32122e677270632e74657374696e672e4d61726b48" . + "0042090a07617267747970652297030a0c536572766572436f6e66696712" . + "2d0a0b7365727665725f7479706518012001280e32182e677270632e7465" . + "7374696e672e5365727665725479706512350a0f73656375726974795f70" . + "6172616d7318022001280b321c2e677270632e74657374696e672e536563" . + "7572697479506172616d73120c0a04706f7274180420012805121c0a1461" . + "73796e635f7365727665725f7468726561647318072001280512120a0a63" . + "6f72655f6c696d697418082001280512330a0e7061796c6f61645f636f6e" . + "66696718092001280b321b2e677270632e74657374696e672e5061796c6f" . + "6164436f6e66696712110a09636f72655f6c697374180a2003280512180a" . + "106f746865725f7365727665725f617069180b2001280912160a0e746872" . + "656164735f7065725f6371180c20012805121c0a137265736f757263655f" . + "71756f74615f73697a6518e90720012805122f0a0c6368616e6e656c5f61" . + "72677318ea072003280b32182e677270632e74657374696e672e4368616e" . + "6e656c41726712180a107365727665725f70726f63657373657318152001" . + "280522680a0a53657276657241726773122b0a0573657475701801200128" . + "0b321a2e677270632e74657374696e672e536572766572436f6e66696748" . + "0012220a046d61726b18022001280b32122e677270632e74657374696e67" . + "2e4d61726b480042090a076172677479706522550a0c5365727665725374" . "6174757312280a05737461747318012001280b32192e677270632e746573" . - "74696e672e436c69656e74537461747322150a044d61726b120d0a057265" . - "73657418012001280822680a0a436c69656e7441726773122b0a05736574" . - "757018012001280b321a2e677270632e74657374696e672e436c69656e74" . - "436f6e666967480012220a046d61726b18022001280b32122e677270632e" . - "74657374696e672e4d61726b480042090a076172677479706522fd020a0c" . - "536572766572436f6e666967122d0a0b7365727665725f74797065180120" . - "01280e32182e677270632e74657374696e672e5365727665725479706512" . - "350a0f73656375726974795f706172616d7318022001280b321c2e677270" . - "632e74657374696e672e5365637572697479506172616d73120c0a04706f" . - "7274180420012805121c0a146173796e635f7365727665725f7468726561" . - "647318072001280512120a0a636f72655f6c696d69741808200128051233" . - "0a0e7061796c6f61645f636f6e66696718092001280b321b2e677270632e" . - "74657374696e672e5061796c6f6164436f6e66696712110a09636f72655f" . - "6c697374180a2003280512180a106f746865725f7365727665725f617069" . - "180b2001280912160a0e746872656164735f7065725f6371180c20012805" . - "121c0a137265736f757263655f71756f74615f73697a6518e90720012805" . - "122f0a0c6368616e6e656c5f6172677318ea072003280b32182e67727063" . - "2e74657374696e672e4368616e6e656c41726722680a0a53657276657241" . - "726773122b0a05736574757018012001280b321a2e677270632e74657374" . - "696e672e536572766572436f6e666967480012220a046d61726b18022001" . - "280b32122e677270632e74657374696e672e4d61726b480042090a076172" . - "677479706522550a0c53657276657253746174757312280a057374617473" . - "18012001280b32192e677270632e74657374696e672e5365727665725374" . - "617473120c0a04706f7274180220012805120d0a05636f72657318032001" . - "2805220d0a0b436f726552657175657374221d0a0c436f7265526573706f" . - "6e7365120d0a05636f72657318012001280522060a04566f696422fd010a" . - "085363656e6172696f120c0a046e616d6518012001280912310a0d636c69" . - "656e745f636f6e66696718022001280b321a2e677270632e74657374696e" . - "672e436c69656e74436f6e66696712130a0b6e756d5f636c69656e747318" . - "032001280512310a0d7365727665725f636f6e66696718042001280b321a" . - "2e677270632e74657374696e672e536572766572436f6e66696712130a0b" . - "6e756d5f7365727665727318052001280512160a0e7761726d75705f7365" . - "636f6e647318062001280512190a1162656e63686d61726b5f7365636f6e" . - "647318072001280512200a18737061776e5f6c6f63616c5f776f726b6572" . - "5f636f756e7418082001280522360a095363656e6172696f7312290a0973" . - "63656e6172696f7318012003280b32162e677270632e74657374696e672e" . - "5363656e6172696f2284040a155363656e6172696f526573756c7453756d" . - "6d617279120b0a03717073180120012801121b0a137170735f7065725f73" . - "65727665725f636f7265180220012801121a0a127365727665725f737973" . - "74656d5f74696d6518032001280112180a107365727665725f757365725f" . - "74696d65180420012801121a0a12636c69656e745f73797374656d5f7469" . - "6d6518052001280112180a10636c69656e745f757365725f74696d651806" . - "2001280112120a0a6c6174656e63795f353018072001280112120a0a6c61" . - "74656e63795f393018082001280112120a0a6c6174656e63795f39351809" . - "2001280112120a0a6c6174656e63795f3939180a2001280112130a0b6c61" . - "74656e63795f393939180b2001280112180a107365727665725f6370755f" . - "7573616765180c2001280112260a1e7375636365737366756c5f72657175" . - "657374735f7065725f7365636f6e64180d2001280112220a1a6661696c65" . - "645f72657175657374735f7065725f7365636f6e64180e2001280112200a" . - "18636c69656e745f706f6c6c735f7065725f72657175657374180f200128" . - "0112200a187365727665725f706f6c6c735f7065725f7265717565737418" . - "102001280112220a1a7365727665725f717565726965735f7065725f6370" . - "755f73656318112001280112220a1a636c69656e745f717565726965735f" . - "7065725f6370755f7365631812200128012283030a0e5363656e6172696f" . - "526573756c7412280a087363656e6172696f18012001280b32162e677270" . - "632e74657374696e672e5363656e6172696f122e0a096c6174656e636965" . - "7318022001280b321b2e677270632e74657374696e672e486973746f6772" . - "616d44617461122f0a0c636c69656e745f737461747318032003280b3219" . - "2e677270632e74657374696e672e436c69656e745374617473122f0a0c73" . - "65727665725f737461747318042003280b32192e677270632e7465737469" . - "6e672e536572766572537461747312140a0c7365727665725f636f726573" . - "18052003280512340a0773756d6d61727918062001280b32232e67727063" . - "2e74657374696e672e5363656e6172696f526573756c7453756d6d617279" . - "12160a0e636c69656e745f7375636365737318072003280812160a0e7365" . - "727665725f7375636365737318082003280812390a0f726571756573745f" . - "726573756c747318092003280b32202e677270632e74657374696e672e52" . - "657175657374526573756c74436f756e742a410a0a436c69656e74547970" . - "65120f0a0b53594e435f434c49454e54100012100a0c4153594e435f434c" . - "49454e54100112100a0c4f544845525f434c49454e5410022a5b0a0a5365" . - "7276657254797065120f0a0b53594e435f534552564552100012100a0c41" . - "53594e435f534552564552100112180a144153594e435f47454e45524943" . - "5f534552564552100212100a0c4f544845525f53455256455210032a720a" . - "075270635479706512090a05554e4152591000120d0a0953545245414d49" . - "4e47100112190a1553545245414d494e475f46524f4d5f434c49454e5410" . - "0212190a1553545245414d494e475f46524f4d5f53455256455210031217" . - "0a1353545245414d494e475f424f54485f574159531004620670726f746f" . - "33" - )); + "74696e672e5365727665725374617473120c0a04706f7274180220012805" . + "120d0a05636f726573180320012805220d0a0b436f726552657175657374" . + "221d0a0c436f7265526573706f6e7365120d0a05636f7265731801200128" . + "0522060a04566f696422fd010a085363656e6172696f120c0a046e616d65" . + "18012001280912310a0d636c69656e745f636f6e66696718022001280b32" . + "1a2e677270632e74657374696e672e436c69656e74436f6e66696712130a" . + "0b6e756d5f636c69656e747318032001280512310a0d7365727665725f63" . + "6f6e66696718042001280b321a2e677270632e74657374696e672e536572" . + "766572436f6e66696712130a0b6e756d5f73657276657273180520012805" . + "12160a0e7761726d75705f7365636f6e647318062001280512190a116265" . + "6e63686d61726b5f7365636f6e647318072001280512200a18737061776e" . + "5f6c6f63616c5f776f726b65725f636f756e7418082001280522360a0953" . + "63656e6172696f7312290a097363656e6172696f7318012003280b32162e" . + "677270632e74657374696e672e5363656e6172696f2284040a155363656e" . + "6172696f526573756c7453756d6d617279120b0a03717073180120012801" . + "121b0a137170735f7065725f7365727665725f636f726518022001280112" . + "1a0a127365727665725f73797374656d5f74696d6518032001280112180a" . + "107365727665725f757365725f74696d65180420012801121a0a12636c69" . + "656e745f73797374656d5f74696d6518052001280112180a10636c69656e" . + "745f757365725f74696d6518062001280112120a0a6c6174656e63795f35" . + "3018072001280112120a0a6c6174656e63795f393018082001280112120a" . + "0a6c6174656e63795f393518092001280112120a0a6c6174656e63795f39" . + "39180a2001280112130a0b6c6174656e63795f393939180b200128011218" . + "0a107365727665725f6370755f7573616765180c2001280112260a1e7375" . + "636365737366756c5f72657175657374735f7065725f7365636f6e64180d" . + "2001280112220a1a6661696c65645f72657175657374735f7065725f7365" . + "636f6e64180e2001280112200a18636c69656e745f706f6c6c735f706572" . + "5f72657175657374180f2001280112200a187365727665725f706f6c6c73" . + "5f7065725f7265717565737418102001280112220a1a7365727665725f71" . + "7565726965735f7065725f6370755f73656318112001280112220a1a636c" . + "69656e745f717565726965735f7065725f6370755f736563181220012801" . + "2283030a0e5363656e6172696f526573756c7412280a087363656e617269" . + "6f18012001280b32162e677270632e74657374696e672e5363656e617269" . + "6f122e0a096c6174656e6369657318022001280b321b2e677270632e7465" . + "7374696e672e486973746f6772616d44617461122f0a0c636c69656e745f" . + "737461747318032003280b32192e677270632e74657374696e672e436c69" . + "656e745374617473122f0a0c7365727665725f737461747318042003280b" . + "32192e677270632e74657374696e672e536572766572537461747312140a" . + "0c7365727665725f636f72657318052003280512340a0773756d6d617279" . + "18062001280b32232e677270632e74657374696e672e5363656e6172696f" . + "526573756c7453756d6d61727912160a0e636c69656e745f737563636573" . + "7318072003280812160a0e7365727665725f737563636573731808200328" . + "0812390a0f726571756573745f726573756c747318092003280b32202e67" . + "7270632e74657374696e672e52657175657374526573756c74436f756e74" . + "2a560a0a436c69656e7454797065120f0a0b53594e435f434c49454e5410" . + "0012100a0c4153594e435f434c49454e54100112100a0c4f544845525f43" . + "4c49454e54100212130a0f43414c4c4241434b5f434c49454e5410032a70" . + "0a0a53657276657254797065120f0a0b53594e435f534552564552100012" . + "100a0c4153594e435f534552564552100112180a144153594e435f47454e" . + "455249435f534552564552100212100a0c4f544845525f53455256455210" . + "0312130a0f43414c4c4241434b5f53455256455210042a720a0752706354" . + "79706512090a05554e4152591000120d0a0953545245414d494e47100112" . + "190a1553545245414d494e475f46524f4d5f434c49454e54100212190a15" . + "53545245414d494e475f46524f4d5f534552564552100312170a13535452" . + "45414d494e475f424f54485f574159531004620670726f746f33" + ), true); static::$is_initialized = true; } diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Echo.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Echo.php deleted file mode 100644 index 77c5230f450..00000000000 --- a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Echo.php +++ /dev/null @@ -1,43 +0,0 @@ -internalAddGeneratedFile(hex2bin( - "0aa6040a217372632f70726f746f2f677270632f74657374696e672f6563" . - "686f2e70726f746f120c677270632e74657374696e6732f6020a0f456368" . - "6f5465737453657276696365123d0a044563686f12192e677270632e7465" . - "7374696e672e4563686f526571756573741a1a2e677270632e7465737469" . - "6e672e4563686f526573706f6e736512480a0d5265717565737453747265" . - "616d12192e677270632e74657374696e672e4563686f526571756573741a" . - "1a2e677270632e74657374696e672e4563686f526573706f6e7365280112" . - "490a0e526573706f6e736553747265616d12192e677270632e7465737469" . - "6e672e4563686f526571756573741a1a2e677270632e74657374696e672e" . - "4563686f526573706f6e7365300112470a0a4269646953747265616d1219" . - "2e677270632e74657374696e672e4563686f526571756573741a1a2e6772" . - "70632e74657374696e672e4563686f526573706f6e73652801300112460a" . - "0d556e696d706c656d656e74656412192e677270632e74657374696e672e" . - "4563686f526571756573741a1a2e677270632e74657374696e672e456368" . - "6f526573706f6e736532620a18556e696d706c656d656e7465644563686f" . - "5365727669636512460a0d556e696d706c656d656e74656412192e677270" . - "632e74657374696e672e4563686f526571756573741a1a2e677270632e74" . - "657374696e672e4563686f526573706f6e7365320e0a0c4e6f5270635365" . - "7276696365620670726f746f33" - )); - - static::$is_initialized = true; - } -} - diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/EchoMessages.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/EchoMessages.php index 4bac8a29060..940b6bd21e7 100644 --- a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/EchoMessages.php +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/EchoMessages.php @@ -15,13 +15,13 @@ class EchoMessages return; } $pool->internalAddGeneratedFile(hex2bin( - "0a8f070a2a7372632f70726f746f2f677270632f74657374696e672f6563" . + "0afd070a2a7372632f70726f746f2f677270632f74657374696e672f6563" . "686f5f6d657373616765732e70726f746f120c677270632e74657374696e" . "6722320a094465627567496e666f12150a0d737461636b5f656e74726965" . "73180120032809120e0a0664657461696c18022001280922500a0b457272" . "6f72537461747573120c0a04636f646518012001280512150a0d6572726f" . "725f6d657373616765180220012809121c0a1462696e6172795f6572726f" . - "725f64657461696c7318032001280922e2030a0d52657175657374506172" . + "725f64657461696c7318032001280922cb040a0d52657175657374506172" . "616d7312150a0d6563686f5f646561646c696e65180120012808121e0a16" . "636c69656e745f63616e63656c5f61667465725f7573180220012805121e" . "0a167365727665725f63616e63656c5f61667465725f7573180320012805" . @@ -37,16 +37,20 @@ class EchoMessages "20012808121c0a1462696e6172795f6572726f725f64657461696c73180d" . "2001280912310a0e65787065637465645f6572726f72180e2001280b3219" . "2e677270632e74657374696e672e4572726f7253746174757312170a0f73" . - "65727665725f736c6565705f7573180f20012805224a0a0b4563686f5265" . - "7175657374120f0a076d657373616765180120012809122a0a0570617261" . - "6d18022001280b321b2e677270632e74657374696e672e52657175657374" . - "506172616d7322460a0e526573706f6e7365506172616d7312180a107265" . - "71756573745f646561646c696e65180120012803120c0a04686f73741802" . - "20012809120c0a0470656572180320012809224c0a0c4563686f52657370" . - "6f6e7365120f0a076d657373616765180120012809122b0a05706172616d" . - "18022001280b321c2e677270632e74657374696e672e526573706f6e7365" . - "506172616d73620670726f746f33" - )); + "65727665725f736c6565705f7573180f20012805121b0a136261636b656e" . + "645f6368616e6e656c5f696478181020012805121f0a176563686f5f6d65" . + "7461646174615f696e697469616c6c7918112001280812290a2173657276" . + "65725f6e6f746966795f636c69656e745f7768656e5f7374617274656418" . + "1220012808224a0a0b4563686f52657175657374120f0a076d6573736167" . + "65180120012809122a0a05706172616d18022001280b321b2e677270632e" . + "74657374696e672e52657175657374506172616d7322460a0e526573706f" . + "6e7365506172616d7312180a10726571756573745f646561646c696e6518" . + "0120012803120c0a04686f7374180220012809120c0a0470656572180320" . + "012809224c0a0c4563686f526573706f6e7365120f0a076d657373616765" . + "180120012809122b0a05706172616d18022001280b321c2e677270632e74" . + "657374696e672e526573706f6e7365506172616d734203f8010162067072" . + "6f746f33" + ), true); static::$is_initialized = true; } diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/EmptyService.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/EmptyService.php new file mode 100644 index 00000000000..d0a2f5473d6 --- /dev/null +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/EmptyService.php @@ -0,0 +1,26 @@ +internalAddGeneratedFile(hex2bin( + "0a520a2a7372632f70726f746f2f677270632f74657374696e672f656d70" . + "74795f736572766963652e70726f746f120c677270632e74657374696e67" . + "320e0a0c456d70747953657276696365620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Messages.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Messages.php index c0880026264..72c17046a24 100644 --- a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Messages.php +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Messages.php @@ -15,13 +15,13 @@ class Messages return; } $pool->internalAddGeneratedFile(hex2bin( - "0ad50a0a257372632f70726f746f2f677270632f74657374696e672f6d65" . + "0ad70e0a257372632f70726f746f2f677270632f74657374696e672f6d65" . "7373616765732e70726f746f120c677270632e74657374696e67221a0a09" . "426f6f6c56616c7565120d0a0576616c756518012001280822400a075061" . "796c6f616412270a047479706518012001280e32192e677270632e746573" . "74696e672e5061796c6f616454797065120c0a04626f647918022001280c" . "222b0a0a4563686f537461747573120c0a04636f6465180120012805120f" . - "0a076d65737361676518022001280922ce020a0d53696d706c6552657175" . + "0a076d6573736167651802200128092286030a0d53696d706c6552657175" . "65737412300a0d726573706f6e73655f7479706518012001280e32192e67" . "7270632e74657374696e672e5061796c6f61645479706512150a0d726573" . "706f6e73655f73697a6518022001280512260a077061796c6f6164180320" . @@ -32,36 +32,53 @@ class Messages "426f6f6c56616c756512310a0f726573706f6e73655f7374617475731807" . "2001280b32182e677270632e74657374696e672e4563686f537461747573" . "12320a116578706563745f636f6d7072657373656418082001280b32172e" . - "677270632e74657374696e672e426f6f6c56616c7565225f0a0e53696d70" . - "6c65526573706f6e736512260a077061796c6f616418012001280b32152e" . - "677270632e74657374696e672e5061796c6f616412100a08757365726e61" . - "6d6518022001280912130a0b6f617574685f73636f706518032001280922" . - "770a1953747265616d696e67496e70757443616c6c526571756573741226" . - "0a077061796c6f616418012001280b32152e677270632e74657374696e67" . - "2e5061796c6f616412320a116578706563745f636f6d7072657373656418" . - "022001280b32172e677270632e74657374696e672e426f6f6c56616c7565" . - "223d0a1a53747265616d696e67496e70757443616c6c526573706f6e7365" . - "121f0a17616767726567617465645f7061796c6f61645f73697a65180120" . - "01280522640a12526573706f6e7365506172616d6574657273120c0a0473" . - "697a6518012001280512130a0b696e74657276616c5f7573180220012805" . - "122b0a0a636f6d7072657373656418032001280b32172e677270632e7465" . - "7374696e672e426f6f6c56616c756522e8010a1a53747265616d696e674f" . - "757470757443616c6c5265717565737412300a0d726573706f6e73655f74" . - "79706518012001280e32192e677270632e74657374696e672e5061796c6f" . - "616454797065123d0a13726573706f6e73655f706172616d657465727318" . - "022003280b32202e677270632e74657374696e672e526573706f6e736550" . - "6172616d657465727312260a077061796c6f616418032001280b32152e67" . - "7270632e74657374696e672e5061796c6f616412310a0f726573706f6e73" . - "655f73746174757318072001280b32182e677270632e74657374696e672e" . - "4563686f53746174757322450a1b53747265616d696e674f757470757443" . - "616c6c526573706f6e736512260a077061796c6f616418012001280b3215" . - "2e677270632e74657374696e672e5061796c6f616422330a0f5265636f6e" . - "6e656374506172616d7312200a186d61785f7265636f6e6e6563745f6261" . - "636b6f66665f6d7318012001280522330a0d5265636f6e6e656374496e66" . - "6f120e0a0670617373656418012001280812120a0a6261636b6f66665f6d" . - "731802200328052a1f0a0b5061796c6f61645479706512100a0c434f4d50" . - "5245535341424c451000620670726f746f33" - )); + "677270632e74657374696e672e426f6f6c56616c756512160a0e66696c6c" . + "5f7365727665725f6964180920012808121e0a1666696c6c5f677270636c" . + "625f726f7574655f74797065180a2001280822be010a0e53696d706c6552" . + "6573706f6e736512260a077061796c6f616418012001280b32152e677270" . + "632e74657374696e672e5061796c6f616412100a08757365726e616d6518" . + "022001280912130a0b6f617574685f73636f706518032001280912110a09" . + "7365727665725f696418042001280912380a11677270636c625f726f7574" . + "655f7479706518052001280e321d2e677270632e74657374696e672e4772" . + "70636c62526f7574655479706512100a08686f73746e616d651806200128" . + "0922770a1953747265616d696e67496e70757443616c6c52657175657374" . + "12260a077061796c6f616418012001280b32152e677270632e7465737469" . + "6e672e5061796c6f616412320a116578706563745f636f6d707265737365" . + "6418022001280b32172e677270632e74657374696e672e426f6f6c56616c" . + "7565223d0a1a53747265616d696e67496e70757443616c6c526573706f6e" . + "7365121f0a17616767726567617465645f7061796c6f61645f73697a6518" . + "012001280522640a12526573706f6e7365506172616d6574657273120c0a" . + "0473697a6518012001280512130a0b696e74657276616c5f757318022001" . + "2805122b0a0a636f6d7072657373656418032001280b32172e677270632e" . + "74657374696e672e426f6f6c56616c756522e8010a1a53747265616d696e" . + "674f757470757443616c6c5265717565737412300a0d726573706f6e7365" . + "5f7479706518012001280e32192e677270632e74657374696e672e506179" . + "6c6f616454797065123d0a13726573706f6e73655f706172616d65746572" . + "7318022003280b32202e677270632e74657374696e672e526573706f6e73" . + "65506172616d657465727312260a077061796c6f616418032001280b3215" . + "2e677270632e74657374696e672e5061796c6f616412310a0f726573706f" . + "6e73655f73746174757318072001280b32182e677270632e74657374696e" . + "672e4563686f53746174757322450a1b53747265616d696e674f75747075" . + "7443616c6c526573706f6e736512260a077061796c6f616418012001280b" . + "32152e677270632e74657374696e672e5061796c6f616422330a0f526563" . + "6f6e6e656374506172616d7312200a186d61785f7265636f6e6e6563745f" . + "6261636b6f66665f6d7318012001280522330a0d5265636f6e6e65637449" . + "6e666f120e0a0670617373656418012001280812120a0a6261636b6f6666" . + "5f6d7318022003280522410a184c6f616442616c616e6365725374617473" . + "5265717565737412100a086e756d5f7270637318012001280512130a0b74" . + "696d656f75745f73656318022001280522b3010a194c6f616442616c616e" . + "6365725374617473526573706f6e7365124d0a0c727063735f62795f7065" . + "657218012003280b32372e677270632e74657374696e672e4c6f61644261" . + "6c616e6365725374617473526573706f6e73652e52706373427950656572" . + "456e74727912140a0c6e756d5f6661696c757265731802200128051a310a" . + "0f52706373427950656572456e747279120b0a036b657918012001280912" . + "0d0a0576616c75651802200128053a0238012a1f0a0b5061796c6f616454" . + "79706512100a0c434f4d505245535341424c4510002a6f0a0f477270636c" . + "62526f75746554797065121d0a19475250434c425f524f5554455f545950" . + "455f554e4b4e4f574e1000121e0a1a475250434c425f524f5554455f5459" . + "50455f46414c4c4241434b1001121d0a19475250434c425f524f5554455f" . + "545950455f4241434b454e441002620670726f746f33" + ), true); static::$is_initialized = true; } diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Metrics.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Metrics.php deleted file mode 100644 index 7ac739fb54f..00000000000 --- a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Metrics.php +++ /dev/null @@ -1,36 +0,0 @@ -internalAddGeneratedFile(hex2bin( - "0afb020a247372632f70726f746f2f677270632f74657374696e672f6d65" . - "74726963732e70726f746f120c677270632e74657374696e67226c0a0d47" . - "61756765526573706f6e7365120c0a046e616d6518012001280912140a0a" . - "6c6f6e675f76616c7565180220012803480012160a0c646f75626c655f76" . - "616c7565180320012801480012160a0c737472696e675f76616c75651804" . - "20012809480042070a0576616c7565221c0a0c4761756765526571756573" . - "74120c0a046e616d65180120012809220e0a0c456d7074794d6573736167" . - "6532a0010a0e4d6574726963735365727669636512490a0c476574416c6c" . - "476175676573121a2e677270632e74657374696e672e456d7074794d6573" . - "736167651a1b2e677270632e74657374696e672e4761756765526573706f" . - "6e7365300112430a084765744761756765121a2e677270632e7465737469" . - "6e672e4761756765526571756573741a1b2e677270632e74657374696e67" . - "2e4761756765526573706f6e7365620670726f746f33" - )); - - static::$is_initialized = true; - } -} - diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/PBEmpty.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/PBEmpty.php new file mode 100644 index 00000000000..6118c2609c0 --- /dev/null +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/PBEmpty.php @@ -0,0 +1,26 @@ +internalAddGeneratedFile(hex2bin( + "0a4a0a227372632f70726f746f2f677270632f74657374696e672f656d70" . + "74792e70726f746f120c677270632e74657374696e67220e0a0c456d7074" . + "794d657373616765620670726f746f33" + ), true); + + static::$is_initialized = true; + } +} + diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Payloads.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Payloads.php index 279fe00ac82..31a51708e96 100644 --- a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Payloads.php +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Payloads.php @@ -29,7 +29,7 @@ class Payloads "0e636f6d706c65785f706172616d7318032001280b32202e677270632e74" . "657374696e672e436f6d706c657850726f746f506172616d73480042090a" . "077061796c6f6164620670726f746f33" - )); + ), true); 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 e07f73679ea..e8ed140b21b 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 @@ -29,7 +29,7 @@ class ProxyService "2801123f0a0a5265706f727448697374121b2e677270632e74657374696e" . "672e486973746f6772616d446174611a122e677270632e74657374696e67" . "2e566f69642801620670726f746f33" - )); + ), true); static::$is_initialized = true; } diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/ReportQpsScenarioService.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/ReportQpsScenarioService.php index 35a1fb4acb0..19edcc07ffa 100644 --- a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/ReportQpsScenarioService.php +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/ReportQpsScenarioService.php @@ -22,7 +22,7 @@ class ReportQpsScenarioService "656e6172696f5365727669636512420a0e5265706f72745363656e617269" . "6f121c2e677270632e74657374696e672e5363656e6172696f526573756c" . "741a122e677270632e74657374696e672e566f6964620670726f746f33" - )); + ), true); 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 3d23b75dfa0..186de704c77 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 @@ -41,7 +41,7 @@ class Stats "6f756e7412150a0d63715f706f6c6c5f636f756e7418062001280412240a" . "0a636f72655f737461747318072001280b32102e677270632e636f72652e" . "5374617473620670726f746f33" - )); + ), true); static::$is_initialized = true; } diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Test.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Test.php index 54628cfa373..c3063340d00 100644 --- a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Test.php +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/Test.php @@ -14,45 +14,51 @@ class Test if (static::$is_initialized == true) { return; } - \GPBMetadata\Src\Proto\Grpc\Testing\GPBEmpty::initOnce(); + \GPBMetadata\Src\Proto\Grpc\Testing\PBEmpty::initOnce(); \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); $pool->internalAddGeneratedFile(hex2bin( - "0a91080a217372632f70726f746f2f677270632f74657374696e672f7465" . + "0aca090a217372632f70726f746f2f677270632f74657374696e672f7465" . "73742e70726f746f120c677270632e74657374696e671a257372632f7072" . "6f746f2f677270632f74657374696e672f6d657373616765732e70726f74" . - "6f32cb050a0b546573745365727669636512350a09456d70747943616c6c" . - "12132e677270632e74657374696e672e456d7074791a132e677270632e74" . - "657374696e672e456d70747912460a09556e61727943616c6c121b2e6772" . - "70632e74657374696e672e53696d706c65526571756573741a1c2e677270" . - "632e74657374696e672e53696d706c65526573706f6e7365124f0a124361" . - "63686561626c65556e61727943616c6c121b2e677270632e74657374696e" . - "672e53696d706c65526571756573741a1c2e677270632e74657374696e67" . - "2e53696d706c65526573706f6e7365126c0a1353747265616d696e674f75" . - "7470757443616c6c12282e677270632e74657374696e672e53747265616d" . - "696e674f757470757443616c6c526571756573741a292e677270632e7465" . - "7374696e672e53747265616d696e674f757470757443616c6c526573706f" . - "6e7365300112690a1253747265616d696e67496e70757443616c6c12272e" . - "677270632e74657374696e672e53747265616d696e67496e70757443616c" . - "6c526571756573741a282e677270632e74657374696e672e53747265616d" . - "696e67496e70757443616c6c526573706f6e7365280112690a0e46756c6c" . - "4475706c657843616c6c12282e677270632e74657374696e672e53747265" . - "616d696e674f757470757443616c6c526571756573741a292e677270632e" . - "74657374696e672e53747265616d696e674f757470757443616c6c526573" . - "706f6e73652801300112690a0e48616c664475706c657843616c6c12282e" . - "677270632e74657374696e672e53747265616d696e674f75747075744361" . - "6c6c526571756573741a292e677270632e74657374696e672e5374726561" . - "6d696e674f757470757443616c6c526573706f6e736528013001123d0a11" . - "556e696d706c656d656e74656443616c6c12132e677270632e7465737469" . - "6e672e456d7074791a132e677270632e74657374696e672e456d70747932" . - "550a14556e696d706c656d656e74656453657276696365123d0a11556e69" . - "6d706c656d656e74656443616c6c12132e677270632e74657374696e672e" . - "456d7074791a132e677270632e74657374696e672e456d7074793289010a" . - "105265636f6e6e65637453657276696365123b0a055374617274121d2e67" . - "7270632e74657374696e672e5265636f6e6e656374506172616d731a132e" . - "677270632e74657374696e672e456d70747912380a0453746f7012132e67" . - "7270632e74657374696e672e456d7074791a1b2e677270632e7465737469" . - "6e672e5265636f6e6e656374496e666f620670726f746f33" - )); + "6f32e7050a0b546573745365727669636512430a09456d70747943616c6c" . + "121a2e677270632e74657374696e672e456d7074794d6573736167651a1a" . + "2e677270632e74657374696e672e456d7074794d65737361676512460a09" . + "556e61727943616c6c121b2e677270632e74657374696e672e53696d706c" . + "65526571756573741a1c2e677270632e74657374696e672e53696d706c65" . + "526573706f6e7365124f0a12436163686561626c65556e61727943616c6c" . + "121b2e677270632e74657374696e672e53696d706c65526571756573741a" . + "1c2e677270632e74657374696e672e53696d706c65526573706f6e736512" . + "6c0a1353747265616d696e674f757470757443616c6c12282e677270632e" . + "74657374696e672e53747265616d696e674f757470757443616c6c526571" . + "756573741a292e677270632e74657374696e672e53747265616d696e674f" . + "757470757443616c6c526573706f6e7365300112690a1253747265616d69" . + "6e67496e70757443616c6c12272e677270632e74657374696e672e537472" . + "65616d696e67496e70757443616c6c526571756573741a282e677270632e" . + "74657374696e672e53747265616d696e67496e70757443616c6c52657370" . + "6f6e7365280112690a0e46756c6c4475706c657843616c6c12282e677270" . + "632e74657374696e672e53747265616d696e674f757470757443616c6c52" . + "6571756573741a292e677270632e74657374696e672e53747265616d696e" . + "674f757470757443616c6c526573706f6e73652801300112690a0e48616c" . + "664475706c657843616c6c12282e677270632e74657374696e672e537472" . + "65616d696e674f757470757443616c6c526571756573741a292e67727063" . + "2e74657374696e672e53747265616d696e674f757470757443616c6c5265" . + "73706f6e736528013001124b0a11556e696d706c656d656e74656443616c" . + "6c121a2e677270632e74657374696e672e456d7074794d6573736167651a" . + "1a2e677270632e74657374696e672e456d7074794d65737361676532630a" . + "14556e696d706c656d656e74656453657276696365124b0a11556e696d70" . + "6c656d656e74656443616c6c121a2e677270632e74657374696e672e456d" . + "7074794d6573736167651a1a2e677270632e74657374696e672e456d7074" . + "794d6573736167653297010a105265636f6e6e6563745365727669636512" . + "420a055374617274121d2e677270632e74657374696e672e5265636f6e6e" . + "656374506172616d731a1a2e677270632e74657374696e672e456d707479" . + "4d657373616765123f0a0453746f70121a2e677270632e74657374696e67" . + "2e456d7074794d6573736167651a1b2e677270632e74657374696e672e52" . + "65636f6e6e656374496e666f327f0a184c6f616442616c616e6365725374" . + "6174735365727669636512630a0e476574436c69656e7453746174731226" . + "2e677270632e74657374696e672e4c6f616442616c616e63657253746174" . + "73526571756573741a272e677270632e74657374696e672e4c6f61644261" . + "6c616e6365725374617473526573706f6e73652200620670726f746f33" + ), true); static::$is_initialized = true; } diff --git a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/WorkerService.php b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/WorkerService.php index a8a863df19d..3f67c9918f8 100644 --- a/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/WorkerService.php +++ b/src/php/tests/qps/generated_code/GPBMetadata/Src/Proto/Grpc/Testing/WorkerService.php @@ -28,7 +28,7 @@ class WorkerService "74657374696e672e436f7265526573706f6e736512340a0a51756974576f" . "726b657212122e677270632e74657374696e672e566f69641a122e677270" . "632e74657374696e672e566f6964620670726f746f33" - )); + ), true); 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 index 897d6271c28..d9743584292 100644 --- a/src/php/tests/qps/generated_code/Grpc/Core/Bucket.php +++ b/src/php/tests/qps/generated_code/Grpc/Core/Bucket.php @@ -16,15 +16,25 @@ class Bucket extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field double start = 1; */ - private $start = 0.0; + protected $start = 0.0; /** * Generated from protobuf field uint64 count = 2; */ - private $count = 0; + protected $count = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $start + * @type int|string $count + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Core\Stats::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/src/php/tests/qps/generated_code/Grpc/Core/Histogram.php b/src/php/tests/qps/generated_code/Grpc/Core/Histogram.php index 1902be8e4ac..a40319b0fa3 100644 --- a/src/php/tests/qps/generated_code/Grpc/Core/Histogram.php +++ b/src/php/tests/qps/generated_code/Grpc/Core/Histogram.php @@ -18,9 +18,18 @@ class Histogram extends \Google\Protobuf\Internal\Message */ private $buckets; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grpc\Core\Bucket[]|\Google\Protobuf\Internal\RepeatedField $buckets + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Core\Stats::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/src/php/tests/qps/generated_code/Grpc/Core/Metric.php b/src/php/tests/qps/generated_code/Grpc/Core/Metric.php index c3581b7d21b..d8c1e85fc1f 100644 --- a/src/php/tests/qps/generated_code/Grpc/Core/Metric.php +++ b/src/php/tests/qps/generated_code/Grpc/Core/Metric.php @@ -16,12 +16,23 @@ class Metric extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; protected $value; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * @type int|string $count + * @type \Grpc\Core\Histogram $histogram + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Core\Stats::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/src/php/tests/qps/generated_code/Grpc/Core/Stats.php b/src/php/tests/qps/generated_code/Grpc/Core/Stats.php index e6f3fb08992..482776a4670 100644 --- a/src/php/tests/qps/generated_code/Grpc/Core/Stats.php +++ b/src/php/tests/qps/generated_code/Grpc/Core/Stats.php @@ -18,9 +18,18 @@ class Stats extends \Google\Protobuf\Internal\Message */ private $metrics; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grpc\Core\Metric[]|\Google\Protobuf\Internal\RepeatedField $metrics + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Core\Stats::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 7eb364b7a0b..a1fd08d674d 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/BoolValue.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/BoolValue.php @@ -22,11 +22,21 @@ class BoolValue extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool value = 1; */ - private $value = false; + protected $value = false; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $value + * The bool value. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 0511026ba74..2a37cd259a2 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ByteBufferParams.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ByteBufferParams.php @@ -16,15 +16,25 @@ class ByteBufferParams extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field int32 req_size = 1; */ - private $req_size = 0; + protected $req_size = 0; /** * Generated from protobuf field int32 resp_size = 2; */ - private $resp_size = 0; + protected $resp_size = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $req_size + * @type int $resp_size + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Payloads::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 5c5fb861a40..72c1b0cad04 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ChannelArg.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ChannelArg.php @@ -16,12 +16,23 @@ class ChannelArg extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; protected $value; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * @type string $str_value + * @type int $int_value + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 ee3fd46f0f6..9964098035f 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ClientArgs.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ClientArgs.php @@ -15,9 +15,19 @@ class ClientArgs extends \Google\Protobuf\Internal\Message { protected $argtype; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grpc\Testing\ClientConfig $setup + * @type \Grpc\Testing\Mark $mark + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 0dd3072f184..d14257a3392 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ClientConfig.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ClientConfig.php @@ -22,49 +22,49 @@ class ClientConfig extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field .grpc.testing.ClientType client_type = 2; */ - private $client_type = 0; + protected $client_type = 0; /** * Generated from protobuf field .grpc.testing.SecurityParams security_params = 3; */ - private $security_params = null; + protected $security_params = null; /** * How many concurrent RPCs to start for each channel. * For synchronous client, use a separate thread for each outstanding RPC. * * Generated from protobuf field int32 outstanding_rpcs_per_channel = 4; */ - private $outstanding_rpcs_per_channel = 0; + protected $outstanding_rpcs_per_channel = 0; /** * Number of independent client channels to create. * i-th channel will connect to server_target[i % server_targets.size()] * * Generated from protobuf field int32 client_channels = 5; */ - private $client_channels = 0; + protected $client_channels = 0; /** * Only for async client. Number of threads to use to start/manage RPCs. * * Generated from protobuf field int32 async_client_threads = 7; */ - private $async_client_threads = 0; + protected $async_client_threads = 0; /** * Generated from protobuf field .grpc.testing.RpcType rpc_type = 8; */ - private $rpc_type = 0; + protected $rpc_type = 0; /** * The requested load for the entire client (aggregated over all the threads). * * Generated from protobuf field .grpc.testing.LoadParams load_params = 10; */ - private $load_params = null; + protected $load_params = null; /** * Generated from protobuf field .grpc.testing.PayloadConfig payload_config = 11; */ - private $payload_config = null; + protected $payload_config = null; /** * Generated from protobuf field .grpc.testing.HistogramParams histogram_params = 12; */ - private $histogram_params = null; + protected $histogram_params = null; /** * Specify the cores we should run the client on, if desired * @@ -74,13 +74,13 @@ class ClientConfig extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field int32 core_limit = 14; */ - private $core_limit = 0; + protected $core_limit = 0; /** * If we use an OTHER_CLIENT client_type, this string gives more detail * * Generated from protobuf field string other_client_api = 15; */ - private $other_client_api = ''; + protected $other_client_api = ''; /** * Generated from protobuf field repeated .grpc.testing.ChannelArg channel_args = 16; */ @@ -90,23 +90,78 @@ class ClientConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 threads_per_cq = 17; */ - private $threads_per_cq = 0; + protected $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; + protected $messages_per_stream = 0; /** * Use coalescing API when possible. * * Generated from protobuf field bool use_coalesce_api = 19; */ - private $use_coalesce_api = false; + protected $use_coalesce_api = false; + /** + * If 0, disabled. Else, specifies the period between gathering latency + * medians in milliseconds. + * + * Generated from protobuf field int32 median_latency_collection_interval_millis = 20; + */ + protected $median_latency_collection_interval_millis = 0; + /** + * Number of client processes. 0 indicates no restriction. + * + * Generated from protobuf field int32 client_processes = 21; + */ + protected $client_processes = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string[]|\Google\Protobuf\Internal\RepeatedField $server_targets + * List of targets to connect to. At least one target needs to be specified. + * @type int $client_type + * @type \Grpc\Testing\SecurityParams $security_params + * @type int $outstanding_rpcs_per_channel + * How many concurrent RPCs to start for each channel. + * For synchronous client, use a separate thread for each outstanding RPC. + * @type int $client_channels + * Number of independent client channels to create. + * i-th channel will connect to server_target[i % server_targets.size()] + * @type int $async_client_threads + * Only for async client. Number of threads to use to start/manage RPCs. + * @type int $rpc_type + * @type \Grpc\Testing\LoadParams $load_params + * The requested load for the entire client (aggregated over all the threads). + * @type \Grpc\Testing\PayloadConfig $payload_config + * @type \Grpc\Testing\HistogramParams $histogram_params + * @type int[]|\Google\Protobuf\Internal\RepeatedField $core_list + * Specify the cores we should run the client on, if desired + * @type int $core_limit + * @type string $other_client_api + * If we use an OTHER_CLIENT client_type, this string gives more detail + * @type \Grpc\Testing\ChannelArg[]|\Google\Protobuf\Internal\RepeatedField $channel_args + * @type int $threads_per_cq + * Number of threads that share each completion queue + * @type int $messages_per_stream + * Number of messages on a stream before it gets finished/restarted + * @type bool $use_coalesce_api + * Use coalescing API when possible. + * @type int $median_latency_collection_interval_millis + * If 0, disabled. Else, specifies the period between gathering latency + * medians in milliseconds. + * @type int $client_processes + * Number of client processes. 0 indicates no restriction. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); - parent::__construct(); + parent::__construct($data); } /** @@ -527,5 +582,59 @@ class ClientConfig extends \Google\Protobuf\Internal\Message return $this; } + /** + * If 0, disabled. Else, specifies the period between gathering latency + * medians in milliseconds. + * + * Generated from protobuf field int32 median_latency_collection_interval_millis = 20; + * @return int + */ + public function getMedianLatencyCollectionIntervalMillis() + { + return $this->median_latency_collection_interval_millis; + } + + /** + * If 0, disabled. Else, specifies the period between gathering latency + * medians in milliseconds. + * + * Generated from protobuf field int32 median_latency_collection_interval_millis = 20; + * @param int $var + * @return $this + */ + public function setMedianLatencyCollectionIntervalMillis($var) + { + GPBUtil::checkInt32($var); + $this->median_latency_collection_interval_millis = $var; + + return $this; + } + + /** + * Number of client processes. 0 indicates no restriction. + * + * Generated from protobuf field int32 client_processes = 21; + * @return int + */ + public function getClientProcesses() + { + return $this->client_processes; + } + + /** + * Number of client processes. 0 indicates no restriction. + * + * Generated from protobuf field int32 client_processes = 21; + * @param int $var + * @return $this + */ + public function setClientProcesses($var) + { + GPBUtil::checkInt32($var); + $this->client_processes = $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 f2a76217917..89d241a8c1c 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ClientStats.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ClientStats.php @@ -18,21 +18,21 @@ class ClientStats extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .grpc.testing.HistogramData latencies = 1; */ - private $latencies = null; + protected $latencies = null; /** * See ServerStats for details. * * Generated from protobuf field double time_elapsed = 2; */ - private $time_elapsed = 0.0; + protected $time_elapsed = 0.0; /** * Generated from protobuf field double time_user = 3; */ - private $time_user = 0.0; + protected $time_user = 0.0; /** * Generated from protobuf field double time_system = 4; */ - private $time_system = 0.0; + protected $time_system = 0.0; /** * Number of failed requests (one row per status code seen) * @@ -44,17 +44,37 @@ class ClientStats extends \Google\Protobuf\Internal\Message * * Generated from protobuf field uint64 cq_poll_count = 6; */ - private $cq_poll_count = 0; + protected $cq_poll_count = 0; /** * Core library stats * * Generated from protobuf field .grpc.core.Stats core_stats = 7; */ - private $core_stats = null; + protected $core_stats = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grpc\Testing\HistogramData $latencies + * Latency histogram. Data points are in nanoseconds. + * @type float $time_elapsed + * See ServerStats for details. + * @type float $time_user + * @type float $time_system + * @type \Grpc\Testing\RequestResultCount[]|\Google\Protobuf\Internal\RepeatedField $request_results + * Number of failed requests (one row per status code seen) + * @type int|string $cq_poll_count + * Number of polls called inside completion queue + * @type \Grpc\Core\Stats $core_stats + * Core library stats + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Stats::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 3ea40c4dfa0..3f879291298 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ClientStatus.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ClientStatus.php @@ -16,11 +16,20 @@ class ClientStatus extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field .grpc.testing.ClientStats stats = 1; */ - private $stats = null; + protected $stats = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grpc\Testing\ClientStats $stats + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 d1df4f19436..080cb405a65 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ClientType.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ClientType.php @@ -4,8 +4,10 @@ namespace Grpc\Testing; +use UnexpectedValueException; + /** - * Protobuf enum Grpc\Testing\ClientType + * Protobuf type grpc.testing.ClientType */ class ClientType { @@ -26,5 +28,36 @@ class ClientType * Generated from protobuf enum OTHER_CLIENT = 2; */ const OTHER_CLIENT = 2; + /** + * Generated from protobuf enum CALLBACK_CLIENT = 3; + */ + const CALLBACK_CLIENT = 3; + + private static $valueToName = [ + self::SYNC_CLIENT => 'SYNC_CLIENT', + self::ASYNC_CLIENT => 'ASYNC_CLIENT', + self::OTHER_CLIENT => 'OTHER_CLIENT', + self::CALLBACK_CLIENT => 'CALLBACK_CLIENT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } } 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 2772836f13d..59e7cb55c82 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ClosedLoopParams.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ClosedLoopParams.php @@ -17,9 +17,17 @@ use Google\Protobuf\Internal\GPBUtil; class ClosedLoopParams extends \Google\Protobuf\Internal\Message { - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); - parent::__construct(); + parent::__construct($data); } } 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 b9013cdb300..8a6471a4f18 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ComplexProtoParams.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ComplexProtoParams.php @@ -17,9 +17,17 @@ use Google\Protobuf\Internal\GPBUtil; class ComplexProtoParams extends \Google\Protobuf\Internal\Message { - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Payloads::initOnce(); - parent::__construct(); + parent::__construct($data); } } 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 7772572f1c5..8f60530d31a 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/CoreRequest.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/CoreRequest.php @@ -14,9 +14,17 @@ use Google\Protobuf\Internal\GPBUtil; class CoreRequest extends \Google\Protobuf\Internal\Message { - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); - parent::__construct(); + parent::__construct($data); } } 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 e0b40ee3001..4964375bdd3 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/CoreResponse.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/CoreResponse.php @@ -18,11 +18,21 @@ class CoreResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 cores = 1; */ - private $cores = 0; + protected $cores = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $cores + * Number of cores available on the server + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/DebugInfo.php b/src/php/tests/qps/generated_code/Grpc/Testing/DebugInfo.php index 805b629b0db..c12e0a08f2b 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/DebugInfo.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/DebugInfo.php @@ -22,11 +22,21 @@ class DebugInfo extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field string detail = 2; */ - private $detail = ''; + protected $detail = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string[]|\Google\Protobuf\Internal\RepeatedField $stack_entries + * @type string $detail + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\EchoMessages::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/EchoRequest.php b/src/php/tests/qps/generated_code/Grpc/Testing/EchoRequest.php index 9aadfc5dee3..1ad946966a0 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/EchoRequest.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/EchoRequest.php @@ -16,15 +16,25 @@ class EchoRequest extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field string message = 1; */ - private $message = ''; + protected $message = ''; /** * Generated from protobuf field .grpc.testing.RequestParams param = 2; */ - private $param = null; + protected $param = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $message + * @type \Grpc\Testing\RequestParams $param + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\EchoMessages::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/EchoResponse.php b/src/php/tests/qps/generated_code/Grpc/Testing/EchoResponse.php index c4a9db35aba..47d4d9e8141 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/EchoResponse.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/EchoResponse.php @@ -16,15 +16,25 @@ class EchoResponse extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field string message = 1; */ - private $message = ''; + protected $message = ''; /** * Generated from protobuf field .grpc.testing.ResponseParams param = 2; */ - private $param = null; + protected $param = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $message + * @type \Grpc\Testing\ResponseParams $param + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\EchoMessages::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 6a6623a042d..31fd6dd8995 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/EchoStatus.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/EchoStatus.php @@ -19,15 +19,25 @@ class EchoStatus extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field int32 code = 1; */ - private $code = 0; + protected $code = 0; /** * Generated from protobuf field string message = 2; */ - private $message = ''; + protected $message = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $code + * @type string $message + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/EmptyMessage.php b/src/php/tests/qps/generated_code/Grpc/Testing/EmptyMessage.php index 3da163e7c09..66e49ab07d2 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/EmptyMessage.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/EmptyMessage.php @@ -1,6 +1,6 @@ grpc.testing.EmptyMessage */ class EmptyMessage extends \Google\Protobuf\Internal\Message { - public function __construct() { - \GPBMetadata\Src\Proto\Grpc\Testing\Metrics::initOnce(); - parent::__construct(); + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\PBEmpty::initOnce(); + parent::__construct($data); } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/NoRpcServiceClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/EmptyServiceClient.php similarity index 85% rename from src/php/tests/qps/generated_code/Grpc/Testing/NoRpcServiceClient.php rename to src/php/tests/qps/generated_code/Grpc/Testing/EmptyServiceClient.php index 1d58eaf88ac..c28dd47271b 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/NoRpcServiceClient.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/EmptyServiceClient.php @@ -2,7 +2,7 @@ // GENERATED CODE -- DO NOT EDIT! // Original file comments: -// Copyright 2015 gRPC authors. +// Copyright 2018 gRPC authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -19,9 +19,10 @@ namespace Grpc\Testing; /** - * A service without any rpc defined to test coverage. + * A service that has zero methods. + * See https://github.com/grpc/grpc/issues/15574 */ -class NoRpcServiceClient extends \Grpc\BaseStub { +class EmptyServiceClient extends \Grpc\BaseStub { /** * @param string $hostname hostname diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ErrorStatus.php b/src/php/tests/qps/generated_code/Grpc/Testing/ErrorStatus.php index cc378756c75..a9d12bcb872 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ErrorStatus.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ErrorStatus.php @@ -18,19 +18,30 @@ class ErrorStatus extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field int32 code = 1; */ - private $code = 0; + protected $code = 0; /** * Generated from protobuf field string error_message = 2; */ - private $error_message = ''; + protected $error_message = ''; /** * Generated from protobuf field string binary_error_details = 3; */ - private $binary_error_details = ''; + protected $binary_error_details = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $code + * @type string $error_message + * @type string $binary_error_details + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\EchoMessages::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/GaugeRequest.php b/src/php/tests/qps/generated_code/Grpc/Testing/GaugeRequest.php deleted file mode 100644 index 3c283693c9c..00000000000 --- a/src/php/tests/qps/generated_code/Grpc/Testing/GaugeRequest.php +++ /dev/null @@ -1,51 +0,0 @@ -grpc.testing.GaugeRequest - */ -class GaugeRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Generated from protobuf field string name = 1; - */ - private $name = ''; - - public function __construct() { - \GPBMetadata\Src\Proto\Grpc\Testing\Metrics::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; - } - -} - diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/GaugeResponse.php b/src/php/tests/qps/generated_code/Grpc/Testing/GaugeResponse.php deleted file mode 100644 index 3969a708a06..00000000000 --- a/src/php/tests/qps/generated_code/Grpc/Testing/GaugeResponse.php +++ /dev/null @@ -1,126 +0,0 @@ -grpc.testing.GaugeResponse - */ -class GaugeResponse extends \Google\Protobuf\Internal\Message -{ - /** - * Generated from protobuf field string name = 1; - */ - private $name = ''; - protected $value; - - public function __construct() { - \GPBMetadata\Src\Proto\Grpc\Testing\Metrics::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 int64 long_value = 2; - * @return int|string - */ - public function getLongValue() - { - return $this->readOneof(2); - } - - /** - * Generated from protobuf field int64 long_value = 2; - * @param int|string $var - * @return $this - */ - public function setLongValue($var) - { - GPBUtil::checkInt64($var); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * Generated from protobuf field double double_value = 3; - * @return float - */ - public function getDoubleValue() - { - return $this->readOneof(3); - } - - /** - * Generated from protobuf field double double_value = 3; - * @param float $var - * @return $this - */ - public function setDoubleValue($var) - { - GPBUtil::checkDouble($var); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * Generated from protobuf field string string_value = 4; - * @return string - */ - public function getStringValue() - { - return $this->readOneof(4); - } - - /** - * Generated from protobuf field string string_value = 4; - * @param string $var - * @return $this - */ - public function setStringValue($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(4, $var); - - return $this; - } - - /** - * @return string - */ - public function getValue() - { - return $this->whichOneof("value"); - } - -} - diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/GrpclbRouteType.php b/src/php/tests/qps/generated_code/Grpc/Testing/GrpclbRouteType.php new file mode 100644 index 00000000000..f8bff1cb695 --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/GrpclbRouteType.php @@ -0,0 +1,66 @@ +grpc.testing.GrpclbRouteType + */ +class GrpclbRouteType +{ + /** + * Server didn't detect the route that a client took to reach it. + * + * Generated from protobuf enum GRPCLB_ROUTE_TYPE_UNKNOWN = 0; + */ + const GRPCLB_ROUTE_TYPE_UNKNOWN = 0; + /** + * Indicates that a client reached a server via gRPCLB fallback. + * + * Generated from protobuf enum GRPCLB_ROUTE_TYPE_FALLBACK = 1; + */ + const GRPCLB_ROUTE_TYPE_FALLBACK = 1; + /** + * Indicates that a client reached a server as a gRPCLB-given backend. + * + * Generated from protobuf enum GRPCLB_ROUTE_TYPE_BACKEND = 2; + */ + const GRPCLB_ROUTE_TYPE_BACKEND = 2; + + private static $valueToName = [ + self::GRPCLB_ROUTE_TYPE_UNKNOWN => 'GRPCLB_ROUTE_TYPE_UNKNOWN', + self::GRPCLB_ROUTE_TYPE_FALLBACK => 'GRPCLB_ROUTE_TYPE_FALLBACK', + self::GRPCLB_ROUTE_TYPE_BACKEND => 'GRPCLB_ROUTE_TYPE_BACKEND', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + 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 136eac75e28..705bc832c23 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/HistogramData.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/HistogramData.php @@ -22,27 +22,41 @@ class HistogramData extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field double min_seen = 2; */ - private $min_seen = 0.0; + protected $min_seen = 0.0; /** * Generated from protobuf field double max_seen = 3; */ - private $max_seen = 0.0; + protected $max_seen = 0.0; /** * Generated from protobuf field double sum = 4; */ - private $sum = 0.0; + protected $sum = 0.0; /** * Generated from protobuf field double sum_of_squares = 5; */ - private $sum_of_squares = 0.0; + protected $sum_of_squares = 0.0; /** * Generated from protobuf field double count = 6; */ - private $count = 0.0; + protected $count = 0.0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int[]|\Google\Protobuf\Internal\RepeatedField $bucket + * @type float $min_seen + * @type float $max_seen + * @type float $sum + * @type float $sum_of_squares + * @type float $count + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Stats::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 1a1b484f144..126b0b928a2 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/HistogramParams.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/HistogramParams.php @@ -20,17 +20,29 @@ class HistogramParams extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double resolution = 1; */ - private $resolution = 0.0; + protected $resolution = 0.0; /** * use enough buckets to allow this value * * Generated from protobuf field double max_possible = 2; */ - private $max_possible = 0.0; + protected $max_possible = 0.0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $resolution + * first bucket is [0, 1 + resolution) + * @type float $max_possible + * use enough buckets to allow this value + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Stats::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/LoadBalancerStatsRequest.php b/src/php/tests/qps/generated_code/Grpc/Testing/LoadBalancerStatsRequest.php new file mode 100644 index 00000000000..02a15306688 --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/LoadBalancerStatsRequest.php @@ -0,0 +1,99 @@ +grpc.testing.LoadBalancerStatsRequest + */ +class LoadBalancerStatsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Request stats for the next num_rpcs sent by client. + * + * Generated from protobuf field int32 num_rpcs = 1; + */ + protected $num_rpcs = 0; + /** + * If num_rpcs have not completed within timeout_sec, return partial results. + * + * Generated from protobuf field int32 timeout_sec = 2; + */ + protected $timeout_sec = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $num_rpcs + * Request stats for the next num_rpcs sent by client. + * @type int $timeout_sec + * If num_rpcs have not completed within timeout_sec, return partial results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * Request stats for the next num_rpcs sent by client. + * + * Generated from protobuf field int32 num_rpcs = 1; + * @return int + */ + public function getNumRpcs() + { + return $this->num_rpcs; + } + + /** + * Request stats for the next num_rpcs sent by client. + * + * Generated from protobuf field int32 num_rpcs = 1; + * @param int $var + * @return $this + */ + public function setNumRpcs($var) + { + GPBUtil::checkInt32($var); + $this->num_rpcs = $var; + + return $this; + } + + /** + * If num_rpcs have not completed within timeout_sec, return partial results. + * + * Generated from protobuf field int32 timeout_sec = 2; + * @return int + */ + public function getTimeoutSec() + { + return $this->timeout_sec; + } + + /** + * If num_rpcs have not completed within timeout_sec, return partial results. + * + * Generated from protobuf field int32 timeout_sec = 2; + * @param int $var + * @return $this + */ + public function setTimeoutSec($var) + { + GPBUtil::checkInt32($var); + $this->timeout_sec = $var; + + return $this; + } + +} + diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/LoadBalancerStatsResponse.php b/src/php/tests/qps/generated_code/Grpc/Testing/LoadBalancerStatsResponse.php new file mode 100644 index 00000000000..270189e1871 --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/LoadBalancerStatsResponse.php @@ -0,0 +1,99 @@ +grpc.testing.LoadBalancerStatsResponse + */ +class LoadBalancerStatsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The number of completed RPCs for each peer. + * + * Generated from protobuf field map rpcs_by_peer = 1; + */ + private $rpcs_by_peer; + /** + * The number of RPCs that failed to record a remote peer. + * + * Generated from protobuf field int32 num_failures = 2; + */ + protected $num_failures = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\MapField $rpcs_by_peer + * The number of completed RPCs for each peer. + * @type int $num_failures + * The number of RPCs that failed to record a remote peer. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); + parent::__construct($data); + } + + /** + * The number of completed RPCs for each peer. + * + * Generated from protobuf field map rpcs_by_peer = 1; + * @return \Google\Protobuf\Internal\MapField + */ + public function getRpcsByPeer() + { + return $this->rpcs_by_peer; + } + + /** + * The number of completed RPCs for each peer. + * + * Generated from protobuf field map rpcs_by_peer = 1; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setRpcsByPeer($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT32); + $this->rpcs_by_peer = $arr; + + return $this; + } + + /** + * The number of RPCs that failed to record a remote peer. + * + * Generated from protobuf field int32 num_failures = 2; + * @return int + */ + public function getNumFailures() + { + return $this->num_failures; + } + + /** + * The number of RPCs that failed to record a remote peer. + * + * Generated from protobuf field int32 num_failures = 2; + * @param int $var + * @return $this + */ + public function setNumFailures($var) + { + GPBUtil::checkInt32($var); + $this->num_failures = $var; + + return $this; + } + +} + diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/LoadBalancerStatsServiceClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/LoadBalancerStatsServiceClient.php new file mode 100644 index 00000000000..129776d8a30 --- /dev/null +++ b/src/php/tests/qps/generated_code/Grpc/Testing/LoadBalancerStatsServiceClient.php @@ -0,0 +1,52 @@ +_simpleRequest('/grpc.testing.LoadBalancerStatsService/GetClientStats', + $argument, + ['\Grpc\Testing\LoadBalancerStatsResponse', 'decode'], + $metadata, $options); + } + +} 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 04c345f2421..0df1401a10b 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/LoadParams.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/LoadParams.php @@ -15,9 +15,19 @@ class LoadParams extends \Google\Protobuf\Internal\Message { protected $load; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grpc\Testing\ClosedLoopParams $closed_loop + * @type \Grpc\Testing\PoissonParams $poisson + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 be058d51be8..ad97eb92f5a 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/Mark.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/Mark.php @@ -20,11 +20,21 @@ class Mark extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool reset = 1; */ - private $reset = false; + protected $reset = false; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $reset + * if true, the stats will be reset after taking their snapshot. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/PBVoid.php b/src/php/tests/qps/generated_code/Grpc/Testing/PBVoid.php index 94cb6c1ecfe..2215f8901f6 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/PBVoid.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/PBVoid.php @@ -14,9 +14,17 @@ use Google\Protobuf\Internal\GPBUtil; class PBVoid extends \Google\Protobuf\Internal\Message { - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); - parent::__construct(); + parent::__construct($data); } } 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 ad97890c93f..65a007e119e 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/Payload.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/Payload.php @@ -16,26 +16,36 @@ use Google\Protobuf\Internal\GPBUtil; class Payload extends \Google\Protobuf\Internal\Message { /** - * DEPRECATED, don't use. To be removed shortly. * The type of data in body. * * Generated from protobuf field .grpc.testing.PayloadType type = 1; */ - private $type = 0; + protected $type = 0; /** * Primary contents of payload. * * Generated from protobuf field bytes body = 2; */ - private $body = ''; + protected $body = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * The type of data in body. + * @type string $body + * Primary contents of payload. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); - parent::__construct(); + parent::__construct($data); } /** - * DEPRECATED, don't use. To be removed shortly. * The type of data in body. * * Generated from protobuf field .grpc.testing.PayloadType type = 1; @@ -47,7 +57,6 @@ class Payload extends \Google\Protobuf\Internal\Message } /** - * DEPRECATED, don't use. To be removed shortly. * The type of data in body. * * Generated from protobuf field .grpc.testing.PayloadType type = 1; 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 748f52da82d..495d2e13f68 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/PayloadConfig.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/PayloadConfig.php @@ -15,9 +15,20 @@ class PayloadConfig extends \Google\Protobuf\Internal\Message { protected $payload; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grpc\Testing\ByteBufferParams $bytebuf_params + * @type \Grpc\Testing\SimpleProtoParams $simple_params + * @type \Grpc\Testing\ComplexProtoParams $complex_params + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Payloads::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 d8df1af7982..dc246b37891 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/PayloadType.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/PayloadType.php @@ -4,11 +4,12 @@ namespace Grpc\Testing; +use UnexpectedValueException; + /** - * DEPRECATED, don't use. To be removed shortly. * The type of payload that should be returned. * - * Protobuf enum Grpc\Testing\PayloadType + * Protobuf type grpc.testing.PayloadType */ class PayloadType { @@ -18,5 +19,29 @@ class PayloadType * Generated from protobuf enum COMPRESSABLE = 0; */ const COMPRESSABLE = 0; + + private static $valueToName = [ + self::COMPRESSABLE => 'COMPRESSABLE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } } 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 6a4047f2ece..34a0a66fd70 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/PoissonParams.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/PoissonParams.php @@ -21,11 +21,21 @@ class PoissonParams extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double offered_load = 1; */ - private $offered_load = 0.0; + protected $offered_load = 0.0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $offered_load + * The rate of arrivals (a.k.a. lambda parameter of the exp distribution). + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 6fab6115342..f9525162445 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ProxyStat.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ProxyStat.php @@ -16,11 +16,20 @@ class ProxyStat extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field double latency = 1; */ - private $latency = 0.0; + protected $latency = 0.0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $latency + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\ProxyService::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 cd728705fa4..58ac838a859 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ReconnectInfo.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ReconnectInfo.php @@ -20,15 +20,25 @@ class ReconnectInfo extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field bool passed = 1; */ - private $passed = false; + protected $passed = false; /** * Generated from protobuf field repeated int32 backoff_ms = 2; */ private $backoff_ms; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $passed + * @type int[]|\Google\Protobuf\Internal\RepeatedField $backoff_ms + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 f91dc410cb5..599b13db1d6 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ReconnectParams.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ReconnectParams.php @@ -19,11 +19,20 @@ class ReconnectParams extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field int32 max_reconnect_backoff_ms = 1; */ - private $max_reconnect_backoff_ms = 0; + protected $max_reconnect_backoff_ms = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $max_reconnect_backoff_ms + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ReconnectServiceClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/ReconnectServiceClient.php index a1802e97cdb..50beca20e00 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ReconnectServiceClient.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ReconnectServiceClient.php @@ -44,16 +44,16 @@ class ReconnectServiceClient extends \Grpc\BaseStub { $metadata = [], $options = []) { return $this->_simpleRequest('/grpc.testing.ReconnectService/Start', $argument, - ['\Grpc\Testing\PBEmpty', 'decode'], + ['\Grpc\Testing\EmptyMessage', 'decode'], $metadata, $options); } /** - * @param \Grpc\Testing\PBEmpty $argument input argument + * @param \Grpc\Testing\EmptyMessage $argument input argument * @param array $metadata metadata * @param array $options call options */ - public function Stop(\Grpc\Testing\PBEmpty $argument, + public function Stop(\Grpc\Testing\EmptyMessage $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/grpc.testing.ReconnectService/Stop', $argument, diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/Request.php b/src/php/tests/qps/generated_code/Grpc/Testing/Request.php index 6a20f6a897e..d425141096a 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/Request.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/Request.php @@ -14,9 +14,17 @@ use Google\Protobuf\Internal\GPBUtil; class Request extends \Google\Protobuf\Internal\Message { - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\CompilerTest::initOnce(); - parent::__construct(); + parent::__construct($data); } } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/RequestParams.php b/src/php/tests/qps/generated_code/Grpc/Testing/RequestParams.php index f01f50d5afa..d321a8098ca 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/RequestParams.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/RequestParams.php @@ -16,73 +16,117 @@ class RequestParams extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field bool echo_deadline = 1; */ - private $echo_deadline = false; + protected $echo_deadline = false; /** * Generated from protobuf field int32 client_cancel_after_us = 2; */ - private $client_cancel_after_us = 0; + protected $client_cancel_after_us = 0; /** * Generated from protobuf field int32 server_cancel_after_us = 3; */ - private $server_cancel_after_us = 0; + protected $server_cancel_after_us = 0; /** * Generated from protobuf field bool echo_metadata = 4; */ - private $echo_metadata = false; + protected $echo_metadata = false; /** * Generated from protobuf field bool check_auth_context = 5; */ - private $check_auth_context = false; + protected $check_auth_context = false; /** * Generated from protobuf field int32 response_message_length = 6; */ - private $response_message_length = 0; + protected $response_message_length = 0; /** * Generated from protobuf field bool echo_peer = 7; */ - private $echo_peer = false; + protected $echo_peer = false; /** * will force check_auth_context. * * Generated from protobuf field string expected_client_identity = 8; */ - private $expected_client_identity = ''; + protected $expected_client_identity = ''; /** * Generated from protobuf field bool skip_cancelled_check = 9; */ - private $skip_cancelled_check = false; + protected $skip_cancelled_check = false; /** * Generated from protobuf field string expected_transport_security_type = 10; */ - private $expected_transport_security_type = ''; + protected $expected_transport_security_type = ''; /** * Generated from protobuf field .grpc.testing.DebugInfo debug_info = 11; */ - private $debug_info = null; + protected $debug_info = null; /** * Server should not see a request with this set. * * Generated from protobuf field bool server_die = 12; */ - private $server_die = false; + protected $server_die = false; /** * Generated from protobuf field string binary_error_details = 13; */ - private $binary_error_details = ''; + protected $binary_error_details = ''; /** * Generated from protobuf field .grpc.testing.ErrorStatus expected_error = 14; */ - private $expected_error = null; + protected $expected_error = null; /** - * Amount to sleep when invoking server + * sleep when invoking server for deadline tests * * Generated from protobuf field int32 server_sleep_us = 15; */ - private $server_sleep_us = 0; + protected $server_sleep_us = 0; + /** + * which backend to send request to + * + * Generated from protobuf field int32 backend_channel_idx = 16; + */ + protected $backend_channel_idx = 0; + /** + * Generated from protobuf field bool echo_metadata_initially = 17; + */ + protected $echo_metadata_initially = false; + /** + * Generated from protobuf field bool server_notify_client_when_started = 18; + */ + protected $server_notify_client_when_started = false; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $echo_deadline + * @type int $client_cancel_after_us + * @type int $server_cancel_after_us + * @type bool $echo_metadata + * @type bool $check_auth_context + * @type int $response_message_length + * @type bool $echo_peer + * @type string $expected_client_identity + * will force check_auth_context. + * @type bool $skip_cancelled_check + * @type string $expected_transport_security_type + * @type \Grpc\Testing\DebugInfo $debug_info + * @type bool $server_die + * Server should not see a request with this set. + * @type string $binary_error_details + * @type \Grpc\Testing\ErrorStatus $expected_error + * @type int $server_sleep_us + * sleep when invoking server for deadline tests + * @type int $backend_channel_idx + * which backend to send request to + * @type bool $echo_metadata_initially + * @type bool $server_notify_client_when_started + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\EchoMessages::initOnce(); - parent::__construct(); + parent::__construct($data); } /** @@ -402,7 +446,7 @@ class RequestParams extends \Google\Protobuf\Internal\Message } /** - * Amount to sleep when invoking server + * sleep when invoking server for deadline tests * * Generated from protobuf field int32 server_sleep_us = 15; * @return int @@ -413,7 +457,7 @@ class RequestParams extends \Google\Protobuf\Internal\Message } /** - * Amount to sleep when invoking server + * sleep when invoking server for deadline tests * * Generated from protobuf field int32 server_sleep_us = 15; * @param int $var @@ -427,5 +471,75 @@ class RequestParams extends \Google\Protobuf\Internal\Message return $this; } + /** + * which backend to send request to + * + * Generated from protobuf field int32 backend_channel_idx = 16; + * @return int + */ + public function getBackendChannelIdx() + { + return $this->backend_channel_idx; + } + + /** + * which backend to send request to + * + * Generated from protobuf field int32 backend_channel_idx = 16; + * @param int $var + * @return $this + */ + public function setBackendChannelIdx($var) + { + GPBUtil::checkInt32($var); + $this->backend_channel_idx = $var; + + return $this; + } + + /** + * Generated from protobuf field bool echo_metadata_initially = 17; + * @return bool + */ + public function getEchoMetadataInitially() + { + return $this->echo_metadata_initially; + } + + /** + * Generated from protobuf field bool echo_metadata_initially = 17; + * @param bool $var + * @return $this + */ + public function setEchoMetadataInitially($var) + { + GPBUtil::checkBool($var); + $this->echo_metadata_initially = $var; + + return $this; + } + + /** + * Generated from protobuf field bool server_notify_client_when_started = 18; + * @return bool + */ + public function getServerNotifyClientWhenStarted() + { + return $this->server_notify_client_when_started; + } + + /** + * Generated from protobuf field bool server_notify_client_when_started = 18; + * @param bool $var + * @return $this + */ + public function setServerNotifyClientWhenStarted($var) + { + GPBUtil::checkBool($var); + $this->server_notify_client_when_started = $var; + + return $this; + } + } 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 75fa6cafe28..5bbe79f49f3 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/RequestResultCount.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/RequestResultCount.php @@ -16,15 +16,25 @@ class RequestResultCount extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field int32 status_code = 1; */ - private $status_code = 0; + protected $status_code = 0; /** * Generated from protobuf field int64 count = 2; */ - private $count = 0; + protected $count = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $status_code + * @type int|string $count + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Stats::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/Response.php b/src/php/tests/qps/generated_code/Grpc/Testing/Response.php index 7925a7db3df..84e93b8a9c4 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/Response.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/Response.php @@ -14,9 +14,17 @@ use Google\Protobuf\Internal\GPBUtil; class Response extends \Google\Protobuf\Internal\Message { - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\CompilerTest::initOnce(); - parent::__construct(); + parent::__construct($data); } } 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 b2f0a827fe0..470349325c4 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ResponseParameters.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ResponseParameters.php @@ -20,14 +20,14 @@ class ResponseParameters extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 size = 1; */ - private $size = 0; + protected $size = 0; /** * Desired interval between consecutive responses in the response stream in * microseconds. * * Generated from protobuf field int32 interval_us = 2; */ - private $interval_us = 0; + protected $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 @@ -36,11 +36,29 @@ class ResponseParameters extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .grpc.testing.BoolValue compressed = 3; */ - private $compressed = null; + protected $compressed = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $size + * Desired payload sizes in responses from the server. + * @type int $interval_us + * Desired interval between consecutive responses in the response stream in + * microseconds. + * @type \Grpc\Testing\BoolValue $compressed + * 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. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/ResponseParams.php b/src/php/tests/qps/generated_code/Grpc/Testing/ResponseParams.php index d20f92289a3..18e99b0534b 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ResponseParams.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ResponseParams.php @@ -16,19 +16,30 @@ class ResponseParams extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field int64 request_deadline = 1; */ - private $request_deadline = 0; + protected $request_deadline = 0; /** * Generated from protobuf field string host = 2; */ - private $host = ''; + protected $host = ''; /** * Generated from protobuf field string peer = 3; */ - private $peer = ''; + protected $peer = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $request_deadline + * @type string $host + * @type string $peer + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\EchoMessages::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 73a66490ea9..559d12b23f3 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/RpcType.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/RpcType.php @@ -4,8 +4,10 @@ namespace Grpc\Testing; +use UnexpectedValueException; + /** - * Protobuf enum Grpc\Testing\RpcType + * Protobuf type grpc.testing.RpcType */ class RpcType { @@ -29,5 +31,33 @@ class RpcType * Generated from protobuf enum STREAMING_BOTH_WAYS = 4; */ const STREAMING_BOTH_WAYS = 4; + + private static $valueToName = [ + self::UNARY => 'UNARY', + self::STREAMING => 'STREAMING', + self::STREAMING_FROM_CLIENT => 'STREAMING_FROM_CLIENT', + self::STREAMING_FROM_SERVER => 'STREAMING_FROM_SERVER', + self::STREAMING_BOTH_WAYS => 'STREAMING_BOTH_WAYS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } } 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 9ec284b71f2..8c1f3fb865b 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/Scenario.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/Scenario.php @@ -20,53 +20,77 @@ class Scenario extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string name = 1; */ - private $name = ''; + protected $name = ''; /** * Client configuration * * Generated from protobuf field .grpc.testing.ClientConfig client_config = 2; */ - private $client_config = null; + protected $client_config = null; /** * Number of clients to start for the test * * Generated from protobuf field int32 num_clients = 3; */ - private $num_clients = 0; + protected $num_clients = 0; /** * Server configuration * * Generated from protobuf field .grpc.testing.ServerConfig server_config = 4; */ - private $server_config = null; + protected $server_config = null; /** * Number of servers to start for the test * * Generated from protobuf field int32 num_servers = 5; */ - private $num_servers = 0; + protected $num_servers = 0; /** * Warmup period, in seconds * * Generated from protobuf field int32 warmup_seconds = 6; */ - private $warmup_seconds = 0; + protected $warmup_seconds = 0; /** * Benchmark time, in seconds * * Generated from protobuf field int32 benchmark_seconds = 7; */ - private $benchmark_seconds = 0; + protected $benchmark_seconds = 0; /** * Number of workers to spawn locally (usually zero) * * Generated from protobuf field int32 spawn_local_worker_count = 8; */ - private $spawn_local_worker_count = 0; + protected $spawn_local_worker_count = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Human readable name for this scenario + * @type \Grpc\Testing\ClientConfig $client_config + * Client configuration + * @type int $num_clients + * Number of clients to start for the test + * @type \Grpc\Testing\ServerConfig $server_config + * Server configuration + * @type int $num_servers + * Number of servers to start for the test + * @type int $warmup_seconds + * Warmup period, in seconds + * @type int $benchmark_seconds + * Benchmark time, in seconds + * @type int $spawn_local_worker_count + * Number of workers to spawn locally (usually zero) + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 31d9a39a1fc..a15b787fca6 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ScenarioResult.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ScenarioResult.php @@ -20,13 +20,13 @@ class ScenarioResult extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .grpc.testing.Scenario scenario = 1; */ - private $scenario = null; + protected $scenario = null; /** * Histograms from all clients merged into one histogram. * * Generated from protobuf field .grpc.testing.HistogramData latencies = 2; */ - private $latencies = null; + protected $latencies = null; /** * Client stats for each client * @@ -50,7 +50,7 @@ class ScenarioResult extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .grpc.testing.ScenarioResultSummary summary = 6; */ - private $summary = null; + protected $summary = null; /** * Information on success or failure of each worker * @@ -68,9 +68,34 @@ class ScenarioResult extends \Google\Protobuf\Internal\Message */ private $request_results; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grpc\Testing\Scenario $scenario + * Inputs used to run the scenario. + * @type \Grpc\Testing\HistogramData $latencies + * Histograms from all clients merged into one histogram. + * @type \Grpc\Testing\ClientStats[]|\Google\Protobuf\Internal\RepeatedField $client_stats + * Client stats for each client + * @type \Grpc\Testing\ServerStats[]|\Google\Protobuf\Internal\RepeatedField $server_stats + * Server stats for each server + * @type int[]|\Google\Protobuf\Internal\RepeatedField $server_cores + * Number of cores available to each server + * @type \Grpc\Testing\ScenarioResultSummary $summary + * An after-the-fact computed summary + * @type bool[]|\Google\Protobuf\Internal\RepeatedField $client_success + * Information on success or failure of each worker + * @type bool[]|\Google\Protobuf\Internal\RepeatedField $server_success + * @type \Grpc\Testing\RequestResultCount[]|\Google\Protobuf\Internal\RepeatedField $request_results + * Number of failed requests (one row per status code seen) + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 f7f1c987b53..2724e9cb372 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ScenarioResultSummary.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ScenarioResultSummary.php @@ -17,107 +17,156 @@ use Google\Protobuf\Internal\GPBUtil; class ScenarioResultSummary extends \Google\Protobuf\Internal\Message { /** - * Total number of operations per second over all clients. + * Total number of operations per second over all clients. What is counted as 1 'operation' depends on the benchmark scenarios: + * For unary benchmarks, an operation is processing of a single unary RPC. + * For streaming benchmarks, an operation is processing of a single ping pong of request and response. * * Generated from protobuf field double qps = 1; */ - private $qps = 0.0; + protected $qps = 0.0; /** - * QPS per one server core. + * QPS per server core. * * Generated from protobuf field double qps_per_server_core = 2; */ - private $qps_per_server_core = 0.0; + protected $qps_per_server_core = 0.0; /** - * server load based on system_time (0.85 => 85%) + * The total server cpu load based on system time across all server processes, expressed as percentage of a single cpu core. + * For example, 85 implies 85% of a cpu core, 125 implies 125% of a cpu core. Since we are accumulating the cpu load across all the server + * processes, the value could > 100 when there are multiple servers or a single server using multiple threads and cores. + * Same explanation for the total client cpu load below. * * Generated from protobuf field double server_system_time = 3; */ - private $server_system_time = 0.0; + protected $server_system_time = 0.0; /** - * server load based on user_time (0.85 => 85%) + * The total server cpu load based on user time across all server processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%) * * Generated from protobuf field double server_user_time = 4; */ - private $server_user_time = 0.0; + protected $server_user_time = 0.0; /** - * client load based on system_time (0.85 => 85%) + * The total client cpu load based on system time across all client processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%) * * Generated from protobuf field double client_system_time = 5; */ - private $client_system_time = 0.0; + protected $client_system_time = 0.0; /** - * client load based on user_time (0.85 => 85%) + * The total client cpu load based on user time across all client processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%) * * Generated from protobuf field double client_user_time = 6; */ - private $client_user_time = 0.0; + protected $client_user_time = 0.0; /** * X% latency percentiles (in nanoseconds) * * Generated from protobuf field double latency_50 = 7; */ - private $latency_50 = 0.0; + protected $latency_50 = 0.0; /** * Generated from protobuf field double latency_90 = 8; */ - private $latency_90 = 0.0; + protected $latency_90 = 0.0; /** * Generated from protobuf field double latency_95 = 9; */ - private $latency_95 = 0.0; + protected $latency_95 = 0.0; /** * Generated from protobuf field double latency_99 = 10; */ - private $latency_99 = 0.0; + protected $latency_99 = 0.0; /** * Generated from protobuf field double latency_999 = 11; */ - private $latency_999 = 0.0; + protected $latency_999 = 0.0; /** * server cpu usage percentage * * Generated from protobuf field double server_cpu_usage = 12; */ - private $server_cpu_usage = 0.0; + protected $server_cpu_usage = 0.0; /** * Number of requests that succeeded/failed * * Generated from protobuf field double successful_requests_per_second = 13; */ - private $successful_requests_per_second = 0.0; + protected $successful_requests_per_second = 0.0; /** * Generated from protobuf field double failed_requests_per_second = 14; */ - private $failed_requests_per_second = 0.0; + protected $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; + protected $client_polls_per_request = 0.0; /** * Generated from protobuf field double server_polls_per_request = 16; */ - private $server_polls_per_request = 0.0; + protected $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; + protected $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() { + protected $client_queries_per_cpu_sec = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $qps + * Total number of operations per second over all clients. What is counted as 1 'operation' depends on the benchmark scenarios: + * For unary benchmarks, an operation is processing of a single unary RPC. + * For streaming benchmarks, an operation is processing of a single ping pong of request and response. + * @type float $qps_per_server_core + * QPS per server core. + * @type float $server_system_time + * The total server cpu load based on system time across all server processes, expressed as percentage of a single cpu core. + * For example, 85 implies 85% of a cpu core, 125 implies 125% of a cpu core. Since we are accumulating the cpu load across all the server + * processes, the value could > 100 when there are multiple servers or a single server using multiple threads and cores. + * Same explanation for the total client cpu load below. + * @type float $server_user_time + * The total server cpu load based on user time across all server processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%) + * @type float $client_system_time + * The total client cpu load based on system time across all client processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%) + * @type float $client_user_time + * The total client cpu load based on user time across all client processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%) + * @type float $latency_50 + * X% latency percentiles (in nanoseconds) + * @type float $latency_90 + * @type float $latency_95 + * @type float $latency_99 + * @type float $latency_999 + * @type float $server_cpu_usage + * server cpu usage percentage + * @type float $successful_requests_per_second + * Number of requests that succeeded/failed + * @type float $failed_requests_per_second + * @type float $client_polls_per_request + * Number of polls called inside completion queue per request + * @type float $server_polls_per_request + * @type float $server_queries_per_cpu_sec + * Queries per CPU-sec over all servers or clients + * @type float $client_queries_per_cpu_sec + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); - parent::__construct(); + parent::__construct($data); } /** - * Total number of operations per second over all clients. + * Total number of operations per second over all clients. What is counted as 1 'operation' depends on the benchmark scenarios: + * For unary benchmarks, an operation is processing of a single unary RPC. + * For streaming benchmarks, an operation is processing of a single ping pong of request and response. * * Generated from protobuf field double qps = 1; * @return float @@ -128,7 +177,9 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - * Total number of operations per second over all clients. + * Total number of operations per second over all clients. What is counted as 1 'operation' depends on the benchmark scenarios: + * For unary benchmarks, an operation is processing of a single unary RPC. + * For streaming benchmarks, an operation is processing of a single ping pong of request and response. * * Generated from protobuf field double qps = 1; * @param float $var @@ -143,7 +194,7 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - * QPS per one server core. + * QPS per server core. * * Generated from protobuf field double qps_per_server_core = 2; * @return float @@ -154,7 +205,7 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - * QPS per one server core. + * QPS per server core. * * Generated from protobuf field double qps_per_server_core = 2; * @param float $var @@ -169,7 +220,10 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - * server load based on system_time (0.85 => 85%) + * The total server cpu load based on system time across all server processes, expressed as percentage of a single cpu core. + * For example, 85 implies 85% of a cpu core, 125 implies 125% of a cpu core. Since we are accumulating the cpu load across all the server + * processes, the value could > 100 when there are multiple servers or a single server using multiple threads and cores. + * Same explanation for the total client cpu load below. * * Generated from protobuf field double server_system_time = 3; * @return float @@ -180,7 +234,10 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - * server load based on system_time (0.85 => 85%) + * The total server cpu load based on system time across all server processes, expressed as percentage of a single cpu core. + * For example, 85 implies 85% of a cpu core, 125 implies 125% of a cpu core. Since we are accumulating the cpu load across all the server + * processes, the value could > 100 when there are multiple servers or a single server using multiple threads and cores. + * Same explanation for the total client cpu load below. * * Generated from protobuf field double server_system_time = 3; * @param float $var @@ -195,7 +252,7 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - * server load based on user_time (0.85 => 85%) + * The total server cpu load based on user time across all server processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%) * * Generated from protobuf field double server_user_time = 4; * @return float @@ -206,7 +263,7 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - * server load based on user_time (0.85 => 85%) + * The total server cpu load based on user time across all server processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%) * * Generated from protobuf field double server_user_time = 4; * @param float $var @@ -221,7 +278,7 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - * client load based on system_time (0.85 => 85%) + * The total client cpu load based on system time across all client processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%) * * Generated from protobuf field double client_system_time = 5; * @return float @@ -232,7 +289,7 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - * client load based on system_time (0.85 => 85%) + * The total client cpu load based on system time across all client processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%) * * Generated from protobuf field double client_system_time = 5; * @param float $var @@ -247,7 +304,7 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - * client load based on user_time (0.85 => 85%) + * The total client cpu load based on user time across all client processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%) * * Generated from protobuf field double client_user_time = 6; * @return float @@ -258,7 +315,7 @@ class ScenarioResultSummary extends \Google\Protobuf\Internal\Message } /** - * client load based on user_time (0.85 => 85%) + * The total client cpu load based on user time across all client processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%) * * Generated from protobuf field double client_user_time = 6; * @param float $var 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 2146b4776e2..8712524784f 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/Scenarios.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/Scenarios.php @@ -20,9 +20,18 @@ class Scenarios extends \Google\Protobuf\Internal\Message */ private $scenarios; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grpc\Testing\Scenario[]|\Google\Protobuf\Internal\RepeatedField $scenarios + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 8ce623a4bc1..d54e56b0842 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/SecurityParams.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/SecurityParams.php @@ -18,19 +18,30 @@ class SecurityParams extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field bool use_test_ca = 1; */ - private $use_test_ca = false; + protected $use_test_ca = false; /** * Generated from protobuf field string server_host_override = 2; */ - private $server_host_override = ''; + protected $server_host_override = ''; /** * Generated from protobuf field string cred_type = 3; */ - private $cred_type = ''; + protected $cred_type = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $use_test_ca + * @type string $server_host_override + * @type string $cred_type + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 acf7e18b6da..a6783ed5303 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ServerArgs.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ServerArgs.php @@ -15,9 +15,19 @@ class ServerArgs extends \Google\Protobuf\Internal\Message { protected $argtype; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grpc\Testing\ServerConfig $setup + * @type \Grpc\Testing\Mark $mark + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 8bd4c69566b..f44fa3180f9 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ServerConfig.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ServerConfig.php @@ -16,29 +16,29 @@ class ServerConfig extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field .grpc.testing.ServerType server_type = 1; */ - private $server_type = 0; + protected $server_type = 0; /** * Generated from protobuf field .grpc.testing.SecurityParams security_params = 2; */ - private $security_params = null; + protected $security_params = null; /** * Port on which to listen. Zero means pick unused port. * * Generated from protobuf field int32 port = 4; */ - private $port = 0; + protected $port = 0; /** * Only for async server. Number of threads used to serve the requests. * * Generated from protobuf field int32 async_server_threads = 7; */ - private $async_server_threads = 0; + protected $async_server_threads = 0; /** * Specify the number of cores to limit server to, if desired * * Generated from protobuf field int32 core_limit = 8; */ - private $core_limit = 0; + protected $core_limit = 0; /** * payload config, used in generic server. * Note this must NOT be used in proto (non-generic) servers. For proto servers, @@ -47,7 +47,7 @@ class ServerConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .grpc.testing.PayloadConfig payload_config = 9; */ - private $payload_config = null; + protected $payload_config = null; /** * Specify the cores we should run the server on, if desired * @@ -59,27 +59,65 @@ class ServerConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string other_server_api = 11; */ - private $other_server_api = ''; + protected $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; + protected $threads_per_cq = 0; /** * Buffer pool size (no buffer pool specified if unset) * * Generated from protobuf field int32 resource_quota_size = 1001; */ - private $resource_quota_size = 0; + protected $resource_quota_size = 0; /** * Generated from protobuf field repeated .grpc.testing.ChannelArg channel_args = 1002; */ private $channel_args; + /** + * Number of server processes. 0 indicates no restriction. + * + * Generated from protobuf field int32 server_processes = 21; + */ + protected $server_processes = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $server_type + * @type \Grpc\Testing\SecurityParams $security_params + * @type int $port + * Port on which to listen. Zero means pick unused port. + * @type int $async_server_threads + * Only for async server. Number of threads used to serve the requests. + * @type int $core_limit + * Specify the number of cores to limit server to, if desired + * @type \Grpc\Testing\PayloadConfig $payload_config + * 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. + * @type int[]|\Google\Protobuf\Internal\RepeatedField $core_list + * Specify the cores we should run the server on, if desired + * @type string $other_server_api + * If we use an OTHER_SERVER client_type, this string gives more detail + * @type int $threads_per_cq + * Number of threads that share each completion queue + * @type int $resource_quota_size + * Buffer pool size (no buffer pool specified if unset) + * @type \Grpc\Testing\ChannelArg[]|\Google\Protobuf\Internal\RepeatedField $channel_args + * @type int $server_processes + * Number of server processes. 0 indicates no restriction. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); - parent::__construct(); + parent::__construct($data); } /** @@ -362,5 +400,31 @@ class ServerConfig extends \Google\Protobuf\Internal\Message return $this; } + /** + * Number of server processes. 0 indicates no restriction. + * + * Generated from protobuf field int32 server_processes = 21; + * @return int + */ + public function getServerProcesses() + { + return $this->server_processes; + } + + /** + * Number of server processes. 0 indicates no restriction. + * + * Generated from protobuf field int32 server_processes = 21; + * @param int $var + * @return $this + */ + public function setServerProcesses($var) + { + GPBUtil::checkInt32($var); + $this->server_processes = $var; + + 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 aea2cb0fce3..c91696d3240 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ServerStats.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ServerStats.php @@ -18,48 +18,71 @@ class ServerStats extends \Google\Protobuf\Internal\Message * * Generated from protobuf field double time_elapsed = 1; */ - private $time_elapsed = 0.0; + protected $time_elapsed = 0.0; /** * change in user time (in seconds) used by the server since last reset * * Generated from protobuf field double time_user = 2; */ - private $time_user = 0.0; + protected $time_user = 0.0; /** * change in server time (in seconds) used by the server process and all * threads since last reset * * Generated from protobuf field double time_system = 3; */ - private $time_system = 0.0; + protected $time_system = 0.0; /** * change in total cpu time of the server (data from proc/stat) * * Generated from protobuf field uint64 total_cpu_time = 4; */ - private $total_cpu_time = 0; + protected $total_cpu_time = 0; /** * change in idle time of the server (data from proc/stat) * * Generated from protobuf field uint64 idle_cpu_time = 5; */ - private $idle_cpu_time = 0; + protected $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; + protected $cq_poll_count = 0; /** * Core library stats * * Generated from protobuf field .grpc.core.Stats core_stats = 7; */ - private $core_stats = null; + protected $core_stats = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $time_elapsed + * wall clock time change in seconds since last reset + * @type float $time_user + * change in user time (in seconds) used by the server since last reset + * @type float $time_system + * change in server time (in seconds) used by the server process and all + * threads since last reset + * @type int|string $total_cpu_time + * change in total cpu time of the server (data from proc/stat) + * @type int|string $idle_cpu_time + * change in idle time of the server (data from proc/stat) + * @type int|string $cq_poll_count + * Number of polls called inside completion queue + * @type \Grpc\Core\Stats $core_stats + * Core library stats + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Stats::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 04f2ca7c4ae..ae96db02c6c 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ServerStatus.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ServerStatus.php @@ -16,23 +16,36 @@ class ServerStatus extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field .grpc.testing.ServerStats stats = 1; */ - private $stats = null; + protected $stats = null; /** * the port bound by the server * * Generated from protobuf field int32 port = 2; */ - private $port = 0; + protected $port = 0; /** * Number of cores available to the server * * Generated from protobuf field int32 cores = 3; */ - private $cores = 0; + protected $cores = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grpc\Testing\ServerStats $stats + * @type int $port + * the port bound by the server + * @type int $cores + * Number of cores available to the server + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Control::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 4110e91c18a..1c2c0413445 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/ServerType.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/ServerType.php @@ -4,8 +4,10 @@ namespace Grpc\Testing; +use UnexpectedValueException; + /** - * Protobuf enum Grpc\Testing\ServerType + * Protobuf type grpc.testing.ServerType */ class ServerType { @@ -27,5 +29,37 @@ class ServerType * Generated from protobuf enum OTHER_SERVER = 3; */ const OTHER_SERVER = 3; + /** + * Generated from protobuf enum CALLBACK_SERVER = 4; + */ + const CALLBACK_SERVER = 4; + + private static $valueToName = [ + self::SYNC_SERVER => 'SYNC_SERVER', + self::ASYNC_SERVER => 'ASYNC_SERVER', + self::ASYNC_GENERIC_SERVER => 'ASYNC_GENERIC_SERVER', + self::OTHER_SERVER => 'OTHER_SERVER', + self::CALLBACK_SERVER => 'CALLBACK_SERVER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } } 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 507db598f03..1edc36870e9 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/SimpleProtoParams.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/SimpleProtoParams.php @@ -16,15 +16,25 @@ class SimpleProtoParams extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field int32 req_size = 1; */ - private $req_size = 0; + protected $req_size = 0; /** * Generated from protobuf field int32 resp_size = 2; */ - private $resp_size = 0; + protected $resp_size = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $req_size + * @type int $resp_size + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Payloads::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 e0c2d2d94ce..95393659811 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/SimpleRequest.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/SimpleRequest.php @@ -16,37 +16,36 @@ use Google\Protobuf\Internal\GPBUtil; 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. * * Generated from protobuf field .grpc.testing.PayloadType response_type = 1; */ - private $response_type = 0; + protected $response_type = 0; /** * Desired payload size in the response from the server. * * Generated from protobuf field int32 response_size = 2; */ - private $response_size = 0; + protected $response_size = 0; /** * Optional input payload sent along with the request. * * Generated from protobuf field .grpc.testing.Payload payload = 3; */ - private $payload = null; + protected $payload = null; /** * Whether SimpleResponse should include username. * * Generated from protobuf field bool fill_username = 4; */ - private $fill_username = false; + protected $fill_username = false; /** * Whether SimpleResponse should include OAuth scope. * * Generated from protobuf field bool fill_oauth_scope = 5; */ - private $fill_oauth_scope = false; + protected $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 @@ -55,27 +54,70 @@ class SimpleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .grpc.testing.BoolValue response_compressed = 6; */ - private $response_compressed = null; + protected $response_compressed = null; /** * Whether server should return a given status * * Generated from protobuf field .grpc.testing.EchoStatus response_status = 7; */ - private $response_status = null; + protected $response_status = null; /** * Whether the server should expect this request to be compressed. * * Generated from protobuf field .grpc.testing.BoolValue expect_compressed = 8; */ - private $expect_compressed = null; + protected $expect_compressed = null; + /** + * Whether SimpleResponse should include server_id. + * + * Generated from protobuf field bool fill_server_id = 9; + */ + protected $fill_server_id = false; + /** + * Whether SimpleResponse should include grpclb_route_type. + * + * Generated from protobuf field bool fill_grpclb_route_type = 10; + */ + protected $fill_grpclb_route_type = false; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $response_type + * Desired payload type in the response from the server. + * If response_type is RANDOM, server randomly chooses one from other formats. + * @type int $response_size + * Desired payload size in the response from the server. + * @type \Grpc\Testing\Payload $payload + * Optional input payload sent along with the request. + * @type bool $fill_username + * Whether SimpleResponse should include username. + * @type bool $fill_oauth_scope + * Whether SimpleResponse should include OAuth scope. + * @type \Grpc\Testing\BoolValue $response_compressed + * 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. + * @type \Grpc\Testing\EchoStatus $response_status + * Whether server should return a given status + * @type \Grpc\Testing\BoolValue $expect_compressed + * Whether the server should expect this request to be compressed. + * @type bool $fill_server_id + * Whether SimpleResponse should include server_id. + * @type bool $fill_grpclb_route_type + * Whether SimpleResponse should include grpclb_route_type. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); - parent::__construct(); + parent::__construct($data); } /** - * 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. * @@ -88,7 +130,6 @@ 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. * @@ -292,5 +333,57 @@ class SimpleRequest extends \Google\Protobuf\Internal\Message return $this; } + /** + * Whether SimpleResponse should include server_id. + * + * Generated from protobuf field bool fill_server_id = 9; + * @return bool + */ + public function getFillServerId() + { + return $this->fill_server_id; + } + + /** + * Whether SimpleResponse should include server_id. + * + * Generated from protobuf field bool fill_server_id = 9; + * @param bool $var + * @return $this + */ + public function setFillServerId($var) + { + GPBUtil::checkBool($var); + $this->fill_server_id = $var; + + return $this; + } + + /** + * Whether SimpleResponse should include grpclb_route_type. + * + * Generated from protobuf field bool fill_grpclb_route_type = 10; + * @return bool + */ + public function getFillGrpclbRouteType() + { + return $this->fill_grpclb_route_type; + } + + /** + * Whether SimpleResponse should include grpclb_route_type. + * + * Generated from protobuf field bool fill_grpclb_route_type = 10; + * @param bool $var + * @return $this + */ + public function setFillGrpclbRouteType($var) + { + GPBUtil::checkBool($var); + $this->fill_grpclb_route_type = $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 d49f33746e2..7121fc215ec 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/SimpleResponse.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/SimpleResponse.php @@ -20,24 +20,65 @@ class SimpleResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .grpc.testing.Payload payload = 1; */ - private $payload = null; + protected $payload = null; /** * The user the request came from, for verifying authentication was * successful when the client expected it. * * Generated from protobuf field string username = 2; */ - private $username = ''; + protected $username = ''; /** * OAuth scope. * * Generated from protobuf field string oauth_scope = 3; */ - private $oauth_scope = ''; + protected $oauth_scope = ''; + /** + * Server ID. This must be unique among different server instances, + * but the same across all RPC's made to a particular server instance. + * + * Generated from protobuf field string server_id = 4; + */ + protected $server_id = ''; + /** + * gRPCLB Path. + * + * Generated from protobuf field .grpc.testing.GrpclbRouteType grpclb_route_type = 5; + */ + protected $grpclb_route_type = 0; + /** + * Server hostname. + * + * Generated from protobuf field string hostname = 6; + */ + protected $hostname = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grpc\Testing\Payload $payload + * Payload to increase message size. + * @type string $username + * The user the request came from, for verifying authentication was + * successful when the client expected it. + * @type string $oauth_scope + * OAuth scope. + * @type string $server_id + * Server ID. This must be unique among different server instances, + * but the same across all RPC's made to a particular server instance. + * @type int $grpclb_route_type + * gRPCLB Path. + * @type string $hostname + * Server hostname. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); - parent::__construct(); + parent::__construct($data); } /** @@ -120,5 +161,85 @@ class SimpleResponse extends \Google\Protobuf\Internal\Message return $this; } + /** + * Server ID. This must be unique among different server instances, + * but the same across all RPC's made to a particular server instance. + * + * Generated from protobuf field string server_id = 4; + * @return string + */ + public function getServerId() + { + return $this->server_id; + } + + /** + * Server ID. This must be unique among different server instances, + * but the same across all RPC's made to a particular server instance. + * + * Generated from protobuf field string server_id = 4; + * @param string $var + * @return $this + */ + public function setServerId($var) + { + GPBUtil::checkString($var, True); + $this->server_id = $var; + + return $this; + } + + /** + * gRPCLB Path. + * + * Generated from protobuf field .grpc.testing.GrpclbRouteType grpclb_route_type = 5; + * @return int + */ + public function getGrpclbRouteType() + { + return $this->grpclb_route_type; + } + + /** + * gRPCLB Path. + * + * Generated from protobuf field .grpc.testing.GrpclbRouteType grpclb_route_type = 5; + * @param int $var + * @return $this + */ + public function setGrpclbRouteType($var) + { + GPBUtil::checkEnum($var, \Grpc\Testing\GrpclbRouteType::class); + $this->grpclb_route_type = $var; + + return $this; + } + + /** + * Server hostname. + * + * Generated from protobuf field string hostname = 6; + * @return string + */ + public function getHostname() + { + return $this->hostname; + } + + /** + * Server hostname. + * + * Generated from protobuf field string hostname = 6; + * @param string $var + * @return $this + */ + public function setHostname($var) + { + GPBUtil::checkString($var, True); + $this->hostname = $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 a7460af83a3..00c754b946b 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/StreamingInputCallRequest.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/StreamingInputCallRequest.php @@ -20,7 +20,7 @@ class StreamingInputCallRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .grpc.testing.Payload payload = 1; */ - private $payload = null; + protected $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 @@ -29,11 +29,26 @@ class StreamingInputCallRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .grpc.testing.BoolValue expect_compressed = 2; */ - private $expect_compressed = null; + protected $expect_compressed = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grpc\Testing\Payload $payload + * Optional input payload sent along with the request. + * @type \Grpc\Testing\BoolValue $expect_compressed + * 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. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 41f3893aa3f..f7ff87c1fb1 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/StreamingInputCallResponse.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/StreamingInputCallResponse.php @@ -20,11 +20,21 @@ class StreamingInputCallResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 aggregated_payload_size = 1; */ - private $aggregated_payload_size = 0; + protected $aggregated_payload_size = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $aggregated_payload_size + * Aggregated size of payloads received from the client. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); - parent::__construct(); + parent::__construct($data); } /** 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 69d9cecffa7..552e96d7ae2 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/StreamingOutputCallRequest.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/StreamingOutputCallRequest.php @@ -16,7 +16,6 @@ use Google\Protobuf\Internal\GPBUtil; 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 @@ -24,7 +23,7 @@ class StreamingOutputCallRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .grpc.testing.PayloadType response_type = 1; */ - private $response_type = 0; + protected $response_type = 0; /** * Configuration for each expected response message. * @@ -36,21 +35,39 @@ class StreamingOutputCallRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .grpc.testing.Payload payload = 3; */ - private $payload = null; + protected $payload = null; /** * Whether server should return a given status * * Generated from protobuf field .grpc.testing.EchoStatus response_status = 7; */ - private $response_status = null; + protected $response_status = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $response_type + * 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. + * @type \Grpc\Testing\ResponseParameters[]|\Google\Protobuf\Internal\RepeatedField $response_parameters + * Configuration for each expected response message. + * @type \Grpc\Testing\Payload $payload + * Optional input payload sent along with the request. + * @type \Grpc\Testing\EchoStatus $response_status + * Whether server should return a given status + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); - parent::__construct(); + parent::__construct($data); } /** - * 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 @@ -65,7 +82,6 @@ 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 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 52315bb4995..b28b906ce93 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/StreamingOutputCallResponse.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/StreamingOutputCallResponse.php @@ -20,11 +20,21 @@ class StreamingOutputCallResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .grpc.testing.Payload payload = 1; */ - private $payload = null; + protected $payload = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Grpc\Testing\Payload $payload + * Payload to increase response size. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/TestServiceClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/TestServiceClient.php index 7da9713d65e..e6fef125b8b 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/TestServiceClient.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/TestServiceClient.php @@ -38,15 +38,15 @@ class TestServiceClient extends \Grpc\BaseStub { /** * One empty request followed by one empty response. - * @param \Grpc\Testing\PBEmpty $argument input argument + * @param \Grpc\Testing\EmptyMessage $argument input argument * @param array $metadata metadata * @param array $options call options */ - public function EmptyCall(\Grpc\Testing\PBEmpty $argument, + public function EmptyCall(\Grpc\Testing\EmptyMessage $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/grpc.testing.TestService/EmptyCall', $argument, - ['\Grpc\Testing\PBEmpty', 'decode'], + ['\Grpc\Testing\EmptyMessage', 'decode'], $metadata, $options); } @@ -137,15 +137,15 @@ class TestServiceClient extends \Grpc\BaseStub { /** * The test server will not implement this method. It will be used * to test the behavior when clients call unimplemented methods. - * @param \Grpc\Testing\PBEmpty $argument input argument + * @param \Grpc\Testing\EmptyMessage $argument input argument * @param array $metadata metadata * @param array $options call options */ - public function UnimplementedCall(\Grpc\Testing\PBEmpty $argument, + public function UnimplementedCall(\Grpc\Testing\EmptyMessage $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/grpc.testing.TestService/UnimplementedCall', $argument, - ['\Grpc\Testing\PBEmpty', 'decode'], + ['\Grpc\Testing\EmptyMessage', 'decode'], $metadata, $options); } diff --git a/src/php/tests/qps/generated_code/Grpc/Testing/UnimplementedServiceClient.php b/src/php/tests/qps/generated_code/Grpc/Testing/UnimplementedServiceClient.php index 53b2020f190..2c1d921bfcc 100644 --- a/src/php/tests/qps/generated_code/Grpc/Testing/UnimplementedServiceClient.php +++ b/src/php/tests/qps/generated_code/Grpc/Testing/UnimplementedServiceClient.php @@ -38,15 +38,15 @@ class UnimplementedServiceClient extends \Grpc\BaseStub { /** * A call that no server should implement - * @param \Grpc\Testing\PBEmpty $argument input argument + * @param \Grpc\Testing\EmptyMessage $argument input argument * @param array $metadata metadata * @param array $options call options */ - public function UnimplementedCall(\Grpc\Testing\PBEmpty $argument, + public function UnimplementedCall(\Grpc\Testing\EmptyMessage $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/grpc.testing.UnimplementedService/UnimplementedCall', $argument, - ['\Grpc\Testing\PBEmpty', 'decode'], + ['\Grpc\Testing\EmptyMessage', 'decode'], $metadata, $options); } diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py index ff799cd07e9..d6c6815291c 100644 --- a/src/python/grpcio/grpc/__init__.py +++ b/src/python/grpcio/grpc/__init__.py @@ -414,8 +414,8 @@ class ClientCallDetails(six.with_metaclass(abc.ABCMeta)): metadata: Optional :term:`metadata` to be transmitted to the service-side of the RPC. credentials: An optional CallCredentials for the RPC. - wait_for_ready: This is an EXPERIMENTAL argument. An optional flag t - enable wait for ready mechanism. + wait_for_ready: This is an EXPERIMENTAL argument. An optional + flag to enable :term:`wait_for_ready` mechanism. compression: An element of grpc.compression, e.g. grpc.compression.Gzip. This is an EXPERIMENTAL option. """ @@ -690,7 +690,7 @@ class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)): credentials: An optional CallCredentials for the RPC. Only valid for secure Channel. wait_for_ready: This is an EXPERIMENTAL argument. An optional - flag to enable wait for ready mechanism + flag to enable :term:`wait_for_ready` mechanism. compression: An element of grpc.compression, e.g. grpc.compression.Gzip. This is an EXPERIMENTAL option. @@ -723,7 +723,7 @@ class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)): credentials: An optional CallCredentials for the RPC. Only valid for secure Channel. wait_for_ready: This is an EXPERIMENTAL argument. An optional - flag to enable wait for ready mechanism + flag to enable :term:`wait_for_ready` mechanism. compression: An element of grpc.compression, e.g. grpc.compression.Gzip. This is an EXPERIMENTAL option. @@ -756,7 +756,7 @@ class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)): credentials: An optional CallCredentials for the RPC. Only valid for secure Channel. wait_for_ready: This is an EXPERIMENTAL argument. An optional - flag to enable wait for ready mechanism + flag to enable :term:`wait_for_ready` mechanism. compression: An element of grpc.compression, e.g. grpc.compression.Gzip. This is an EXPERIMENTAL option. @@ -792,7 +792,7 @@ class UnaryStreamMultiCallable(six.with_metaclass(abc.ABCMeta)): credentials: An optional CallCredentials for the RPC. Only valid for secure Channel. wait_for_ready: This is an EXPERIMENTAL argument. An optional - flag to enable wait for ready mechanism + flag to enable :term:`wait_for_ready` mechanism. compression: An element of grpc.compression, e.g. grpc.compression.Gzip. This is an EXPERIMENTAL option. @@ -828,7 +828,7 @@ class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)): credentials: An optional CallCredentials for the RPC. Only valid for secure Channel. wait_for_ready: This is an EXPERIMENTAL argument. An optional - flag to enable wait for ready mechanism + flag to enable :term:`wait_for_ready` mechanism. compression: An element of grpc.compression, e.g. grpc.compression.Gzip. This is an EXPERIMENTAL option. @@ -862,7 +862,7 @@ class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)): credentials: An optional CallCredentials for the RPC. Only valid for secure Channel. wait_for_ready: This is an EXPERIMENTAL argument. An optional - flag to enable wait for ready mechanism + flag to enable :term:`wait_for_ready` mechanism. compression: An element of grpc.compression, e.g. grpc.compression.Gzip. This is an EXPERIMENTAL option. @@ -895,7 +895,7 @@ class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)): credentials: An optional CallCredentials for the RPC. Only valid for secure Channel. wait_for_ready: This is an EXPERIMENTAL argument. An optional - flag to enable wait for ready mechanism + flag to enable :term:`wait_for_ready` mechanism. compression: An element of grpc.compression, e.g. grpc.compression.Gzip. This is an EXPERIMENTAL option. @@ -931,7 +931,7 @@ class StreamStreamMultiCallable(six.with_metaclass(abc.ABCMeta)): credentials: An optional CallCredentials for the RPC. Only valid for secure Channel. wait_for_ready: This is an EXPERIMENTAL argument. An optional - flag to enable wait for ready mechanism + flag to enable :term:`wait_for_ready` mechanism. compression: An element of grpc.compression, e.g. grpc.compression.Gzip. This is an EXPERIMENTAL option. @@ -1857,7 +1857,7 @@ def insecure_channel(target, options=None, compression=None): Args: target: The server address - options: An optional list of key-value pairs (channel args + options: An optional list of key-value pairs (:term:`channel_arguments` in gRPC Core runtime) to configure the channel. compression: An optional value indicating the compression method to be used over the lifetime of the channel. This is an EXPERIMENTAL option. @@ -1878,7 +1878,7 @@ def secure_channel(target, credentials, options=None, compression=None): Args: target: The server address. credentials: A ChannelCredentials instance. - options: An optional list of key-value pairs (channel args + options: An optional list of key-value pairs (:term:`channel_arguments` in gRPC Core runtime) to configure the channel. compression: An optional value indicating the compression method to be used over the lifetime of the channel. This is an EXPERIMENTAL option. @@ -1942,7 +1942,7 @@ def server(thread_pool, and optionally manipulate the incoming RPCs before handing them over to handlers. The interceptors are given control in the order they are specified. This is an EXPERIMENTAL API. - options: An optional list of key-value pairs (channel args in gRPC runtime) + options: An optional list of key-value pairs (:term:`channel_arguments` in gRPC runtime) to configure the channel. maximum_concurrent_rpcs: The maximum number of concurrent RPCs this server will service before returning RESOURCE_EXHAUSTED status, or None to diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/completion_queue.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/completion_queue.pyx.pxi index 15d2e18f3d7..f42929461a0 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/aio/completion_queue.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/completion_queue.pyx.pxi @@ -15,6 +15,7 @@ import socket cdef gpr_timespec _GPR_INF_FUTURE = gpr_inf_future(GPR_CLOCK_REALTIME) +cdef float _POLL_AWAKE_INTERVAL_S = 0.2 IF UNAME_SYSNAME == "Windows": @@ -58,8 +59,8 @@ cdef class PollerCompletionQueue(BaseCompletionQueue): while not self._shutdown: event = grpc_completion_queue_next(self._cq, - _GPR_INF_FUTURE, - NULL) + _GPR_INF_FUTURE, + NULL) if event.type == GRPC_QUEUE_TIMEOUT: with gil: @@ -80,6 +81,8 @@ cdef class PollerCompletionQueue(BaseCompletionQueue): self._loop.remove_reader(self._read_socket) # TODO(https://github.com/grpc/grpc/issues/22365) perform graceful shutdown grpc_completion_queue_shutdown(self._cq) + while not self._shutdown: + self._poller_thread.join(timeout=_POLL_AWAKE_INTERVAL_S) grpc_completion_queue_destroy(self._cq) def _handle_events(self): diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi index a0d51a14325..0e407172806 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi @@ -189,9 +189,6 @@ cdef class _ServicerContext: raise self._rpc_state.abort_exception - async def abort_with_status(self, object status): - await self.abort(status.code, status.details, status.trailing_metadata) - def set_trailing_metadata(self, tuple metadata): self._rpc_state.trailing_metadata = metadata diff --git a/src/python/grpcio/grpc/_simple_stubs.py b/src/python/grpcio/grpc/_simple_stubs.py index 39535527ef5..202ad123e82 100644 --- a/src/python/grpcio/grpc/_simple_stubs.py +++ b/src/python/grpcio/grpc/_simple_stubs.py @@ -196,7 +196,7 @@ def unary_unary( message. Request goes unserialized in case None is passed. response_deserializer: Optional :term:`deserializer` for deserializing the response message. Response goes undeserialized in case None is passed. - options: An optional list of key-value pairs (channel args in gRPC Core + options: An optional list of key-value pairs (:term:`channel_arguments` in gRPC Core runtime) to configure the channel. channel_credentials: A credential applied to the whole channel, e.g. the return value of grpc.ssl_channel_credentials() or @@ -267,7 +267,7 @@ def unary_stream( message. Request goes unserialized in case None is passed. response_deserializer: Optional :term:`deserializer` for deserializing the response message. Response goes undeserialized in case None is passed. - options: An optional list of key-value pairs (channel args in gRPC Core + options: An optional list of key-value pairs (:term:`channel_arguments` in gRPC Core runtime) to configure the channel. channel_credentials: A credential applied to the whole channel, e.g. the return value of grpc.ssl_channel_credentials(). @@ -337,7 +337,7 @@ def stream_unary( message. Request goes unserialized in case None is passed. response_deserializer: Optional :term:`deserializer` for deserializing the response message. Response goes undeserialized in case None is passed. - options: An optional list of key-value pairs (channel args in gRPC Core + options: An optional list of key-value pairs (:term:`channel_arguments` in gRPC Core runtime) to configure the channel. channel_credentials: A credential applied to the whole channel, e.g. the return value of grpc.ssl_channel_credentials(). @@ -407,7 +407,7 @@ def stream_stream( message. Request goes unserialized in case None is passed. response_deserializer: Optional :term:`deserializer` for deserializing the response message. Response goes undeserialized in case None is passed. - options: An optional list of key-value pairs (channel args in gRPC Core + options: An optional list of key-value pairs (:term:`channel_arguments` in gRPC Core runtime) to configure the channel. channel_credentials: A credential applied to the whole channel, e.g. the return value of grpc.ssl_channel_credentials(). diff --git a/src/python/grpcio/grpc/experimental/aio/_base_channel.py b/src/python/grpcio/grpc/experimental/aio/_base_channel.py index b6c946a4367..33efa7789cb 100644 --- a/src/python/grpcio/grpc/experimental/aio/_base_channel.py +++ b/src/python/grpcio/grpc/experimental/aio/_base_channel.py @@ -49,7 +49,7 @@ class UnaryUnaryMultiCallable(abc.ABC): credentials: An optional CallCredentials for the RPC. Only valid for secure Channel. wait_for_ready: This is an EXPERIMENTAL argument. An optional - flag to enable wait for ready mechanism + flag to enable :term:`wait_for_ready` mechanism. compression: An element of grpc.compression, e.g. grpc.compression.Gzip. This is an EXPERIMENTAL option. @@ -87,7 +87,7 @@ class UnaryStreamMultiCallable(abc.ABC): credentials: An optional CallCredentials for the RPC. Only valid for secure Channel. wait_for_ready: This is an EXPERIMENTAL argument. An optional - flag to enable wait for ready mechanism + flag to enable :term:`wait_for_ready` mechanism. compression: An element of grpc.compression, e.g. grpc.compression.Gzip. This is an EXPERIMENTAL option. @@ -125,7 +125,7 @@ class StreamUnaryMultiCallable(abc.ABC): credentials: An optional CallCredentials for the RPC. Only valid for secure Channel. wait_for_ready: This is an EXPERIMENTAL argument. An optional - flag to enable wait for ready mechanism + flag to enable :term:`wait_for_ready` mechanism. compression: An element of grpc.compression, e.g. grpc.compression.Gzip. This is an EXPERIMENTAL option. @@ -163,7 +163,7 @@ class StreamStreamMultiCallable(abc.ABC): credentials: An optional CallCredentials for the RPC. Only valid for secure Channel. wait_for_ready: This is an EXPERIMENTAL argument. An optional - flag to enable wait for ready mechanism + flag to enable :term:`wait_for_ready` mechanism. compression: An element of grpc.compression, e.g. grpc.compression.Gzip. This is an EXPERIMENTAL option. diff --git a/src/python/grpcio/grpc/experimental/aio/_channel.py b/src/python/grpcio/grpc/experimental/aio/_channel.py index 89c556c997e..afa9cf30630 100644 --- a/src/python/grpcio/grpc/experimental/aio/_channel.py +++ b/src/python/grpcio/grpc/experimental/aio/_channel.py @@ -406,7 +406,7 @@ def insecure_channel( Args: target: The server address - options: An optional list of key-value pairs (channel args + options: An optional list of key-value pairs (:term:`channel_arguments` in gRPC Core runtime) to configure the channel. compression: An optional value indicating the compression method to be used over the lifetime of the channel. This is an EXPERIMENTAL option. @@ -430,7 +430,7 @@ def secure_channel(target: str, Args: target: The server address. credentials: A ChannelCredentials instance. - options: An optional list of key-value pairs (channel args + options: An optional list of key-value pairs (:term:`channel_arguments` in gRPC Core runtime) to configure the channel. compression: An optional value indicating the compression method to be used over the lifetime of the channel. This is an EXPERIMENTAL option. diff --git a/src/python/grpcio/grpc/experimental/aio/_interceptor.py b/src/python/grpcio/grpc/experimental/aio/_interceptor.py index 80d17e04ce9..b9f786e5522 100644 --- a/src/python/grpcio/grpc/experimental/aio/_interceptor.py +++ b/src/python/grpcio/grpc/experimental/aio/_interceptor.py @@ -73,8 +73,8 @@ class ClientCallDetails( metadata: Optional metadata to be transmitted to the service-side of the RPC. credentials: An optional CallCredentials for the RPC. - wait_for_ready: This is an EXPERIMENTAL argument. An optional flag to - enable wait for ready mechanism. + wait_for_ready: This is an EXPERIMENTAL argument. An optional + flag to enable :term:`wait_for_ready` mechanism. """ method: str diff --git a/src/python/grpcio/grpc/experimental/aio/_server.py b/src/python/grpcio/grpc/experimental/aio/_server.py index 478049e5db4..81438891268 100644 --- a/src/python/grpcio/grpc/experimental/aio/_server.py +++ b/src/python/grpcio/grpc/experimental/aio/_server.py @@ -187,7 +187,7 @@ def server(migration_thread_pool: Optional[Executor] = None, and optionally manipulate the incoming RPCs before handing them over to handlers. The interceptors are given control in the order they are specified. This is an EXPERIMENTAL API. - options: An optional list of key-value pairs (channel args in gRPC runtime) + options: An optional list of key-value pairs (:term:`channel_arguments` in gRPC runtime) to configure the channel. maximum_concurrent_rpcs: The maximum number of concurrent RPCs this server will service before returning RESOURCE_EXHAUSTED status, or None to diff --git a/src/python/grpcio_status/grpc_status/BUILD.bazel b/src/python/grpcio_status/grpc_status/BUILD.bazel index a6abdd3ef56..122a94f411a 100644 --- a/src/python/grpcio_status/grpc_status/BUILD.bazel +++ b/src/python/grpcio_status/grpc_status/BUILD.bazel @@ -4,7 +4,7 @@ package(default_visibility = ["//visibility:public"]) py_library( name = "grpc_status", - srcs = glob(["*.py"]), + srcs = ["rpc_status.py"], imports = ["../"], deps = [ "//src/python/grpcio/grpc:grpcio", diff --git a/src/python/grpcio_status/grpc_status/_async.py b/src/python/grpcio_status/grpc_status/_async.py deleted file mode 100644 index a6a6f7ef6ad..00000000000 --- a/src/python/grpcio_status/grpc_status/_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright 2020 The 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. -"""Reference implementation for status mapping in gRPC Python.""" - -from grpc.experimental import aio - -from google.rpc import status_pb2 - -from ._common import code_to_grpc_status_code, GRPC_DETAILS_METADATA_KEY - - -async def from_call(call: aio.Call): - """Returns a google.rpc.status.Status message from a given grpc.aio.Call. - - This is an EXPERIMENTAL API. - - Args: - call: An grpc.aio.Call instance. - - Returns: - A google.rpc.status.Status message representing the status of the RPC. - """ - code = await call.code() - details = await call.details() - trailing_metadata = await call.trailing_metadata() - if trailing_metadata is None: - return None - for key, value in trailing_metadata: - if key == GRPC_DETAILS_METADATA_KEY: - rich_status = status_pb2.Status.FromString(value) - if code.value[0] != rich_status.code: - raise ValueError( - 'Code in Status proto (%s) doesn\'t match status code (%s)' - % (code_to_grpc_status_code(rich_status.code), code)) - if details != rich_status.message: - raise ValueError( - 'Message in Status proto (%s) doesn\'t match status details (%s)' - % (rich_status.message, details)) - return rich_status - return None - - -__all__ = [ - 'from_call', -] diff --git a/src/python/grpcio_status/grpc_status/_common.py b/src/python/grpcio_status/grpc_status/_common.py deleted file mode 100644 index 4bec0ba1372..00000000000 --- a/src/python/grpcio_status/grpc_status/_common.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2020 The 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. -"""Reference implementation for status mapping in gRPC Python.""" - -import grpc - -_CODE_TO_GRPC_CODE_MAPPING = {x.value[0]: x for x in grpc.StatusCode} - -GRPC_DETAILS_METADATA_KEY = 'grpc-status-details-bin' - - -def code_to_grpc_status_code(code): - try: - return _CODE_TO_GRPC_CODE_MAPPING[code] - except KeyError: - raise ValueError('Invalid status code %s' % code) diff --git a/src/python/grpcio_status/grpc_status/rpc_status.py b/src/python/grpcio_status/grpc_status/rpc_status.py index d0ec08e3a5d..ec78c477694 100644 --- a/src/python/grpcio_status/grpc_status/rpc_status.py +++ b/src/python/grpcio_status/grpc_status/rpc_status.py @@ -14,12 +14,14 @@ """Reference implementation for status mapping in gRPC Python.""" import collections -import sys import grpc from google.rpc import status_pb2 -from ._common import code_to_grpc_status_code, GRPC_DETAILS_METADATA_KEY + +_CODE_TO_GRPC_CODE_MAPPING = {x.value[0]: x for x in grpc.StatusCode} + +_GRPC_DETAILS_METADATA_KEY = 'grpc-status-details-bin' class _Status( @@ -29,6 +31,13 @@ class _Status( pass +def _code_to_grpc_status_code(code): + try: + return _CODE_TO_GRPC_CODE_MAPPING[code] + except KeyError: + raise ValueError('Invalid status code %s' % code) + + def from_call(call): """Returns a google.rpc.status.Status message corresponding to a given grpc.Call. @@ -47,12 +56,13 @@ def from_call(call): if call.trailing_metadata() is None: return None for key, value in call.trailing_metadata(): - if key == GRPC_DETAILS_METADATA_KEY: + if key == _GRPC_DETAILS_METADATA_KEY: rich_status = status_pb2.Status.FromString(value) if call.code().value[0] != rich_status.code: raise ValueError( 'Code in Status proto (%s) doesn\'t match status code (%s)' - % (code_to_grpc_status_code(rich_status.code), call.code())) + % + (_code_to_grpc_status_code(rich_status.code), call.code())) if call.details() != rich_status.message: raise ValueError( 'Message in Status proto (%s) doesn\'t match status details (%s)' @@ -73,17 +83,7 @@ def to_status(status): Returns: A grpc.Status instance representing the input google.rpc.status.Status message. """ - return _Status(code=code_to_grpc_status_code(status.code), + return _Status(code=_code_to_grpc_status_code(status.code), details=status.message, - trailing_metadata=((GRPC_DETAILS_METADATA_KEY, + trailing_metadata=((_GRPC_DETAILS_METADATA_KEY, status.SerializeToString()),)) - - -__all__ = [ - 'from_call', - 'to_status', -] - -if sys.version_info[0] >= 3 and sys.version_info[1] >= 6: - from . import _async as aio # pylint: disable=unused-import - __all__.append('aio') diff --git a/src/python/grpcio_tests/tests/unit/_channel_args_test.py b/src/python/grpcio_tests/tests/unit/_channel_args_test.py index 3f3db2edd23..2f2eea61dbd 100644 --- a/src/python/grpcio_tests/tests/unit/_channel_args_test.py +++ b/src/python/grpcio_tests/tests/unit/_channel_args_test.py @@ -11,7 +11,7 @@ # 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. -"""Tests of Channel Args on client/server side.""" +"""Tests of channel arguments on client/server side.""" from concurrent import futures import unittest diff --git a/src/python/grpcio_tests/tests_aio/status/BUILD.bazel b/src/python/grpcio_tests/tests_aio/status/BUILD.bazel deleted file mode 100644 index 2fd82f2684c..00000000000 --- a/src/python/grpcio_tests/tests_aio/status/BUILD.bazel +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2020 The 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. - -load("@grpc_python_dependencies//:requirements.bzl", "requirement") - -py_test( - name = "grpc_status_test", - size = "small", - srcs = ["grpc_status_test.py"], - imports = ["../../"], - python_version = "PY3", - deps = [ - "//src/python/grpcio/grpc:grpcio", - "//src/python/grpcio_status/grpc_status", - "//src/python/grpcio_tests/tests_aio/unit:_test_base", - requirement("protobuf"), - requirement("googleapis-common-protos"), - ], -) diff --git a/src/python/grpcio_tests/tests_aio/status/__init__.py b/src/python/grpcio_tests/tests_aio/status/__init__.py deleted file mode 100644 index 1517f71d093..00000000000 --- a/src/python/grpcio_tests/tests_aio/status/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2020 The 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. diff --git a/src/python/grpcio_tests/tests_aio/status/grpc_status_test.py b/src/python/grpcio_tests/tests_aio/status/grpc_status_test.py deleted file mode 100644 index 980cf5a67e7..00000000000 --- a/src/python/grpcio_tests/tests_aio/status/grpc_status_test.py +++ /dev/null @@ -1,175 +0,0 @@ -# Copyright 2020 The 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. -"""Tests of grpc_status with gRPC AsyncIO stack.""" - -import logging -import traceback -import unittest - -import grpc -from google.protobuf import any_pb2 -from google.rpc import code_pb2, error_details_pb2, status_pb2 -from grpc.experimental import aio - -from grpc_status import rpc_status -from tests_aio.unit._test_base import AioTestBase - -_STATUS_OK = '/test/StatusOK' -_STATUS_NOT_OK = '/test/StatusNotOk' -_ERROR_DETAILS = '/test/ErrorDetails' -_INCONSISTENT = '/test/Inconsistent' -_INVALID_CODE = '/test/InvalidCode' - -_REQUEST = b'\x00\x00\x00' -_RESPONSE = b'\x01\x01\x01' - -_GRPC_DETAILS_METADATA_KEY = 'grpc-status-details-bin' - -_STATUS_DETAILS = 'This is an error detail' -_STATUS_DETAILS_ANOTHER = 'This is another error detail' - - -async def _ok_unary_unary(request, servicer_context): - return _RESPONSE - - -async def _not_ok_unary_unary(request, servicer_context): - await servicer_context.abort(grpc.StatusCode.INTERNAL, _STATUS_DETAILS) - - -async def _error_details_unary_unary(request, servicer_context): - details = any_pb2.Any() - details.Pack( - error_details_pb2.DebugInfo(stack_entries=traceback.format_stack(), - detail='Intentionally invoked')) - rich_status = status_pb2.Status( - code=code_pb2.INTERNAL, - message=_STATUS_DETAILS, - details=[details], - ) - await servicer_context.abort_with_status(rpc_status.to_status(rich_status)) - - -async def _inconsistent_unary_unary(request, servicer_context): - rich_status = status_pb2.Status( - code=code_pb2.INTERNAL, - message=_STATUS_DETAILS, - ) - servicer_context.set_code(grpc.StatusCode.NOT_FOUND) - servicer_context.set_details(_STATUS_DETAILS_ANOTHER) - # User put inconsistent status information in trailing metadata - servicer_context.set_trailing_metadata( - ((_GRPC_DETAILS_METADATA_KEY, rich_status.SerializeToString()),)) - - -async def _invalid_code_unary_unary(request, servicer_context): - rich_status = status_pb2.Status( - code=42, - message='Invalid code', - ) - await servicer_context.abort_with_status(rpc_status.to_status(rich_status)) - - -class _GenericHandler(grpc.GenericRpcHandler): - - def service(self, handler_call_details): - if handler_call_details.method == _STATUS_OK: - return grpc.unary_unary_rpc_method_handler(_ok_unary_unary) - elif handler_call_details.method == _STATUS_NOT_OK: - return grpc.unary_unary_rpc_method_handler(_not_ok_unary_unary) - elif handler_call_details.method == _ERROR_DETAILS: - return grpc.unary_unary_rpc_method_handler( - _error_details_unary_unary) - elif handler_call_details.method == _INCONSISTENT: - return grpc.unary_unary_rpc_method_handler( - _inconsistent_unary_unary) - elif handler_call_details.method == _INVALID_CODE: - return grpc.unary_unary_rpc_method_handler( - _invalid_code_unary_unary) - else: - return None - - -class StatusTest(AioTestBase): - - async def setUp(self): - self._server = aio.server() - self._server.add_generic_rpc_handlers((_GenericHandler(),)) - port = self._server.add_insecure_port('[::]:0') - await self._server.start() - - self._channel = aio.insecure_channel('localhost:%d' % port) - - async def tearDown(self): - await self._server.stop(None) - await self._channel.close() - - async def test_status_ok(self): - call = self._channel.unary_unary(_STATUS_OK)(_REQUEST) - - # Succeed RPC doesn't have status - status = await rpc_status.aio.from_call(call) - self.assertIs(status, None) - - async def test_status_not_ok(self): - call = self._channel.unary_unary(_STATUS_NOT_OK)(_REQUEST) - with self.assertRaises(aio.AioRpcError) as exception_context: - await call - rpc_error = exception_context.exception - - self.assertEqual(rpc_error.code(), grpc.StatusCode.INTERNAL) - # Failed RPC doesn't automatically generate status - status = await rpc_status.aio.from_call(call) - self.assertIs(status, None) - - async def test_error_details(self): - call = self._channel.unary_unary(_ERROR_DETAILS)(_REQUEST) - with self.assertRaises(aio.AioRpcError) as exception_context: - await call - rpc_error = exception_context.exception - - status = await rpc_status.aio.from_call(call) - self.assertEqual(rpc_error.code(), grpc.StatusCode.INTERNAL) - self.assertEqual(status.code, code_pb2.Code.Value('INTERNAL')) - - # Check if the underlying proto message is intact - self.assertTrue(status.details[0].Is( - error_details_pb2.DebugInfo.DESCRIPTOR)) - info = error_details_pb2.DebugInfo() - status.details[0].Unpack(info) - self.assertIn('_error_details_unary_unary', info.stack_entries[-1]) - - async def test_code_message_validation(self): - call = self._channel.unary_unary(_INCONSISTENT)(_REQUEST) - with self.assertRaises(aio.AioRpcError) as exception_context: - await call - rpc_error = exception_context.exception - self.assertEqual(rpc_error.code(), grpc.StatusCode.NOT_FOUND) - - # Code/Message validation failed - with self.assertRaises(ValueError): - await rpc_status.aio.from_call(call) - - async def test_invalid_code(self): - with self.assertRaises(aio.AioRpcError) as exception_context: - await self._channel.unary_unary(_INVALID_CODE)(_REQUEST) - rpc_error = exception_context.exception - self.assertEqual(rpc_error.code(), grpc.StatusCode.UNKNOWN) - # Invalid status code exception raised during coversion - self.assertIn('Invalid status code', rpc_error.details()) - - -if __name__ == '__main__': - logging.basicConfig() - unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests_aio/tests.json b/src/python/grpcio_tests/tests_aio/tests.json index a1e6f88d38f..e657cfa7e4d 100644 --- a/src/python/grpcio_tests/tests_aio/tests.json +++ b/src/python/grpcio_tests/tests_aio/tests.json @@ -4,7 +4,6 @@ "interop.local_interop_test.InsecureLocalInteropTest", "interop.local_interop_test.SecureLocalInteropTest", "reflection.reflection_servicer_test.ReflectionServicerTest", - "status.grpc_status_test.StatusTest", "unit._metadata_test.TestTypeMetadata", "unit.abort_test.TestAbort", "unit.aio_rpc_error_test.TestAioRpcError", diff --git a/test/core/client_channel/resolvers/fake_resolver_test.cc b/test/core/client_channel/resolvers/fake_resolver_test.cc index 84ff252deaf..fb1e3e2dc1d 100644 --- a/test/core/client_channel/resolvers/fake_resolver_test.cc +++ b/test/core/client_channel/resolvers/fake_resolver_test.cc @@ -94,7 +94,7 @@ static grpc_core::Resolver::Result create_new_resolver_result() { grpc_uri* uri = grpc_uri_parse(uri_string, true); grpc_resolved_address address; GPR_ASSERT(grpc_parse_uri(uri, &address)); - grpc_core::InlinedVector args_to_add; + absl::InlinedVector args_to_add; result.addresses.emplace_back( address.addr, address.len, grpc_channel_args_copy_and_add(nullptr, nullptr, 0)); diff --git a/test/core/client_channel/service_config_test.cc b/test/core/client_channel/service_config_test.cc index 5cdb51341ab..b0f5a3ae70f 100644 --- a/test/core/client_channel/service_config_test.cc +++ b/test/core/client_channel/service_config_test.cc @@ -913,8 +913,8 @@ TEST_F(ClientChannelParserTest, ValidHealthCheck) { static_cast( svc_cfg->GetGlobalParsedConfig(0)); ASSERT_NE(parsed_config, nullptr); - EXPECT_STREQ(parsed_config->health_check_service_name(), - "health_check_service_name"); + EXPECT_EQ(parsed_config->health_check_service_name(), + "health_check_service_name"); } TEST_F(ClientChannelParserTest, InvalidHealthCheckMultipleEntries) { diff --git a/test/core/end2end/fixtures/h2_tls.cc b/test/core/end2end/fixtures/h2_tls.cc index 95cff3a2b00..1a79bc96014 100644 --- a/test/core/end2end/fixtures/h2_tls.cc +++ b/test/core/end2end/fixtures/h2_tls.cc @@ -23,12 +23,13 @@ #include #include +#include "absl/container/inlined_vector.h" + #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gpr/env.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/tmpfile.h" #include "src/core/lib/gprpp/host_port.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/load_file.h" #include "src/core/lib/security/credentials/credentials.h" @@ -42,7 +43,7 @@ #define SERVER_CERT_PATH "src/core/tsi/test_creds/server1.pem" #define SERVER_KEY_PATH "src/core/tsi/test_creds/server1.key" -typedef grpc_core::InlinedVector ThreadList; +typedef absl::InlinedVector ThreadList; struct fullstack_secure_fixture_data { ~fullstack_secure_fixture_data() { diff --git a/test/core/end2end/generate_tests.bzl b/test/core/end2end/generate_tests.bzl index 83a2541a14b..7eabb251413 100755 --- a/test/core/end2end/generate_tests.bzl +++ b/test/core/end2end/generate_tests.bzl @@ -64,7 +64,6 @@ END2END_FIXTURES = { fullstack = False, client_channel = False, _platforms = ["linux", "mac", "posix"], - flaky_tests = ["resource_quota_server"], # TODO(b/151212019) ), "h2_full": _fixture_options(), "h2_full+pipe": _fixture_options(_platforms = ["linux"]), @@ -96,7 +95,6 @@ END2END_FIXTURES = { secure = True, dns_resolver = False, _platforms = ["linux", "mac", "posix"], - flaky_tests = ["resource_quota_server"], # TODO(b/151212019) ), "h2_local_ipv4": _fixture_options(secure = True, dns_resolver = False, _platforms = ["linux", "mac", "posix"]), "h2_local_ipv6": _fixture_options(secure = True, dns_resolver = False, _platforms = ["linux", "mac", "posix"]), @@ -104,7 +102,6 @@ END2END_FIXTURES = { "h2_uds": _fixture_options( dns_resolver = False, _platforms = ["linux", "mac", "posix"], - flaky_tests = ["resource_quota_server"], # TODO(b/151212019) ), "inproc": _fixture_options( secure = True, @@ -133,7 +130,6 @@ END2END_NOSEC_FIXTURES = { secure = False, _platforms = ["linux", "mac", "posix"], supports_msvc = False, - flaky_tests = ["resource_quota_server"], # TODO(b/151212019) ), "h2_full": _fixture_options(secure = False), "h2_full+pipe": _fixture_options(secure = False, _platforms = ["linux"], supports_msvc = False), @@ -168,7 +164,6 @@ END2END_NOSEC_FIXTURES = { _platforms = ["linux", "mac", "posix"], secure = False, supports_msvc = False, - flaky_tests = ["resource_quota_server"], # TODO(b/151212019) ), } @@ -184,7 +179,8 @@ def _test_options( needs_proxy_auth = False, needs_write_buffering = False, needs_client_channel = False, - short_name = None): + short_name = None, + exclude_pollers = []): return struct( needs_fullstack = needs_fullstack, needs_dns = needs_dns, @@ -198,6 +194,7 @@ def _test_options( needs_write_buffering = needs_write_buffering, needs_client_channel = needs_client_channel, short_name = short_name, + exclude_pollers = exclude_pollers, ) # maps test names to options @@ -205,7 +202,11 @@ END2END_TESTS = { "bad_hostname": _test_options(needs_names = True), "bad_ping": _test_options(needs_fullstack = True, proxyable = False), "binary_metadata": _test_options(), - "resource_quota_server": _test_options(proxyable = False), + "resource_quota_server": _test_options( + proxyable = False, + # TODO(b/151212019): Test case known to be flaky under epoll1. + exclude_pollers = ["epoll1"], + ), "call_creds": _test_options(secure = True), "call_host_override": _test_options( needs_fullstack = True, @@ -466,6 +467,8 @@ def grpc_end2end_tests(): ) for poller in POLLERS: + if poller in topt.exclude_pollers: + continue native.sh_test( name = "%s_test@%s@poller=%s" % (f, test_short_name, poller), data = [":%s_test" % f], @@ -542,6 +545,8 @@ def grpc_end2end_nosec_tests(): ) for poller in POLLERS: + if poller in topt.exclude_pollers: + continue native.sh_test( name = "%s_nosec_test@%s@poller=%s" % (f, test_short_name, poller), data = [":%s_nosec_test" % f], diff --git a/test/core/gprpp/BUILD b/test/core/gprpp/BUILD index a9a8f84ebec..4eb81c3db23 100644 --- a/test/core/gprpp/BUILD +++ b/test/core/gprpp/BUILD @@ -95,19 +95,6 @@ grpc_cc_test( ], ) -grpc_cc_test( - name = "optional_test", - srcs = ["optional_test.cc"], - external_deps = [ - "gtest", - ], - language = "C++", - deps = [ - "//:optional", - "//test/core/util:grpc_test_util", - ], -) - grpc_cc_test( name = "orphanable_test", srcs = ["orphanable_test.cc"], diff --git a/test/core/gprpp/optional_test.cc b/test/core/gprpp/optional_test.cc deleted file mode 100644 index 67c7fad6c32..00000000000 --- a/test/core/gprpp/optional_test.cc +++ /dev/null @@ -1,50 +0,0 @@ -/* - * - * Copyright 2019 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. - * - */ - -#include "src/core/lib/gprpp/optional.h" -#include -#include -#include "src/core/lib/gprpp/memory.h" -#include "test/core/util/test_config.h" - -namespace grpc_core { -namespace testing { - -namespace { -TEST(OptionalTest, BasicTest) { - grpc_core::Optional opt_val; - EXPECT_FALSE(opt_val.has_value()); - const int kTestVal = 123; - - opt_val.emplace(kTestVal); - EXPECT_TRUE(opt_val.has_value()); - EXPECT_EQ(opt_val.value(), kTestVal); - - opt_val.reset(); - EXPECT_EQ(opt_val.has_value(), false); -} -} // namespace - -} // namespace testing -} // namespace grpc_core - -int main(int argc, char** argv) { - grpc::testing::TestEnvironment env(argc, argv); - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/test/core/transport/chttp2/hpack_encoder_test.cc b/test/core/transport/chttp2/hpack_encoder_test.cc index 707091bc129..8099b4fe021 100644 --- a/test/core/transport/chttp2/hpack_encoder_test.cc +++ b/test/core/transport/chttp2/hpack_encoder_test.cc @@ -49,6 +49,102 @@ typedef struct { bool only_intern_key; } verify_params; +/* verify that the output frames that are generated by encoding the stream + have sensible type and flags values */ +static void verify_frames(grpc_slice_buffer& output, bool header_is_eof) { + /* per the HTTP/2 spec: + All frames begin with a fixed 9-octet header followed by a + variable-length payload. + + +-----------------------------------------------+ + | Length (24) | + +---------------+---------------+---------------+ + | Type (8) | Flags (8) | + +-+-------------+---------------+-------------------------------+ + |R| Stream Identifier (31) | + +=+=============================================================+ + | Frame Payload (0...) ... + +---------------------------------------------------------------+ + */ + uint8_t type = 0xff, flags = 0xff; + size_t i, merged_length, frame_size; + bool first_frame = false; + bool in_header = false; + bool end_header = false; + bool is_closed = false; + for (i = 0; i < output.count;) { + first_frame = i == 0; + grpc_slice* slice = &output.slices[i++]; + + // Read gRPC frame header + uint8_t* p = GRPC_SLICE_START_PTR(*slice); + frame_size = 0; + frame_size |= static_cast(p[0]) << 16; + frame_size |= static_cast(p[1]) << 8; + frame_size |= static_cast(p[2]); + type = p[3]; + flags = p[4]; + + // Read remainder of the gRPC frame + merged_length = GRPC_SLICE_LENGTH(*slice); + while (merged_length < frame_size + 9) { // including 9 byte frame header + grpc_slice* slice = &output.slices[i++]; + merged_length += GRPC_SLICE_LENGTH(*slice); + } + + // Verifications + if (first_frame && type != GRPC_CHTTP2_FRAME_HEADER) { + gpr_log(GPR_ERROR, "expected first frame to be of type header"); + gpr_log(GPR_ERROR, "EXPECT: 0x%x", GRPC_CHTTP2_FRAME_HEADER); + gpr_log(GPR_ERROR, "GOT: 0x%x", type); + g_failure = 1; + } else if (first_frame && header_is_eof && + !(flags & GRPC_CHTTP2_DATA_FLAG_END_STREAM)) { + gpr_log(GPR_ERROR, "missing END_STREAM flag in HEADER frame"); + g_failure = 1; + } + if (is_closed && + (type == GRPC_CHTTP2_FRAME_DATA || type == GRPC_CHTTP2_FRAME_HEADER)) { + gpr_log(GPR_ERROR, + "stream is closed; new frame headers and data are not allowed"); + g_failure = 1; + } + if (end_header && (type == GRPC_CHTTP2_FRAME_HEADER || + type == GRPC_CHTTP2_FRAME_CONTINUATION)) { + gpr_log(GPR_ERROR, + "frame header is ended; new headers and continuations are not " + "allowed"); + g_failure = 1; + } + if (in_header && + (type == GRPC_CHTTP2_FRAME_DATA || type == GRPC_CHTTP2_FRAME_HEADER)) { + gpr_log(GPR_ERROR, + "parsing frame header; new headers and data are not allowed"); + g_failure = 1; + } + if (flags & ~(GRPC_CHTTP2_DATA_FLAG_END_STREAM | + GRPC_CHTTP2_DATA_FLAG_END_HEADERS)) { + gpr_log(GPR_ERROR, "unexpected frame flags: 0x%x", flags); + g_failure = 1; + } + + // Update state + if (flags & GRPC_CHTTP2_DATA_FLAG_END_HEADERS) { + in_header = false; + end_header = true; + } else if (type == GRPC_CHTTP2_DATA_FLAG_END_HEADERS) { + in_header = true; + } + if (flags & GRPC_CHTTP2_DATA_FLAG_END_STREAM) { + is_closed = true; + if (type == GRPC_CHTTP2_FRAME_CONTINUATION) { + gpr_log(GPR_ERROR, "unexpected END_STREAM flag in CONTINUATION frame"); + g_failure = 1; + } + } + } +} + /* verify that the output generated by encoding the stream matches the hexstring passed in */ static void verify(const verify_params params, const char* expected, @@ -106,6 +202,7 @@ static void verify(const verify_params params, const char* expected, &stats /* stats */ }; grpc_chttp2_encode_header(&g_compressor, nullptr, 0, &b, &hopt, &output); + verify_frames(output, params.eof); merged = grpc_slice_merge(output.slices, output.count); grpc_slice_buffer_destroy_internal(&output); grpc_metadata_batch_destroy(&b); @@ -151,6 +248,50 @@ static void test_basic_headers() { verify(params, "000004 0104 deadbeef 0f 2f 0176", 1, "a", "v"); } +static void verify_continuation_headers(const char* key, const char* value, + bool is_eof) { + grpc_slice_buffer output; + grpc_mdelem elem = grpc_mdelem_from_slices( + grpc_slice_intern(grpc_slice_from_static_string(key)), + grpc_slice_intern(grpc_slice_from_static_string(value))); + grpc_linked_mdelem* e = + static_cast(gpr_malloc(sizeof(*e))); + grpc_metadata_batch b; + grpc_metadata_batch_init(&b); + e[0].md = elem; + e[0].prev = nullptr; + e[0].next = nullptr; + b.list.head = &e[0]; + b.list.tail = &e[0]; + b.list.count = 1; + grpc_slice_buffer_init(&output); + + grpc_transport_one_way_stats stats; + stats = {}; + grpc_encode_header_options hopt = {0xdeadbeef, /* stream_id */ + is_eof, /* is_eof */ + false, /* use_true_binary_metadata */ + 150, /* max_frame_size */ + &stats /* stats */}; + grpc_chttp2_encode_header(&g_compressor, nullptr, 0, &b, &hopt, &output); + verify_frames(output, is_eof); + grpc_slice_buffer_destroy_internal(&output); + grpc_metadata_batch_destroy(&b); + gpr_free(e); +} + +static void test_continuation_headers() { + char value[200]; + memset(value, 'a', 200); + value[199] = 0; // null terminator + verify_continuation_headers("key", value, true); + + char value2[400]; + memset(value2, 'b', 400); + value2[399] = 0; // null terminator + verify_continuation_headers("key2", value2, true); +} + static void encode_int_to_str(int i, char* p) { p[0] = static_cast('a' + i % 26); i /= 26; @@ -225,6 +366,7 @@ static void verify_table_size_change_match_elem_size(const char* key, 16384, /* max_frame_size */ &stats /* stats */}; grpc_chttp2_encode_header(&g_compressor, nullptr, 0, &b, &hopt, &output); + verify_frames(output, false); grpc_slice_buffer_destroy_internal(&output); grpc_metadata_batch_destroy(&b); @@ -267,6 +409,7 @@ int main(int argc, char** argv) { TEST(test_decode_table_overflow); TEST(test_encode_header_size); TEST(test_interned_key_indexed); + TEST(test_continuation_headers); grpc_shutdown(); for (i = 0; i < num_to_delete; i++) { gpr_free(to_delete[i]); diff --git a/test/cpp/client/credentials_test.cc b/test/cpp/client/credentials_test.cc index a1a0633e1f8..7ca90f7ff68 100644 --- a/test/cpp/client/credentials_test.cc +++ b/test/cpp/client/credentials_test.cc @@ -399,8 +399,7 @@ TEST_F(CredentialsTest, TlsCredentialReloadConfigCppToC) { ssl_pair->cert_chain = gpr_strdup(test_cert_chain.c_str()); ::grpc_core::PemKeyCertPair pem_key_cert_pair = ::grpc_core::PemKeyCertPair(ssl_pair); - ::grpc_core::InlinedVector<::grpc_core::PemKeyCertPair, 1> - pem_key_cert_pair_list; + ::absl::InlinedVector<::grpc_core::PemKeyCertPair, 1> pem_key_cert_pair_list; pem_key_cert_pair_list.push_back(pem_key_cert_pair); grpc::string test_pem_root_certs = "pem_root_certs"; c_key_materials.set_key_materials(test_pem_root_certs.c_str(), @@ -417,7 +416,7 @@ TEST_F(CredentialsTest, TlsCredentialReloadConfigCppToC) { EXPECT_EQ(c_arg.cb_user_data, nullptr); EXPECT_STREQ(c_arg.key_materials_config->pem_root_certs(), "new_pem_root_certs"); - ::grpc_core::InlinedVector<::grpc_core::PemKeyCertPair, 1> pair_list = + ::absl::InlinedVector<::grpc_core::PemKeyCertPair, 1> pair_list = c_arg.key_materials_config->pem_key_cert_pair_list(); EXPECT_EQ(static_cast(pair_list.size()), 2); EXPECT_STREQ(pair_list[0].private_key(), "private_key"); @@ -625,7 +624,7 @@ TEST_F(CredentialsTest, TlsCredentialsOptionsCppToC) { EXPECT_EQ(c_credential_reload_arg.cb_user_data, nullptr); EXPECT_STREQ(c_credential_reload_arg.key_materials_config->pem_root_certs(), "new_pem_root_certs"); - ::grpc_core::InlinedVector<::grpc_core::PemKeyCertPair, 1> c_pair_list = + ::absl::InlinedVector<::grpc_core::PemKeyCertPair, 1> c_pair_list = c_credential_reload_arg.key_materials_config->pem_key_cert_pair_list(); EXPECT_EQ(static_cast(c_pair_list.size()), 2); EXPECT_STREQ(c_pair_list[0].private_key(), "private_key"); diff --git a/test/cpp/end2end/xds_end2end_test.cc b/test/cpp/end2end/xds_end2end_test.cc index 9a4befb0388..3ec43c61e72 100644 --- a/test/cpp/end2end/xds_end2end_test.cc +++ b/test/cpp/end2end/xds_end2end_test.cc @@ -17,6 +17,7 @@ */ #include +#include #include #include #include @@ -47,7 +48,6 @@ #include "src/core/ext/filters/client_channel/xds/xds_api.h" #include "src/core/lib/gpr/env.h" #include "src/core/lib/gpr/tmpfile.h" -#include "src/core/lib/gprpp/map.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/sockaddr.h" @@ -1805,7 +1805,16 @@ TEST_P(BasicTest, BackendsRestart) { WaitForAllBackends(); // Stop backends. RPCs should fail. ShutdownAllBackends(); - CheckRpcSendFailure(); + // Sending multiple failed requests instead of just one to ensure that the + // client notices that all backends are down before we restart them. If we + // didn't do this, then a single RPC could fail here due to the race condition + // between the LB pick and the GOAWAY from the chosen backend being shut down, + // which would not actually prove that the client noticed that all of the + // backends are down. Then, when we send another request below (which we + // expect to succeed), if the callbacks happen in the wrong order, the same + // race condition could happen again due to the client not yet having noticed + // that the backends were all down. + CheckRpcSendFailure(num_backends_); // Restart all backends. RPCs should start succeeding again. StartAllBackends(); CheckRpcSendOk(1, RpcOptions().set_timeout_ms(2000).set_wait_for_ready(true)); @@ -3817,9 +3826,6 @@ TEST_P(ClientLoadReportingTest, Vanilla) { EXPECT_EQ(kNumRpcsPerAddress + kNumFailuresPerAddress, backends_[i]->backend_service()->request_count()); } - // The LRS service got a single request, and sent a single response. - EXPECT_EQ(1U, balancers_[0]->lrs_service()->request_count()); - EXPECT_EQ(1U, balancers_[0]->lrs_service()->response_count()); // The load report received at the balancer should be correct. std::vector load_report = balancers_[0]->lrs_service()->WaitForLoadReport(); @@ -3834,6 +3840,9 @@ TEST_P(ClientLoadReportingTest, Vanilla) { EXPECT_EQ(kNumFailuresPerAddress * num_backends_ + num_failure, client_stats.total_error_requests()); EXPECT_EQ(0U, client_stats.total_dropped_requests()); + // The LRS service got a single request, and sent a single response. + EXPECT_EQ(1U, balancers_[0]->lrs_service()->request_count()); + EXPECT_EQ(1U, balancers_[0]->lrs_service()->response_count()); } // Tests that we don't include stats for clusters that are not requested @@ -3947,7 +3956,7 @@ class ClientLoadReportingWithDropTest : public XdsEnd2endTest { TEST_P(ClientLoadReportingWithDropTest, Vanilla) { SetNextResolution({}); SetNextResolutionForLbChannelAllBalancers(); - const size_t kNumRpcs = 3000; + const size_t kNumRpcs = 5000; const uint32_t kDropPerMillionForLb = 100000; const uint32_t kDropPerMillionForThrottle = 200000; const double kDropRateForLb = kDropPerMillionForLb / 1000000.0; diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py index 831d62ef52e..c264bf8a454 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import print_function import argparse import datetime import os @@ -129,9 +130,9 @@ assert (re.search(RE_LICENSE['Makefile'], load('Makefile'))) def log(cond, why, filename): if not cond: return if args.output == 'details': - print '%s: %s' % (why, filename) + print('%s: %s' % (why, filename)) else: - print filename + print(filename) # scan files, validate the text diff --git a/tools/dockerfile/interoptest/grpc_interop_php/build_interop.sh b/tools/dockerfile/interoptest/grpc_interop_php/build_interop.sh index 8f9a7c3d09e..bce6c12f280 100755 --- a/tools/dockerfile/interoptest/grpc_interop_php/build_interop.sh +++ b/tools/dockerfile/interoptest/grpc_interop_php/build_interop.sh @@ -40,9 +40,11 @@ cd src/php DONE=0 for ((i = 0; i < 5; i++)); do - php -d extension=ext/grpc/modules/grpc.so /usr/local/bin/composer install && DONE=1 - [[ "$DONE" == 1 ]] && break + php -d extension=ext/grpc/modules/grpc.so /usr/local/bin/composer install && DONE=1 && break done -[[ "$DONE" != 1 ]] && echo "Failed to do composer install" && exit 1 -./bin/generate_proto_php.sh +if [ "$DONE" != "1" ] +then + echo "Failed to do composer install" + exit 1 +fi diff --git a/tools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh b/tools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh index 7de17550df2..26a49be6300 100755 --- a/tools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh +++ b/tools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh @@ -40,9 +40,11 @@ cd src/php DONE=0 for ((i = 0; i < 5; i++)); do - php -d extension=ext/grpc/modules/grpc.so /usr/local/bin/composer install && DONE=1 - [[ "$DONE" == 1 ]] && break + php -d extension=ext/grpc/modules/grpc.so /usr/local/bin/composer install && DONE=1 && break done -[[ "$DONE" != 1 ]] && echo "Failed to do composer install" && exit 1 -./bin/generate_proto_php.sh +if [ "$DONE" != "1" ] +then + echo "Failed to do composer install" + exit 1 +fi diff --git a/tools/dockerfile/push_testing_images.sh b/tools/dockerfile/push_testing_images.sh index 2e0841a4db5..7d2068edbe1 100755 --- a/tools/dockerfile/push_testing_images.sh +++ b/tools/dockerfile/push_testing_images.sh @@ -36,14 +36,15 @@ do # contents of the docker image always changes the SHA (e.g. using "ADD file" # cmd in the dockerfile in not ok as contents of the added file will not be # reflected in the SHA). - DOCKER_IMAGE_NAME=$(basename $DOCKERFILE_DIR)_$(sha1sum $DOCKERFILE_DIR/Dockerfile | cut -f1 -d\ ) + DOCKER_IMAGE_NAME=$(basename $DOCKERFILE_DIR) + DOCKER_IMAGE_TAG=$(sha1sum $DOCKERFILE_DIR/Dockerfile | cut -f1 -d\ ) # skip the image if it already exists in the repo - curl --silent -f -lSL https://registry.hub.docker.com/v2/repositories/${DOCKERHUB_ORGANIZATION}/${DOCKER_IMAGE_NAME}/tags/latest > /dev/null \ + curl --silent -f -lSL https://registry.hub.docker.com/v2/repositories/${DOCKERHUB_ORGANIZATION}/${DOCKER_IMAGE_NAME}/tags/${DOCKER_IMAGE_TAG} > /dev/null \ && continue - docker build -t ${DOCKERHUB_ORGANIZATION}/${DOCKER_IMAGE_NAME} ${DOCKERFILE_DIR} - + docker build -t ${DOCKERHUB_ORGANIZATION}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} ${DOCKERFILE_DIR} + # "docker login" needs to be run in advance - docker push ${DOCKERHUB_ORGANIZATION}/${DOCKER_IMAGE_NAME} + docker push ${DOCKERHUB_ORGANIZATION}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} done diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index c00bec03dcb..36a25781429 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1495,13 +1495,10 @@ src/core/lib/gprpp/global_config_env.h \ src/core/lib/gprpp/global_config_generic.h \ src/core/lib/gprpp/host_port.cc \ src/core/lib/gprpp/host_port.h \ -src/core/lib/gprpp/inlined_vector.h \ src/core/lib/gprpp/manual_constructor.h \ -src/core/lib/gprpp/map.h \ src/core/lib/gprpp/memory.h \ src/core/lib/gprpp/mpscq.cc \ src/core/lib/gprpp/mpscq.h \ -src/core/lib/gprpp/optional.h \ src/core/lib/gprpp/orphanable.h \ src/core/lib/gprpp/ref_counted.h \ src/core/lib/gprpp/ref_counted_ptr.h \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index fd50700de67..dbbf9104c61 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1306,13 +1306,10 @@ src/core/lib/gprpp/global_config_env.h \ src/core/lib/gprpp/global_config_generic.h \ src/core/lib/gprpp/host_port.cc \ src/core/lib/gprpp/host_port.h \ -src/core/lib/gprpp/inlined_vector.h \ src/core/lib/gprpp/manual_constructor.h \ -src/core/lib/gprpp/map.h \ src/core/lib/gprpp/memory.h \ src/core/lib/gprpp/mpscq.cc \ src/core/lib/gprpp/mpscq.h \ -src/core/lib/gprpp/optional.h \ src/core/lib/gprpp/orphanable.h \ src/core/lib/gprpp/ref_counted.h \ src/core/lib/gprpp/ref_counted_ptr.h \ diff --git a/tools/run_tests/dockerize/build_and_run_docker.sh b/tools/run_tests/dockerize/build_and_run_docker.sh index a5ef4284be7..7e9bc7744eb 100755 --- a/tools/run_tests/dockerize/build_and_run_docker.sh +++ b/tools/run_tests/dockerize/build_and_run_docker.sh @@ -33,7 +33,7 @@ cd - # $@ - Extra args to pass to docker run # Use image name based on Dockerfile location checksum -DOCKER_IMAGE_NAME=$(basename "$DOCKERFILE_DIR")_$(sha1sum "$DOCKERFILE_DIR/Dockerfile" | cut -f1 -d\ ) +DOCKER_IMAGE_NAME=$(basename "$DOCKERFILE_DIR"):$(sha1sum "$DOCKERFILE_DIR/Dockerfile" | cut -f1 -d\ ) # Pull the base image to force an update if [ "$DOCKER_BASE_IMAGE" != "" ] diff --git a/tools/run_tests/dockerize/build_docker_and_run_tests.sh b/tools/run_tests/dockerize/build_docker_and_run_tests.sh index aeaae3f9a2b..4a7908b0462 100755 --- a/tools/run_tests/dockerize/build_docker_and_run_tests.sh +++ b/tools/run_tests/dockerize/build_docker_and_run_tests.sh @@ -30,7 +30,7 @@ cd - # DOCKERHUB_ORGANIZATION - If set, pull a prebuilt image from given dockerhub org. # Use image name based on Dockerfile location checksum -DOCKER_IMAGE_NAME=$(basename "$DOCKERFILE_DIR")_$(sha1sum "$DOCKERFILE_DIR/Dockerfile" | cut -f1 -d\ ) +DOCKER_IMAGE_NAME=$(basename "$DOCKERFILE_DIR"):$(sha1sum "$DOCKERFILE_DIR/Dockerfile" | cut -f1 -d\ ) if [ "$DOCKERHUB_ORGANIZATION" != "" ] then diff --git a/tools/run_tests/dockerize/build_interop_image.sh b/tools/run_tests/dockerize/build_interop_image.sh index 9516c5ade26..5b5bfb65982 100755 --- a/tools/run_tests/dockerize/build_interop_image.sh +++ b/tools/run_tests/dockerize/build_interop_image.sh @@ -84,9 +84,9 @@ fi # on OSX use md5 instead of sha1sum if command -v sha1sum > /dev/null; then - BASE_IMAGE=${BASE_NAME}_$(sha1sum "tools/dockerfile/interoptest/$BASE_NAME/Dockerfile" | cut -f1 -d\ ) + BASE_IMAGE=${BASE_NAME}:$(sha1sum "tools/dockerfile/interoptest/$BASE_NAME/Dockerfile" | cut -f1 -d\ ) else - BASE_IMAGE=${BASE_NAME}_$(md5 -r "tools/dockerfile/interoptest/$BASE_NAME/Dockerfile" | cut -f1 -d\ ) + BASE_IMAGE=${BASE_NAME}:$(md5 -r "tools/dockerfile/interoptest/$BASE_NAME/Dockerfile" | cut -f1 -d\ ) fi if [ "$DOCKERHUB_ORGANIZATION" != "" ] diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index b09efd61926..ab8760486a7 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -4931,30 +4931,6 @@ ], "uses_polling": true }, - { - "args": [], - "benchmark": false, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "gtest": true, - "language": "c++", - "name": "optional_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "uses_polling": true - }, { "args": [], "benchmark": false, diff --git a/tools/run_tests/run_build_statistics.py b/tools/run_tests/run_build_statistics.py deleted file mode 100755 index d88f3db2817..00000000000 --- a/tools/run_tests/run_build_statistics.py +++ /dev/null @@ -1,250 +0,0 @@ -#!/usr/bin/env python -# Copyright 2016 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. -"""Tool to get build statistics from Jenkins and upload to BigQuery.""" - -from __future__ import print_function - -import argparse -import jenkinsapi -from jenkinsapi.custom_exceptions import JenkinsAPIException -from jenkinsapi.jenkins import Jenkins -import json -import os -import re -import sys -import urllib - -gcp_utils_dir = os.path.abspath( - os.path.join(os.path.dirname(__file__), '../gcp/utils')) -sys.path.append(gcp_utils_dir) -import big_query_utils - -_PROJECT_ID = 'grpc-testing' -_HAS_MATRIX = True -_BUILDS = { - 'gRPC_interop_master': not _HAS_MATRIX, - 'gRPC_master_linux': not _HAS_MATRIX, - 'gRPC_master_macos': not _HAS_MATRIX, - 'gRPC_master_windows': not _HAS_MATRIX, - 'gRPC_performance_master': not _HAS_MATRIX, - 'gRPC_portability_master_linux': not _HAS_MATRIX, - 'gRPC_portability_master_windows': not _HAS_MATRIX, - 'gRPC_master_asanitizer_c': not _HAS_MATRIX, - 'gRPC_master_asanitizer_cpp': not _HAS_MATRIX, - 'gRPC_master_msan_c': not _HAS_MATRIX, - 'gRPC_master_tsanitizer_c': not _HAS_MATRIX, - 'gRPC_master_tsan_cpp': not _HAS_MATRIX, - 'gRPC_interop_pull_requests': not _HAS_MATRIX, - 'gRPC_performance_pull_requests': not _HAS_MATRIX, - 'gRPC_portability_pull_requests_linux': not _HAS_MATRIX, - 'gRPC_portability_pr_win': not _HAS_MATRIX, - 'gRPC_pull_requests_linux': not _HAS_MATRIX, - 'gRPC_pull_requests_macos': not _HAS_MATRIX, - 'gRPC_pr_win': not _HAS_MATRIX, - 'gRPC_pull_requests_asan_c': not _HAS_MATRIX, - 'gRPC_pull_requests_asan_cpp': not _HAS_MATRIX, - 'gRPC_pull_requests_msan_c': not _HAS_MATRIX, - 'gRPC_pull_requests_tsan_c': not _HAS_MATRIX, - 'gRPC_pull_requests_tsan_cpp': not _HAS_MATRIX, -} -_URL_BASE = 'https://grpc-testing.appspot.com/job' - -# This is a dynamic list where known and active issues should be added. -# Fixed ones should be removed. -# Also try not to add multiple messages from the same failure. -_KNOWN_ERRORS = [ - 'Failed to build workspace Tests with scheme AllTests', - 'Build timed out', - 'TIMEOUT: tools/run_tests/pre_build_node.sh', - 'TIMEOUT: tools/run_tests/pre_build_ruby.sh', - 'FATAL: Unable to produce a script file', - 'FAILED: build_docker_c\+\+', - 'cannot find package \"cloud.google.com/go/compute/metadata\"', - 'LLVM ERROR: IO failure on output stream.', - 'MSBUILD : error MSB1009: Project file does not exist.', - 'fatal: git fetch_pack: expected ACK/NAK', - 'Failed to fetch from http://github.com/grpc/grpc.git', - ('hudson.remoting.RemotingSystemException: java.io.IOException: ' - 'Backing channel is disconnected.'), - 'hudson.remoting.ChannelClosedException', - 'Could not initialize class hudson.Util', - 'Too many open files in system', - 'FAILED: bins/tsan/qps_openloop_test GRPC_POLL_STRATEGY=epoll', - 'FAILED: bins/tsan/qps_openloop_test GRPC_POLL_STRATEGY=legacy', - 'FAILED: bins/tsan/qps_openloop_test GRPC_POLL_STRATEGY=poll', - ('tests.bins/asan/h2_proxy_test streaming_error_response ' - 'GRPC_POLL_STRATEGY=legacy'), - 'hudson.plugins.git.GitException', - 'Couldn\'t find any revision to build', - 'org.jenkinsci.plugin.Diskcheck.preCheckout', - 'Something went wrong while deleting Files', -] -_NO_REPORT_FILES_FOUND_ERROR = 'No test report files were found.' -_UNKNOWN_ERROR = 'Unknown error' -_DATASET_ID = 'build_statistics' - - -def _scrape_for_known_errors(html): - error_list = [] - for known_error in _KNOWN_ERRORS: - errors = re.findall(known_error, html) - this_error_count = len(errors) - if this_error_count > 0: - error_list.append({ - 'description': known_error, - 'count': this_error_count - }) - print('====> %d failures due to %s' % - (this_error_count, known_error)) - return error_list - - -def _no_report_files_found(html): - return _NO_REPORT_FILES_FOUND_ERROR in html - - -def _get_last_processed_buildnumber(build_name): - query = 'SELECT max(build_number) FROM [%s:%s.%s];' % ( - _PROJECT_ID, _DATASET_ID, build_name) - query_job = big_query_utils.sync_query_job(bq, _PROJECT_ID, query) - page = bq.jobs().getQueryResults( - pageToken=None, **query_job['jobReference']).execute(num_retries=3) - if page['rows'][0]['f'][0]['v']: - return int(page['rows'][0]['f'][0]['v']) - return 0 - - -def _process_matrix(build, url_base): - matrix_list = [] - for matrix in build.get_matrix_runs(): - matrix_str = re.match('.*\\xc2\\xbb ((?:[^,]+,?)+) #.*', - matrix.name).groups()[0] - matrix_tuple = matrix_str.split(',') - json_url = '%s/config=%s,language=%s,platform=%s/testReport/api/json' % ( - url_base, matrix_tuple[0], matrix_tuple[1], matrix_tuple[2]) - console_url = '%s/config=%s,language=%s,platform=%s/consoleFull' % ( - url_base, matrix_tuple[0], matrix_tuple[1], matrix_tuple[2]) - matrix_dict = { - 'name': matrix_str, - 'duration': matrix.get_duration().total_seconds() - } - matrix_dict.update(_process_build(json_url, console_url)) - matrix_list.append(matrix_dict) - - return matrix_list - - -def _process_build(json_url, console_url): - build_result = {} - error_list = [] - try: - html = urllib.urlopen(json_url).read() - test_result = json.loads(html) - print('====> Parsing result from %s' % json_url) - failure_count = test_result['failCount'] - build_result['pass_count'] = test_result['passCount'] - build_result['failure_count'] = failure_count - # This means Jenkins failure occurred. - build_result['no_report_files_found'] = _no_report_files_found(html) - # Only check errors if Jenkins failure occurred. - if build_result['no_report_files_found']: - error_list = _scrape_for_known_errors(html) - except Exception as e: - print('====> Got exception for %s: %s.' % (json_url, str(e))) - print('====> Parsing errors from %s.' % console_url) - html = urllib.urlopen(console_url).read() - build_result['pass_count'] = 0 - build_result['failure_count'] = 1 - # In this case, the string doesn't exist in the result html but the fact - # that we fail to parse the result html indicates Jenkins failure and hence - # no report files were generated. - build_result['no_report_files_found'] = True - error_list = _scrape_for_known_errors(html) - - if error_list: - build_result['error'] = error_list - elif build_result['no_report_files_found']: - build_result['error'] = [{'description': _UNKNOWN_ERROR, 'count': 1}] - else: - build_result['error'] = [{'description': '', 'count': 0}] - - return build_result - - -# parse command line -argp = argparse.ArgumentParser(description='Get build statistics.') -argp.add_argument('-u', '--username', default='jenkins') -argp.add_argument('-b', - '--builds', - choices=['all'] + sorted(_BUILDS.keys()), - nargs='+', - default=['all']) -args = argp.parse_args() - -J = Jenkins('https://grpc-testing.appspot.com', args.username, 'apiToken') -bq = big_query_utils.create_big_query() - -for build_name in _BUILDS.keys() if 'all' in args.builds else args.builds: - print('====> Build: %s' % build_name) - # Since get_last_completed_build() always fails due to malformatted string - # error, we use get_build_metadata() instead. - job = None - try: - job = J[build_name] - except Exception as e: - print('====> Failed to get build %s: %s.' % (build_name, str(e))) - continue - last_processed_build_number = _get_last_processed_buildnumber(build_name) - last_complete_build_number = job.get_last_completed_buildnumber() - # To avoid processing all builds for a project never looked at. In this case, - # only examine 10 latest builds. - starting_build_number = max(last_processed_build_number + 1, - last_complete_build_number - 9) - for build_number in xrange(starting_build_number, - last_complete_build_number + 1): - print('====> Processing %s build %d.' % (build_name, build_number)) - build = None - try: - build = job.get_build_metadata(build_number) - print('====> Build status: %s.' % build.get_status()) - if build.get_status() == 'ABORTED': - continue - # If any build is still running, stop processing this job. Next time, we - # start from where it was left so that all builds are processed - # sequentially. - if build.is_running(): - print('====> Build %d is still running.' % build_number) - break - except KeyError: - print('====> Build %s is missing. Skip.' % build_number) - continue - build_result = { - 'build_number': build_number, - 'timestamp': str(build.get_timestamp()) - } - url_base = json_url = '%s/%s/%d' % (_URL_BASE, build_name, build_number) - if _BUILDS[build_name]: # The build has matrix, such as gRPC_master. - build_result['matrix'] = _process_matrix(build, url_base) - else: - json_url = '%s/testReport/api/json' % url_base - console_url = '%s/consoleFull' % url_base - build_result['duration'] = build.get_duration().total_seconds() - build_stat = _process_build(json_url, console_url) - build_result.update(build_stat) - rows = [big_query_utils.make_row(build_number, build_result)] - if not big_query_utils.insert_rows(bq, _PROJECT_ID, _DATASET_ID, - build_name, rows): - print('====> Error uploading result to bigquery.') - sys.exit(1)