diff --git a/BUILD b/BUILD index 4763bc0abd7..bad6f3f0755 100644 --- a/BUILD +++ b/BUILD @@ -1652,6 +1652,8 @@ cc_library( "src/compiler/node_generator_helpers.h", "src/compiler/objective_c_generator.h", "src/compiler/objective_c_generator_helpers.h", + "src/compiler/php_generator.h", + "src/compiler/php_generator_helpers.h", "src/compiler/python_generator.h", "src/compiler/ruby_generator.h", "src/compiler/ruby_generator_helpers-inl.h", @@ -1661,6 +1663,7 @@ cc_library( "src/compiler/csharp_generator.cc", "src/compiler/node_generator.cc", "src/compiler/objective_c_generator.cc", + "src/compiler/php_generator.cc", "src/compiler/python_generator.cc", "src/compiler/ruby_generator.cc", ], @@ -2259,6 +2262,18 @@ cc_binary( ) +cc_binary( + name = "grpc_php_plugin", + srcs = [ + "src/compiler/php_plugin.cc", + ], + deps = [ + "//external:protobuf_compiler", + ":grpc_plugin_support", + ], +) + + cc_binary( name = "grpc_python_plugin", srcs = [ diff --git a/CMakeLists.txt b/CMakeLists.txt index 97cedbe449b..c4191521bd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1430,6 +1430,7 @@ add_library(grpc_plugin_support src/compiler/csharp_generator.cc src/compiler/node_generator.cc src/compiler/objective_c_generator.cc + src/compiler/php_generator.cc src/compiler/python_generator.cc src/compiler/ruby_generator.cc ) @@ -1770,6 +1771,34 @@ if (gRPC_INSTALL) endif() +add_executable(grpc_php_plugin + src/compiler/php_plugin.cc +) + +target_include_directories(grpc_php_plugin + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${BORINGSSL_ROOT_DIR}/include + PRIVATE ${PROTOBUF_ROOT_DIR}/src + PRIVATE ${ZLIB_ROOT_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib +) + +target_link_libraries(grpc_php_plugin + ${_gRPC_PROTOBUF_PROTOC_LIBRARIES} + grpc_plugin_support +) + + +if (gRPC_INSTALL) + install(TARGETS grpc_php_plugin EXPORT gRPCTargets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) +endif() + + add_executable(grpc_python_plugin src/compiler/python_plugin.cc ) diff --git a/Makefile b/Makefile index fc0c38f3c7f..62c65822b0f 100644 --- a/Makefile +++ b/Makefile @@ -732,7 +732,7 @@ PC_LIBS_GRPCXX = CPPFLAGS := -Ithird_party/googletest/include $(CPPFLAGS) -PROTOC_PLUGINS_ALL = $(BINDIR)/$(CONFIG)/grpc_cpp_plugin $(BINDIR)/$(CONFIG)/grpc_csharp_plugin $(BINDIR)/$(CONFIG)/grpc_node_plugin $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin $(BINDIR)/$(CONFIG)/grpc_python_plugin $(BINDIR)/$(CONFIG)/grpc_ruby_plugin +PROTOC_PLUGINS_ALL = $(BINDIR)/$(CONFIG)/grpc_cpp_plugin $(BINDIR)/$(CONFIG)/grpc_csharp_plugin $(BINDIR)/$(CONFIG)/grpc_node_plugin $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin $(BINDIR)/$(CONFIG)/grpc_php_plugin $(BINDIR)/$(CONFIG)/grpc_python_plugin $(BINDIR)/$(CONFIG)/grpc_ruby_plugin PROTOC_PLUGINS_DIR = $(BINDIR)/$(CONFIG) ifeq ($(HAS_SYSTEM_PROTOBUF),true) @@ -919,6 +919,7 @@ client_fuzzer: $(BINDIR)/$(CONFIG)/client_fuzzer combiner_test: $(BINDIR)/$(CONFIG)/combiner_test compression_test: $(BINDIR)/$(CONFIG)/compression_test concurrent_connectivity_test: $(BINDIR)/$(CONFIG)/concurrent_connectivity_test +connection_refused_test: $(BINDIR)/$(CONFIG)/connection_refused_test dns_resolver_connectivity_test: $(BINDIR)/$(CONFIG)/dns_resolver_connectivity_test dns_resolver_test: $(BINDIR)/$(CONFIG)/dns_resolver_test dualstack_socket_test: $(BINDIR)/$(CONFIG)/dualstack_socket_test @@ -1047,6 +1048,7 @@ grpc_cpp_plugin: $(BINDIR)/$(CONFIG)/grpc_cpp_plugin grpc_csharp_plugin: $(BINDIR)/$(CONFIG)/grpc_csharp_plugin grpc_node_plugin: $(BINDIR)/$(CONFIG)/grpc_node_plugin grpc_objective_c_plugin: $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin +grpc_php_plugin: $(BINDIR)/$(CONFIG)/grpc_php_plugin grpc_python_plugin: $(BINDIR)/$(CONFIG)/grpc_python_plugin grpc_ruby_plugin: $(BINDIR)/$(CONFIG)/grpc_ruby_plugin grpc_tool_test: $(BINDIR)/$(CONFIG)/grpc_tool_test @@ -1249,6 +1251,7 @@ buildtests_c: privatelibs_c \ $(BINDIR)/$(CONFIG)/combiner_test \ $(BINDIR)/$(CONFIG)/compression_test \ $(BINDIR)/$(CONFIG)/concurrent_connectivity_test \ + $(BINDIR)/$(CONFIG)/connection_refused_test \ $(BINDIR)/$(CONFIG)/dns_resolver_connectivity_test \ $(BINDIR)/$(CONFIG)/dns_resolver_test \ $(BINDIR)/$(CONFIG)/dualstack_socket_test \ @@ -1575,6 +1578,8 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/compression_test || ( echo test compression_test failed ; exit 1 ) $(E) "[RUN] Testing concurrent_connectivity_test" $(Q) $(BINDIR)/$(CONFIG)/concurrent_connectivity_test || ( echo test concurrent_connectivity_test failed ; exit 1 ) + $(E) "[RUN] Testing connection_refused_test" + $(Q) $(BINDIR)/$(CONFIG)/connection_refused_test || ( echo test connection_refused_test failed ; exit 1 ) $(E) "[RUN] Testing dns_resolver_connectivity_test" $(Q) $(BINDIR)/$(CONFIG)/dns_resolver_connectivity_test || ( echo test dns_resolver_connectivity_test failed ; exit 1 ) $(E) "[RUN] Testing dns_resolver_test" @@ -2343,6 +2348,8 @@ else $(Q) $(INSTALL) -d $(prefix)/bin $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin $(prefix)/bin/grpc_objective_c_plugin $(Q) $(INSTALL) -d $(prefix)/bin + $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_php_plugin $(prefix)/bin/grpc_php_plugin + $(Q) $(INSTALL) -d $(prefix)/bin $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_python_plugin $(prefix)/bin/grpc_python_plugin $(Q) $(INSTALL) -d $(prefix)/bin $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_ruby_plugin $(prefix)/bin/grpc_ruby_plugin @@ -4343,6 +4350,7 @@ LIBGRPC_PLUGIN_SUPPORT_SRC = \ src/compiler/csharp_generator.cc \ src/compiler/node_generator.cc \ src/compiler/objective_c_generator.cc \ + src/compiler/php_generator.cc \ src/compiler/python_generator.cc \ src/compiler/ruby_generator.cc \ @@ -7357,6 +7365,38 @@ endif endif +CONNECTION_REFUSED_TEST_SRC = \ + test/core/end2end/connection_refused_test.c \ + +CONNECTION_REFUSED_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(CONNECTION_REFUSED_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/connection_refused_test: openssl_dep_error + +else + + + +$(BINDIR)/$(CONFIG)/connection_refused_test: $(CONNECTION_REFUSED_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(CONNECTION_REFUSED_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/connection_refused_test + +endif + +$(OBJDIR)/$(CONFIG)/test/core/end2end/connection_refused_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_connection_refused_test: $(CONNECTION_REFUSED_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(CONNECTION_REFUSED_TEST_OBJS:.o=.dep) +endif +endif + + DNS_RESOLVER_CONNECTIVITY_TEST_SRC = \ test/core/client_config/resolvers/dns_resolver_connectivity_test.c \ @@ -11698,6 +11738,37 @@ ifneq ($(NO_DEPS),true) endif +GRPC_PHP_PLUGIN_SRC = \ + src/compiler/php_plugin.cc \ + +GRPC_PHP_PLUGIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_PHP_PLUGIN_SRC)))) + + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. + +$(BINDIR)/$(CONFIG)/grpc_php_plugin: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/grpc_php_plugin: $(PROTOBUF_DEP) $(GRPC_PHP_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a + $(E) "[HOSTLD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_PHP_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_php_plugin + +endif + +$(OBJDIR)/$(CONFIG)/src/compiler/php_plugin.o: $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a + +deps_grpc_php_plugin: $(GRPC_PHP_PLUGIN_OBJS:.o=.dep) + +ifneq ($(NO_DEPS),true) +-include $(GRPC_PHP_PLUGIN_OBJS:.o=.dep) +endif + + GRPC_PYTHON_PLUGIN_SRC = \ src/compiler/python_plugin.cc \ diff --git a/build.yaml b/build.yaml index 9e8b4c33043..7a70f0dabe6 100644 --- a/build.yaml +++ b/build.yaml @@ -1112,6 +1112,8 @@ libs: - src/compiler/node_generator_helpers.h - src/compiler/objective_c_generator.h - src/compiler/objective_c_generator_helpers.h + - src/compiler/php_generator.h + - src/compiler/php_generator_helpers.h - src/compiler/python_generator.h - src/compiler/ruby_generator.h - src/compiler/ruby_generator_helpers-inl.h @@ -1122,6 +1124,7 @@ libs: - src/compiler/csharp_generator.cc - src/compiler/node_generator.cc - src/compiler/objective_c_generator.cc + - src/compiler/php_generator.cc - src/compiler/python_generator.cc - src/compiler/ruby_generator.cc filegroups: @@ -1463,6 +1466,17 @@ targets: - grpc - gpr_test_util - gpr +- name: connection_refused_test + cpu_cost: 0.1 + build: test + language: c + src: + - test/core/end2end/connection_refused_test.c + deps: + - grpc_test_util + - grpc + - gpr_test_util + - gpr - name: dns_resolver_connectivity_test cpu_cost: 0.1 build: test @@ -2861,6 +2875,15 @@ targets: secure: false vs_config_type: Application vs_project_guid: '{19564640-CEE6-4921-ABA5-676ED79A36F6}' +- name: grpc_php_plugin + build: protoc + language: c++ + src: + - src/compiler/php_plugin.cc + deps: + - grpc_plugin_support + secure: false + vs_config_type: Application - name: grpc_python_plugin build: protoc language: c++ diff --git a/composer.json b/composer.json index 78366208edb..c5c7ae81d88 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "license": "BSD-3-Clause", "require": { "php": ">=5.5.0", - "stanley-cheung/protobuf-php": "v0.6" + "google/protobuf": "v3.1.0-alpha-1" }, "require-dev": { "google/auth": "v0.9" diff --git a/doc/PROTOCOL-HTTP2.md b/doc/PROTOCOL-HTTP2.md index df7585d6099..18803f2a097 100644 --- a/doc/PROTOCOL-HTTP2.md +++ b/doc/PROTOCOL-HTTP2.md @@ -175,6 +175,16 @@ grpc-ruby/1.2.3 grpc-ruby-jruby/1.3.4 grpc-java-android/0.9.1 (gingerbread/1.2.4; nexus5; tmobile) ``` + +####Idempotency and Retries + +Unless explicitly defined to be, gRPC Calls are not assumed to be idempotent. Specifically: + +* Calls that cannot be proven to have started will not be retried. +* There is no mechanisim for duplicate suppression as it is not necessary. +* Calls that are marked as idempotent may be sent multiple times. + + ####HTTP2 Transport Mapping #####Stream Identification diff --git a/doc/environment_variables.md b/doc/environment_variables.md new file mode 100644 index 00000000000..74b7862c7df --- /dev/null +++ b/doc/environment_variables.md @@ -0,0 +1,67 @@ +gRPC environment variables +-------------------------- + +gRPC C core based implementations (those contained in this repository) expose +some configuration as environment variables that can be set. + +* GRPC_ABORT_ON_LEAKS + A debugging aid to cause a call to abort() when gRPC objects are leaked past + grpc_shutdown(). Set to 1 to cause the abort, if unset or 0 it does not + abort the process. + +* GOOGLE_APPLICATION_CREDENTIALS + The path to find the credentials to use when Google credentials are created + +* GRPC_SSL_CIPHER_SUITES + A colon separated list of cipher suites to use with OpenSSL + Defaults to: + ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-GCM-SHA384 + +* GRPC_DEFAULT_SSL_ROOTS_FILE_PATH + PEM file to load SSL roots from + +* GRPC_POLL_STRATEGY [posix-style environments only] + Declares which polling engines to try when starting gRPC. + This is a comma-separated list of engines, which are tried in priority order + first -> last. + Available polling engines include: + - epoll (linux-only) - a polling engine based around the epoll family of + system calls + - poll - a portable polling engine based around poll(), intended to be a + fallback engine when nothing better exists + - legacy - the (deprecated) original polling engine for gRPC + +* GRPC_TRACE + A comma separated list of tracers that provide additional insight into how + gRPC C core is processing requests via debug logs. Available tracers include: + - api - traces api calls to the C core + - channel - traces operations on the C core channel stack + - combiner - traces combiner lock state + - compression - traces compression operations + - connectivity_state - traces connectivity state changes to channels + - channel_stack_builder - traces information about channel stacks being built + - http - traces state in the http2 transport engine + - http1 - traces HTTP/1.x operations performed by gRPC + - flowctl - traces http2 flow control + - op_failure - traces error information when failure is pushed onto a + completion queue + - pending_tags - [debug builds only] traces still-in-progress tags on + completion queues + - round_robin - traces the round_robin load balancing policy + - glb - traces the grpclb load balancer + - queue_pluck + - queue_timeout + - secure_endpoint - traces bytes flowing through encrypted channels + - transport_security - traces metadata about secure channel establishment + - tcp - traces bytes in and out of a channel + 'all' can additionally be used to turn all traces on. + Individual traces can be disabled by prefixing them with '-'. + Example: + export GRPC_TRACE=all,-pending_tags + +* GRPC_VERBOSITY + Default gRPC logging verbosity - one of: + - DEBUG - log all gRPC messages + - INFO - log INFO and ERROR message + - ERROR - log only errors + diff --git a/examples/node/static_codegen/greeter_client.js b/examples/node/static_codegen/greeter_client.js index da80cf34d8e..9b93e003a5c 100644 --- a/examples/node/static_codegen/greeter_client.js +++ b/examples/node/static_codegen/greeter_client.js @@ -39,13 +39,13 @@ var grpc = require('grpc'); function main() { var client = new services.GreeterClient('localhost:50051', grpc.credentials.createInsecure()); + var request = new messages.HelloRequest(); var user; if (process.argv.length >= 3) { user = process.argv[2]; } else { user = 'world'; } - var request = new messages.HelloRequest(); request.setName(user); client.sayHello(request, function(err, response) { console.log('Greeting:', response.getMessage()); diff --git a/include/grpc++/ext/reflection.pb.h b/include/grpc++/ext/reflection.pb.h index caa1592424a..6e645af10e5 100644 --- a/include/grpc++/ext/reflection.pb.h +++ b/include/grpc++/ext/reflection.pb.h @@ -42,12 +42,12 @@ #include -#if GOOGLE_PROTOBUF_VERSION < 3000000 +#if GOOGLE_PROTOBUF_VERSION < 3001000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3000000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3001000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -69,6 +69,7 @@ namespace v1alpha { // Internal implementation detail -- do not call these. void protobuf_AddDesc_reflection_2eproto(); +void protobuf_InitDefaults_reflection_2eproto(); void protobuf_AssignDesc_reflection_2eproto(); void protobuf_ShutdownFile_reflection_2eproto(); @@ -107,6 +108,8 @@ class ServerReflectionRequest : public ::google::protobuf::Message /* @@protoc_i MESSAGE_REQUEST_NOT_SET = 0, }; + static const ServerReflectionRequest* internal_default_instance(); + void Swap(ServerReflectionRequest* other); // implements Message ---------------------------------------------- @@ -121,7 +124,7 @@ class ServerReflectionRequest : public ::google::protobuf::Message /* @@protoc_i void Clear(); bool IsInitialized() const; - int ByteSize() const; + size_t ByteSizeLong() const; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( @@ -137,6 +140,7 @@ class ServerReflectionRequest : public ::google::protobuf::Message /* @@protoc_i void SharedDtor(); void SetCachedSize(int size) const; void InternalSwap(ServerReflectionRequest* other); + void UnsafeMergeFrom(const ServerReflectionRequest& from); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); @@ -242,7 +246,6 @@ class ServerReflectionRequest : public ::google::protobuf::Message /* @@protoc_i inline void clear_has_message_request(); ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - bool _is_default_instance_; ::google::protobuf::internal::ArenaStringPtr host_; union MessageRequestUnion { MessageRequestUnion() {} @@ -255,13 +258,15 @@ class ServerReflectionRequest : public ::google::protobuf::Message /* @@protoc_i mutable int _cached_size_; ::google::protobuf::uint32 _oneof_case_[1]; - friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_InitDefaults_reflection_2eproto_impl(); + friend void protobuf_AddDesc_reflection_2eproto_impl(); friend void protobuf_AssignDesc_reflection_2eproto(); friend void protobuf_ShutdownFile_reflection_2eproto(); void InitAsDefaultInstance(); - static ServerReflectionRequest* default_instance_; }; +extern ::google::protobuf::internal::ExplicitlyConstructed ServerReflectionRequest_default_instance_; + // ------------------------------------------------------------------- class ExtensionRequest : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:grpc.reflection.v1alpha.ExtensionRequest) */ { @@ -279,6 +284,8 @@ class ExtensionRequest : public ::google::protobuf::Message /* @@protoc_insertio static const ::google::protobuf::Descriptor* descriptor(); static const ExtensionRequest& default_instance(); + static const ExtensionRequest* internal_default_instance(); + void Swap(ExtensionRequest* other); // implements Message ---------------------------------------------- @@ -293,7 +300,7 @@ class ExtensionRequest : public ::google::protobuf::Message /* @@protoc_insertio void Clear(); bool IsInitialized() const; - int ByteSize() const; + size_t ByteSizeLong() const; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( @@ -309,6 +316,7 @@ class ExtensionRequest : public ::google::protobuf::Message /* @@protoc_insertio void SharedDtor(); void SetCachedSize(int size) const; void InternalSwap(ExtensionRequest* other); + void UnsafeMergeFrom(const ExtensionRequest& from); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); @@ -345,17 +353,18 @@ class ExtensionRequest : public ::google::protobuf::Message /* @@protoc_insertio private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - bool _is_default_instance_; ::google::protobuf::internal::ArenaStringPtr containing_type_; ::google::protobuf::int32 extension_number_; mutable int _cached_size_; - friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_InitDefaults_reflection_2eproto_impl(); + friend void protobuf_AddDesc_reflection_2eproto_impl(); friend void protobuf_AssignDesc_reflection_2eproto(); friend void protobuf_ShutdownFile_reflection_2eproto(); void InitAsDefaultInstance(); - static ExtensionRequest* default_instance_; }; +extern ::google::protobuf::internal::ExplicitlyConstructed ExtensionRequest_default_instance_; + // ------------------------------------------------------------------- class ServerReflectionResponse : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:grpc.reflection.v1alpha.ServerReflectionResponse) */ { @@ -381,6 +390,8 @@ class ServerReflectionResponse : public ::google::protobuf::Message /* @@protoc_ MESSAGE_RESPONSE_NOT_SET = 0, }; + static const ServerReflectionResponse* internal_default_instance(); + void Swap(ServerReflectionResponse* other); // implements Message ---------------------------------------------- @@ -395,7 +406,7 @@ class ServerReflectionResponse : public ::google::protobuf::Message /* @@protoc_ void Clear(); bool IsInitialized() const; - int ByteSize() const; + size_t ByteSizeLong() const; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( @@ -411,6 +422,7 @@ class ServerReflectionResponse : public ::google::protobuf::Message /* @@protoc_ void SharedDtor(); void SetCachedSize(int size) const; void InternalSwap(ServerReflectionResponse* other); + void UnsafeMergeFrom(const ServerReflectionResponse& from); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); @@ -495,7 +507,6 @@ class ServerReflectionResponse : public ::google::protobuf::Message /* @@protoc_ inline void clear_has_message_response(); ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - bool _is_default_instance_; ::google::protobuf::internal::ArenaStringPtr valid_host_; ::grpc::reflection::v1alpha::ServerReflectionRequest* original_request_; union MessageResponseUnion { @@ -508,13 +519,15 @@ class ServerReflectionResponse : public ::google::protobuf::Message /* @@protoc_ mutable int _cached_size_; ::google::protobuf::uint32 _oneof_case_[1]; - friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_InitDefaults_reflection_2eproto_impl(); + friend void protobuf_AddDesc_reflection_2eproto_impl(); friend void protobuf_AssignDesc_reflection_2eproto(); friend void protobuf_ShutdownFile_reflection_2eproto(); void InitAsDefaultInstance(); - static ServerReflectionResponse* default_instance_; }; +extern ::google::protobuf::internal::ExplicitlyConstructed ServerReflectionResponse_default_instance_; + // ------------------------------------------------------------------- class FileDescriptorResponse : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:grpc.reflection.v1alpha.FileDescriptorResponse) */ { @@ -532,6 +545,8 @@ class FileDescriptorResponse : public ::google::protobuf::Message /* @@protoc_in static const ::google::protobuf::Descriptor* descriptor(); static const FileDescriptorResponse& default_instance(); + static const FileDescriptorResponse* internal_default_instance(); + void Swap(FileDescriptorResponse* other); // implements Message ---------------------------------------------- @@ -546,7 +561,7 @@ class FileDescriptorResponse : public ::google::protobuf::Message /* @@protoc_in void Clear(); bool IsInitialized() const; - int ByteSize() const; + size_t ByteSizeLong() const; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( @@ -562,6 +577,7 @@ class FileDescriptorResponse : public ::google::protobuf::Message /* @@protoc_in void SharedDtor(); void SetCachedSize(int size) const; void InternalSwap(FileDescriptorResponse* other); + void UnsafeMergeFrom(const FileDescriptorResponse& from); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); @@ -597,16 +613,17 @@ class FileDescriptorResponse : public ::google::protobuf::Message /* @@protoc_in private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - bool _is_default_instance_; ::google::protobuf::RepeatedPtrField< ::std::string> file_descriptor_proto_; mutable int _cached_size_; - friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_InitDefaults_reflection_2eproto_impl(); + friend void protobuf_AddDesc_reflection_2eproto_impl(); friend void protobuf_AssignDesc_reflection_2eproto(); friend void protobuf_ShutdownFile_reflection_2eproto(); void InitAsDefaultInstance(); - static FileDescriptorResponse* default_instance_; }; +extern ::google::protobuf::internal::ExplicitlyConstructed FileDescriptorResponse_default_instance_; + // ------------------------------------------------------------------- class ExtensionNumberResponse : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:grpc.reflection.v1alpha.ExtensionNumberResponse) */ { @@ -624,6 +641,8 @@ class ExtensionNumberResponse : public ::google::protobuf::Message /* @@protoc_i static const ::google::protobuf::Descriptor* descriptor(); static const ExtensionNumberResponse& default_instance(); + static const ExtensionNumberResponse* internal_default_instance(); + void Swap(ExtensionNumberResponse* other); // implements Message ---------------------------------------------- @@ -638,7 +657,7 @@ class ExtensionNumberResponse : public ::google::protobuf::Message /* @@protoc_i void Clear(); bool IsInitialized() const; - int ByteSize() const; + size_t ByteSizeLong() const; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( @@ -654,6 +673,7 @@ class ExtensionNumberResponse : public ::google::protobuf::Message /* @@protoc_i void SharedDtor(); void SetCachedSize(int size) const; void InternalSwap(ExtensionNumberResponse* other); + void UnsafeMergeFrom(const ExtensionNumberResponse& from); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); @@ -696,18 +716,19 @@ class ExtensionNumberResponse : public ::google::protobuf::Message /* @@protoc_i private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - bool _is_default_instance_; - ::google::protobuf::internal::ArenaStringPtr base_type_name_; ::google::protobuf::RepeatedField< ::google::protobuf::int32 > extension_number_; mutable int _extension_number_cached_byte_size_; + ::google::protobuf::internal::ArenaStringPtr base_type_name_; mutable int _cached_size_; - friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_InitDefaults_reflection_2eproto_impl(); + friend void protobuf_AddDesc_reflection_2eproto_impl(); friend void protobuf_AssignDesc_reflection_2eproto(); friend void protobuf_ShutdownFile_reflection_2eproto(); void InitAsDefaultInstance(); - static ExtensionNumberResponse* default_instance_; }; +extern ::google::protobuf::internal::ExplicitlyConstructed ExtensionNumberResponse_default_instance_; + // ------------------------------------------------------------------- class ListServiceResponse : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:grpc.reflection.v1alpha.ListServiceResponse) */ { @@ -725,6 +746,8 @@ class ListServiceResponse : public ::google::protobuf::Message /* @@protoc_inser static const ::google::protobuf::Descriptor* descriptor(); static const ListServiceResponse& default_instance(); + static const ListServiceResponse* internal_default_instance(); + void Swap(ListServiceResponse* other); // implements Message ---------------------------------------------- @@ -739,7 +762,7 @@ class ListServiceResponse : public ::google::protobuf::Message /* @@protoc_inser void Clear(); bool IsInitialized() const; - int ByteSize() const; + size_t ByteSizeLong() const; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( @@ -755,6 +778,7 @@ class ListServiceResponse : public ::google::protobuf::Message /* @@protoc_inser void SharedDtor(); void SetCachedSize(int size) const; void InternalSwap(ListServiceResponse* other); + void UnsafeMergeFrom(const ListServiceResponse& from); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); @@ -786,16 +810,17 @@ class ListServiceResponse : public ::google::protobuf::Message /* @@protoc_inser private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - bool _is_default_instance_; ::google::protobuf::RepeatedPtrField< ::grpc::reflection::v1alpha::ServiceResponse > service_; mutable int _cached_size_; - friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_InitDefaults_reflection_2eproto_impl(); + friend void protobuf_AddDesc_reflection_2eproto_impl(); friend void protobuf_AssignDesc_reflection_2eproto(); friend void protobuf_ShutdownFile_reflection_2eproto(); void InitAsDefaultInstance(); - static ListServiceResponse* default_instance_; }; +extern ::google::protobuf::internal::ExplicitlyConstructed ListServiceResponse_default_instance_; + // ------------------------------------------------------------------- class ServiceResponse : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:grpc.reflection.v1alpha.ServiceResponse) */ { @@ -813,6 +838,8 @@ class ServiceResponse : public ::google::protobuf::Message /* @@protoc_insertion static const ::google::protobuf::Descriptor* descriptor(); static const ServiceResponse& default_instance(); + static const ServiceResponse* internal_default_instance(); + void Swap(ServiceResponse* other); // implements Message ---------------------------------------------- @@ -827,7 +854,7 @@ class ServiceResponse : public ::google::protobuf::Message /* @@protoc_insertion void Clear(); bool IsInitialized() const; - int ByteSize() const; + size_t ByteSizeLong() const; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( @@ -843,6 +870,7 @@ class ServiceResponse : public ::google::protobuf::Message /* @@protoc_insertion void SharedDtor(); void SetCachedSize(int size) const; void InternalSwap(ServiceResponse* other); + void UnsafeMergeFrom(const ServiceResponse& from); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); @@ -873,16 +901,17 @@ class ServiceResponse : public ::google::protobuf::Message /* @@protoc_insertion private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - bool _is_default_instance_; ::google::protobuf::internal::ArenaStringPtr name_; mutable int _cached_size_; - friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_InitDefaults_reflection_2eproto_impl(); + friend void protobuf_AddDesc_reflection_2eproto_impl(); friend void protobuf_AssignDesc_reflection_2eproto(); friend void protobuf_ShutdownFile_reflection_2eproto(); void InitAsDefaultInstance(); - static ServiceResponse* default_instance_; }; +extern ::google::protobuf::internal::ExplicitlyConstructed ServiceResponse_default_instance_; + // ------------------------------------------------------------------- class ErrorResponse : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:grpc.reflection.v1alpha.ErrorResponse) */ { @@ -900,6 +929,8 @@ class ErrorResponse : public ::google::protobuf::Message /* @@protoc_insertion_p static const ::google::protobuf::Descriptor* descriptor(); static const ErrorResponse& default_instance(); + static const ErrorResponse* internal_default_instance(); + void Swap(ErrorResponse* other); // implements Message ---------------------------------------------- @@ -914,7 +945,7 @@ class ErrorResponse : public ::google::protobuf::Message /* @@protoc_insertion_p void Clear(); bool IsInitialized() const; - int ByteSize() const; + size_t ByteSizeLong() const; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( @@ -930,6 +961,7 @@ class ErrorResponse : public ::google::protobuf::Message /* @@protoc_insertion_p void SharedDtor(); void SetCachedSize(int size) const; void InternalSwap(ErrorResponse* other); + void UnsafeMergeFrom(const ErrorResponse& from); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); @@ -966,17 +998,18 @@ class ErrorResponse : public ::google::protobuf::Message /* @@protoc_insertion_p private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - bool _is_default_instance_; ::google::protobuf::internal::ArenaStringPtr error_message_; ::google::protobuf::int32 error_code_; mutable int _cached_size_; - friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_InitDefaults_reflection_2eproto_impl(); + friend void protobuf_AddDesc_reflection_2eproto_impl(); friend void protobuf_AssignDesc_reflection_2eproto(); friend void protobuf_ShutdownFile_reflection_2eproto(); void InitAsDefaultInstance(); - static ErrorResponse* default_instance_; }; +extern ::google::protobuf::internal::ExplicitlyConstructed ErrorResponse_default_instance_; + // =================================================================== @@ -1410,6 +1443,9 @@ inline void ServerReflectionRequest::clear_has_message_request() { inline ServerReflectionRequest::MessageRequestCase ServerReflectionRequest::message_request_case() const { return ServerReflectionRequest::MessageRequestCase(_oneof_case_[0]); } +inline const ServerReflectionRequest* ServerReflectionRequest::internal_default_instance() { + return &ServerReflectionRequest_default_instance_.get(); +} // ------------------------------------------------------------------- // ExtensionRequest @@ -1472,6 +1508,9 @@ inline void ExtensionRequest::set_extension_number(::google::protobuf::int32 val // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionRequest.extension_number) } +inline const ExtensionRequest* ExtensionRequest::internal_default_instance() { + return &ExtensionRequest_default_instance_.get(); +} // ------------------------------------------------------------------- // ServerReflectionResponse @@ -1522,7 +1561,7 @@ inline void ServerReflectionResponse::set_allocated_valid_host(::std::string* va // optional .grpc.reflection.v1alpha.ServerReflectionRequest original_request = 2; inline bool ServerReflectionResponse::has_original_request() const { - return !_is_default_instance_ && original_request_ != NULL; + return this != internal_default_instance() && original_request_ != NULL; } inline void ServerReflectionResponse::clear_original_request() { if (GetArenaNoVirtual() == NULL && original_request_ != NULL) delete original_request_; @@ -1530,7 +1569,8 @@ inline void ServerReflectionResponse::clear_original_request() { } inline const ::grpc::reflection::v1alpha::ServerReflectionRequest& ServerReflectionResponse::original_request() const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.original_request) - return original_request_ != NULL ? *original_request_ : *default_instance_->original_request_; + return original_request_ != NULL ? *original_request_ + : *::grpc::reflection::v1alpha::ServerReflectionRequest::internal_default_instance(); } inline ::grpc::reflection::v1alpha::ServerReflectionRequest* ServerReflectionResponse::mutable_original_request() { @@ -1759,6 +1799,9 @@ inline void ServerReflectionResponse::clear_has_message_response() { inline ServerReflectionResponse::MessageResponseCase ServerReflectionResponse::message_response_case() const { return ServerReflectionResponse::MessageResponseCase(_oneof_case_[0]); } +inline const ServerReflectionResponse* ServerReflectionResponse::internal_default_instance() { + return &ServerReflectionResponse_default_instance_.get(); +} // ------------------------------------------------------------------- // FileDescriptorResponse @@ -1818,6 +1861,9 @@ FileDescriptorResponse::mutable_file_descriptor_proto() { return &file_descriptor_proto_; } +inline const FileDescriptorResponse* FileDescriptorResponse::internal_default_instance() { + return &FileDescriptorResponse_default_instance_.get(); +} // ------------------------------------------------------------------- // ExtensionNumberResponse @@ -1896,6 +1942,9 @@ ExtensionNumberResponse::mutable_extension_number() { return &extension_number_; } +inline const ExtensionNumberResponse* ExtensionNumberResponse::internal_default_instance() { + return &ExtensionNumberResponse_default_instance_.get(); +} // ------------------------------------------------------------------- // ListServiceResponse @@ -1930,6 +1979,9 @@ ListServiceResponse::service() const { return service_; } +inline const ListServiceResponse* ListServiceResponse::internal_default_instance() { + return &ListServiceResponse_default_instance_.get(); +} // ------------------------------------------------------------------- // ServiceResponse @@ -1978,6 +2030,9 @@ inline void ServiceResponse::set_allocated_name(::std::string* name) { // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServiceResponse.name) } +inline const ServiceResponse* ServiceResponse::internal_default_instance() { + return &ServiceResponse_default_instance_.get(); +} // ------------------------------------------------------------------- // ErrorResponse @@ -2040,6 +2095,9 @@ inline void ErrorResponse::set_allocated_error_message(::std::string* error_mess // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ErrorResponse.error_message) } +inline const ErrorResponse* ErrorResponse::internal_default_instance() { + return &ErrorResponse_default_instance_.get(); +} #endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // ------------------------------------------------------------------- diff --git a/src/compiler/php_generator.cc b/src/compiler/php_generator.cc new file mode 100644 index 00000000000..5dac02cec43 --- /dev/null +++ b/src/compiler/php_generator.cc @@ -0,0 +1,174 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include "src/compiler/config.h" +#include "src/compiler/generator_helpers.h" +#include "src/compiler/php_generator_helpers.h" + +using grpc::protobuf::FileDescriptor; +using grpc::protobuf::ServiceDescriptor; +using grpc::protobuf::MethodDescriptor; +using grpc::protobuf::Descriptor; +using grpc::protobuf::io::Printer; +using grpc::protobuf::io::StringOutputStream; +using std::map; + +namespace grpc_php_generator { +namespace { + +grpc::string MessageIdentifierName(const grpc::string &name) { + std::vector tokens = grpc_generator::tokenize(name, "."); + std::ostringstream oss; + for (unsigned int i = 0; i < tokens.size(); i++) { + oss << (i == 0 ? "" : "\\") + << grpc_generator::CapitalizeFirstLetter(tokens[i]); + } + return oss.str(); +} + +void PrintMethod(const MethodDescriptor *method, Printer *out) { + const Descriptor *input_type = method->input_type(); + const Descriptor *output_type = method->output_type(); + map vars; + vars["service_name"] = method->service()->full_name(); + vars["name"] = method->name(); + vars["input_type_id"] = MessageIdentifierName(input_type->full_name()); + vars["output_type_id"] = MessageIdentifierName(output_type->full_name()); + + out->Print("/**\n"); + out->Print(GetPHPComments(method, " *").c_str()); + if (method->client_streaming()) { + out->Print(vars, + " * @param array $$metadata metadata\n" + " * @param array $$options call options\n */\n" + "public function $name$($$metadata = [], " + "$$options = []) {\n"); + out->Indent(); + if (method->server_streaming()) { + out->Print("return $$this->_bidiRequest("); + } else { + out->Print("return $$this->_clientStreamRequest("); + } + out->Print(vars, + "'/$service_name$/$name$',\n" + "['\\$output_type_id$','decode'],\n" + "$$metadata, $$options);\n"); + } else { + out->Print(vars, + " * @param \\$input_type_id$ $$argument input argument\n" + " * @param array $$metadata metadata\n" + " * @param array $$options call options\n */\n" + "public function $name$(\\$input_type_id$ $$argument,\n" + " $$metadata = [], $$options = []) {\n"); + out->Indent(); + if (method->server_streaming()) { + out->Print("return $$this->_serverStreamRequest("); + } else { + out->Print("return $$this->_simpleRequest("); + } + out->Print(vars, + "'/$service_name$/$name$',\n" + "$$argument,\n" + "['\\$output_type_id$', 'decode'],\n" + "$$metadata, $$options);\n"); + } + out->Outdent(); + out->Print("}\n\n"); +} + +// Prints out the service descriptor object +void PrintService(const ServiceDescriptor *service, Printer *out) { + map vars; + out->Print(GetPHPComments(service, "//").c_str()); + vars["name"] = service->name(); + out->Print(vars, "class $name$Client extends \\Grpc\\BaseStub {\n\n"); + out->Indent(); + out->Print( + "/**\n * @param string $$hostname hostname\n" + " * @param array $$opts channel options\n" + " * @param Grpc\\Channel $$channel (optional) re-use channel " + "object\n */\n" + "public function __construct($$hostname, $$opts, " + "$$channel = null) {\n"); + out->Indent(); + out->Print("parent::__construct($$hostname, $$opts, $$channel);\n"); + out->Outdent(); + out->Print("}\n\n"); + for (int i = 0; i < service->method_count(); i++) { + grpc::string method_name = + grpc_generator::LowercaseFirstLetter(service->method(i)->name()); + PrintMethod(service->method(i), out); + } + out->Outdent(); + out->Print("}\n\n"); +} + +void PrintServices(const FileDescriptor *file, Printer *out) { + map vars; + vars["package"] = MessageIdentifierName(file->package()); + out->Print(vars, "namespace $package$ {\n\n"); + out->Indent(); + for (int i = 0; i < file->service_count(); i++) { + PrintService(file->service(i), out); + } + out->Outdent(); + out->Print("}\n"); +} +} + +grpc::string GenerateFile(const FileDescriptor *file) { + grpc::string output; + { + StringOutputStream output_stream(&output); + Printer out(&output_stream, '$'); + + if (file->service_count() == 0) { + return output; + } + out.Print(" + +#include "src/compiler/config.h" +#include "src/compiler/generator_helpers.h" + +namespace grpc_php_generator { + +inline grpc::string GetPHPServiceFilename(const grpc::string& filename) { + return grpc_generator::StripProto(filename) + "_grpc_pb.php"; +} + +// Get leading or trailing comments in a string. Comment lines start with "// ". +// Leading detached comments are put in in front of leading comments. +template +inline grpc::string GetPHPComments(const DescriptorType* desc, + grpc::string prefix) { + return grpc_generator::GetPrefixedComments(desc, true, prefix); +} + +} // namespace grpc_php_generator + +#endif // GRPC_INTERNAL_COMPILER_PHP_GENERATOR_HELPERS_H diff --git a/src/compiler/php_plugin.cc b/src/compiler/php_plugin.cc new file mode 100644 index 00000000000..88acad6524f --- /dev/null +++ b/src/compiler/php_plugin.cc @@ -0,0 +1,73 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// Generates PHP gRPC service interface out of Protobuf IDL. + +#include + +#include "src/compiler/config.h" +#include "src/compiler/php_generator.h" +#include "src/compiler/php_generator_helpers.h" + +using grpc_php_generator::GenerateFile; +using grpc_php_generator::GetPHPServiceFilename; + +class PHPGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { + public: + PHPGrpcGenerator() {} + ~PHPGrpcGenerator() {} + + bool Generate(const grpc::protobuf::FileDescriptor *file, + const grpc::string ¶meter, + grpc::protobuf::compiler::GeneratorContext *context, + grpc::string *error) const { + grpc::string code = GenerateFile(file); + if (code.size() == 0) { + return true; + } + + // Get output file name + grpc::string file_name = GetPHPServiceFilename(file->name()); + + std::unique_ptr output( + context->Open(file_name)); + grpc::protobuf::io::CodedOutputStream coded_out(output.get()); + coded_out.WriteRaw(code.data(), code.size()); + return true; + } +}; + +int main(int argc, char *argv[]) { + PHPGrpcGenerator generator; + return grpc::protobuf::compiler::PluginMain(argc, argv, &generator); +} diff --git a/src/core/ext/client_config/client_channel.c b/src/core/ext/client_config/client_channel.c index 31f435ef625..f3befe9b478 100644 --- a/src/core/ext/client_config/client_channel.c +++ b/src/core/ext/client_config/client_channel.c @@ -626,9 +626,10 @@ static bool pick_subchannel(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, int r; GRPC_LB_POLICY_REF(lb_policy, "pick_subchannel"); gpr_mu_unlock(&chand->mu); - const grpc_lb_policy_pick_args inputs = {calld->pollent, initial_metadata, - initial_metadata_flags, - &calld->lb_token_mdelem}; + // TODO(dgq): make this deadline configurable somehow. + const grpc_lb_policy_pick_args inputs = { + calld->pollent, initial_metadata, initial_metadata_flags, + &calld->lb_token_mdelem, gpr_inf_future(GPR_CLOCK_MONOTONIC)}; r = grpc_lb_policy_pick(exec_ctx, lb_policy, &inputs, connected_subchannel, NULL, on_ready); GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "pick_subchannel"); diff --git a/src/core/ext/client_config/lb_policy.h b/src/core/ext/client_config/lb_policy.h index 7fb3e08cb3e..6cc3e1ebd38 100644 --- a/src/core/ext/client_config/lb_policy.h +++ b/src/core/ext/client_config/lb_policy.h @@ -59,10 +59,14 @@ typedef struct grpc_lb_policy_pick_args { grpc_polling_entity *pollent; /** Initial metadata associated with the picking call. */ grpc_metadata_batch *initial_metadata; - /** See \a GRPC_INITIAL_METADATA_* in grpc_types.h */ + /** Bitmask used for selective cancelling. See \a + * grpc_lb_policy_cancel_picks() and \a GRPC_INITIAL_METADATA_* in + * grpc_types.h */ uint32_t initial_metadata_flags; /** Storage for LB token in \a initial_metadata, or NULL if not used */ grpc_linked_mdelem *lb_token_mdelem_storage; + /** Deadline for the call to the LB server */ + gpr_timespec deadline; } grpc_lb_policy_pick_args; struct grpc_lb_policy_vtable { diff --git a/src/core/ext/lb_policy/grpclb/grpclb.c b/src/core/ext/lb_policy/grpclb/grpclb.c index bdfe65a62a4..63af774ea6d 100644 --- a/src/core/ext/lb_policy/grpclb/grpclb.c +++ b/src/core/ext/lb_policy/grpclb/grpclb.c @@ -105,6 +105,7 @@ #include #include #include +#include #include "src/core/ext/client_config/client_channel_factory.h" #include "src/core/ext/client_config/lb_policy_factory.h" @@ -199,18 +200,8 @@ static void wrapped_rr_closure(grpc_exec_ctx *exec_ctx, void *arg, typedef struct pending_pick { struct pending_pick *next; - /* polling entity for the pick()'s async notification */ - grpc_polling_entity *pollent; - - /* the initial metadata for the pick. See grpc_lb_policy_pick() */ - grpc_metadata_batch *initial_metadata; - - /* storage for the lb token initial metadata mdelem */ - grpc_linked_mdelem *lb_token_mdelem_storage; - - /* bitmask passed to pick() and used for selective cancelling. See - * grpc_lb_policy_cancel_picks() */ - uint32_t initial_metadata_flags; + /* original pick()'s arguments */ + grpc_lb_policy_pick_args pick_args; /* output argument where to store the pick()ed connected subchannel, or NULL * upon error. */ @@ -232,11 +223,8 @@ static void add_pending_pick(pending_pick **root, memset(pp, 0, sizeof(pending_pick)); memset(&pp->wrapped_on_complete_arg, 0, sizeof(wrapped_rr_closure_arg)); pp->next = *root; - pp->pollent = pick_args->pollent; + pp->pick_args = *pick_args; pp->target = target; - pp->initial_metadata = pick_args->initial_metadata; - pp->initial_metadata_flags = pick_args->initial_metadata_flags; - pp->lb_token_mdelem_storage = pick_args->lb_token_mdelem_storage; pp->wrapped_on_complete_arg.wrapped_closure = on_complete; pp->wrapped_on_complete_arg.target = target; pp->wrapped_on_complete_arg.initial_metadata = pick_args->initial_metadata; @@ -283,9 +271,13 @@ typedef struct glb_lb_policy { /** mutex protecting remaining members */ gpr_mu mu; + /** who the client is trying to communicate with */ const char *server_name; grpc_client_channel_factory *cc_factory; + /** deadline for the LB's call */ + gpr_timespec deadline; + /** for communicating with the LB server */ grpc_channel *lb_channel; @@ -486,10 +478,8 @@ static void rr_handover(grpc_exec_ctx *exec_ctx, glb_lb_policy *glb_policy, gpr_log(GPR_INFO, "Pending pick about to PICK from 0x%" PRIxPTR "", (intptr_t)glb_policy->rr_policy); } - const grpc_lb_policy_pick_args pick_args = { - pp->pollent, pp->initial_metadata, pp->initial_metadata_flags, - pp->lb_token_mdelem_storage}; - grpc_lb_policy_pick(exec_ctx, glb_policy->rr_policy, &pick_args, pp->target, + grpc_lb_policy_pick(exec_ctx, glb_policy->rr_policy, &pp->pick_args, + pp->target, (void **)&pp->wrapped_on_complete_arg.lb_token, &pp->wrapped_on_complete); pp->wrapped_on_complete_arg.owning_pending_node = pp; @@ -589,7 +579,7 @@ static grpc_lb_policy *glb_create(grpc_exec_ctx *exec_ctx, &addr_strs[addr_index++], (const struct sockaddr *)&args->addresses->addresses[i] .address.addr, - true) == 0); + true) > 0); } } } @@ -660,7 +650,6 @@ static void glb_shutdown(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { *pp->target = NULL; grpc_exec_ctx_sched(exec_ctx, &pp->wrapped_on_complete, GRPC_ERROR_NONE, NULL); - gpr_free(pp); pp = next; } @@ -698,12 +687,11 @@ static void glb_cancel_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, pending_pick *next = pp->next; if (pp->target == target) { grpc_polling_entity_del_from_pollset_set( - exec_ctx, pp->pollent, glb_policy->base.interested_parties); + exec_ctx, pp->pick_args.pollent, glb_policy->base.interested_parties); *target = NULL; grpc_exec_ctx_sched( exec_ctx, &pp->wrapped_on_complete, GRPC_ERROR_CREATE_REFERENCING("Pick Cancelled", &error, 1), NULL); - gpr_free(pp); } else { pp->next = glb_policy->pending_picks; glb_policy->pending_picks = pp; @@ -729,14 +717,13 @@ static void glb_cancel_picks(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, glb_policy->pending_picks = NULL; while (pp != NULL) { pending_pick *next = pp->next; - if ((pp->initial_metadata_flags & initial_metadata_flags_mask) == + if ((pp->pick_args.initial_metadata_flags & initial_metadata_flags_mask) == initial_metadata_flags_eq) { grpc_polling_entity_del_from_pollset_set( - exec_ctx, pp->pollent, glb_policy->base.interested_parties); + exec_ctx, pp->pick_args.pollent, glb_policy->base.interested_parties); grpc_exec_ctx_sched( exec_ctx, &pp->wrapped_on_complete, GRPC_ERROR_CREATE_REFERENCING("Pick Cancelled", &error, 1), NULL); - gpr_free(pp); } else { pp->next = glb_policy->pending_picks; glb_policy->pending_picks = pp; @@ -767,8 +754,6 @@ static int glb_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, const grpc_lb_policy_pick_args *pick_args, grpc_connected_subchannel **target, void **user_data, grpc_closure *on_complete) { - glb_lb_policy *glb_policy = (glb_lb_policy *)pol; - if (pick_args->lb_token_mdelem_storage == NULL) { *target = NULL; grpc_exec_ctx_sched( @@ -779,8 +764,10 @@ static int glb_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, return 1; } + glb_lb_policy *glb_policy = (glb_lb_policy *)pol; gpr_mu_lock(&glb_policy->mu); - int r; + glb_policy->deadline = pick_args->deadline; + bool pick_done; if (glb_policy->rr_policy != NULL) { if (grpc_lb_glb_trace) { @@ -799,10 +786,11 @@ static int glb_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, grpc_closure_init(&glb_policy->wrapped_on_complete, wrapped_rr_closure, &glb_policy->wc_arg); - r = grpc_lb_policy_pick(exec_ctx, glb_policy->rr_policy, pick_args, target, + pick_done = + grpc_lb_policy_pick(exec_ctx, glb_policy->rr_policy, pick_args, target, (void **)&glb_policy->wc_arg.lb_token, &glb_policy->wrapped_on_complete); - if (r != 0) { + if (pick_done) { /* synchronous grpc_lb_policy_pick call. Unref the RR policy. */ if (grpc_lb_glb_trace) { gpr_log(GPR_INFO, "Unreffing RR (0x%" PRIxPTR ")", @@ -816,6 +804,8 @@ static int glb_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, GRPC_MDELEM_REF(glb_policy->wc_arg.lb_token)); } } else { + /* else, the pending pick will be registered and taken care of by the + * pending pick list inside the RR policy (glb_policy->rr_policy) */ grpc_polling_entity_add_to_pollset_set(exec_ctx, pick_args->pollent, glb_policy->base.interested_parties); add_pending_pick(&glb_policy->pending_picks, pick_args, target, @@ -824,10 +814,10 @@ static int glb_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, if (!glb_policy->started_picking) { start_picking(exec_ctx, glb_policy); } - r = 0; + pick_done = false; } gpr_mu_unlock(&glb_policy->mu); - return r; + return pick_done; } static grpc_connectivity_state glb_check_connectivity( @@ -937,8 +927,7 @@ static lb_client_data *lb_client_data_create(glb_lb_policy *glb_policy) { grpc_closure_init(&lb_client->close_sent, close_sent_cb, lb_client); grpc_closure_init(&lb_client->srv_status_rcvd, srv_status_rcvd_cb, lb_client); - /* TODO(dgq): get the deadline from the parent channel. */ - lb_client->deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); + lb_client->deadline = glb_policy->deadline; /* Note the following LB call progresses every time there's activity in \a * glb_policy->base.interested_parties, which is comprised of the polling diff --git a/src/cpp/ext/reflection.pb.cc b/src/cpp/ext/reflection.pb.cc index b50465b9b59..d75503b3ce1 100644 --- a/src/cpp/ext/reflection.pb.cc +++ b/src/cpp/ext/reflection.pb.cc @@ -118,7 +118,7 @@ void protobuf_AssignDesc_reflection_2eproto() { ServerReflectionRequest_reflection_ = ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( ServerReflectionRequest_descriptor_, - ServerReflectionRequest::default_instance_, + ServerReflectionRequest::internal_default_instance(), ServerReflectionRequest_offsets_, -1, -1, @@ -126,8 +126,7 @@ void protobuf_AssignDesc_reflection_2eproto() { ServerReflectionRequest_default_oneof_instance_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServerReflectionRequest, _oneof_case_[0]), sizeof(ServerReflectionRequest), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServerReflectionRequest, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServerReflectionRequest, _is_default_instance_)); + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServerReflectionRequest, _internal_metadata_)); ExtensionRequest_descriptor_ = file->message_type(1); static const int ExtensionRequest_offsets_[2] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRequest, containing_type_), @@ -136,14 +135,13 @@ void protobuf_AssignDesc_reflection_2eproto() { ExtensionRequest_reflection_ = ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( ExtensionRequest_descriptor_, - ExtensionRequest::default_instance_, + ExtensionRequest::internal_default_instance(), ExtensionRequest_offsets_, -1, -1, -1, sizeof(ExtensionRequest), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRequest, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRequest, _is_default_instance_)); + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRequest, _internal_metadata_)); ServerReflectionResponse_descriptor_ = file->message_type(2); static const int ServerReflectionResponse_offsets_[7] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServerReflectionResponse, valid_host_), @@ -157,7 +155,7 @@ void protobuf_AssignDesc_reflection_2eproto() { ServerReflectionResponse_reflection_ = ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( ServerReflectionResponse_descriptor_, - ServerReflectionResponse::default_instance_, + ServerReflectionResponse::internal_default_instance(), ServerReflectionResponse_offsets_, -1, -1, @@ -165,8 +163,7 @@ void protobuf_AssignDesc_reflection_2eproto() { ServerReflectionResponse_default_oneof_instance_, GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServerReflectionResponse, _oneof_case_[0]), sizeof(ServerReflectionResponse), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServerReflectionResponse, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServerReflectionResponse, _is_default_instance_)); + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServerReflectionResponse, _internal_metadata_)); FileDescriptorResponse_descriptor_ = file->message_type(3); static const int FileDescriptorResponse_offsets_[1] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorResponse, file_descriptor_proto_), @@ -174,14 +171,13 @@ void protobuf_AssignDesc_reflection_2eproto() { FileDescriptorResponse_reflection_ = ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( FileDescriptorResponse_descriptor_, - FileDescriptorResponse::default_instance_, + FileDescriptorResponse::internal_default_instance(), FileDescriptorResponse_offsets_, -1, -1, -1, sizeof(FileDescriptorResponse), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorResponse, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorResponse, _is_default_instance_)); + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorResponse, _internal_metadata_)); ExtensionNumberResponse_descriptor_ = file->message_type(4); static const int ExtensionNumberResponse_offsets_[2] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionNumberResponse, base_type_name_), @@ -190,14 +186,13 @@ void protobuf_AssignDesc_reflection_2eproto() { ExtensionNumberResponse_reflection_ = ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( ExtensionNumberResponse_descriptor_, - ExtensionNumberResponse::default_instance_, + ExtensionNumberResponse::internal_default_instance(), ExtensionNumberResponse_offsets_, -1, -1, -1, sizeof(ExtensionNumberResponse), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionNumberResponse, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionNumberResponse, _is_default_instance_)); + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionNumberResponse, _internal_metadata_)); ListServiceResponse_descriptor_ = file->message_type(5); static const int ListServiceResponse_offsets_[1] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListServiceResponse, service_), @@ -205,14 +200,13 @@ void protobuf_AssignDesc_reflection_2eproto() { ListServiceResponse_reflection_ = ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( ListServiceResponse_descriptor_, - ListServiceResponse::default_instance_, + ListServiceResponse::internal_default_instance(), ListServiceResponse_offsets_, -1, -1, -1, sizeof(ListServiceResponse), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListServiceResponse, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListServiceResponse, _is_default_instance_)); + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListServiceResponse, _internal_metadata_)); ServiceResponse_descriptor_ = file->message_type(6); static const int ServiceResponse_offsets_[1] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceResponse, name_), @@ -220,14 +214,13 @@ void protobuf_AssignDesc_reflection_2eproto() { ServiceResponse_reflection_ = ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( ServiceResponse_descriptor_, - ServiceResponse::default_instance_, + ServiceResponse::internal_default_instance(), ServiceResponse_offsets_, -1, -1, -1, sizeof(ServiceResponse), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceResponse, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceResponse, _is_default_instance_)); + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceResponse, _internal_metadata_)); ErrorResponse_descriptor_ = file->message_type(7); static const int ErrorResponse_offsets_[2] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ErrorResponse, error_code_), @@ -236,20 +229,19 @@ void protobuf_AssignDesc_reflection_2eproto() { ErrorResponse_reflection_ = ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( ErrorResponse_descriptor_, - ErrorResponse::default_instance_, + ErrorResponse::internal_default_instance(), ErrorResponse_offsets_, -1, -1, -1, sizeof(ErrorResponse), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ErrorResponse, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ErrorResponse, _is_default_instance_)); + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ErrorResponse, _internal_metadata_)); } namespace { GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); -inline void protobuf_AssignDescriptorsOnce() { +void protobuf_AssignDescriptorsOnce() { ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, &protobuf_AssignDesc_reflection_2eproto); } @@ -258,53 +250,85 @@ void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD; void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - ServerReflectionRequest_descriptor_, &ServerReflectionRequest::default_instance()); + ServerReflectionRequest_descriptor_, ServerReflectionRequest::internal_default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - ExtensionRequest_descriptor_, &ExtensionRequest::default_instance()); + ExtensionRequest_descriptor_, ExtensionRequest::internal_default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - ServerReflectionResponse_descriptor_, &ServerReflectionResponse::default_instance()); + ServerReflectionResponse_descriptor_, ServerReflectionResponse::internal_default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - FileDescriptorResponse_descriptor_, &FileDescriptorResponse::default_instance()); + FileDescriptorResponse_descriptor_, FileDescriptorResponse::internal_default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - ExtensionNumberResponse_descriptor_, &ExtensionNumberResponse::default_instance()); + ExtensionNumberResponse_descriptor_, ExtensionNumberResponse::internal_default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - ListServiceResponse_descriptor_, &ListServiceResponse::default_instance()); + ListServiceResponse_descriptor_, ListServiceResponse::internal_default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - ServiceResponse_descriptor_, &ServiceResponse::default_instance()); + ServiceResponse_descriptor_, ServiceResponse::internal_default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - ErrorResponse_descriptor_, &ErrorResponse::default_instance()); + ErrorResponse_descriptor_, ErrorResponse::internal_default_instance()); } } // namespace void protobuf_ShutdownFile_reflection_2eproto() { - delete ServerReflectionRequest::default_instance_; + ServerReflectionRequest_default_instance_.Shutdown(); delete ServerReflectionRequest_default_oneof_instance_; delete ServerReflectionRequest_reflection_; - delete ExtensionRequest::default_instance_; + ExtensionRequest_default_instance_.Shutdown(); delete ExtensionRequest_reflection_; - delete ServerReflectionResponse::default_instance_; + ServerReflectionResponse_default_instance_.Shutdown(); delete ServerReflectionResponse_default_oneof_instance_; delete ServerReflectionResponse_reflection_; - delete FileDescriptorResponse::default_instance_; + FileDescriptorResponse_default_instance_.Shutdown(); delete FileDescriptorResponse_reflection_; - delete ExtensionNumberResponse::default_instance_; + ExtensionNumberResponse_default_instance_.Shutdown(); delete ExtensionNumberResponse_reflection_; - delete ListServiceResponse::default_instance_; + ListServiceResponse_default_instance_.Shutdown(); delete ListServiceResponse_reflection_; - delete ServiceResponse::default_instance_; + ServiceResponse_default_instance_.Shutdown(); delete ServiceResponse_reflection_; - delete ErrorResponse::default_instance_; + ErrorResponse_default_instance_.Shutdown(); delete ErrorResponse_reflection_; } -void protobuf_AddDesc_reflection_2eproto() GOOGLE_ATTRIBUTE_COLD; -void protobuf_AddDesc_reflection_2eproto() { - static bool already_here = false; - if (already_here) return; - already_here = true; +void protobuf_InitDefaults_reflection_2eproto_impl() { GOOGLE_PROTOBUF_VERIFY_VERSION; + ::google::protobuf::internal::GetEmptyString(); + ServerReflectionRequest_default_instance_.DefaultConstruct(); + ServerReflectionRequest_default_oneof_instance_ = new ServerReflectionRequestOneofInstance(); + ::google::protobuf::internal::GetEmptyString(); + ExtensionRequest_default_instance_.DefaultConstruct(); + ::google::protobuf::internal::GetEmptyString(); + ServerReflectionResponse_default_instance_.DefaultConstruct(); + ServerReflectionResponse_default_oneof_instance_ = new ServerReflectionResponseOneofInstance(); + ::google::protobuf::internal::GetEmptyString(); + FileDescriptorResponse_default_instance_.DefaultConstruct(); + ::google::protobuf::internal::GetEmptyString(); + ExtensionNumberResponse_default_instance_.DefaultConstruct(); + ListServiceResponse_default_instance_.DefaultConstruct(); + ::google::protobuf::internal::GetEmptyString(); + ServiceResponse_default_instance_.DefaultConstruct(); + ::google::protobuf::internal::GetEmptyString(); + ErrorResponse_default_instance_.DefaultConstruct(); + ServerReflectionRequest_default_instance_.get_mutable()->InitAsDefaultInstance(); + ExtensionRequest_default_instance_.get_mutable()->InitAsDefaultInstance(); + ServerReflectionResponse_default_instance_.get_mutable()->InitAsDefaultInstance(); + FileDescriptorResponse_default_instance_.get_mutable()->InitAsDefaultInstance(); + ExtensionNumberResponse_default_instance_.get_mutable()->InitAsDefaultInstance(); + ListServiceResponse_default_instance_.get_mutable()->InitAsDefaultInstance(); + ServiceResponse_default_instance_.get_mutable()->InitAsDefaultInstance(); + ErrorResponse_default_instance_.get_mutable()->InitAsDefaultInstance(); +} + +GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_InitDefaults_reflection_2eproto_once_); +void protobuf_InitDefaults_reflection_2eproto() { + ::google::protobuf::GoogleOnceInit(&protobuf_InitDefaults_reflection_2eproto_once_, + &protobuf_InitDefaults_reflection_2eproto_impl); +} +void protobuf_AddDesc_reflection_2eproto_impl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + + protobuf_InitDefaults_reflection_2eproto(); ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( "\n\020reflection.proto\022\027grpc.reflection.v1al" "pha\"\212\002\n\027ServerReflectionRequest\022\014\n\004host\030" @@ -341,27 +365,14 @@ void protobuf_AddDesc_reflection_2eproto() { "a.ServerReflectionResponse(\0010\001b\006proto3", 1318); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "reflection.proto", &protobuf_RegisterTypes); - ServerReflectionRequest::default_instance_ = new ServerReflectionRequest(); - ServerReflectionRequest_default_oneof_instance_ = new ServerReflectionRequestOneofInstance(); - ExtensionRequest::default_instance_ = new ExtensionRequest(); - ServerReflectionResponse::default_instance_ = new ServerReflectionResponse(); - ServerReflectionResponse_default_oneof_instance_ = new ServerReflectionResponseOneofInstance(); - FileDescriptorResponse::default_instance_ = new FileDescriptorResponse(); - ExtensionNumberResponse::default_instance_ = new ExtensionNumberResponse(); - ListServiceResponse::default_instance_ = new ListServiceResponse(); - ServiceResponse::default_instance_ = new ServiceResponse(); - ErrorResponse::default_instance_ = new ErrorResponse(); - ServerReflectionRequest::default_instance_->InitAsDefaultInstance(); - ExtensionRequest::default_instance_->InitAsDefaultInstance(); - ServerReflectionResponse::default_instance_->InitAsDefaultInstance(); - FileDescriptorResponse::default_instance_->InitAsDefaultInstance(); - ExtensionNumberResponse::default_instance_->InitAsDefaultInstance(); - ListServiceResponse::default_instance_->InitAsDefaultInstance(); - ServiceResponse::default_instance_->InitAsDefaultInstance(); - ErrorResponse::default_instance_->InitAsDefaultInstance(); ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_reflection_2eproto); } +GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AddDesc_reflection_2eproto_once_); +void protobuf_AddDesc_reflection_2eproto() { + ::google::protobuf::GoogleOnceInit(&protobuf_AddDesc_reflection_2eproto_once_, + &protobuf_AddDesc_reflection_2eproto_impl); +} // Force AddDescriptors() to be called at static initialization time. struct StaticDescriptorInitializer_reflection_2eproto { StaticDescriptorInitializer_reflection_2eproto() { @@ -369,6 +380,16 @@ struct StaticDescriptorInitializer_reflection_2eproto { } } static_descriptor_initializer_reflection_2eproto_; +namespace { + +static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD GOOGLE_ATTRIBUTE_NORETURN; +static void MergeFromFail(int line) { + ::google::protobuf::internal::MergeFromFail(__FILE__, line); +} + +} // namespace + + // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -382,15 +403,16 @@ const int ServerReflectionRequest::kListServicesFieldNumber; ServerReflectionRequest::ServerReflectionRequest() : ::google::protobuf::Message(), _internal_metadata_(NULL) { + if (this != internal_default_instance()) protobuf_InitDefaults_reflection_2eproto(); SharedCtor(); // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.ServerReflectionRequest) } void ServerReflectionRequest::InitAsDefaultInstance() { - _is_default_instance_ = true; ServerReflectionRequest_default_oneof_instance_->file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); ServerReflectionRequest_default_oneof_instance_->file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ServerReflectionRequest_default_oneof_instance_->file_containing_extension_ = const_cast< ::grpc::reflection::v1alpha::ExtensionRequest*>(&::grpc::reflection::v1alpha::ExtensionRequest::default_instance()); + ServerReflectionRequest_default_oneof_instance_->file_containing_extension_ = const_cast< ::grpc::reflection::v1alpha::ExtensionRequest*>( + ::grpc::reflection::v1alpha::ExtensionRequest::internal_default_instance()); ServerReflectionRequest_default_oneof_instance_->all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); ServerReflectionRequest_default_oneof_instance_->list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -399,16 +421,14 @@ ServerReflectionRequest::ServerReflectionRequest(const ServerReflectionRequest& : ::google::protobuf::Message(), _internal_metadata_(NULL) { SharedCtor(); - MergeFrom(from); + UnsafeMergeFrom(from); // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.ServerReflectionRequest) } void ServerReflectionRequest::SharedCtor() { - _is_default_instance_ = false; - ::google::protobuf::internal::GetEmptyString(); - _cached_size_ = 0; host_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); clear_has_message_request(); + _cached_size_ = 0; } ServerReflectionRequest::~ServerReflectionRequest() { @@ -421,8 +441,6 @@ void ServerReflectionRequest::SharedDtor() { if (has_message_request()) { clear_message_request(); } - if (this != default_instance_) { - } } void ServerReflectionRequest::SetCachedSize(int size) const { @@ -436,11 +454,11 @@ const ::google::protobuf::Descriptor* ServerReflectionRequest::descriptor() { } const ServerReflectionRequest& ServerReflectionRequest::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); - return *default_instance_; + protobuf_InitDefaults_reflection_2eproto(); + return *internal_default_instance(); } -ServerReflectionRequest* ServerReflectionRequest::default_instance_ = NULL; +::google::protobuf::internal::ExplicitlyConstructed ServerReflectionRequest_default_instance_; ServerReflectionRequest* ServerReflectionRequest::New(::google::protobuf::Arena* arena) const { ServerReflectionRequest* n = new ServerReflectionRequest; @@ -452,7 +470,7 @@ ServerReflectionRequest* ServerReflectionRequest::New(::google::protobuf::Arena* void ServerReflectionRequest::clear_message_request() { // @@protoc_insertion_point(one_of_clear_start:grpc.reflection.v1alpha.ServerReflectionRequest) - switch(message_request_case()) { + switch (message_request_case()) { case kFileByFilename: { message_request_.file_by_filename_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); break; @@ -526,14 +544,13 @@ bool ServerReflectionRequest::MergePartialFromCodedStream( } else { goto handle_unusual; } - if (input->ExpectTag(34)) goto parse_file_containing_symbol; + goto after_list_services; break; } // optional string file_containing_symbol = 4; case 4: { if (tag == 34) { - parse_file_containing_symbol: DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_file_containing_symbol())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -543,27 +560,25 @@ bool ServerReflectionRequest::MergePartialFromCodedStream( } else { goto handle_unusual; } - if (input->ExpectTag(42)) goto parse_file_containing_extension; + goto after_list_services; break; } // optional .grpc.reflection.v1alpha.ExtensionRequest file_containing_extension = 5; case 5: { if (tag == 42) { - parse_file_containing_extension: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_file_containing_extension())); } else { goto handle_unusual; } - if (input->ExpectTag(50)) goto parse_all_extension_numbers_of_type; + goto after_list_services; break; } // optional string all_extension_numbers_of_type = 6; case 6: { if (tag == 50) { - parse_all_extension_numbers_of_type: DO_(::google::protobuf::internal::WireFormatLite::ReadString( input, this->mutable_all_extension_numbers_of_type())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( @@ -590,6 +605,7 @@ bool ServerReflectionRequest::MergePartialFromCodedStream( } else { goto handle_unusual; } + after_list_services: if (input->ExpectAtEnd()) goto success; break; } @@ -679,6 +695,7 @@ void ServerReflectionRequest::SerializeWithCachedSizes( ::google::protobuf::uint8* ServerReflectionRequest::InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const { + (void)deterministic; // Unused // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.ServerReflectionRequest) // optional string host = 1; if (this->host().size() > 0) { @@ -746,9 +763,9 @@ void ServerReflectionRequest::SerializeWithCachedSizes( return target; } -int ServerReflectionRequest::ByteSize() const { +size_t ServerReflectionRequest::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:grpc.reflection.v1alpha.ServerReflectionRequest) - int total_size = 0; + size_t total_size = 0; // optional string host = 1; if (this->host().size() > 0) { @@ -797,18 +814,17 @@ int ServerReflectionRequest::ByteSize() const { break; } } + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; + _cached_size_ = cached_size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); return total_size; } void ServerReflectionRequest::MergeFrom(const ::google::protobuf::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:grpc.reflection.v1alpha.ServerReflectionRequest) - if (GOOGLE_PREDICT_FALSE(&from == this)) { - ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__); - } - const ServerReflectionRequest* source = + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const ServerReflectionRequest* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { @@ -816,15 +832,21 @@ void ServerReflectionRequest::MergeFrom(const ::google::protobuf::Message& from) ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { // @@protoc_insertion_point(generalized_merge_from_cast_success:grpc.reflection.v1alpha.ServerReflectionRequest) - MergeFrom(*source); + UnsafeMergeFrom(*source); } } void ServerReflectionRequest::MergeFrom(const ServerReflectionRequest& from) { // @@protoc_insertion_point(class_specific_merge_from_start:grpc.reflection.v1alpha.ServerReflectionRequest) - if (GOOGLE_PREDICT_FALSE(&from == this)) { - ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__); + if (GOOGLE_PREDICT_TRUE(&from != this)) { + UnsafeMergeFrom(from); + } else { + MergeFromFail(__LINE__); } +} + +void ServerReflectionRequest::UnsafeMergeFrom(const ServerReflectionRequest& from) { + GOOGLE_DCHECK(&from != this); switch (from.message_request_case()) { case kFileByFilename: { set_file_by_filename(from.file_by_filename()); @@ -867,7 +889,7 @@ void ServerReflectionRequest::CopyFrom(const ServerReflectionRequest& from) { // @@protoc_insertion_point(class_specific_copy_from_start:grpc.reflection.v1alpha.ServerReflectionRequest) if (&from == this) return; Clear(); - MergeFrom(from); + UnsafeMergeFrom(from); } bool ServerReflectionRequest::IsInitialized() const { @@ -902,37 +924,37 @@ void ServerReflectionRequest::InternalSwap(ServerReflectionRequest* other) { void ServerReflectionRequest::clear_host() { host_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - const ::std::string& ServerReflectionRequest::host() const { +const ::std::string& ServerReflectionRequest::host() const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.host) return host_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - void ServerReflectionRequest::set_host(const ::std::string& value) { +void ServerReflectionRequest::set_host(const ::std::string& value) { host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.host) } - void ServerReflectionRequest::set_host(const char* value) { +void ServerReflectionRequest::set_host(const char* value) { host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionRequest.host) } - void ServerReflectionRequest::set_host(const char* value, size_t size) { +void ServerReflectionRequest::set_host(const char* value, size_t size) { host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast(value), size)); // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionRequest.host) } - ::std::string* ServerReflectionRequest::mutable_host() { +::std::string* ServerReflectionRequest::mutable_host() { // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.host) return host_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - ::std::string* ServerReflectionRequest::release_host() { +::std::string* ServerReflectionRequest::release_host() { // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.host) return host_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - void ServerReflectionRequest::set_allocated_host(::std::string* host) { +void ServerReflectionRequest::set_allocated_host(::std::string* host) { if (host != NULL) { } else { @@ -955,14 +977,14 @@ void ServerReflectionRequest::clear_file_by_filename() { clear_has_message_request(); } } - const ::std::string& ServerReflectionRequest::file_by_filename() const { +const ::std::string& ServerReflectionRequest::file_by_filename() const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) if (has_file_by_filename()) { return message_request_.file_by_filename_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); } - void ServerReflectionRequest::set_file_by_filename(const ::std::string& value) { +void ServerReflectionRequest::set_file_by_filename(const ::std::string& value) { // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) if (!has_file_by_filename()) { clear_message_request(); @@ -972,7 +994,7 @@ void ServerReflectionRequest::clear_file_by_filename() { message_request_.file_by_filename_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) } - void ServerReflectionRequest::set_file_by_filename(const char* value) { +void ServerReflectionRequest::set_file_by_filename(const char* value) { if (!has_file_by_filename()) { clear_message_request(); set_has_file_by_filename(); @@ -982,7 +1004,7 @@ void ServerReflectionRequest::clear_file_by_filename() { ::std::string(value)); // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) } - void ServerReflectionRequest::set_file_by_filename(const char* value, size_t size) { +void ServerReflectionRequest::set_file_by_filename(const char* value, size_t size) { if (!has_file_by_filename()) { clear_message_request(); set_has_file_by_filename(); @@ -992,7 +1014,7 @@ void ServerReflectionRequest::clear_file_by_filename() { reinterpret_cast(value), size)); // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) } - ::std::string* ServerReflectionRequest::mutable_file_by_filename() { +::std::string* ServerReflectionRequest::mutable_file_by_filename() { if (!has_file_by_filename()) { clear_message_request(); set_has_file_by_filename(); @@ -1001,7 +1023,7 @@ void ServerReflectionRequest::clear_file_by_filename() { // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) return message_request_.file_by_filename_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - ::std::string* ServerReflectionRequest::release_file_by_filename() { +::std::string* ServerReflectionRequest::release_file_by_filename() { // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) if (has_file_by_filename()) { clear_has_message_request(); @@ -1010,7 +1032,7 @@ void ServerReflectionRequest::clear_file_by_filename() { return NULL; } } - void ServerReflectionRequest::set_allocated_file_by_filename(::std::string* file_by_filename) { +void ServerReflectionRequest::set_allocated_file_by_filename(::std::string* file_by_filename) { if (!has_file_by_filename()) { message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -1036,14 +1058,14 @@ void ServerReflectionRequest::clear_file_containing_symbol() { clear_has_message_request(); } } - const ::std::string& ServerReflectionRequest::file_containing_symbol() const { +const ::std::string& ServerReflectionRequest::file_containing_symbol() const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) if (has_file_containing_symbol()) { return message_request_.file_containing_symbol_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); } - void ServerReflectionRequest::set_file_containing_symbol(const ::std::string& value) { +void ServerReflectionRequest::set_file_containing_symbol(const ::std::string& value) { // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) if (!has_file_containing_symbol()) { clear_message_request(); @@ -1053,7 +1075,7 @@ void ServerReflectionRequest::clear_file_containing_symbol() { message_request_.file_containing_symbol_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) } - void ServerReflectionRequest::set_file_containing_symbol(const char* value) { +void ServerReflectionRequest::set_file_containing_symbol(const char* value) { if (!has_file_containing_symbol()) { clear_message_request(); set_has_file_containing_symbol(); @@ -1063,7 +1085,7 @@ void ServerReflectionRequest::clear_file_containing_symbol() { ::std::string(value)); // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) } - void ServerReflectionRequest::set_file_containing_symbol(const char* value, size_t size) { +void ServerReflectionRequest::set_file_containing_symbol(const char* value, size_t size) { if (!has_file_containing_symbol()) { clear_message_request(); set_has_file_containing_symbol(); @@ -1073,7 +1095,7 @@ void ServerReflectionRequest::clear_file_containing_symbol() { reinterpret_cast(value), size)); // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) } - ::std::string* ServerReflectionRequest::mutable_file_containing_symbol() { +::std::string* ServerReflectionRequest::mutable_file_containing_symbol() { if (!has_file_containing_symbol()) { clear_message_request(); set_has_file_containing_symbol(); @@ -1082,7 +1104,7 @@ void ServerReflectionRequest::clear_file_containing_symbol() { // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) return message_request_.file_containing_symbol_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - ::std::string* ServerReflectionRequest::release_file_containing_symbol() { +::std::string* ServerReflectionRequest::release_file_containing_symbol() { // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) if (has_file_containing_symbol()) { clear_has_message_request(); @@ -1091,7 +1113,7 @@ void ServerReflectionRequest::clear_file_containing_symbol() { return NULL; } } - void ServerReflectionRequest::set_allocated_file_containing_symbol(::std::string* file_containing_symbol) { +void ServerReflectionRequest::set_allocated_file_containing_symbol(::std::string* file_containing_symbol) { if (!has_file_containing_symbol()) { message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -1165,14 +1187,14 @@ void ServerReflectionRequest::clear_all_extension_numbers_of_type() { clear_has_message_request(); } } - const ::std::string& ServerReflectionRequest::all_extension_numbers_of_type() const { +const ::std::string& ServerReflectionRequest::all_extension_numbers_of_type() const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) if (has_all_extension_numbers_of_type()) { return message_request_.all_extension_numbers_of_type_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); } - void ServerReflectionRequest::set_all_extension_numbers_of_type(const ::std::string& value) { +void ServerReflectionRequest::set_all_extension_numbers_of_type(const ::std::string& value) { // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) if (!has_all_extension_numbers_of_type()) { clear_message_request(); @@ -1182,7 +1204,7 @@ void ServerReflectionRequest::clear_all_extension_numbers_of_type() { message_request_.all_extension_numbers_of_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) } - void ServerReflectionRequest::set_all_extension_numbers_of_type(const char* value) { +void ServerReflectionRequest::set_all_extension_numbers_of_type(const char* value) { if (!has_all_extension_numbers_of_type()) { clear_message_request(); set_has_all_extension_numbers_of_type(); @@ -1192,7 +1214,7 @@ void ServerReflectionRequest::clear_all_extension_numbers_of_type() { ::std::string(value)); // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) } - void ServerReflectionRequest::set_all_extension_numbers_of_type(const char* value, size_t size) { +void ServerReflectionRequest::set_all_extension_numbers_of_type(const char* value, size_t size) { if (!has_all_extension_numbers_of_type()) { clear_message_request(); set_has_all_extension_numbers_of_type(); @@ -1202,7 +1224,7 @@ void ServerReflectionRequest::clear_all_extension_numbers_of_type() { reinterpret_cast(value), size)); // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) } - ::std::string* ServerReflectionRequest::mutable_all_extension_numbers_of_type() { +::std::string* ServerReflectionRequest::mutable_all_extension_numbers_of_type() { if (!has_all_extension_numbers_of_type()) { clear_message_request(); set_has_all_extension_numbers_of_type(); @@ -1211,7 +1233,7 @@ void ServerReflectionRequest::clear_all_extension_numbers_of_type() { // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) return message_request_.all_extension_numbers_of_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - ::std::string* ServerReflectionRequest::release_all_extension_numbers_of_type() { +::std::string* ServerReflectionRequest::release_all_extension_numbers_of_type() { // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) if (has_all_extension_numbers_of_type()) { clear_has_message_request(); @@ -1220,7 +1242,7 @@ void ServerReflectionRequest::clear_all_extension_numbers_of_type() { return NULL; } } - void ServerReflectionRequest::set_allocated_all_extension_numbers_of_type(::std::string* all_extension_numbers_of_type) { +void ServerReflectionRequest::set_allocated_all_extension_numbers_of_type(::std::string* all_extension_numbers_of_type) { if (!has_all_extension_numbers_of_type()) { message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -1246,14 +1268,14 @@ void ServerReflectionRequest::clear_list_services() { clear_has_message_request(); } } - const ::std::string& ServerReflectionRequest::list_services() const { +const ::std::string& ServerReflectionRequest::list_services() const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) if (has_list_services()) { return message_request_.list_services_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); } - void ServerReflectionRequest::set_list_services(const ::std::string& value) { +void ServerReflectionRequest::set_list_services(const ::std::string& value) { // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) if (!has_list_services()) { clear_message_request(); @@ -1263,7 +1285,7 @@ void ServerReflectionRequest::clear_list_services() { message_request_.list_services_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) } - void ServerReflectionRequest::set_list_services(const char* value) { +void ServerReflectionRequest::set_list_services(const char* value) { if (!has_list_services()) { clear_message_request(); set_has_list_services(); @@ -1273,7 +1295,7 @@ void ServerReflectionRequest::clear_list_services() { ::std::string(value)); // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) } - void ServerReflectionRequest::set_list_services(const char* value, size_t size) { +void ServerReflectionRequest::set_list_services(const char* value, size_t size) { if (!has_list_services()) { clear_message_request(); set_has_list_services(); @@ -1283,7 +1305,7 @@ void ServerReflectionRequest::clear_list_services() { reinterpret_cast(value), size)); // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) } - ::std::string* ServerReflectionRequest::mutable_list_services() { +::std::string* ServerReflectionRequest::mutable_list_services() { if (!has_list_services()) { clear_message_request(); set_has_list_services(); @@ -1292,7 +1314,7 @@ void ServerReflectionRequest::clear_list_services() { // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) return message_request_.list_services_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - ::std::string* ServerReflectionRequest::release_list_services() { +::std::string* ServerReflectionRequest::release_list_services() { // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) if (has_list_services()) { clear_has_message_request(); @@ -1301,7 +1323,7 @@ void ServerReflectionRequest::clear_list_services() { return NULL; } } - void ServerReflectionRequest::set_allocated_list_services(::std::string* list_services) { +void ServerReflectionRequest::set_allocated_list_services(::std::string* list_services) { if (!has_list_services()) { message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -1323,6 +1345,9 @@ void ServerReflectionRequest::clear_has_message_request() { ServerReflectionRequest::MessageRequestCase ServerReflectionRequest::message_request_case() const { return ServerReflectionRequest::MessageRequestCase(_oneof_case_[0]); } +inline const ServerReflectionRequest* ServerReflectionRequest::internal_default_instance() { + return &ServerReflectionRequest_default_instance_.get(); +} #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== @@ -1334,28 +1359,26 @@ const int ExtensionRequest::kExtensionNumberFieldNumber; ExtensionRequest::ExtensionRequest() : ::google::protobuf::Message(), _internal_metadata_(NULL) { + if (this != internal_default_instance()) protobuf_InitDefaults_reflection_2eproto(); SharedCtor(); // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.ExtensionRequest) } void ExtensionRequest::InitAsDefaultInstance() { - _is_default_instance_ = true; } ExtensionRequest::ExtensionRequest(const ExtensionRequest& from) : ::google::protobuf::Message(), _internal_metadata_(NULL) { SharedCtor(); - MergeFrom(from); + UnsafeMergeFrom(from); // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.ExtensionRequest) } void ExtensionRequest::SharedCtor() { - _is_default_instance_ = false; - ::google::protobuf::internal::GetEmptyString(); - _cached_size_ = 0; containing_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); extension_number_ = 0; + _cached_size_ = 0; } ExtensionRequest::~ExtensionRequest() { @@ -1365,8 +1388,6 @@ ExtensionRequest::~ExtensionRequest() { void ExtensionRequest::SharedDtor() { containing_type_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (this != default_instance_) { - } } void ExtensionRequest::SetCachedSize(int size) const { @@ -1380,11 +1401,11 @@ const ::google::protobuf::Descriptor* ExtensionRequest::descriptor() { } const ExtensionRequest& ExtensionRequest::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); - return *default_instance_; + protobuf_InitDefaults_reflection_2eproto(); + return *internal_default_instance(); } -ExtensionRequest* ExtensionRequest::default_instance_ = NULL; +::google::protobuf::internal::ExplicitlyConstructed ExtensionRequest_default_instance_; ExtensionRequest* ExtensionRequest::New(::google::protobuf::Arena* arena) const { ExtensionRequest* n = new ExtensionRequest; @@ -1430,10 +1451,10 @@ bool ExtensionRequest::MergePartialFromCodedStream( case 2: { if (tag == 16) { parse_extension_number: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, &extension_number_))); - } else { goto handle_unusual; } @@ -1485,6 +1506,7 @@ void ExtensionRequest::SerializeWithCachedSizes( ::google::protobuf::uint8* ExtensionRequest::InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const { + (void)deterministic; // Unused // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.ExtensionRequest) // optional string containing_type = 1; if (this->containing_type().size() > 0) { @@ -1506,9 +1528,9 @@ void ExtensionRequest::SerializeWithCachedSizes( return target; } -int ExtensionRequest::ByteSize() const { +size_t ExtensionRequest::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:grpc.reflection.v1alpha.ExtensionRequest) - int total_size = 0; + size_t total_size = 0; // optional string containing_type = 1; if (this->containing_type().size() > 0) { @@ -1524,18 +1546,17 @@ int ExtensionRequest::ByteSize() const { this->extension_number()); } + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; + _cached_size_ = cached_size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); return total_size; } void ExtensionRequest::MergeFrom(const ::google::protobuf::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:grpc.reflection.v1alpha.ExtensionRequest) - if (GOOGLE_PREDICT_FALSE(&from == this)) { - ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__); - } - const ExtensionRequest* source = + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const ExtensionRequest* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { @@ -1543,15 +1564,21 @@ void ExtensionRequest::MergeFrom(const ::google::protobuf::Message& from) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { // @@protoc_insertion_point(generalized_merge_from_cast_success:grpc.reflection.v1alpha.ExtensionRequest) - MergeFrom(*source); + UnsafeMergeFrom(*source); } } void ExtensionRequest::MergeFrom(const ExtensionRequest& from) { // @@protoc_insertion_point(class_specific_merge_from_start:grpc.reflection.v1alpha.ExtensionRequest) - if (GOOGLE_PREDICT_FALSE(&from == this)) { - ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__); + if (GOOGLE_PREDICT_TRUE(&from != this)) { + UnsafeMergeFrom(from); + } else { + MergeFromFail(__LINE__); } +} + +void ExtensionRequest::UnsafeMergeFrom(const ExtensionRequest& from) { + GOOGLE_DCHECK(&from != this); if (from.containing_type().size() > 0) { containing_type_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.containing_type_); @@ -1572,7 +1599,7 @@ void ExtensionRequest::CopyFrom(const ExtensionRequest& from) { // @@protoc_insertion_point(class_specific_copy_from_start:grpc.reflection.v1alpha.ExtensionRequest) if (&from == this) return; Clear(); - MergeFrom(from); + UnsafeMergeFrom(from); } bool ExtensionRequest::IsInitialized() const { @@ -1606,37 +1633,37 @@ void ExtensionRequest::InternalSwap(ExtensionRequest* other) { void ExtensionRequest::clear_containing_type() { containing_type_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - const ::std::string& ExtensionRequest::containing_type() const { +const ::std::string& ExtensionRequest::containing_type() const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionRequest.containing_type) return containing_type_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - void ExtensionRequest::set_containing_type(const ::std::string& value) { +void ExtensionRequest::set_containing_type(const ::std::string& value) { containing_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionRequest.containing_type) } - void ExtensionRequest::set_containing_type(const char* value) { +void ExtensionRequest::set_containing_type(const char* value) { containing_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ExtensionRequest.containing_type) } - void ExtensionRequest::set_containing_type(const char* value, size_t size) { +void ExtensionRequest::set_containing_type(const char* value, size_t size) { containing_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast(value), size)); // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ExtensionRequest.containing_type) } - ::std::string* ExtensionRequest::mutable_containing_type() { +::std::string* ExtensionRequest::mutable_containing_type() { // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ExtensionRequest.containing_type) return containing_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - ::std::string* ExtensionRequest::release_containing_type() { +::std::string* ExtensionRequest::release_containing_type() { // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ExtensionRequest.containing_type) return containing_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - void ExtensionRequest::set_allocated_containing_type(::std::string* containing_type) { +void ExtensionRequest::set_allocated_containing_type(::std::string* containing_type) { if (containing_type != NULL) { } else { @@ -1650,16 +1677,19 @@ void ExtensionRequest::clear_containing_type() { void ExtensionRequest::clear_extension_number() { extension_number_ = 0; } - ::google::protobuf::int32 ExtensionRequest::extension_number() const { +::google::protobuf::int32 ExtensionRequest::extension_number() const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionRequest.extension_number) return extension_number_; } - void ExtensionRequest::set_extension_number(::google::protobuf::int32 value) { +void ExtensionRequest::set_extension_number(::google::protobuf::int32 value) { extension_number_ = value; // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionRequest.extension_number) } +inline const ExtensionRequest* ExtensionRequest::internal_default_instance() { + return &ExtensionRequest_default_instance_.get(); +} #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== @@ -1675,34 +1705,37 @@ const int ServerReflectionResponse::kErrorResponseFieldNumber; ServerReflectionResponse::ServerReflectionResponse() : ::google::protobuf::Message(), _internal_metadata_(NULL) { + if (this != internal_default_instance()) protobuf_InitDefaults_reflection_2eproto(); SharedCtor(); // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.ServerReflectionResponse) } void ServerReflectionResponse::InitAsDefaultInstance() { - _is_default_instance_ = true; - original_request_ = const_cast< ::grpc::reflection::v1alpha::ServerReflectionRequest*>(&::grpc::reflection::v1alpha::ServerReflectionRequest::default_instance()); - ServerReflectionResponse_default_oneof_instance_->file_descriptor_response_ = const_cast< ::grpc::reflection::v1alpha::FileDescriptorResponse*>(&::grpc::reflection::v1alpha::FileDescriptorResponse::default_instance()); - ServerReflectionResponse_default_oneof_instance_->all_extension_numbers_response_ = const_cast< ::grpc::reflection::v1alpha::ExtensionNumberResponse*>(&::grpc::reflection::v1alpha::ExtensionNumberResponse::default_instance()); - ServerReflectionResponse_default_oneof_instance_->list_services_response_ = const_cast< ::grpc::reflection::v1alpha::ListServiceResponse*>(&::grpc::reflection::v1alpha::ListServiceResponse::default_instance()); - ServerReflectionResponse_default_oneof_instance_->error_response_ = const_cast< ::grpc::reflection::v1alpha::ErrorResponse*>(&::grpc::reflection::v1alpha::ErrorResponse::default_instance()); + original_request_ = const_cast< ::grpc::reflection::v1alpha::ServerReflectionRequest*>( + ::grpc::reflection::v1alpha::ServerReflectionRequest::internal_default_instance()); + ServerReflectionResponse_default_oneof_instance_->file_descriptor_response_ = const_cast< ::grpc::reflection::v1alpha::FileDescriptorResponse*>( + ::grpc::reflection::v1alpha::FileDescriptorResponse::internal_default_instance()); + ServerReflectionResponse_default_oneof_instance_->all_extension_numbers_response_ = const_cast< ::grpc::reflection::v1alpha::ExtensionNumberResponse*>( + ::grpc::reflection::v1alpha::ExtensionNumberResponse::internal_default_instance()); + ServerReflectionResponse_default_oneof_instance_->list_services_response_ = const_cast< ::grpc::reflection::v1alpha::ListServiceResponse*>( + ::grpc::reflection::v1alpha::ListServiceResponse::internal_default_instance()); + ServerReflectionResponse_default_oneof_instance_->error_response_ = const_cast< ::grpc::reflection::v1alpha::ErrorResponse*>( + ::grpc::reflection::v1alpha::ErrorResponse::internal_default_instance()); } ServerReflectionResponse::ServerReflectionResponse(const ServerReflectionResponse& from) : ::google::protobuf::Message(), _internal_metadata_(NULL) { SharedCtor(); - MergeFrom(from); + UnsafeMergeFrom(from); // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.ServerReflectionResponse) } void ServerReflectionResponse::SharedCtor() { - _is_default_instance_ = false; - ::google::protobuf::internal::GetEmptyString(); - _cached_size_ = 0; valid_host_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); original_request_ = NULL; clear_has_message_response(); + _cached_size_ = 0; } ServerReflectionResponse::~ServerReflectionResponse() { @@ -1715,7 +1748,7 @@ void ServerReflectionResponse::SharedDtor() { if (has_message_response()) { clear_message_response(); } - if (this != default_instance_) { + if (this != &ServerReflectionResponse_default_instance_.get()) { delete original_request_; } } @@ -1731,11 +1764,11 @@ const ::google::protobuf::Descriptor* ServerReflectionResponse::descriptor() { } const ServerReflectionResponse& ServerReflectionResponse::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); - return *default_instance_; + protobuf_InitDefaults_reflection_2eproto(); + return *internal_default_instance(); } -ServerReflectionResponse* ServerReflectionResponse::default_instance_ = NULL; +::google::protobuf::internal::ExplicitlyConstructed ServerReflectionResponse_default_instance_; ServerReflectionResponse* ServerReflectionResponse::New(::google::protobuf::Arena* arena) const { ServerReflectionResponse* n = new ServerReflectionResponse; @@ -1747,7 +1780,7 @@ ServerReflectionResponse* ServerReflectionResponse::New(::google::protobuf::Aren void ServerReflectionResponse::clear_message_response() { // @@protoc_insertion_point(one_of_clear_start:grpc.reflection.v1alpha.ServerReflectionResponse) - switch(message_response_case()) { + switch (message_response_case()) { case kFileDescriptorResponse: { delete message_response_.file_descriptor_response_; break; @@ -1828,27 +1861,25 @@ bool ServerReflectionResponse::MergePartialFromCodedStream( } else { goto handle_unusual; } - if (input->ExpectTag(42)) goto parse_all_extension_numbers_response; + goto after_error_response; break; } // optional .grpc.reflection.v1alpha.ExtensionNumberResponse all_extension_numbers_response = 5; case 5: { if (tag == 42) { - parse_all_extension_numbers_response: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_all_extension_numbers_response())); } else { goto handle_unusual; } - if (input->ExpectTag(50)) goto parse_list_services_response; + goto after_error_response; break; } // optional .grpc.reflection.v1alpha.ListServiceResponse list_services_response = 6; case 6: { if (tag == 50) { - parse_list_services_response: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( input, mutable_list_services_response())); } else { @@ -1867,6 +1898,7 @@ bool ServerReflectionResponse::MergePartialFromCodedStream( } else { goto handle_unusual; } + after_error_response: if (input->ExpectAtEnd()) goto success; break; } @@ -1940,6 +1972,7 @@ void ServerReflectionResponse::SerializeWithCachedSizes( ::google::protobuf::uint8* ServerReflectionResponse::InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const { + (void)deterministic; // Unused // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.ServerReflectionResponse) // optional string valid_host = 1; if (this->valid_host().size() > 0) { @@ -1991,9 +2024,9 @@ void ServerReflectionResponse::SerializeWithCachedSizes( return target; } -int ServerReflectionResponse::ByteSize() const { +size_t ServerReflectionResponse::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:grpc.reflection.v1alpha.ServerReflectionResponse) - int total_size = 0; + size_t total_size = 0; // optional string valid_host = 1; if (this->valid_host().size() > 0) { @@ -2042,18 +2075,17 @@ int ServerReflectionResponse::ByteSize() const { break; } } + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; + _cached_size_ = cached_size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); return total_size; } void ServerReflectionResponse::MergeFrom(const ::google::protobuf::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:grpc.reflection.v1alpha.ServerReflectionResponse) - if (GOOGLE_PREDICT_FALSE(&from == this)) { - ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__); - } - const ServerReflectionResponse* source = + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const ServerReflectionResponse* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { @@ -2061,15 +2093,21 @@ void ServerReflectionResponse::MergeFrom(const ::google::protobuf::Message& from ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { // @@protoc_insertion_point(generalized_merge_from_cast_success:grpc.reflection.v1alpha.ServerReflectionResponse) - MergeFrom(*source); + UnsafeMergeFrom(*source); } } void ServerReflectionResponse::MergeFrom(const ServerReflectionResponse& from) { // @@protoc_insertion_point(class_specific_merge_from_start:grpc.reflection.v1alpha.ServerReflectionResponse) - if (GOOGLE_PREDICT_FALSE(&from == this)) { - ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__); + if (GOOGLE_PREDICT_TRUE(&from != this)) { + UnsafeMergeFrom(from); + } else { + MergeFromFail(__LINE__); } +} + +void ServerReflectionResponse::UnsafeMergeFrom(const ServerReflectionResponse& from) { + GOOGLE_DCHECK(&from != this); switch (from.message_response_case()) { case kFileDescriptorResponse: { mutable_file_descriptor_response()->::grpc::reflection::v1alpha::FileDescriptorResponse::MergeFrom(from.file_descriptor_response()); @@ -2111,7 +2149,7 @@ void ServerReflectionResponse::CopyFrom(const ServerReflectionResponse& from) { // @@protoc_insertion_point(class_specific_copy_from_start:grpc.reflection.v1alpha.ServerReflectionResponse) if (&from == this) return; Clear(); - MergeFrom(from); + UnsafeMergeFrom(from); } bool ServerReflectionResponse::IsInitialized() const { @@ -2147,37 +2185,37 @@ void ServerReflectionResponse::InternalSwap(ServerReflectionResponse* other) { void ServerReflectionResponse::clear_valid_host() { valid_host_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - const ::std::string& ServerReflectionResponse::valid_host() const { +const ::std::string& ServerReflectionResponse::valid_host() const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) return valid_host_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - void ServerReflectionResponse::set_valid_host(const ::std::string& value) { +void ServerReflectionResponse::set_valid_host(const ::std::string& value) { valid_host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) } - void ServerReflectionResponse::set_valid_host(const char* value) { +void ServerReflectionResponse::set_valid_host(const char* value) { valid_host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) } - void ServerReflectionResponse::set_valid_host(const char* value, size_t size) { +void ServerReflectionResponse::set_valid_host(const char* value, size_t size) { valid_host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast(value), size)); // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) } - ::std::string* ServerReflectionResponse::mutable_valid_host() { +::std::string* ServerReflectionResponse::mutable_valid_host() { // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) return valid_host_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - ::std::string* ServerReflectionResponse::release_valid_host() { +::std::string* ServerReflectionResponse::release_valid_host() { // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) return valid_host_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - void ServerReflectionResponse::set_allocated_valid_host(::std::string* valid_host) { +void ServerReflectionResponse::set_allocated_valid_host(::std::string* valid_host) { if (valid_host != NULL) { } else { @@ -2189,7 +2227,7 @@ void ServerReflectionResponse::clear_valid_host() { // optional .grpc.reflection.v1alpha.ServerReflectionRequest original_request = 2; bool ServerReflectionResponse::has_original_request() const { - return !_is_default_instance_ && original_request_ != NULL; + return this != internal_default_instance() && original_request_ != NULL; } void ServerReflectionResponse::clear_original_request() { if (GetArenaNoVirtual() == NULL && original_request_ != NULL) delete original_request_; @@ -2197,7 +2235,8 @@ void ServerReflectionResponse::clear_original_request() { } const ::grpc::reflection::v1alpha::ServerReflectionRequest& ServerReflectionResponse::original_request() const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.original_request) - return original_request_ != NULL ? *original_request_ : *default_instance_->original_request_; + return original_request_ != NULL ? *original_request_ + : *::grpc::reflection::v1alpha::ServerReflectionRequest::internal_default_instance(); } ::grpc::reflection::v1alpha::ServerReflectionRequest* ServerReflectionResponse::mutable_original_request() { @@ -2426,6 +2465,9 @@ void ServerReflectionResponse::clear_has_message_response() { ServerReflectionResponse::MessageResponseCase ServerReflectionResponse::message_response_case() const { return ServerReflectionResponse::MessageResponseCase(_oneof_case_[0]); } +inline const ServerReflectionResponse* ServerReflectionResponse::internal_default_instance() { + return &ServerReflectionResponse_default_instance_.get(); +} #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== @@ -2436,25 +2478,23 @@ const int FileDescriptorResponse::kFileDescriptorProtoFieldNumber; FileDescriptorResponse::FileDescriptorResponse() : ::google::protobuf::Message(), _internal_metadata_(NULL) { + if (this != internal_default_instance()) protobuf_InitDefaults_reflection_2eproto(); SharedCtor(); // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.FileDescriptorResponse) } void FileDescriptorResponse::InitAsDefaultInstance() { - _is_default_instance_ = true; } FileDescriptorResponse::FileDescriptorResponse(const FileDescriptorResponse& from) : ::google::protobuf::Message(), _internal_metadata_(NULL) { SharedCtor(); - MergeFrom(from); + UnsafeMergeFrom(from); // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.FileDescriptorResponse) } void FileDescriptorResponse::SharedCtor() { - _is_default_instance_ = false; - ::google::protobuf::internal::GetEmptyString(); _cached_size_ = 0; } @@ -2464,8 +2504,6 @@ FileDescriptorResponse::~FileDescriptorResponse() { } void FileDescriptorResponse::SharedDtor() { - if (this != default_instance_) { - } } void FileDescriptorResponse::SetCachedSize(int size) const { @@ -2479,11 +2517,11 @@ const ::google::protobuf::Descriptor* FileDescriptorResponse::descriptor() { } const FileDescriptorResponse& FileDescriptorResponse::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); - return *default_instance_; + protobuf_InitDefaults_reflection_2eproto(); + return *internal_default_instance(); } -FileDescriptorResponse* FileDescriptorResponse::default_instance_ = NULL; +::google::protobuf::internal::ExplicitlyConstructed FileDescriptorResponse_default_instance_; FileDescriptorResponse* FileDescriptorResponse::New(::google::protobuf::Arena* arena) const { FileDescriptorResponse* n = new FileDescriptorResponse; @@ -2557,6 +2595,7 @@ void FileDescriptorResponse::SerializeWithCachedSizes( ::google::protobuf::uint8* FileDescriptorResponse::InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const { + (void)deterministic; // Unused // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.FileDescriptorResponse) // repeated bytes file_descriptor_proto = 1; for (int i = 0; i < this->file_descriptor_proto_size(); i++) { @@ -2568,29 +2607,29 @@ void FileDescriptorResponse::SerializeWithCachedSizes( return target; } -int FileDescriptorResponse::ByteSize() const { +size_t FileDescriptorResponse::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:grpc.reflection.v1alpha.FileDescriptorResponse) - int total_size = 0; + size_t total_size = 0; // repeated bytes file_descriptor_proto = 1; - total_size += 1 * this->file_descriptor_proto_size(); + total_size += 1 * + ::google::protobuf::internal::FromIntSize(this->file_descriptor_proto_size()); for (int i = 0; i < this->file_descriptor_proto_size(); i++) { total_size += ::google::protobuf::internal::WireFormatLite::BytesSize( this->file_descriptor_proto(i)); } + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; + _cached_size_ = cached_size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); return total_size; } void FileDescriptorResponse::MergeFrom(const ::google::protobuf::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:grpc.reflection.v1alpha.FileDescriptorResponse) - if (GOOGLE_PREDICT_FALSE(&from == this)) { - ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__); - } - const FileDescriptorResponse* source = + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const FileDescriptorResponse* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { @@ -2598,16 +2637,22 @@ void FileDescriptorResponse::MergeFrom(const ::google::protobuf::Message& from) ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { // @@protoc_insertion_point(generalized_merge_from_cast_success:grpc.reflection.v1alpha.FileDescriptorResponse) - MergeFrom(*source); + UnsafeMergeFrom(*source); } } void FileDescriptorResponse::MergeFrom(const FileDescriptorResponse& from) { // @@protoc_insertion_point(class_specific_merge_from_start:grpc.reflection.v1alpha.FileDescriptorResponse) - if (GOOGLE_PREDICT_FALSE(&from == this)) { - ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__); + if (GOOGLE_PREDICT_TRUE(&from != this)) { + UnsafeMergeFrom(from); + } else { + MergeFromFail(__LINE__); } - file_descriptor_proto_.MergeFrom(from.file_descriptor_proto_); +} + +void FileDescriptorResponse::UnsafeMergeFrom(const FileDescriptorResponse& from) { + GOOGLE_DCHECK(&from != this); + file_descriptor_proto_.UnsafeMergeFrom(from.file_descriptor_proto_); } void FileDescriptorResponse::CopyFrom(const ::google::protobuf::Message& from) { @@ -2621,7 +2666,7 @@ void FileDescriptorResponse::CopyFrom(const FileDescriptorResponse& from) { // @@protoc_insertion_point(class_specific_copy_from_start:grpc.reflection.v1alpha.FileDescriptorResponse) if (&from == this) return; Clear(); - MergeFrom(from); + UnsafeMergeFrom(from); } bool FileDescriptorResponse::IsInitialized() const { @@ -2657,54 +2702,57 @@ int FileDescriptorResponse::file_descriptor_proto_size() const { void FileDescriptorResponse::clear_file_descriptor_proto() { file_descriptor_proto_.Clear(); } - const ::std::string& FileDescriptorResponse::file_descriptor_proto(int index) const { +const ::std::string& FileDescriptorResponse::file_descriptor_proto(int index) const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) return file_descriptor_proto_.Get(index); } - ::std::string* FileDescriptorResponse::mutable_file_descriptor_proto(int index) { +::std::string* FileDescriptorResponse::mutable_file_descriptor_proto(int index) { // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) return file_descriptor_proto_.Mutable(index); } - void FileDescriptorResponse::set_file_descriptor_proto(int index, const ::std::string& value) { +void FileDescriptorResponse::set_file_descriptor_proto(int index, const ::std::string& value) { // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) file_descriptor_proto_.Mutable(index)->assign(value); } - void FileDescriptorResponse::set_file_descriptor_proto(int index, const char* value) { +void FileDescriptorResponse::set_file_descriptor_proto(int index, const char* value) { file_descriptor_proto_.Mutable(index)->assign(value); // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) } - void FileDescriptorResponse::set_file_descriptor_proto(int index, const void* value, size_t size) { +void FileDescriptorResponse::set_file_descriptor_proto(int index, const void* value, size_t size) { file_descriptor_proto_.Mutable(index)->assign( reinterpret_cast(value), size); // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) } - ::std::string* FileDescriptorResponse::add_file_descriptor_proto() { +::std::string* FileDescriptorResponse::add_file_descriptor_proto() { // @@protoc_insertion_point(field_add_mutable:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) return file_descriptor_proto_.Add(); } - void FileDescriptorResponse::add_file_descriptor_proto(const ::std::string& value) { +void FileDescriptorResponse::add_file_descriptor_proto(const ::std::string& value) { file_descriptor_proto_.Add()->assign(value); // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) } - void FileDescriptorResponse::add_file_descriptor_proto(const char* value) { +void FileDescriptorResponse::add_file_descriptor_proto(const char* value) { file_descriptor_proto_.Add()->assign(value); // @@protoc_insertion_point(field_add_char:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) } - void FileDescriptorResponse::add_file_descriptor_proto(const void* value, size_t size) { +void FileDescriptorResponse::add_file_descriptor_proto(const void* value, size_t size) { file_descriptor_proto_.Add()->assign(reinterpret_cast(value), size); // @@protoc_insertion_point(field_add_pointer:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) } - const ::google::protobuf::RepeatedPtrField< ::std::string>& +const ::google::protobuf::RepeatedPtrField< ::std::string>& FileDescriptorResponse::file_descriptor_proto() const { // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) return file_descriptor_proto_; } - ::google::protobuf::RepeatedPtrField< ::std::string>* +::google::protobuf::RepeatedPtrField< ::std::string>* FileDescriptorResponse::mutable_file_descriptor_proto() { // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) return &file_descriptor_proto_; } +inline const FileDescriptorResponse* FileDescriptorResponse::internal_default_instance() { + return &FileDescriptorResponse_default_instance_.get(); +} #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== @@ -2716,27 +2764,25 @@ const int ExtensionNumberResponse::kExtensionNumberFieldNumber; ExtensionNumberResponse::ExtensionNumberResponse() : ::google::protobuf::Message(), _internal_metadata_(NULL) { + if (this != internal_default_instance()) protobuf_InitDefaults_reflection_2eproto(); SharedCtor(); // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.ExtensionNumberResponse) } void ExtensionNumberResponse::InitAsDefaultInstance() { - _is_default_instance_ = true; } ExtensionNumberResponse::ExtensionNumberResponse(const ExtensionNumberResponse& from) : ::google::protobuf::Message(), _internal_metadata_(NULL) { SharedCtor(); - MergeFrom(from); + UnsafeMergeFrom(from); // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.ExtensionNumberResponse) } void ExtensionNumberResponse::SharedCtor() { - _is_default_instance_ = false; - ::google::protobuf::internal::GetEmptyString(); - _cached_size_ = 0; base_type_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + _cached_size_ = 0; } ExtensionNumberResponse::~ExtensionNumberResponse() { @@ -2746,8 +2792,6 @@ ExtensionNumberResponse::~ExtensionNumberResponse() { void ExtensionNumberResponse::SharedDtor() { base_type_name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (this != default_instance_) { - } } void ExtensionNumberResponse::SetCachedSize(int size) const { @@ -2761,11 +2805,11 @@ const ::google::protobuf::Descriptor* ExtensionNumberResponse::descriptor() { } const ExtensionNumberResponse& ExtensionNumberResponse::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); - return *default_instance_; + protobuf_InitDefaults_reflection_2eproto(); + return *internal_default_instance(); } -ExtensionNumberResponse* ExtensionNumberResponse::default_instance_ = NULL; +::google::protobuf::internal::ExplicitlyConstructed ExtensionNumberResponse_default_instance_; ExtensionNumberResponse* ExtensionNumberResponse::New(::google::protobuf::Arena* arena) const { ExtensionNumberResponse* n = new ExtensionNumberResponse; @@ -2874,6 +2918,7 @@ void ExtensionNumberResponse::SerializeWithCachedSizes( ::google::protobuf::uint8* ExtensionNumberResponse::InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const { + (void)deterministic; // Unused // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.ExtensionNumberResponse) // optional string base_type_name = 1; if (this->base_type_name().size() > 0) { @@ -2904,9 +2949,9 @@ void ExtensionNumberResponse::SerializeWithCachedSizes( return target; } -int ExtensionNumberResponse::ByteSize() const { +size_t ExtensionNumberResponse::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:grpc.reflection.v1alpha.ExtensionNumberResponse) - int total_size = 0; + size_t total_size = 0; // optional string base_type_name = 1; if (this->base_type_name().size() > 0) { @@ -2917,8 +2962,9 @@ int ExtensionNumberResponse::ByteSize() const { // repeated int32 extension_number = 2; { - int data_size = 0; - for (int i = 0; i < this->extension_number_size(); i++) { + size_t data_size = 0; + unsigned int count = this->extension_number_size(); + for (unsigned int i = 0; i < count; i++) { data_size += ::google::protobuf::internal::WireFormatLite:: Int32Size(this->extension_number(i)); } @@ -2926,24 +2972,24 @@ int ExtensionNumberResponse::ByteSize() const { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); } + int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _extension_number_cached_byte_size_ = data_size; + _extension_number_cached_byte_size_ = cached_size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); total_size += data_size; } + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; + _cached_size_ = cached_size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); return total_size; } void ExtensionNumberResponse::MergeFrom(const ::google::protobuf::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:grpc.reflection.v1alpha.ExtensionNumberResponse) - if (GOOGLE_PREDICT_FALSE(&from == this)) { - ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__); - } - const ExtensionNumberResponse* source = + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const ExtensionNumberResponse* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { @@ -2951,16 +2997,22 @@ void ExtensionNumberResponse::MergeFrom(const ::google::protobuf::Message& from) ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { // @@protoc_insertion_point(generalized_merge_from_cast_success:grpc.reflection.v1alpha.ExtensionNumberResponse) - MergeFrom(*source); + UnsafeMergeFrom(*source); } } void ExtensionNumberResponse::MergeFrom(const ExtensionNumberResponse& from) { // @@protoc_insertion_point(class_specific_merge_from_start:grpc.reflection.v1alpha.ExtensionNumberResponse) - if (GOOGLE_PREDICT_FALSE(&from == this)) { - ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__); + if (GOOGLE_PREDICT_TRUE(&from != this)) { + UnsafeMergeFrom(from); + } else { + MergeFromFail(__LINE__); } - extension_number_.MergeFrom(from.extension_number_); +} + +void ExtensionNumberResponse::UnsafeMergeFrom(const ExtensionNumberResponse& from) { + GOOGLE_DCHECK(&from != this); + extension_number_.UnsafeMergeFrom(from.extension_number_); if (from.base_type_name().size() > 0) { base_type_name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.base_type_name_); @@ -2978,7 +3030,7 @@ void ExtensionNumberResponse::CopyFrom(const ExtensionNumberResponse& from) { // @@protoc_insertion_point(class_specific_copy_from_start:grpc.reflection.v1alpha.ExtensionNumberResponse) if (&from == this) return; Clear(); - MergeFrom(from); + UnsafeMergeFrom(from); } bool ExtensionNumberResponse::IsInitialized() const { @@ -3012,37 +3064,37 @@ void ExtensionNumberResponse::InternalSwap(ExtensionNumberResponse* other) { void ExtensionNumberResponse::clear_base_type_name() { base_type_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - const ::std::string& ExtensionNumberResponse::base_type_name() const { +const ::std::string& ExtensionNumberResponse::base_type_name() const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) return base_type_name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - void ExtensionNumberResponse::set_base_type_name(const ::std::string& value) { +void ExtensionNumberResponse::set_base_type_name(const ::std::string& value) { base_type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) } - void ExtensionNumberResponse::set_base_type_name(const char* value) { +void ExtensionNumberResponse::set_base_type_name(const char* value) { base_type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) } - void ExtensionNumberResponse::set_base_type_name(const char* value, size_t size) { +void ExtensionNumberResponse::set_base_type_name(const char* value, size_t size) { base_type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast(value), size)); // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) } - ::std::string* ExtensionNumberResponse::mutable_base_type_name() { +::std::string* ExtensionNumberResponse::mutable_base_type_name() { // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) return base_type_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - ::std::string* ExtensionNumberResponse::release_base_type_name() { +::std::string* ExtensionNumberResponse::release_base_type_name() { // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) return base_type_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - void ExtensionNumberResponse::set_allocated_base_type_name(::std::string* base_type_name) { +void ExtensionNumberResponse::set_allocated_base_type_name(::std::string* base_type_name) { if (base_type_name != NULL) { } else { @@ -3059,29 +3111,32 @@ int ExtensionNumberResponse::extension_number_size() const { void ExtensionNumberResponse::clear_extension_number() { extension_number_.Clear(); } - ::google::protobuf::int32 ExtensionNumberResponse::extension_number(int index) const { +::google::protobuf::int32 ExtensionNumberResponse::extension_number(int index) const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) return extension_number_.Get(index); } - void ExtensionNumberResponse::set_extension_number(int index, ::google::protobuf::int32 value) { +void ExtensionNumberResponse::set_extension_number(int index, ::google::protobuf::int32 value) { extension_number_.Set(index, value); // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) } - void ExtensionNumberResponse::add_extension_number(::google::protobuf::int32 value) { +void ExtensionNumberResponse::add_extension_number(::google::protobuf::int32 value) { extension_number_.Add(value); // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) } - const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& +const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& ExtensionNumberResponse::extension_number() const { // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) return extension_number_; } - ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* +::google::protobuf::RepeatedField< ::google::protobuf::int32 >* ExtensionNumberResponse::mutable_extension_number() { // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) return &extension_number_; } +inline const ExtensionNumberResponse* ExtensionNumberResponse::internal_default_instance() { + return &ExtensionNumberResponse_default_instance_.get(); +} #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== @@ -3092,24 +3147,23 @@ const int ListServiceResponse::kServiceFieldNumber; ListServiceResponse::ListServiceResponse() : ::google::protobuf::Message(), _internal_metadata_(NULL) { + if (this != internal_default_instance()) protobuf_InitDefaults_reflection_2eproto(); SharedCtor(); // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.ListServiceResponse) } void ListServiceResponse::InitAsDefaultInstance() { - _is_default_instance_ = true; } ListServiceResponse::ListServiceResponse(const ListServiceResponse& from) : ::google::protobuf::Message(), _internal_metadata_(NULL) { SharedCtor(); - MergeFrom(from); + UnsafeMergeFrom(from); // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.ListServiceResponse) } void ListServiceResponse::SharedCtor() { - _is_default_instance_ = false; _cached_size_ = 0; } @@ -3119,8 +3173,6 @@ ListServiceResponse::~ListServiceResponse() { } void ListServiceResponse::SharedDtor() { - if (this != default_instance_) { - } } void ListServiceResponse::SetCachedSize(int size) const { @@ -3134,11 +3186,11 @@ const ::google::protobuf::Descriptor* ListServiceResponse::descriptor() { } const ListServiceResponse& ListServiceResponse::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); - return *default_instance_; + protobuf_InitDefaults_reflection_2eproto(); + return *internal_default_instance(); } -ListServiceResponse* ListServiceResponse::default_instance_ = NULL; +::google::protobuf::internal::ExplicitlyConstructed ListServiceResponse_default_instance_; ListServiceResponse* ListServiceResponse::New(::google::protobuf::Arena* arena) const { ListServiceResponse* n = new ListServiceResponse; @@ -3214,6 +3266,7 @@ void ListServiceResponse::SerializeWithCachedSizes( ::google::protobuf::uint8* ListServiceResponse::InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const { + (void)deterministic; // Unused // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.ListServiceResponse) // repeated .grpc.reflection.v1alpha.ServiceResponse service = 1; for (unsigned int i = 0, n = this->service_size(); i < n; i++) { @@ -3226,30 +3279,32 @@ void ListServiceResponse::SerializeWithCachedSizes( return target; } -int ListServiceResponse::ByteSize() const { +size_t ListServiceResponse::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:grpc.reflection.v1alpha.ListServiceResponse) - int total_size = 0; + size_t total_size = 0; // repeated .grpc.reflection.v1alpha.ServiceResponse service = 1; - total_size += 1 * this->service_size(); - for (int i = 0; i < this->service_size(); i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->service(i)); + { + unsigned int count = this->service_size(); + total_size += 1UL * count; + for (unsigned int i = 0; i < count; i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->service(i)); + } } + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; + _cached_size_ = cached_size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); return total_size; } void ListServiceResponse::MergeFrom(const ::google::protobuf::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:grpc.reflection.v1alpha.ListServiceResponse) - if (GOOGLE_PREDICT_FALSE(&from == this)) { - ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__); - } - const ListServiceResponse* source = + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const ListServiceResponse* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { @@ -3257,15 +3312,21 @@ void ListServiceResponse::MergeFrom(const ::google::protobuf::Message& from) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { // @@protoc_insertion_point(generalized_merge_from_cast_success:grpc.reflection.v1alpha.ListServiceResponse) - MergeFrom(*source); + UnsafeMergeFrom(*source); } } void ListServiceResponse::MergeFrom(const ListServiceResponse& from) { // @@protoc_insertion_point(class_specific_merge_from_start:grpc.reflection.v1alpha.ListServiceResponse) - if (GOOGLE_PREDICT_FALSE(&from == this)) { - ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__); + if (GOOGLE_PREDICT_TRUE(&from != this)) { + UnsafeMergeFrom(from); + } else { + MergeFromFail(__LINE__); } +} + +void ListServiceResponse::UnsafeMergeFrom(const ListServiceResponse& from) { + GOOGLE_DCHECK(&from != this); service_.MergeFrom(from.service_); } @@ -3280,7 +3341,7 @@ void ListServiceResponse::CopyFrom(const ListServiceResponse& from) { // @@protoc_insertion_point(class_specific_copy_from_start:grpc.reflection.v1alpha.ListServiceResponse) if (&from == this) return; Clear(); - MergeFrom(from); + UnsafeMergeFrom(from); } bool ListServiceResponse::IsInitialized() const { @@ -3339,6 +3400,9 @@ ListServiceResponse::service() const { return service_; } +inline const ListServiceResponse* ListServiceResponse::internal_default_instance() { + return &ListServiceResponse_default_instance_.get(); +} #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== @@ -3349,27 +3413,25 @@ const int ServiceResponse::kNameFieldNumber; ServiceResponse::ServiceResponse() : ::google::protobuf::Message(), _internal_metadata_(NULL) { + if (this != internal_default_instance()) protobuf_InitDefaults_reflection_2eproto(); SharedCtor(); // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.ServiceResponse) } void ServiceResponse::InitAsDefaultInstance() { - _is_default_instance_ = true; } ServiceResponse::ServiceResponse(const ServiceResponse& from) : ::google::protobuf::Message(), _internal_metadata_(NULL) { SharedCtor(); - MergeFrom(from); + UnsafeMergeFrom(from); // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.ServiceResponse) } void ServiceResponse::SharedCtor() { - _is_default_instance_ = false; - ::google::protobuf::internal::GetEmptyString(); - _cached_size_ = 0; name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + _cached_size_ = 0; } ServiceResponse::~ServiceResponse() { @@ -3379,8 +3441,6 @@ ServiceResponse::~ServiceResponse() { void ServiceResponse::SharedDtor() { name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (this != default_instance_) { - } } void ServiceResponse::SetCachedSize(int size) const { @@ -3394,11 +3454,11 @@ const ::google::protobuf::Descriptor* ServiceResponse::descriptor() { } const ServiceResponse& ServiceResponse::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); - return *default_instance_; + protobuf_InitDefaults_reflection_2eproto(); + return *internal_default_instance(); } -ServiceResponse* ServiceResponse::default_instance_ = NULL; +::google::protobuf::internal::ExplicitlyConstructed ServiceResponse_default_instance_; ServiceResponse* ServiceResponse::New(::google::protobuf::Arena* arena) const { ServiceResponse* n = new ServiceResponse; @@ -3478,6 +3538,7 @@ void ServiceResponse::SerializeWithCachedSizes( ::google::protobuf::uint8* ServiceResponse::InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const { + (void)deterministic; // Unused // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.ServiceResponse) // optional string name = 1; if (this->name().size() > 0) { @@ -3494,9 +3555,9 @@ void ServiceResponse::SerializeWithCachedSizes( return target; } -int ServiceResponse::ByteSize() const { +size_t ServiceResponse::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:grpc.reflection.v1alpha.ServiceResponse) - int total_size = 0; + size_t total_size = 0; // optional string name = 1; if (this->name().size() > 0) { @@ -3505,18 +3566,17 @@ int ServiceResponse::ByteSize() const { this->name()); } + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; + _cached_size_ = cached_size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); return total_size; } void ServiceResponse::MergeFrom(const ::google::protobuf::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:grpc.reflection.v1alpha.ServiceResponse) - if (GOOGLE_PREDICT_FALSE(&from == this)) { - ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__); - } - const ServiceResponse* source = + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const ServiceResponse* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { @@ -3524,15 +3584,21 @@ void ServiceResponse::MergeFrom(const ::google::protobuf::Message& from) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { // @@protoc_insertion_point(generalized_merge_from_cast_success:grpc.reflection.v1alpha.ServiceResponse) - MergeFrom(*source); + UnsafeMergeFrom(*source); } } void ServiceResponse::MergeFrom(const ServiceResponse& from) { // @@protoc_insertion_point(class_specific_merge_from_start:grpc.reflection.v1alpha.ServiceResponse) - if (GOOGLE_PREDICT_FALSE(&from == this)) { - ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__); + if (GOOGLE_PREDICT_TRUE(&from != this)) { + UnsafeMergeFrom(from); + } else { + MergeFromFail(__LINE__); } +} + +void ServiceResponse::UnsafeMergeFrom(const ServiceResponse& from) { + GOOGLE_DCHECK(&from != this); if (from.name().size() > 0) { name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); @@ -3550,7 +3616,7 @@ void ServiceResponse::CopyFrom(const ServiceResponse& from) { // @@protoc_insertion_point(class_specific_copy_from_start:grpc.reflection.v1alpha.ServiceResponse) if (&from == this) return; Clear(); - MergeFrom(from); + UnsafeMergeFrom(from); } bool ServiceResponse::IsInitialized() const { @@ -3583,37 +3649,37 @@ void ServiceResponse::InternalSwap(ServiceResponse* other) { void ServiceResponse::clear_name() { name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - const ::std::string& ServiceResponse::name() const { +const ::std::string& ServiceResponse::name() const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServiceResponse.name) return name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - void ServiceResponse::set_name(const ::std::string& value) { +void ServiceResponse::set_name(const ::std::string& value) { name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServiceResponse.name) } - void ServiceResponse::set_name(const char* value) { +void ServiceResponse::set_name(const char* value) { name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServiceResponse.name) } - void ServiceResponse::set_name(const char* value, size_t size) { +void ServiceResponse::set_name(const char* value, size_t size) { name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast(value), size)); // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServiceResponse.name) } - ::std::string* ServiceResponse::mutable_name() { +::std::string* ServiceResponse::mutable_name() { // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServiceResponse.name) return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - ::std::string* ServiceResponse::release_name() { +::std::string* ServiceResponse::release_name() { // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServiceResponse.name) return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - void ServiceResponse::set_allocated_name(::std::string* name) { +void ServiceResponse::set_allocated_name(::std::string* name) { if (name != NULL) { } else { @@ -3623,6 +3689,9 @@ void ServiceResponse::clear_name() { // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServiceResponse.name) } +inline const ServiceResponse* ServiceResponse::internal_default_instance() { + return &ServiceResponse_default_instance_.get(); +} #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== @@ -3634,28 +3703,26 @@ const int ErrorResponse::kErrorMessageFieldNumber; ErrorResponse::ErrorResponse() : ::google::protobuf::Message(), _internal_metadata_(NULL) { + if (this != internal_default_instance()) protobuf_InitDefaults_reflection_2eproto(); SharedCtor(); // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.ErrorResponse) } void ErrorResponse::InitAsDefaultInstance() { - _is_default_instance_ = true; } ErrorResponse::ErrorResponse(const ErrorResponse& from) : ::google::protobuf::Message(), _internal_metadata_(NULL) { SharedCtor(); - MergeFrom(from); + UnsafeMergeFrom(from); // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.ErrorResponse) } void ErrorResponse::SharedCtor() { - _is_default_instance_ = false; - ::google::protobuf::internal::GetEmptyString(); - _cached_size_ = 0; - error_code_ = 0; error_message_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + error_code_ = 0; + _cached_size_ = 0; } ErrorResponse::~ErrorResponse() { @@ -3665,8 +3732,6 @@ ErrorResponse::~ErrorResponse() { void ErrorResponse::SharedDtor() { error_message_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (this != default_instance_) { - } } void ErrorResponse::SetCachedSize(int size) const { @@ -3680,11 +3745,11 @@ const ::google::protobuf::Descriptor* ErrorResponse::descriptor() { } const ErrorResponse& ErrorResponse::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); - return *default_instance_; + protobuf_InitDefaults_reflection_2eproto(); + return *internal_default_instance(); } -ErrorResponse* ErrorResponse::default_instance_ = NULL; +::google::protobuf::internal::ExplicitlyConstructed ErrorResponse_default_instance_; ErrorResponse* ErrorResponse::New(::google::protobuf::Arena* arena) const { ErrorResponse* n = new ErrorResponse; @@ -3713,10 +3778,10 @@ bool ErrorResponse::MergePartialFromCodedStream( // optional int32 error_code = 1; case 1: { if (tag == 8) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( input, &error_code_))); - } else { goto handle_unusual; } @@ -3785,6 +3850,7 @@ void ErrorResponse::SerializeWithCachedSizes( ::google::protobuf::uint8* ErrorResponse::InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const { + (void)deterministic; // Unused // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.ErrorResponse) // optional int32 error_code = 1; if (this->error_code() != 0) { @@ -3806,9 +3872,9 @@ void ErrorResponse::SerializeWithCachedSizes( return target; } -int ErrorResponse::ByteSize() const { +size_t ErrorResponse::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:grpc.reflection.v1alpha.ErrorResponse) - int total_size = 0; + size_t total_size = 0; // optional int32 error_code = 1; if (this->error_code() != 0) { @@ -3824,18 +3890,17 @@ int ErrorResponse::ByteSize() const { this->error_message()); } + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; + _cached_size_ = cached_size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); return total_size; } void ErrorResponse::MergeFrom(const ::google::protobuf::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:grpc.reflection.v1alpha.ErrorResponse) - if (GOOGLE_PREDICT_FALSE(&from == this)) { - ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__); - } - const ErrorResponse* source = + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const ErrorResponse* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { @@ -3843,15 +3908,21 @@ void ErrorResponse::MergeFrom(const ::google::protobuf::Message& from) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { // @@protoc_insertion_point(generalized_merge_from_cast_success:grpc.reflection.v1alpha.ErrorResponse) - MergeFrom(*source); + UnsafeMergeFrom(*source); } } void ErrorResponse::MergeFrom(const ErrorResponse& from) { // @@protoc_insertion_point(class_specific_merge_from_start:grpc.reflection.v1alpha.ErrorResponse) - if (GOOGLE_PREDICT_FALSE(&from == this)) { - ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__); + if (GOOGLE_PREDICT_TRUE(&from != this)) { + UnsafeMergeFrom(from); + } else { + MergeFromFail(__LINE__); } +} + +void ErrorResponse::UnsafeMergeFrom(const ErrorResponse& from) { + GOOGLE_DCHECK(&from != this); if (from.error_code() != 0) { set_error_code(from.error_code()); } @@ -3872,7 +3943,7 @@ void ErrorResponse::CopyFrom(const ErrorResponse& from) { // @@protoc_insertion_point(class_specific_copy_from_start:grpc.reflection.v1alpha.ErrorResponse) if (&from == this) return; Clear(); - MergeFrom(from); + UnsafeMergeFrom(from); } bool ErrorResponse::IsInitialized() const { @@ -3906,11 +3977,11 @@ void ErrorResponse::InternalSwap(ErrorResponse* other) { void ErrorResponse::clear_error_code() { error_code_ = 0; } - ::google::protobuf::int32 ErrorResponse::error_code() const { +::google::protobuf::int32 ErrorResponse::error_code() const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ErrorResponse.error_code) return error_code_; } - void ErrorResponse::set_error_code(::google::protobuf::int32 value) { +void ErrorResponse::set_error_code(::google::protobuf::int32 value) { error_code_ = value; // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ErrorResponse.error_code) @@ -3920,37 +3991,37 @@ void ErrorResponse::clear_error_code() { void ErrorResponse::clear_error_message() { error_message_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - const ::std::string& ErrorResponse::error_message() const { +const ::std::string& ErrorResponse::error_message() const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ErrorResponse.error_message) return error_message_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - void ErrorResponse::set_error_message(const ::std::string& value) { +void ErrorResponse::set_error_message(const ::std::string& value) { error_message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ErrorResponse.error_message) } - void ErrorResponse::set_error_message(const char* value) { +void ErrorResponse::set_error_message(const char* value) { error_message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ErrorResponse.error_message) } - void ErrorResponse::set_error_message(const char* value, size_t size) { +void ErrorResponse::set_error_message(const char* value, size_t size) { error_message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast(value), size)); // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ErrorResponse.error_message) } - ::std::string* ErrorResponse::mutable_error_message() { +::std::string* ErrorResponse::mutable_error_message() { // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ErrorResponse.error_message) return error_message_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - ::std::string* ErrorResponse::release_error_message() { +::std::string* ErrorResponse::release_error_message() { // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ErrorResponse.error_message) return error_message_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - void ErrorResponse::set_allocated_error_message(::std::string* error_message) { +void ErrorResponse::set_allocated_error_message(::std::string* error_message) { if (error_message != NULL) { } else { @@ -3960,6 +4031,9 @@ void ErrorResponse::clear_error_message() { // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ErrorResponse.error_message) } +inline const ErrorResponse* ErrorResponse::internal_default_instance() { + return &ErrorResponse_default_instance_.get(); +} #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) diff --git a/src/php/.gitignore b/src/php/.gitignore index ecde2ca4c65..f124cbcbf44 100644 --- a/src/php/.gitignore +++ b/src/php/.gitignore @@ -20,3 +20,6 @@ mkinstalldirs ext/grpc/ltmain.sh composer.lock vendor/ + +*.pb.php +*_grpc_pb.php diff --git a/src/php/README.md b/src/php/README.md index 7e9819b256d..0e5b4de31e3 100644 --- a/src/php/README.md +++ b/src/php/README.md @@ -1,7 +1,8 @@ #Overview -This directory contains source code for PHP implementation of gRPC layered on shared C library. +This directory contains source code for PHP implementation of gRPC layered on +shared C library. #Status @@ -9,17 +10,29 @@ GA ## Environment -Prerequisite: +**Prerequisite:** * `php` 5.5 or above, 7.0 or above -* `pear` and `pecl` -* `phpunit` +* `pecl` +* `composer` +* `phpunit` (optional) -**PEAR:** +**Ubuntu/Debian:** +```sh +$ sudo apt-get install php5 php5-dev +``` + +**PEAR/PECL:** ```sh $ curl -O http://pear.php.net/go-pear.phar $ sudo php -d detect_unicode=0 go-pear.phar ``` +**Composer:** +```sh +$ curl -sS https://getcomposer.org/installer | php +$ sudo mv composer.phar /usr/local/bin/composer +``` + **PHPUnit:** ```sh $ wget https://phar.phpunit.de/phpunit-old.phar @@ -29,15 +42,31 @@ $ sudo mv phpunit-old.phar /usr/bin/phpunit ## Quick Install -Install the gRPC PHP extension +**Install the gRPC PHP extension** ```sh sudo pecl install grpc ``` -This will compile and install the gRPC PHP extension into the standard PHP extension directory. You should be able to run the [unit tests](#unit-tests), with the PHP extension installed. +This will compile and install the gRPC PHP extension into the standard PHP +extension directory. You should be able to run the [unit tests](#unit-tests), +with the PHP extension installed. + + +**Add the gRPC PHP library as a Composer dependency** + +You need to add this to your project's `composer.json` file. + +``` + "require": { + "grpc/grpc": "v1.0.0" + } +``` + +To run tests with generated stub code from `.proto` files, you will also need +the `composer` and `protoc` binaries. You can find out how to get these +[below](#generated-code-tests). -To run tests with generated stub code from `.proto` files, you will also need the `composer`, `protoc` and `protoc-gen-php` binaries. You can find out how to get these [below](#generated-code-tests). ## Build from Source @@ -98,45 +127,46 @@ $ ./bin/run_tests.sh ## Generated Code Tests -This section specifies the prerequisites for running the generated code tests, as well as how to run the tests themselves. +This section specifies the prerequisites for running the generated code tests, +as well as how to run the tests themselves. ### Composer -If you don't have it already, install `composer` to pull in some runtime dependencies based on the `composer.json` file. +Install the runtime dependencies via `composer install`. ```sh -$ curl -sS https://getcomposer.org/installer | php -$ sudo mv composer.phar /usr/local/bin/composer - $ cd grpc/src/php $ composer install ``` ### Protobuf compiler -Again if you don't have it already, you need to install the protobuf compiler `protoc`, version 3.0.0+. +Again if you don't have it already, you need to install the protobuf compiler +`protoc`, version 3.1.0+. + +If `protoc` hasn't been installed, you can download the `protoc` binaries from +[the protocol buffers Github repository](https://github.com/google/protobuf/releases). -If you compiled the gRPC C core library from source above, the `protoc` binary should have been installed as well. If it hasn't been installed, you can run the following commands to install it. +If you really must compile `protoc` from source, you can run the following +commands, but this is risky because there is no easy way to uninstall / +upgrade to a newer release. ```sh $ cd grpc/third_party/protobuf -$ sudo make install # 'make' should have been run by core grpc +$ ./autogen.sh && ./configure && make +$ sudo make install ``` -Alternatively, you can download `protoc` binaries from [the protocol buffers Github repository](https://github.com/google/protobuf/releases). +### PHP Protoc Plugin -### PHP protobuf compiler +You need the gRPC PHP protoc plugin to generate the client stub classes. -You need to install `protoc-gen-php` to generate stub class `.php` files from service definition `.proto` files. +It should already been compiled when you run `make` from the root directory +of this repo. The plugin can be found in the `bins/opt` directory. We are +planning to provide a better way to download and install the plugin +in the future. -```sh -$ git clone https://github.com/stanley-cheung/Protobuf-PHP -$ cd Protobuf-PHP -$ gem install rake ronn -$ rake pear:package version=1.0 -$ sudo pear install Protobuf-1.0.tgz -``` ### Client Stub @@ -149,7 +179,8 @@ $ ./bin/generate_proto_php.sh ### Run test server -Run a local server serving the math services. Please see [Node][] for how to run an example server. +Run a local server serving the math services. Please see [Node][] for how to +run an example server. ```sh $ cd grpc diff --git a/src/php/bin/determine_extension_dir.sh b/src/php/bin/determine_extension_dir.sh index a59882506f9..e3d6bbc1a55 100755 --- a/src/php/bin/determine_extension_dir.sh +++ b/src/php/bin/determine_extension_dir.sh @@ -32,7 +32,7 @@ default_extension_dir=$(php-config --extension-dir) if [ ! -e $default_extension_dir/grpc.so ]; then # the grpc extension is not found in the default PHP extension dir # try the source modules directory - module_dir=../ext/grpc/modules + module_dir=$(pwd)/../ext/grpc/modules if [ ! -e $module_dir/grpc.so ]; then echo "Please run 'phpize && ./configure && make' from ext/grpc first" exit 1 diff --git a/src/php/bin/generate_proto_php.sh b/src/php/bin/generate_proto_php.sh index 16f93747ab8..c558bc57698 100755 --- a/src/php/bin/generate_proto_php.sh +++ b/src/php/bin/generate_proto_php.sh @@ -28,13 +28,32 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - set +e -cd $(dirname $0) +cd $(dirname $0)/../../.. + +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 \ + src/proto/math/math.proto -gen_code='../tests/generated_code' -interop='../tests/interop' +# replace the Empty message with EmptyMessage +# because Empty is a PHP reserved word +sed -i 's/message Empty/message EmptyMessage/g' \ + src/proto/grpc/testing/empty.proto +sed -i 's/grpc\.testing\.Empty/grpc\.testing\.EmptyMessage/g' \ + src/proto/grpc/testing/test.proto -protoc-gen-php -i $gen_code -o $gen_code $gen_code/math.proto +protoc --proto_path=. \ + --php_out=src/php/tests/interop \ + --grpc_out=src/php/tests/interop \ + --plugin=protoc-gen-grpc=bins/opt/grpc_php_plugin \ + src/proto/grpc/testing/messages.proto \ + src/proto/grpc/testing/empty.proto \ + src/proto/grpc/testing/test.proto -protoc-gen-php -i $interop -o $interop $interop/test.proto +# change it back +sed -i 's/message EmptyMessage/message Empty/g' \ + src/proto/grpc/testing/empty.proto +sed -i 's/grpc\.testing\.EmptyMessage/grpc\.testing\.Empty/g' \ + src/proto/grpc/testing/test.proto diff --git a/src/php/bin/interop_client.sh b/src/php/bin/interop_client.sh index 2af49cd8922..7fa4686ef82 100755 --- a/src/php/bin/interop_client.sh +++ b/src/php/bin/interop_client.sh @@ -31,5 +31,6 @@ set -e cd $(dirname $0) source ./determine_extension_dir.sh +cd ../tests/interop php $extension_dir -d max_execution_time=300 \ - ../tests/interop/interop_client.php $@ 1>&2 + interop_client.php $@ 1>&2 diff --git a/src/php/composer.json b/src/php/composer.json index 571f30013fa..60420940321 100644 --- a/src/php/composer.json +++ b/src/php/composer.json @@ -8,7 +8,7 @@ "version": "1.1.0", "require": { "php": ">=5.5.0", - "stanley-cheung/protobuf-php": "v0.6" + "google/protobuf": "v3.1.0-alpha-1" }, "require-dev": { "google/auth": "v0.9" diff --git a/src/php/lib/Grpc/AbstractCall.php b/src/php/lib/Grpc/AbstractCall.php index c58ee567424..e24be3fc763 100644 --- a/src/php/lib/Grpc/AbstractCall.php +++ b/src/php/lib/Grpc/AbstractCall.php @@ -120,6 +120,23 @@ abstract class AbstractCall $this->call->cancel(); } + /** + * Serialize a message to the protobuf binary format + * + * @param mixed $data The Protobuf message + * + * @return string The protobuf binary format + */ + protected function serializeMessage($data) { + // Proto3 implementation + if (method_exists($data, 'encode')) { + return $data->encode(); + } + + // Protobuf-PHP implementation + return $data->serialize(); + } + /** * Deserialize a response value to an object. * @@ -133,6 +150,15 @@ abstract class AbstractCall return; } + // Proto3 implementation + if (is_array($this->deserialize)) { + list($className, $deserializeFunc) = $this->deserialize; + $obj = new $className(); + $obj->$deserializeFunc($value); + return $obj; + } + + // Protobuf-PHP implementation return call_user_func($this->deserialize, $value); } diff --git a/src/php/lib/Grpc/BidiStreamingCall.php b/src/php/lib/Grpc/BidiStreamingCall.php index 5d6ecfb275b..f0e1e811def 100644 --- a/src/php/lib/Grpc/BidiStreamingCall.php +++ b/src/php/lib/Grpc/BidiStreamingCall.php @@ -81,7 +81,7 @@ class BidiStreamingCall extends AbstractCall */ public function write($data, $options = []) { - $message_array = ['message' => $data->serialize()]; + $message_array = ['message' => $this->serializeMessage($data)]; if (array_key_exists('flags', $options)) { $message_array['flags'] = $options['flags']; } diff --git a/src/php/lib/Grpc/ClientStreamingCall.php b/src/php/lib/Grpc/ClientStreamingCall.php index c96e26d0330..20db809ea3c 100644 --- a/src/php/lib/Grpc/ClientStreamingCall.php +++ b/src/php/lib/Grpc/ClientStreamingCall.php @@ -62,7 +62,7 @@ class ClientStreamingCall extends AbstractCall */ public function write($data, array $options = []) { - $message_array = ['message' => $data->serialize()]; + $message_array = ['message' => $this->serializeMessage($data)]; if (array_key_exists('flags', $options)) { $message_array['flags'] = $options['flags']; } diff --git a/src/php/lib/Grpc/ServerStreamingCall.php b/src/php/lib/Grpc/ServerStreamingCall.php index 5f0d42c528a..5aeeafa94ad 100644 --- a/src/php/lib/Grpc/ServerStreamingCall.php +++ b/src/php/lib/Grpc/ServerStreamingCall.php @@ -50,7 +50,7 @@ class ServerStreamingCall extends AbstractCall */ public function start($data, $metadata = [], $options = []) { - $message_array = ['message' => $data->serialize()]; + $message_array = ['message' => $this->serializeMessage($data)]; if (array_key_exists('flags', $options)) { $message_array['flags'] = $options['flags']; } diff --git a/src/php/lib/Grpc/UnaryCall.php b/src/php/lib/Grpc/UnaryCall.php index 487b89ebc1b..e8eb6487a8c 100644 --- a/src/php/lib/Grpc/UnaryCall.php +++ b/src/php/lib/Grpc/UnaryCall.php @@ -50,7 +50,7 @@ class UnaryCall extends AbstractCall */ public function start($data, $metadata = [], $options = []) { - $message_array = ['message' => $data->serialize()]; + $message_array = ['message' => $this->serializeMessage($data)]; if (isset($options['flags'])) { $message_array['flags'] = $options['flags']; } diff --git a/src/php/tests/generated_code/AbstractGeneratedCodeTest.php b/src/php/tests/generated_code/AbstractGeneratedCodeTest.php index 75922d4cf7c..8fe9bc26d8e 100644 --- a/src/php/tests/generated_code/AbstractGeneratedCodeTest.php +++ b/src/php/tests/generated_code/AbstractGeneratedCodeTest.php @@ -32,7 +32,8 @@ * */ require_once realpath(dirname(__FILE__).'/../../vendor/autoload.php'); -require_once dirname(__FILE__).'/math.php'; +require_once dirname(__FILE__).'/math.pb.php'; +require_once dirname(__FILE__).'/math_grpc_pb.php'; abstract class AbstractGeneratedCodeTest extends PHPUnit_Framework_TestCase { @@ -92,7 +93,7 @@ abstract class AbstractGeneratedCodeTest extends PHPUnit_Framework_TestCase public function testTimeout() { $div_arg = new math\DivArgs(); - $call = self::$client->Div($div_arg, [], ['timeout' => 100]); + $call = self::$client->Div($div_arg, [], ['timeout' => 1]); list($response, $status) = $call->wait(); $this->assertSame(\Grpc\STATUS_DEADLINE_EXCEEDED, $status->code); } diff --git a/src/php/tests/generated_code/math.proto b/src/php/tests/generated_code/math.proto deleted file mode 100644 index c872ee6e0b2..00000000000 --- a/src/php/tests/generated_code/math.proto +++ /dev/null @@ -1,83 +0,0 @@ - -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// TODO: start using src/proto/math/math.proto and remove this file once -// PHP supports proto3. - -syntax = "proto2"; - -package math; - -message DivArgs { - optional int64 dividend = 1 [default = 0]; - optional int64 divisor = 2 [default = 0]; -} - -message DivReply { - optional int64 quotient = 1 [default = 0]; - optional int64 remainder = 2 [default = 0]; -} - -message FibArgs { - optional int64 limit = 1 [default = 0]; -} - -message Num { - optional int64 num = 1 [default = 0]; -} - -message FibReply { - optional int64 count = 1 [default = 0]; -} - -service Math { - // Div divides args.dividend by args.divisor and returns the quotient and - // remainder. - rpc Div (DivArgs) returns (DivReply) { - } - - // 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. - rpc DivMany (stream DivArgs) returns (stream DivReply) { - } - - // Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib - // generates up to limit numbers; otherwise it continues until the call is - // canceled. Unlike Fib above, Fib has no final FibReply. - rpc Fib (FibArgs) returns (stream Num) { - } - - // Sum sums a stream of numbers, returning the final result once the stream - // is closed. - rpc Sum (stream Num) returns (Num) { - } -} diff --git a/src/php/tests/interop/empty.proto b/src/php/tests/interop/empty.proto deleted file mode 100644 index 4200d7b5192..00000000000 --- a/src/php/tests/interop/empty.proto +++ /dev/null @@ -1,43 +0,0 @@ - -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto2"; - -package grpc.testing; - -// An empty message that you can re-use to avoid defining duplicated empty -// messages in your project. A typical example is to use it as argument or the -// return value of a service API. For instance: -// -// service Foo { -// rpc Bar (grpc.testing.EmptyMessage) returns (grpc.testing.EmptyMessage) { }; -// }; -// -message EmptyMessage {} diff --git a/src/php/tests/interop/interop_client.php b/src/php/tests/interop/interop_client.php index 4bc4589956c..124d3249138 100755 --- a/src/php/tests/interop/interop_client.php +++ b/src/php/tests/interop/interop_client.php @@ -32,9 +32,8 @@ * */ require_once realpath(dirname(__FILE__).'/../../vendor/autoload.php'); -require 'empty.php'; -require 'messages.php'; -require 'test.php'; +require 'src/proto/grpc/testing/test.pb.php'; +require 'src/proto/grpc/testing/test_grpc_pb.php'; use Google\Auth\CredentialsLoader; use Google\Auth\ApplicationDefaultCredentials; use GuzzleHttp\ClientInterface; @@ -282,7 +281,7 @@ function serverStreaming($stub) foreach ($sizes as $size) { $response_parameters = new grpc\testing\ResponseParameters(); $response_parameters->setSize($size); - $request->addResponseParameters($response_parameters); + $request->getResponseParameters()[] = $response_parameters; } $call = $stub->StreamingOutputCall($request); @@ -316,7 +315,7 @@ function pingPong($stub) $request->setResponseType(grpc\testing\PayloadType::COMPRESSABLE); $response_parameters = new grpc\testing\ResponseParameters(); $response_parameters->setSize($response_lengths[$i]); - $request->addResponseParameters($response_parameters); + $request->getResponseParameters()[] = $response_parameters; $payload = new grpc\testing\Payload(); $payload->setBody(str_repeat("\0", $request_lengths[$i])); $request->setPayload($payload); @@ -376,7 +375,7 @@ function cancelAfterFirstResponse($stub) $request->setResponseType(grpc\testing\PayloadType::COMPRESSABLE); $response_parameters = new grpc\testing\ResponseParameters(); $response_parameters->setSize(31415); - $request->addResponseParameters($response_parameters); + $request->getResponseParameters()[] = $response_parameters; $payload = new grpc\testing\Payload(); $payload->setBody(str_repeat("\0", 27182)); $request->setPayload($payload); @@ -396,7 +395,7 @@ function timeoutOnSleepingServer($stub) $request->setResponseType(grpc\testing\PayloadType::COMPRESSABLE); $response_parameters = new grpc\testing\ResponseParameters(); $response_parameters->setSize(8); - $request->addResponseParameters($response_parameters); + $request->getResponseParameters()[] = $response_parameters; $payload = new grpc\testing\Payload(); $payload->setBody(str_repeat("\0", 9)); $request->setPayload($payload); diff --git a/src/php/tests/interop/messages.proto b/src/php/tests/interop/messages.proto deleted file mode 100644 index 44e3c3b8f97..00000000000 --- a/src/php/tests/interop/messages.proto +++ /dev/null @@ -1,162 +0,0 @@ - -// Copyright 2015-2016, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Message definitions to be used by integration test service definitions. - -syntax = "proto2"; - -package grpc.testing; - -// The type of payload that should be returned. -enum PayloadType { - // Compressable text format. - COMPRESSABLE = 0; - - // Uncompressable binary format. - UNCOMPRESSABLE = 1; -} - -// A block of data, to simply increase gRPC message size. -message Payload { - // The type of data in body. - optional PayloadType type = 1 [default = COMPRESSABLE]; - // Primary contents of payload. - optional bytes body = 2; -} - -// A protobuf representation for grpc status. This is used by test -// clients to specify a status that the server should attempt to return. -message EchoStatus { - optional int32 code = 1; - optional string message = 2; -} - -// Unary request. -message SimpleRequest { - // Desired payload type in the response from the server. - // If response_type is RANDOM, server randomly chooses one from other formats. - optional PayloadType response_type = 1 [default = COMPRESSABLE]; - - // Desired payload size in the response from the server. - // If response_type is COMPRESSABLE, this denotes the size before compression. - optional int32 response_size = 2; - - // Optional input payload sent along with the request. - optional Payload payload = 3; - - // Whether SimpleResponse should include username. - optional bool fill_username = 4; - - // Whether SimpleResponse should include OAuth scope. - optional bool fill_oauth_scope = 5; - - // Whether to request the server to compress the response. - optional bool request_compressed_response = 6; - - // Whether server should return a given status - optional EchoStatus response_status = 7; -} - -// Unary response, as configured by the request. -message SimpleResponse { - // Payload to increase message size. - optional Payload payload = 1; - // The user the request came from, for verifying authentication was - // successful when the client expected it. - optional string username = 2; - // OAuth scope. - optional string oauth_scope = 3; -} - -// Client-streaming request. -message StreamingInputCallRequest { - // Optional input payload sent along with the request. - optional Payload payload = 1; - - // Not expecting any payload from the response. -} - -// Client-streaming response. -message StreamingInputCallResponse { - // Aggregated size of payloads received from the client. - optional int32 aggregated_payload_size = 1; -} - -// Configuration for a particular response. -message ResponseParameters { - // Desired payload sizes in responses from the server. - // If response_type is COMPRESSABLE, this denotes the size before compression. - optional int32 size = 1; - - // Desired interval between consecutive responses in the response stream in - // microseconds. - optional int32 interval_us = 2; -} - -// Server-streaming request. -message StreamingOutputCallRequest { - // 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. - optional PayloadType response_type = 1 [default = COMPRESSABLE]; - - // Configuration for each expected response message. - repeated ResponseParameters response_parameters = 2; - - // Optional input payload sent along with the request. - optional Payload payload = 3; - - // Whether to request the server to compress the response. - optional bool request_compressed_response = 6; - - // Whether server should return a given status - optional EchoStatus response_status = 7; -} - -// Server-streaming response, as configured by the request and parameters. -message StreamingOutputCallResponse { - // Payload to increase response size. - optional Payload payload = 1; -} - -// For reconnect interop test only. -// Client tells server what reconnection parameters it used. -message ReconnectParams { - optional int32 max_reconnect_backoff_ms = 1; -} - -// For reconnect interop test only. -// Server tells client whether its reconnects are following the spec and the -// reconnect backoffs it saw. -message ReconnectInfo { - optional bool passed = 1; - repeated int32 backoff_ms = 2; -} diff --git a/src/php/tests/interop/test.proto b/src/php/tests/interop/test.proto deleted file mode 100644 index 57ef30ee1c1..00000000000 --- a/src/php/tests/interop/test.proto +++ /dev/null @@ -1,78 +0,0 @@ - -// Copyright 2015-2016, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// An integration test service that covers all the method signature permutations -// of unary/streaming requests/responses. -syntax = "proto2"; - -import "empty.proto"; -import "messages.proto"; - -package grpc.testing; - -// A simple service to test the various types of RPCs and experiment with -// performance with various types of payload. -service TestService { - // One empty request followed by one empty response. - rpc EmptyCall(grpc.testing.EmptyMessage) returns (grpc.testing.EmptyMessage); - - // One request followed by one response. - rpc UnaryCall(SimpleRequest) returns (SimpleResponse); - - // One request followed by a sequence of responses (streamed download). - // The server returns the payload with client desired type and sizes. - rpc StreamingOutputCall(StreamingOutputCallRequest) - returns (stream StreamingOutputCallResponse); - - // A sequence of requests followed by one response (streamed upload). - // The server returns the aggregated size of client payload as the result. - rpc StreamingInputCall(stream StreamingInputCallRequest) - returns (StreamingInputCallResponse); - - // 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. - rpc FullDuplexCall(stream StreamingOutputCallRequest) - returns (stream StreamingOutputCallResponse); - - // 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. - rpc HalfDuplexCall(stream StreamingOutputCallRequest) - returns (stream StreamingOutputCallResponse); -} - -// A simple service NOT implemented at servers so clients can test for -// that case. -service UnimplementedService { - // A call that no server should implement - rpc UnimplementedCall(grpc.testing.EmptyMessage) returns (grpc.testing.EmptyMessage); -} diff --git a/templates/composer.json.template b/templates/composer.json.template index 48d3b8892e2..accfb382a99 100644 --- a/templates/composer.json.template +++ b/templates/composer.json.template @@ -9,7 +9,7 @@ "license": "BSD-3-Clause", "require": { "php": ">=5.5.0", - "stanley-cheung/protobuf-php": "v0.6" + "google/protobuf": "v3.1.0-alpha-1" }, "require-dev": { "google/auth": "v0.9" diff --git a/templates/src/php/composer.json.template b/templates/src/php/composer.json.template index bf876f345e7..7feeae976d8 100644 --- a/templates/src/php/composer.json.template +++ b/templates/src/php/composer.json.template @@ -10,7 +10,7 @@ "version": "${settings.php_version.php_composer()}", "require": { "php": ">=5.5.0", - "stanley-cheung/protobuf-php": "v0.6" + "google/protobuf": "v3.1.0-alpha-1" }, "require-dev": { "google/auth": "v0.9" diff --git a/templates/tools/dockerfile/interoptest/grpc_interop_php/Dockerfile.template b/templates/tools/dockerfile/interoptest/grpc_interop_php/Dockerfile.template index f37eadad745..9689f672d08 100644 --- a/templates/tools/dockerfile/interoptest/grpc_interop_php/Dockerfile.template +++ b/templates/tools/dockerfile/interoptest/grpc_interop_php/Dockerfile.template @@ -32,7 +32,6 @@ FROM debian:jessie <%include file="../../apt_get_basic.include"/> - <%include file="../../ruby_deps.include"/> <%include file="../../php_deps.include"/> <%include file="../../run_tests_addons.include"/> <%include file="../../php_common_deps.include"/> diff --git a/templates/tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile.template b/templates/tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile.template index 42157ee062c..c557f34f831 100644 --- a/templates/tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile.template +++ b/templates/tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile.template @@ -32,6 +32,5 @@ FROM debian:jessie <%include file="../../php7_deps.include"/> - <%include file="../../ruby_deps.include"/> <%include file="../../run_tests_addons.include"/> <%include file="../../php_common_deps.include"/> diff --git a/templates/tools/dockerfile/php_common_deps.include b/templates/tools/dockerfile/php_common_deps.include index 8839bb51554..88a90f8adcb 100644 --- a/templates/tools/dockerfile/php_common_deps.include +++ b/templates/tools/dockerfile/php_common_deps.include @@ -1,21 +1,6 @@ -# ronn: a ruby tool used to convert markdown to man pages, used during the -# install of Protobuf extensions -# -# rake: a ruby version of make used to build the PHP Protobuf extension -RUN /bin/bash -l -c "rvm all do gem install ronn rake" - # Install composer RUN curl -sS https://getcomposer.org/installer | php RUN mv composer.phar /usr/local/bin/composer -# Download the patched PHP protobuf so that PHP gRPC clients can be generated -# from proto3 schemas. -RUN git clone https://github.com/stanley-cheung/Protobuf-PHP.git /var/local/git/protobuf-php - -RUN /bin/bash -l -c "rvm use ruby-2.1 ${'\\'} - && cd /var/local/git/protobuf-php ${'\\'} - && rvm all do rake pear:package version=1.0 ${'\\'} - && pear install Protobuf-1.0.tgz" - # Define the default command. CMD ["bash"] diff --git a/templates/tools/dockerfile/stress_test/grpc_interop_stress_php/Dockerfile.template b/templates/tools/dockerfile/stress_test/grpc_interop_stress_php/Dockerfile.template index 13a250eb31c..49ba60168da 100644 --- a/templates/tools/dockerfile/stress_test/grpc_interop_stress_php/Dockerfile.template +++ b/templates/tools/dockerfile/stress_test/grpc_interop_stress_php/Dockerfile.template @@ -37,25 +37,10 @@ <%include file="../../gcp_api_libraries.include"/> <%include file="../../php_deps.include"/> <%include file="../../run_tests_addons.include"/> - # ronn: a ruby tool used to convert markdown to man pages, used during the - # install of Protobuf extensions - # - # rake: a ruby version of make used to build the PHP Protobuf extension - RUN /bin/bash -l -c "rvm all do gem install ronn rake" - # Install composer RUN curl -sS https://getcomposer.org/installer | php RUN mv composer.phar /usr/local/bin/composer - # Download the patched PHP protobuf so that PHP gRPC clients can be generated - # from proto3 schemas. - RUN git clone https://github.com/stanley-cheung/Protobuf-PHP.git /var/local/git/protobuf-php - - RUN /bin/bash -l -c "rvm use ruby-2.1 ${'\\'} - && cd /var/local/git/protobuf-php ${'\\'} - && rvm all do rake pear:package version=1.0 ${'\\'} - && pear install Protobuf-1.0.tgz" - # Define the default command. CMD ["bash"] diff --git a/test/core/end2end/connection_refused_test.c b/test/core/end2end/connection_refused_test.c new file mode 100644 index 00000000000..4149159a378 --- /dev/null +++ b/test/core/end2end/connection_refused_test.c @@ -0,0 +1,128 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include +#include + +#include "test/core/end2end/cq_verifier.h" +#include "test/core/util/port.h" +#include "test/core/util/test_config.h" + +static void *tag(intptr_t i) { return (void *)i; } + +static void run_test(bool fail_fast) { + grpc_channel *chan; + grpc_call *call; + gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2); + grpc_completion_queue *cq; + cq_verifier *cqv; + grpc_op ops[6]; + grpc_op *op; + grpc_metadata_array trailing_metadata_recv; + grpc_status_code status; + char *details = NULL; + size_t details_capacity = 0; + + gpr_log(GPR_INFO, "TEST: fail_fast=%d", fail_fast); + + grpc_init(); + + grpc_metadata_array_init(&trailing_metadata_recv); + + cq = grpc_completion_queue_create(NULL); + cqv = cq_verifier_create(cq); + + /* create a call, channel to a port which will refuse connection */ + int port = grpc_pick_unused_port_or_die(); + char *addr; + gpr_join_host_port(&addr, "localhost", port); + + chan = grpc_insecure_channel_create(addr, NULL, NULL); + call = grpc_channel_create_call(chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq, + "/Foo", "nonexistant", deadline, NULL); + + gpr_free(addr); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = fail_fast ? 0 : GRPC_INITIAL_METADATA_IGNORE_CONNECTIVITY; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; + op->data.recv_status_on_client.status = &status; + op->data.recv_status_on_client.status_details = &details; + op->data.recv_status_on_client.status_details_capacity = &details_capacity; + op->flags = 0; + op->reserved = NULL; + op++; + GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch( + call, ops, (size_t)(op - ops), tag(1), NULL)); + /* verify that all tags get completed */ + CQ_EXPECT_COMPLETION(cqv, tag(1), 1); + cq_verify(cqv); + + if (fail_fast) { + GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); + } else { + GPR_ASSERT(status == GRPC_STATUS_DEADLINE_EXCEEDED); + } + + grpc_completion_queue_shutdown(cq); + while ( + grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL) + .type != GRPC_QUEUE_SHUTDOWN) + ; + grpc_completion_queue_destroy(cq); + grpc_call_destroy(call); + grpc_channel_destroy(chan); + cq_verifier_destroy(cqv); + + gpr_free(details); + grpc_metadata_array_destroy(&trailing_metadata_recv); + + grpc_shutdown(); +} + +int main(int argc, char **argv) { + grpc_test_init(argc, argv); + run_test(true); + run_test(false); + return 0; +} diff --git a/test/cpp/grpclb/grpclb_test.cc b/test/cpp/grpclb/grpclb_test.cc index 41fa36880a6..7666c4e60b2 100644 --- a/test/cpp/grpclb/grpclb_test.cc +++ b/test/cpp/grpclb/grpclb_test.cc @@ -461,7 +461,7 @@ static void perform_request(client_fixture *cf) { c = grpc_channel_create_call(cf->client, NULL, GRPC_PROPAGATE_DEFAULTS, cf->cq, "/foo", "foo.test.google.fr:1234", - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1000), NULL); + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL); gpr_log(GPR_INFO, "Call 0x%" PRIxPTR " created", (intptr_t)c); GPR_ASSERT(c); char *peer; diff --git a/test/cpp/util/proto_file_parser.cc b/test/cpp/util/proto_file_parser.cc index 0c88c244486..01acb015325 100644 --- a/test/cpp/util/proto_file_parser.cc +++ b/test/cpp/util/proto_file_parser.cc @@ -36,6 +36,7 @@ #include #include #include +#include #include @@ -87,6 +88,7 @@ ProtoFileParser::ProtoFileParser(std::shared_ptr channel, reflection_db_->GetServices(&service_list); } + std::unordered_set known_services; if (!protofiles.empty()) { source_tree_.MapPath("", proto_path); error_printer_.reset(new ErrorPrinter(this)); @@ -100,6 +102,7 @@ ProtoFileParser::ProtoFileParser(std::shared_ptr channel, if (file_desc) { for (int i = 0; i < file_desc->service_count(); i++) { service_desc_list_.push_back(file_desc->service(i)); + known_services.insert(file_desc->service(i)->full_name()); } } else { std::cerr << file_name << " not found" << std::endl; @@ -127,9 +130,12 @@ ProtoFileParser::ProtoFileParser(std::shared_ptr channel, dynamic_factory_.reset(new protobuf::DynamicMessageFactory(desc_pool_.get())); for (auto it = service_list.begin(); it != service_list.end(); it++) { - if (const protobuf::ServiceDescriptor* service_desc = - desc_pool_->FindServiceByName(*it)) { - service_desc_list_.push_back(service_desc); + if (known_services.find(*it) == known_services.end()) { + if (const protobuf::ServiceDescriptor* service_desc = + desc_pool_->FindServiceByName(*it)) { + service_desc_list_.push_back(service_desc); + known_services.insert(*it); + } } } } @@ -146,7 +152,8 @@ grpc::string ProtoFileParser::GetFullMethodName(const grpc::string& method) { const auto* method_desc = service_desc->method(j); if (MethodNameMatch(method_desc->full_name(), method)) { if (method_descriptor) { - std::ostringstream error_stream("Ambiguous method names: "); + std::ostringstream error_stream; + error_stream << "Ambiguous method names: "; error_stream << method_descriptor->full_name() << " "; error_stream << method_desc->full_name(); LogError(error_stream.str()); diff --git a/third_party/protobuf b/third_party/protobuf index 1a586735085..a428e420727 160000 --- a/third_party/protobuf +++ b/third_party/protobuf @@ -1 +1 @@ -Subproject commit 1a586735085e817b1f52e53feec92ce418049f69 +Subproject commit a428e42072765993ff674fda72863c9f1aa2d268 diff --git a/tools/distrib/python/grpcio_tools/protoc_lib_deps.py b/tools/distrib/python/grpcio_tools/protoc_lib_deps.py index cd4effa7ae8..569328e57ea 100644 --- a/tools/distrib/python/grpcio_tools/protoc_lib_deps.py +++ b/tools/distrib/python/grpcio_tools/protoc_lib_deps.py @@ -29,7 +29,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # AUTO-GENERATED BY make_grpcio_tools.py! -CC_FILES=['google/protobuf/compiler/zip_writer.cc', 'google/protobuf/compiler/subprocess.cc', 'google/protobuf/compiler/ruby/ruby_generator.cc', 'google/protobuf/compiler/python/python_generator.cc', 'google/protobuf/compiler/plugin.pb.cc', 'google/protobuf/compiler/plugin.cc', 'google/protobuf/compiler/objectivec/objectivec_primitive_field.cc', 'google/protobuf/compiler/objectivec/objectivec_oneof.cc', 'google/protobuf/compiler/objectivec/objectivec_message_field.cc', 'google/protobuf/compiler/objectivec/objectivec_message.cc', 'google/protobuf/compiler/objectivec/objectivec_map_field.cc', 'google/protobuf/compiler/objectivec/objectivec_helpers.cc', 'google/protobuf/compiler/objectivec/objectivec_generator.cc', 'google/protobuf/compiler/objectivec/objectivec_file.cc', 'google/protobuf/compiler/objectivec/objectivec_field.cc', 'google/protobuf/compiler/objectivec/objectivec_extension.cc', 'google/protobuf/compiler/objectivec/objectivec_enum_field.cc', 'google/protobuf/compiler/objectivec/objectivec_enum.cc', 'google/protobuf/compiler/js/js_generator.cc', 'google/protobuf/compiler/javanano/javanano_primitive_field.cc', 'google/protobuf/compiler/javanano/javanano_message_field.cc', 'google/protobuf/compiler/javanano/javanano_message.cc', 'google/protobuf/compiler/javanano/javanano_map_field.cc', 'google/protobuf/compiler/javanano/javanano_helpers.cc', 'google/protobuf/compiler/javanano/javanano_generator.cc', 'google/protobuf/compiler/javanano/javanano_file.cc', 'google/protobuf/compiler/javanano/javanano_field.cc', 'google/protobuf/compiler/javanano/javanano_extension.cc', 'google/protobuf/compiler/javanano/javanano_enum_field.cc', 'google/protobuf/compiler/javanano/javanano_enum.cc', 'google/protobuf/compiler/java/java_string_field_lite.cc', 'google/protobuf/compiler/java/java_string_field.cc', 'google/protobuf/compiler/java/java_shared_code_generator.cc', 'google/protobuf/compiler/java/java_service.cc', 'google/protobuf/compiler/java/java_primitive_field_lite.cc', 'google/protobuf/compiler/java/java_primitive_field.cc', 'google/protobuf/compiler/java/java_name_resolver.cc', 'google/protobuf/compiler/java/java_message_lite.cc', 'google/protobuf/compiler/java/java_message_field_lite.cc', 'google/protobuf/compiler/java/java_message_field.cc', 'google/protobuf/compiler/java/java_message_builder_lite.cc', 'google/protobuf/compiler/java/java_message_builder.cc', 'google/protobuf/compiler/java/java_message.cc', 'google/protobuf/compiler/java/java_map_field_lite.cc', 'google/protobuf/compiler/java/java_map_field.cc', 'google/protobuf/compiler/java/java_lazy_message_field_lite.cc', 'google/protobuf/compiler/java/java_lazy_message_field.cc', 'google/protobuf/compiler/java/java_helpers.cc', 'google/protobuf/compiler/java/java_generator_factory.cc', 'google/protobuf/compiler/java/java_generator.cc', 'google/protobuf/compiler/java/java_file.cc', 'google/protobuf/compiler/java/java_field.cc', 'google/protobuf/compiler/java/java_extension_lite.cc', 'google/protobuf/compiler/java/java_extension.cc', 'google/protobuf/compiler/java/java_enum_lite.cc', 'google/protobuf/compiler/java/java_enum_field_lite.cc', 'google/protobuf/compiler/java/java_enum_field.cc', 'google/protobuf/compiler/java/java_enum.cc', 'google/protobuf/compiler/java/java_doc_comment.cc', 'google/protobuf/compiler/java/java_context.cc', 'google/protobuf/compiler/csharp/csharp_wrapper_field.cc', 'google/protobuf/compiler/csharp/csharp_source_generator_base.cc', 'google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc', 'google/protobuf/compiler/csharp/csharp_repeated_message_field.cc', 'google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc', 'google/protobuf/compiler/csharp/csharp_reflection_class.cc', 'google/protobuf/compiler/csharp/csharp_primitive_field.cc', 'google/protobuf/compiler/csharp/csharp_message_field.cc', 'google/protobuf/compiler/csharp/csharp_message.cc', 'google/protobuf/compiler/csharp/csharp_map_field.cc', 'google/protobuf/compiler/csharp/csharp_helpers.cc', 'google/protobuf/compiler/csharp/csharp_generator.cc', 'google/protobuf/compiler/csharp/csharp_field_base.cc', 'google/protobuf/compiler/csharp/csharp_enum_field.cc', 'google/protobuf/compiler/csharp/csharp_enum.cc', 'google/protobuf/compiler/csharp/csharp_doc_comment.cc', 'google/protobuf/compiler/cpp/cpp_string_field.cc', 'google/protobuf/compiler/cpp/cpp_service.cc', 'google/protobuf/compiler/cpp/cpp_primitive_field.cc', 'google/protobuf/compiler/cpp/cpp_message_field.cc', 'google/protobuf/compiler/cpp/cpp_message.cc', 'google/protobuf/compiler/cpp/cpp_map_field.cc', 'google/protobuf/compiler/cpp/cpp_helpers.cc', 'google/protobuf/compiler/cpp/cpp_generator.cc', 'google/protobuf/compiler/cpp/cpp_file.cc', 'google/protobuf/compiler/cpp/cpp_field.cc', 'google/protobuf/compiler/cpp/cpp_extension.cc', 'google/protobuf/compiler/cpp/cpp_enum_field.cc', 'google/protobuf/compiler/cpp/cpp_enum.cc', 'google/protobuf/compiler/command_line_interface.cc', 'google/protobuf/compiler/code_generator.cc', 'google/protobuf/wrappers.pb.cc', 'google/protobuf/wire_format.cc', 'google/protobuf/util/type_resolver_util.cc', 'google/protobuf/util/time_util.cc', 'google/protobuf/util/message_differencer.cc', 'google/protobuf/util/json_util.cc', 'google/protobuf/util/internal/utility.cc', 'google/protobuf/util/internal/type_info_test_helper.cc', 'google/protobuf/util/internal/type_info.cc', 'google/protobuf/util/internal/protostream_objectwriter.cc', 'google/protobuf/util/internal/protostream_objectsource.cc', 'google/protobuf/util/internal/proto_writer.cc', 'google/protobuf/util/internal/object_writer.cc', 'google/protobuf/util/internal/json_stream_parser.cc', 'google/protobuf/util/internal/json_objectwriter.cc', 'google/protobuf/util/internal/json_escaping.cc', 'google/protobuf/util/internal/field_mask_utility.cc', 'google/protobuf/util/internal/error_listener.cc', 'google/protobuf/util/internal/default_value_objectwriter.cc', 'google/protobuf/util/internal/datapiece.cc', 'google/protobuf/util/field_mask_util.cc', 'google/protobuf/util/field_comparator.cc', 'google/protobuf/unknown_field_set.cc', 'google/protobuf/type.pb.cc', 'google/protobuf/timestamp.pb.cc', 'google/protobuf/text_format.cc', 'google/protobuf/stubs/substitute.cc', 'google/protobuf/stubs/mathlimits.cc', 'google/protobuf/struct.pb.cc', 'google/protobuf/source_context.pb.cc', 'google/protobuf/service.cc', 'google/protobuf/reflection_ops.cc', 'google/protobuf/message.cc', 'google/protobuf/map_field.cc', 'google/protobuf/io/zero_copy_stream_impl.cc', 'google/protobuf/io/tokenizer.cc', 'google/protobuf/io/strtod.cc', 'google/protobuf/io/printer.cc', 'google/protobuf/io/gzip_stream.cc', 'google/protobuf/generated_message_reflection.cc', 'google/protobuf/field_mask.pb.cc', 'google/protobuf/extension_set_heavy.cc', 'google/protobuf/empty.pb.cc', 'google/protobuf/dynamic_message.cc', 'google/protobuf/duration.pb.cc', 'google/protobuf/descriptor_database.cc', 'google/protobuf/descriptor.pb.cc', 'google/protobuf/descriptor.cc', 'google/protobuf/compiler/parser.cc', 'google/protobuf/compiler/importer.cc', 'google/protobuf/api.pb.cc', 'google/protobuf/any.pb.cc', 'google/protobuf/any.cc', 'google/protobuf/wire_format_lite.cc', 'google/protobuf/stubs/time.cc', 'google/protobuf/stubs/strutil.cc', 'google/protobuf/stubs/structurally_valid.cc', 'google/protobuf/stubs/stringprintf.cc', 'google/protobuf/stubs/stringpiece.cc', 'google/protobuf/stubs/statusor.cc', 'google/protobuf/stubs/status.cc', 'google/protobuf/stubs/once.cc', 'google/protobuf/stubs/int128.cc', 'google/protobuf/stubs/common.cc', 'google/protobuf/stubs/bytestream.cc', 'google/protobuf/stubs/atomicops_internals_x86_msvc.cc', 'google/protobuf/stubs/atomicops_internals_x86_gcc.cc', 'google/protobuf/repeated_field.cc', 'google/protobuf/message_lite.cc', 'google/protobuf/io/zero_copy_stream_impl_lite.cc', 'google/protobuf/io/zero_copy_stream.cc', 'google/protobuf/io/coded_stream.cc', 'google/protobuf/generated_message_util.cc', 'google/protobuf/extension_set.cc', 'google/protobuf/arenastring.cc', 'google/protobuf/arena.cc'] +CC_FILES=['google/protobuf/compiler/zip_writer.cc', 'google/protobuf/compiler/subprocess.cc', 'google/protobuf/compiler/ruby/ruby_generator.cc', 'google/protobuf/compiler/python/python_generator.cc', 'google/protobuf/compiler/plugin.pb.cc', 'google/protobuf/compiler/plugin.cc', 'google/protobuf/compiler/php/php_generator.cc', 'google/protobuf/compiler/objectivec/objectivec_primitive_field.cc', 'google/protobuf/compiler/objectivec/objectivec_oneof.cc', 'google/protobuf/compiler/objectivec/objectivec_message_field.cc', 'google/protobuf/compiler/objectivec/objectivec_message.cc', 'google/protobuf/compiler/objectivec/objectivec_map_field.cc', 'google/protobuf/compiler/objectivec/objectivec_helpers.cc', 'google/protobuf/compiler/objectivec/objectivec_generator.cc', 'google/protobuf/compiler/objectivec/objectivec_file.cc', 'google/protobuf/compiler/objectivec/objectivec_field.cc', 'google/protobuf/compiler/objectivec/objectivec_extension.cc', 'google/protobuf/compiler/objectivec/objectivec_enum_field.cc', 'google/protobuf/compiler/objectivec/objectivec_enum.cc', 'google/protobuf/compiler/js/js_generator.cc', 'google/protobuf/compiler/javanano/javanano_primitive_field.cc', 'google/protobuf/compiler/javanano/javanano_message_field.cc', 'google/protobuf/compiler/javanano/javanano_message.cc', 'google/protobuf/compiler/javanano/javanano_map_field.cc', 'google/protobuf/compiler/javanano/javanano_helpers.cc', 'google/protobuf/compiler/javanano/javanano_generator.cc', 'google/protobuf/compiler/javanano/javanano_file.cc', 'google/protobuf/compiler/javanano/javanano_field.cc', 'google/protobuf/compiler/javanano/javanano_extension.cc', 'google/protobuf/compiler/javanano/javanano_enum_field.cc', 'google/protobuf/compiler/javanano/javanano_enum.cc', 'google/protobuf/compiler/java/java_string_field_lite.cc', 'google/protobuf/compiler/java/java_string_field.cc', 'google/protobuf/compiler/java/java_shared_code_generator.cc', 'google/protobuf/compiler/java/java_service.cc', 'google/protobuf/compiler/java/java_primitive_field_lite.cc', 'google/protobuf/compiler/java/java_primitive_field.cc', 'google/protobuf/compiler/java/java_name_resolver.cc', 'google/protobuf/compiler/java/java_message_lite.cc', 'google/protobuf/compiler/java/java_message_field_lite.cc', 'google/protobuf/compiler/java/java_message_field.cc', 'google/protobuf/compiler/java/java_message_builder_lite.cc', 'google/protobuf/compiler/java/java_message_builder.cc', 'google/protobuf/compiler/java/java_message.cc', 'google/protobuf/compiler/java/java_map_field_lite.cc', 'google/protobuf/compiler/java/java_map_field.cc', 'google/protobuf/compiler/java/java_lazy_message_field_lite.cc', 'google/protobuf/compiler/java/java_lazy_message_field.cc', 'google/protobuf/compiler/java/java_helpers.cc', 'google/protobuf/compiler/java/java_generator_factory.cc', 'google/protobuf/compiler/java/java_generator.cc', 'google/protobuf/compiler/java/java_file.cc', 'google/protobuf/compiler/java/java_field.cc', 'google/protobuf/compiler/java/java_extension_lite.cc', 'google/protobuf/compiler/java/java_extension.cc', 'google/protobuf/compiler/java/java_enum_lite.cc', 'google/protobuf/compiler/java/java_enum_field_lite.cc', 'google/protobuf/compiler/java/java_enum_field.cc', 'google/protobuf/compiler/java/java_enum.cc', 'google/protobuf/compiler/java/java_doc_comment.cc', 'google/protobuf/compiler/java/java_context.cc', 'google/protobuf/compiler/csharp/csharp_wrapper_field.cc', 'google/protobuf/compiler/csharp/csharp_source_generator_base.cc', 'google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc', 'google/protobuf/compiler/csharp/csharp_repeated_message_field.cc', 'google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc', 'google/protobuf/compiler/csharp/csharp_reflection_class.cc', 'google/protobuf/compiler/csharp/csharp_primitive_field.cc', 'google/protobuf/compiler/csharp/csharp_message_field.cc', 'google/protobuf/compiler/csharp/csharp_message.cc', 'google/protobuf/compiler/csharp/csharp_map_field.cc', 'google/protobuf/compiler/csharp/csharp_helpers.cc', 'google/protobuf/compiler/csharp/csharp_generator.cc', 'google/protobuf/compiler/csharp/csharp_field_base.cc', 'google/protobuf/compiler/csharp/csharp_enum_field.cc', 'google/protobuf/compiler/csharp/csharp_enum.cc', 'google/protobuf/compiler/csharp/csharp_doc_comment.cc', 'google/protobuf/compiler/cpp/cpp_string_field.cc', 'google/protobuf/compiler/cpp/cpp_service.cc', 'google/protobuf/compiler/cpp/cpp_primitive_field.cc', 'google/protobuf/compiler/cpp/cpp_message_field.cc', 'google/protobuf/compiler/cpp/cpp_message.cc', 'google/protobuf/compiler/cpp/cpp_map_field.cc', 'google/protobuf/compiler/cpp/cpp_helpers.cc', 'google/protobuf/compiler/cpp/cpp_generator.cc', 'google/protobuf/compiler/cpp/cpp_file.cc', 'google/protobuf/compiler/cpp/cpp_field.cc', 'google/protobuf/compiler/cpp/cpp_extension.cc', 'google/protobuf/compiler/cpp/cpp_enum_field.cc', 'google/protobuf/compiler/cpp/cpp_enum.cc', 'google/protobuf/compiler/command_line_interface.cc', 'google/protobuf/compiler/code_generator.cc', 'google/protobuf/wrappers.pb.cc', 'google/protobuf/wire_format.cc', 'google/protobuf/util/type_resolver_util.cc', 'google/protobuf/util/time_util.cc', 'google/protobuf/util/message_differencer.cc', 'google/protobuf/util/json_util.cc', 'google/protobuf/util/internal/utility.cc', 'google/protobuf/util/internal/type_info_test_helper.cc', 'google/protobuf/util/internal/type_info.cc', 'google/protobuf/util/internal/protostream_objectwriter.cc', 'google/protobuf/util/internal/protostream_objectsource.cc', 'google/protobuf/util/internal/proto_writer.cc', 'google/protobuf/util/internal/object_writer.cc', 'google/protobuf/util/internal/json_stream_parser.cc', 'google/protobuf/util/internal/json_objectwriter.cc', 'google/protobuf/util/internal/json_escaping.cc', 'google/protobuf/util/internal/field_mask_utility.cc', 'google/protobuf/util/internal/error_listener.cc', 'google/protobuf/util/internal/default_value_objectwriter.cc', 'google/protobuf/util/internal/datapiece.cc', 'google/protobuf/util/field_mask_util.cc', 'google/protobuf/util/field_comparator.cc', 'google/protobuf/unknown_field_set.cc', 'google/protobuf/type.pb.cc', 'google/protobuf/timestamp.pb.cc', 'google/protobuf/text_format.cc', 'google/protobuf/stubs/substitute.cc', 'google/protobuf/stubs/mathlimits.cc', 'google/protobuf/struct.pb.cc', 'google/protobuf/source_context.pb.cc', 'google/protobuf/service.cc', 'google/protobuf/reflection_ops.cc', 'google/protobuf/message.cc', 'google/protobuf/map_field.cc', 'google/protobuf/io/zero_copy_stream_impl.cc', 'google/protobuf/io/tokenizer.cc', 'google/protobuf/io/strtod.cc', 'google/protobuf/io/printer.cc', 'google/protobuf/io/gzip_stream.cc', 'google/protobuf/generated_message_reflection.cc', 'google/protobuf/field_mask.pb.cc', 'google/protobuf/extension_set_heavy.cc', 'google/protobuf/empty.pb.cc', 'google/protobuf/dynamic_message.cc', 'google/protobuf/duration.pb.cc', 'google/protobuf/descriptor_database.cc', 'google/protobuf/descriptor.pb.cc', 'google/protobuf/descriptor.cc', 'google/protobuf/compiler/parser.cc', 'google/protobuf/compiler/importer.cc', 'google/protobuf/api.pb.cc', 'google/protobuf/any.pb.cc', 'google/protobuf/any.cc', 'google/protobuf/wire_format_lite.cc', 'google/protobuf/stubs/time.cc', 'google/protobuf/stubs/strutil.cc', 'google/protobuf/stubs/structurally_valid.cc', 'google/protobuf/stubs/stringprintf.cc', 'google/protobuf/stubs/stringpiece.cc', 'google/protobuf/stubs/statusor.cc', 'google/protobuf/stubs/status.cc', 'google/protobuf/stubs/once.cc', 'google/protobuf/stubs/int128.cc', 'google/protobuf/stubs/common.cc', 'google/protobuf/stubs/bytestream.cc', 'google/protobuf/stubs/atomicops_internals_x86_msvc.cc', 'google/protobuf/stubs/atomicops_internals_x86_gcc.cc', 'google/protobuf/repeated_field.cc', 'google/protobuf/message_lite.cc', 'google/protobuf/io/zero_copy_stream_impl_lite.cc', 'google/protobuf/io/zero_copy_stream.cc', 'google/protobuf/io/coded_stream.cc', 'google/protobuf/generated_message_util.cc', 'google/protobuf/extension_set.cc', 'google/protobuf/arenastring.cc', 'google/protobuf/arena.cc'] PROTO_FILES=['google/protobuf/wrappers.proto', 'google/protobuf/type.proto', 'google/protobuf/timestamp.proto', 'google/protobuf/struct.proto', 'google/protobuf/source_context.proto', 'google/protobuf/field_mask.proto', 'google/protobuf/empty.proto', 'google/protobuf/duration.proto', 'google/protobuf/descriptor.proto', 'google/protobuf/compiler/plugin.proto', 'google/protobuf/api.proto', 'google/protobuf/any.proto'] CC_INCLUDE='third_party/protobuf/src' diff --git a/tools/dockerfile/interoptest/grpc_interop_go/build_interop.sh b/tools/dockerfile/interoptest/grpc_interop_go/build_interop.sh index 1fd088322cd..858ee0a68cd 100755 --- a/tools/dockerfile/interoptest/grpc_interop_go/build_interop.sh +++ b/tools/dockerfile/interoptest/grpc_interop_go/build_interop.sh @@ -36,19 +36,12 @@ set -e # to test instead of using "go get" to download from Github directly. git clone --recursive /var/local/jenkins/grpc-go src/google.golang.org/grpc +# Get all gRPC Go dependencies +(cd src/google.golang.org/grpc && go get -t .) + # copy service account keys if available cp -r /var/local/jenkins/service_account $HOME || true -# Get dependencies from GitHub -# NOTE: once grpc-go dependencies change, this needs to be updated manually -# but we don't expect this to happen any time soon. -go get github.com/golang/protobuf/proto -go get golang.org/x/net/context -go get golang.org/x/net/trace -go get golang.org/x/oauth2 -go get golang.org/x/oauth2/google -go get google.golang.org/cloud - # Build the interop client and server (cd src/google.golang.org/grpc/interop/client && go install) (cd src/google.golang.org/grpc/interop/server && go install) diff --git a/tools/dockerfile/interoptest/grpc_interop_php/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_php/Dockerfile index 0d6171c1705..d0e1a965530 100644 --- a/tools/dockerfile/interoptest/grpc_interop_php/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_php/Dockerfile @@ -63,21 +63,6 @@ RUN apt-get update && apt-get install -y \ # Build profiling RUN apt-get update && apt-get install -y time && apt-get clean -#================== -# Ruby dependencies - -# Install rvm -RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 -RUN \curl -sSL https://get.rvm.io | bash -s stable - -# Install Ruby 2.1 -RUN /bin/bash -l -c "rvm install ruby-2.1" -RUN /bin/bash -l -c "rvm use --default ruby-2.1" -RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc" -RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc" -RUN /bin/bash -l -c "echo 'rvm --default use ruby-2.1' >> ~/.bashrc" -RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc" - #================= # PHP dependencies @@ -97,25 +82,10 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ RUN mkdir /var/local/jenkins -# ronn: a ruby tool used to convert markdown to man pages, used during the -# install of Protobuf extensions -# -# rake: a ruby version of make used to build the PHP Protobuf extension -RUN /bin/bash -l -c "rvm all do gem install ronn rake" - # Install composer RUN curl -sS https://getcomposer.org/installer | php RUN mv composer.phar /usr/local/bin/composer -# Download the patched PHP protobuf so that PHP gRPC clients can be generated -# from proto3 schemas. -RUN git clone https://github.com/stanley-cheung/Protobuf-PHP.git /var/local/git/protobuf-php - -RUN /bin/bash -l -c "rvm use ruby-2.1 \ - && cd /var/local/git/protobuf-php \ - && rvm all do rake pear:package version=1.0 \ - && pear install Protobuf-1.0.tgz" - # Define the default command. CMD ["bash"] diff --git a/tools/dockerfile/interoptest/grpc_interop_php/build_interop.sh b/tools/dockerfile/interoptest/grpc_interop_php/build_interop.sh index a84a450221e..cf5e888effb 100755 --- a/tools/dockerfile/interoptest/grpc_interop_php/build_interop.sh +++ b/tools/dockerfile/interoptest/grpc_interop_php/build_interop.sh @@ -38,7 +38,6 @@ git clone --recursive /var/local/jenkins/grpc /var/local/git/grpc cp -r /var/local/jenkins/service_account $HOME || true cd /var/local/git/grpc -rvm --default use ruby-2.1 # gRPC core and protobuf need to be installed make install @@ -49,4 +48,4 @@ make install (cd src/php && composer install) -(cd src/php && protoc-gen-php -i tests/interop/ -o tests/interop/ tests/interop/test.proto) +(cd src/php && ./bin/generate_proto_php.sh) diff --git a/tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile index be8f25f8ffa..d8cbe7093c6 100644 --- a/tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_php7/Dockerfile @@ -75,21 +75,6 @@ RUN cd /var/local/git/php-src \ && make \ && make install -#================== -# Ruby dependencies - -# Install rvm -RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 -RUN \curl -sSL https://get.rvm.io | bash -s stable - -# Install Ruby 2.1 -RUN /bin/bash -l -c "rvm install ruby-2.1" -RUN /bin/bash -l -c "rvm use --default ruby-2.1" -RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc" -RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc" -RUN /bin/bash -l -c "echo 'rvm --default use ruby-2.1' >> ~/.bashrc" -RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc" - # Prepare ccache RUN ln -s /usr/bin/ccache /usr/local/bin/gcc RUN ln -s /usr/bin/ccache /usr/local/bin/g++ @@ -101,25 +86,10 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ RUN mkdir /var/local/jenkins -# ronn: a ruby tool used to convert markdown to man pages, used during the -# install of Protobuf extensions -# -# rake: a ruby version of make used to build the PHP Protobuf extension -RUN /bin/bash -l -c "rvm all do gem install ronn rake" - # Install composer RUN curl -sS https://getcomposer.org/installer | php RUN mv composer.phar /usr/local/bin/composer -# Download the patched PHP protobuf so that PHP gRPC clients can be generated -# from proto3 schemas. -RUN git clone https://github.com/stanley-cheung/Protobuf-PHP.git /var/local/git/protobuf-php - -RUN /bin/bash -l -c "rvm use ruby-2.1 \ - && cd /var/local/git/protobuf-php \ - && rvm all do rake pear:package version=1.0 \ - && pear install Protobuf-1.0.tgz" - # Define the default command. CMD ["bash"] diff --git a/tools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh b/tools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh index 261dded2821..e486e5276a8 100755 --- a/tools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh +++ b/tools/dockerfile/interoptest/grpc_interop_php7/build_interop.sh @@ -38,7 +38,6 @@ git clone --recursive /var/local/jenkins/grpc /var/local/git/grpc cp -r /var/local/jenkins/service_account $HOME || true cd /var/local/git/grpc -rvm --default use ruby-2.1 # gRPC core and protobuf need to be installed make install @@ -49,4 +48,4 @@ make install (cd src/php && composer install) -(cd src/php && protoc-gen-php -i tests/interop/ -o tests/interop/ tests/interop/test.proto) +(cd src/php && ./bin/generate_proto_php.sh) diff --git a/tools/dockerfile/stress_test/grpc_interop_stress_php/Dockerfile b/tools/dockerfile/stress_test/grpc_interop_stress_php/Dockerfile index 0716be5a9dd..0fe9c151e53 100644 --- a/tools/dockerfile/stress_test/grpc_interop_stress_php/Dockerfile +++ b/tools/dockerfile/stress_test/grpc_interop_stress_php/Dockerfile @@ -117,24 +117,9 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ RUN mkdir /var/local/jenkins -# ronn: a ruby tool used to convert markdown to man pages, used during the -# install of Protobuf extensions -# -# rake: a ruby version of make used to build the PHP Protobuf extension -RUN /bin/bash -l -c "rvm all do gem install ronn rake" - # Install composer RUN curl -sS https://getcomposer.org/installer | php RUN mv composer.phar /usr/local/bin/composer -# Download the patched PHP protobuf so that PHP gRPC clients can be generated -# from proto3 schemas. -RUN git clone https://github.com/stanley-cheung/Protobuf-PHP.git /var/local/git/protobuf-php - -RUN /bin/bash -l -c "rvm use ruby-2.1 \ - && cd /var/local/git/protobuf-php \ - && rvm all do rake pear:package version=1.0 \ - && pear install Protobuf-1.0.tgz" - # Define the default command. CMD ["bash"] diff --git a/tools/dockerfile/stress_test/grpc_interop_stress_php/build_interop_stress.sh b/tools/dockerfile/stress_test/grpc_interop_stress_php/build_interop_stress.sh index 87262f1d629..34fd09f78b0 100755 --- a/tools/dockerfile/stress_test/grpc_interop_stress_php/build_interop_stress.sh +++ b/tools/dockerfile/stress_test/grpc_interop_stress_php/build_interop_stress.sh @@ -38,7 +38,6 @@ git clone --recursive /var/local/jenkins/grpc /var/local/git/grpc cp -r /var/local/jenkins/service_account $HOME || true cd /var/local/git/grpc -rvm --default use ruby-2.1 make install-certs @@ -51,4 +50,4 @@ make install (cd src/php && composer install) -(cd src/php && protoc-gen-php -i tests/interop/ -o tests/interop/ tests/interop/test.proto) +(cd src/php && ./bin/generate_proto_php.sh) diff --git a/tools/gce/create_linux_worker.sh b/tools/gce/create_linux_worker.sh index 7bf8b240818..013127c585e 100755 --- a/tools/gce/create_linux_worker.sh +++ b/tools/gce/create_linux_worker.sh @@ -42,7 +42,7 @@ INSTANCE_NAME="${1:-grpc-jenkins-worker1}" gcloud compute instances create $INSTANCE_NAME \ --project="$CLOUD_PROJECT" \ --zone "$ZONE" \ - --machine-type n1-standard-8 \ + --machine-type n1-highmem-8 \ --image=ubuntu-1510 \ --image-project=grpc-testing \ --boot-disk-size 1000 diff --git a/tools/gce/linux_worker_init.sh b/tools/gce/linux_worker_init.sh index afcf7a52d92..9230acdca6d 100755 --- a/tools/gce/linux_worker_init.sh +++ b/tools/gce/linux_worker_init.sh @@ -34,6 +34,14 @@ set -ex +# Create some swap space +sudo dd if=/dev/zero of=/swap bs=1024 count=10485760 +sudo chmod 600 /swap +sudo mkswap /swap +sudo sed -i '$ a\/swap none swap sw 0 0' /etc/fstab +sudo swapon -a + +# Typical apt-get maintenance sudo apt-get update # Install JRE diff --git a/tools/jenkins/run_full_performance.sh b/tools/jenkins/run_full_performance.sh index 3feda866f2f..7631db8844b 100755 --- a/tools/jenkins/run_full_performance.sh +++ b/tools/jenkins/run_full_performance.sh @@ -38,7 +38,7 @@ cd $(dirname $0)/../.. tools/run_tests/run_performance_tests.py \ -l c++ csharp node ruby java python go \ --netperf \ - --category all \ + --category scalable \ --bq_result_table performance_test.performance_experiment \ --remote_worker_host grpc-performance-server-8core grpc-performance-client-8core grpc-performance-client2-8core \ || EXIT_CODE=1 @@ -53,4 +53,3 @@ tools/run_tests/run_performance_tests.py \ || EXIT_CODE=1 exit $EXIT_CODE - 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 c2ea6f2c6eb..b4b172ddef6 100755 --- a/tools/run_tests/dockerize/build_docker_and_run_tests.sh +++ b/tools/run_tests/dockerize/build_docker_and_run_tests.sh @@ -44,9 +44,6 @@ mkdir -p /tmp/ccache # its cache location now that --download-cache is deprecated). mkdir -p /tmp/xdg-cache-home -# Create a local branch so the child Docker script won't complain -git branch -f jenkins-docker - # Inputs # DOCKERFILE_DIR - Directory in which Dockerfile file is located. # DOCKER_RUN_SCRIPT - Script to run under docker (relative to grpc repo root) @@ -86,9 +83,12 @@ docker run \ $DOCKER_IMAGE_NAME \ bash -l "/var/local/jenkins/grpc/$DOCKER_RUN_SCRIPT" || DOCKER_FAILED="true" -docker cp "$CONTAINER_NAME:/var/local/git/grpc/reports.zip" $git_root || true -unzip -o $git_root/reports.zip -d $git_root || true -rm -f reports.zip +# use unique name for reports.zip to prevent clash between concurrent +# run_tests.py runs +TEMP_REPORTS_ZIP=`mktemp` +docker cp "$CONTAINER_NAME:/var/local/git/grpc/reports.zip" ${TEMP_REPORTS_ZIP} || true +unzip -o ${TEMP_REPORTS_ZIP} -d $git_root || true +rm -f ${TEMP_REPORTS_ZIP} # remove the container, possibly killing it first docker rm -f $CONTAINER_NAME || true diff --git a/tools/run_tests/dockerize/docker_run_tests.sh b/tools/run_tests/dockerize/docker_run_tests.sh index 8c6143d24f9..ef02d266253 100755 --- a/tools/run_tests/dockerize/docker_run_tests.sh +++ b/tools/run_tests/dockerize/docker_run_tests.sh @@ -63,6 +63,7 @@ echo '' >> index.html cd .. zip -r reports.zip reports -find . -name report.xml | xargs zip reports.zip +find . -name report.xml | xargs -r zip reports.zip +find . -name 'report_*.xml' | xargs -r zip reports.zip exit $exit_code diff --git a/tools/run_tests/performance/scenario_config.py b/tools/run_tests/performance/scenario_config.py index fa401fdaafe..725ca299bd4 100644 --- a/tools/run_tests/performance/scenario_config.py +++ b/tools/run_tests/performance/scenario_config.py @@ -190,7 +190,7 @@ class CXXLanguage: # TODO(ctiller): add 70% load latency test for secure in [True, False]: secstr = 'secure' if secure else 'insecure' - smoketest_categories = [SMOKETEST] if secure else [] + smoketest_categories = ([SMOKETEST] if secure else []) + [SCALABLE] yield _ping_pong_scenario( 'cpp_generic_async_streaming_ping_pong_%s' % secstr, @@ -270,7 +270,7 @@ class CSharpLanguage: 'csharp_generic_async_streaming_ping_pong', rpc_type='STREAMING', client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER', use_generic_payload=True, - categories=[SMOKETEST]) + categories=[SMOKETEST, SCALABLE]) yield _ping_pong_scenario( 'csharp_protobuf_async_streaming_ping_pong', rpc_type='STREAMING', @@ -279,7 +279,7 @@ class CSharpLanguage: yield _ping_pong_scenario( 'csharp_protobuf_async_unary_ping_pong', rpc_type='UNARY', client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER', - categories=[SMOKETEST]) + categories=[SMOKETEST, SCALABLE]) yield _ping_pong_scenario( 'csharp_protobuf_sync_to_async_unary_ping_pong', rpc_type='UNARY', @@ -301,7 +301,7 @@ class CSharpLanguage: 'csharp_to_cpp_protobuf_sync_unary_ping_pong', rpc_type='UNARY', client_type='SYNC_CLIENT', server_type='SYNC_SERVER', server_language='c++', server_core_limit=1, async_server_threads=1, - categories=[SMOKETEST]) + categories=[SMOKETEST, SCALABLE]) yield _ping_pong_scenario( 'csharp_to_cpp_protobuf_async_streaming_ping_pong', rpc_type='STREAMING', @@ -358,13 +358,13 @@ class NodeLanguage: yield _ping_pong_scenario( 'node_protobuf_unary_ping_pong', rpc_type='UNARY', client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER', - categories=[SMOKETEST]) + categories=[SCALABLE, SMOKETEST]) yield _ping_pong_scenario( 'node_protobuf_async_unary_qps_unconstrained', rpc_type='UNARY', client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER', unconstrained_client='async', - categories=[SMOKETEST]) + categories=[SCALABLE, SMOKETEST]) # TODO(jtattermusch): make this scenario work #yield _ping_pong_scenario( @@ -403,7 +403,7 @@ class PythonLanguage: 'python_generic_sync_streaming_ping_pong', rpc_type='STREAMING', client_type='SYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER', use_generic_payload=True, - categories=[SMOKETEST]) + categories=[SMOKETEST, SCALABLE]) yield _ping_pong_scenario( 'python_protobuf_sync_streaming_ping_pong', rpc_type='STREAMING', @@ -416,7 +416,7 @@ class PythonLanguage: yield _ping_pong_scenario( 'python_protobuf_sync_unary_ping_pong', rpc_type='UNARY', client_type='SYNC_CLIENT', server_type='ASYNC_SERVER', - categories=[SMOKETEST]) + categories=[SMOKETEST, SCALABLE]) yield _ping_pong_scenario( 'python_protobuf_sync_unary_qps_unconstrained', rpc_type='UNARY', @@ -432,7 +432,7 @@ class PythonLanguage: 'python_to_cpp_protobuf_sync_unary_ping_pong', rpc_type='UNARY', client_type='SYNC_CLIENT', server_type='ASYNC_SERVER', server_language='c++', server_core_limit=1, async_server_threads=1, - categories=[SMOKETEST]) + categories=[SMOKETEST, SCALABLE]) yield _ping_pong_scenario( 'python_to_cpp_protobuf_sync_streaming_ping_pong', rpc_type='STREAMING', @@ -458,12 +458,12 @@ class RubyLanguage: yield _ping_pong_scenario( 'ruby_protobuf_sync_streaming_ping_pong', rpc_type='STREAMING', client_type='SYNC_CLIENT', server_type='SYNC_SERVER', - categories=[SMOKETEST]) + categories=[SMOKETEST, SCALABLE]) yield _ping_pong_scenario( 'ruby_protobuf_unary_ping_pong', rpc_type='UNARY', client_type='SYNC_CLIENT', server_type='SYNC_SERVER', - categories=[SMOKETEST]) + categories=[SMOKETEST, SCALABLE]) yield _ping_pong_scenario( 'ruby_protobuf_sync_unary_qps_unconstrained', rpc_type='UNARY', @@ -504,7 +504,7 @@ class JavaLanguage: def scenarios(self): for secure in [True, False]: secstr = 'secure' if secure else 'insecure' - smoketest_categories = [SMOKETEST] if secure else [] + smoketest_categories = ([SMOKETEST] if secure else []) + [SCALABLE] yield _ping_pong_scenario( 'java_generic_async_streaming_ping_pong_%s' % secstr, rpc_type='STREAMING', @@ -581,7 +581,7 @@ class GoLanguage: def scenarios(self): for secure in [True, False]: secstr = 'secure' if secure else 'insecure' - smoketest_categories = [SMOKETEST] if secure else [] + smoketest_categories = ([SMOKETEST] if secure else []) + [SCALABLE] # ASYNC_GENERIC_SERVER for Go actually uses a sync streaming server, # but that's mostly because of lack of better name of the enum value. diff --git a/tools/run_tests/run_performance_tests.py b/tools/run_tests/run_performance_tests.py index 3f028f177bd..92149115fe2 100755 --- a/tools/run_tests/run_performance_tests.py +++ b/tools/run_tests/run_performance_tests.py @@ -280,7 +280,7 @@ def create_qpsworkers(languages, worker_hosts): for worker_idx, worker in enumerate(workers)] -Scenario = collections.namedtuple('Scenario', 'jobspec workers') +Scenario = collections.namedtuple('Scenario', 'jobspec workers name') def create_scenarios(languages, workers_by_lang, remote_host=None, regex='.*', @@ -307,7 +307,7 @@ def create_scenarios(languages, workers_by_lang, remote_host=None, regex='.*', create_netperf_jobspec(server_host=netperf_server, client_host=netperf_client, bq_result_table=bq_result_table), - _NO_WORKERS)) + _NO_WORKERS, 'netperf')) for language in languages: for scenario_json in language.scenarios(): @@ -347,7 +347,8 @@ def create_scenarios(languages, workers_by_lang, remote_host=None, regex='.*', [w.host_and_port for w in workers], remote_host=remote_host, bq_result_table=bq_result_table), - workers) + workers, + scenario_json['name']) scenarios.append(scenario) return scenarios @@ -382,6 +383,11 @@ argp.add_argument('--remote_worker_host', nargs='+', default=[], help='Worker hosts where to start QPS workers.') +argp.add_argument('--dry_run', + default=False, + action='store_const', + const=True, + help='Just list scenarios to be run, but don\'t run them.') argp.add_argument('-r', '--regex', default='.*', type=str, help='Regex to select scenarios to run.') argp.add_argument('--bq_result_table', default=None, type=str, @@ -412,16 +418,18 @@ if args.remote_worker_host: if args.remote_driver_host: remote_hosts.add(args.remote_driver_host) -if remote_hosts: - archive_repo(languages=[str(l) for l in languages]) - prepare_remote_hosts(remote_hosts, prepare_local=True) -else: - prepare_remote_hosts([], prepare_local=True) +if not args.dry_run: + if remote_hosts: + archive_repo(languages=[str(l) for l in languages]) + prepare_remote_hosts(remote_hosts, prepare_local=True) + else: + prepare_remote_hosts([], prepare_local=True) build_local = False if not args.remote_driver_host: build_local = True -build_on_remote_hosts(remote_hosts, languages=[str(l) for l in languages], build_local=build_local) +if not args.dry_run: + build_on_remote_hosts(remote_hosts, languages=[str(l) for l in languages], build_local=build_local) qpsworker_jobs = create_qpsworkers(languages, args.remote_worker_host) @@ -443,11 +451,14 @@ if not scenarios: raise Exception('No scenarios to run') for scenario in scenarios: - try: - for worker in scenario.workers: - worker.start() - jobset.run([scenario.jobspec, - create_quit_jobspec(scenario.workers, remote_host=args.remote_driver_host)], - newline_on_success=True, maxjobs=1) - finally: - finish_qps_workers(scenario.workers) + if args.dry_run: + print(scenario.name) + else: + try: + for worker in scenario.workers: + worker.start() + jobset.run([scenario.jobspec, + create_quit_jobspec(scenario.workers, remote_host=args.remote_driver_host)], + newline_on_success=True, maxjobs=1) + finally: + finish_qps_workers(scenario.workers) diff --git a/tools/run_tests/run_tests_in_workspace.sh b/tools/run_tests/run_tests_in_workspace.sh new file mode 100755 index 00000000000..b0c9ad05f76 --- /dev/null +++ b/tools/run_tests/run_tests_in_workspace.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Copyright 2015, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Create a workspace in a subdirectory to allow running multiple builds in isolation. +# WORKSPACE_NAME env variable needs to contain name of the workspace to create. +# All cmdline args will be passed to run_tests.py script (executed in the +# newly created workspace) +set -ex + +cd $(dirname $0)/../.. + +rm -rf "${WORKSPACE_NAME}" +# TODO(jtattermusch): clone --recursive fetches the submodules from github. +# Try avoiding that to save time and network capacity. +git clone --recursive . "${WORKSPACE_NAME}" + +echo "Running run_tests.py in workspace ${WORKSPACE_NAME}" +"${WORKSPACE_NAME}/tools/run_tests/run_tests.py" $@ + diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py new file mode 100755 index 00000000000..d5f90478257 --- /dev/null +++ b/tools/run_tests/run_tests_matrix.py @@ -0,0 +1,291 @@ +#!/usr/bin/env python2.7 +# Copyright 2015, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Run test matrix.""" + +import argparse +import jobset +import multiprocessing +import os +import report_utils +import sys + +_ROOT = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '../..')) +os.chdir(_ROOT) + +# Set the timeout high to allow enough time for sanitizers and pre-building +# clang docker. +_RUNTESTS_TIMEOUT = 2*60*60 + +# Number of jobs assigned to each run_tests.py instance +_INNER_JOBS = 2 + + +def _docker_jobspec(name, runtests_args=[]): + """Run a single instance of run_tests.py in a docker container""" + test_job = jobset.JobSpec( + cmdline=['python', 'tools/run_tests/run_tests.py', + '--use_docker', + '-t', + '-j', str(_INNER_JOBS), + '-x', 'report_%s.xml' % name] + runtests_args, + shortname='run_tests_%s' % name, + timeout_seconds=_RUNTESTS_TIMEOUT) + return test_job + + +def _workspace_jobspec(name, runtests_args=[], workspace_name=None): + """Run a single instance of run_tests.py in a separate workspace""" + if not workspace_name: + workspace_name = 'workspace_%s' % name + env = {'WORKSPACE_NAME': workspace_name} + test_job = jobset.JobSpec( + cmdline=['tools/run_tests/run_tests_in_workspace.sh', + '-t', + '-j', str(_INNER_JOBS), + '-x', '../report_%s.xml' % name] + runtests_args, + environ=env, + shortname='run_tests_%s' % name, + timeout_seconds=_RUNTESTS_TIMEOUT) + return test_job + + +def _generate_jobs(languages, configs, platforms, + arch=None, compiler=None, + labels=[], extra_args=[]): + result = [] + for language in languages: + for platform in platforms: + for config in configs: + name = '%s_%s_%s' % (language, platform, config) + runtests_args = ['-l', language, + '-c', config] + if arch or compiler: + name += '_%s_%s' % (arch, compiler) + runtests_args += ['--arch', arch, + '--compiler', compiler] + + runtests_args += extra_args + if platform == 'linux': + job = _docker_jobspec(name=name, runtests_args=runtests_args) + else: + job = _workspace_jobspec(name=name, runtests_args=runtests_args) + + job.labels = [platform, config, language] + labels + result.append(job) + return result + + +def _create_test_jobs(extra_args=[]): + test_jobs = [] + # supported on linux only + test_jobs += _generate_jobs(languages=['sanity', 'php7'], + configs=['dbg', 'opt'], + platforms=['linux'], + labels=['basictests'], + extra_args=extra_args) + + # supported on all platforms. + test_jobs += _generate_jobs(languages=['c', 'csharp', 'node', 'python'], + configs=['dbg', 'opt'], + platforms=['linux', 'macos', 'windows'], + labels=['basictests'], + extra_args=extra_args) + + # supported on linux and mac. + test_jobs += _generate_jobs(languages=['c++', 'ruby', 'php'], + configs=['dbg', 'opt'], + platforms=['linux', 'macos'], + labels=['basictests'], + extra_args=extra_args) + + # supported on mac only. + test_jobs += _generate_jobs(languages=['objc'], + configs=['dbg', 'opt'], + platforms=['macos'], + labels=['basictests'], + extra_args=extra_args) + + # sanitizers + test_jobs += _generate_jobs(languages=['c'], + configs=['msan', 'asan', 'tsan'], + platforms=['linux'], + labels=['sanitizers'], + extra_args=extra_args) + test_jobs += _generate_jobs(languages=['c++'], + configs=['asan', 'tsan'], + platforms=['linux'], + labels=['sanitizers'], + extra_args=extra_args) + return test_jobs + + +def _create_portability_test_jobs(extra_args=[]): + test_jobs = [] + # portability C x86 + test_jobs += _generate_jobs(languages=['c'], + configs=['dbg'], + platforms=['linux'], + arch='x86', + compiler='default', + labels=['portability'], + extra_args=extra_args) + + # portability C and C++ on x64 + for compiler in ['gcc4.4', 'gcc4.6', 'gcc5.3', + 'clang3.5', 'clang3.6', 'clang3.7']: + test_jobs += _generate_jobs(languages=['c', 'c++'], + configs=['dbg'], + platforms=['linux'], + arch='x64', + compiler=compiler, + labels=['portability'], + extra_args=extra_args) + + # portability C on Windows + for arch in ['x86', 'x64']: + for compiler in ['vs2013', 'vs2015']: + test_jobs += _generate_jobs(languages=['c'], + configs=['dbg'], + platforms=['windows'], + arch=arch, + compiler=compiler, + labels=['portability'], + extra_args=extra_args) + + test_jobs += _generate_jobs(languages=['python'], + configs=['dbg'], + platforms=['linux'], + arch='default', + compiler='python3.4', + labels=['portability'], + extra_args=extra_args) + + test_jobs += _generate_jobs(languages=['csharp'], + configs=['dbg'], + platforms=['linux'], + arch='default', + compiler='coreclr', + labels=['portability'], + extra_args=extra_args) + + for compiler in ['node5', 'node0.12']: + test_jobs += _generate_jobs(languages=['node'], + configs=['dbg'], + platforms=['linux'], + arch='default', + compiler=compiler, + labels=['portability'], + extra_args=extra_args) + return test_jobs + + +def _allowed_labels(): + """Returns a list of existing job labels.""" + all_labels = set() + for job in _create_test_jobs() + _create_portability_test_jobs(): + for label in job.labels: + all_labels.add(label) + return sorted(all_labels) + + +argp = argparse.ArgumentParser(description='Run a matrix of run_tests.py tests.') +argp.add_argument('-j', '--jobs', + default=multiprocessing.cpu_count()/_INNER_JOBS, + type=int, + help='Number of concurrent run_tests.py instances.') +argp.add_argument('-f', '--filter', + choices=_allowed_labels(), + nargs='+', + default=[], + help='Filter targets to run by label with AND semantics.') +argp.add_argument('--build_only', + default=False, + action='store_const', + const=True, + help='Pass --build_only flag to run_tests.py instances.') +argp.add_argument('--force_default_poller', default=False, action='store_const', const=True, + help='Pass --force_default_poller to run_tests.py instances.') +argp.add_argument('--dry_run', + default=False, + action='store_const', + const=True, + help='Only print what would be run.') +args = argp.parse_args() + +extra_args = [] +if args.build_only: + extra_args.append('--build_only') +if args.force_default_poller: + extra_args.append('--force_default_poller') + +all_jobs = _create_test_jobs(extra_args=extra_args) + _create_portability_test_jobs(extra_args=extra_args) + +jobs = [] +for job in all_jobs: + if not args.filter or all(filter in job.labels for filter in args.filter): + jobs.append(job) + +if not jobs: + jobset.message('FAILED', 'No test suites match given criteria.', + do_newline=True) + sys.exit(1) + +print('IMPORTANT: The changes you are testing need to be locally committed') +print('because only the committed changes in the current branch will be') +print('copied to the docker environment or into subworkspaces.') + +print +print 'Will run these tests:' +for job in jobs: + if args.dry_run: + print ' %s: "%s"' % (job.shortname, ' '.join(job.cmdline)) + else: + print ' %s' % job.shortname +print + +if args.dry_run: + print '--dry_run was used, exiting' + sys.exit(1) + +jobset.message('START', 'Running test matrix.', do_newline=True) +num_failures, resultset = jobset.run(jobs, + newline_on_success=True, + travis=True, + maxjobs=args.jobs) +report_utils.render_junit_xml_report(resultset, 'report.xml') + +if num_failures == 0: + jobset.message('SUCCESS', 'All run_tests.py instance finished successfully.', + do_newline=True) +else: + jobset.message('FAILED', 'Some run_tests.py instance have failed.', + do_newline=True) + sys.exit(1) diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh index a33f5b0cc30..6410646cd1a 100755 --- a/tools/run_tests/sanity/check_submodules.sh +++ b/tools/run_tests/sanity/check_submodules.sh @@ -44,7 +44,7 @@ cat << EOF | awk '{ print $1 }' | sort > $want_submodules c880e42ba1c8032d4cdde2aba0541d8a9d9fa2e9 third_party/boringssl (version_for_cocoapods_2.0-100-gc880e42) 05b155ff59114735ec8cd089f669c4c3d8f59029 third_party/gflags (v2.1.0-45-g05b155f) c99458533a9b4c743ed51537e25989ea55944908 third_party/googletest (release-1.7.0) - 1a586735085e817b1f52e53feec92ce418049f69 third_party/protobuf (v3.0.2) + a428e42072765993ff674fda72863c9f1aa2d268 third_party/protobuf (v3.1.0) 50893291621658f355bc5b4d450a8d06a563053d third_party/zlib (v1.2.8) bcad91771b7f0bff28a1cac1981d7ef2b9bcef3c third_party/thrift EOF diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index bbdb998df39..1f6eaccb94c 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -346,6 +346,22 @@ "headers": [], "is_filegroup": false, "language": "c", + "name": "connection_refused_test", + "src": [ + "test/core/end2end/connection_refused_test.c" + ], + "third_party": false, + "type": "target" + }, + { + "deps": [ + "gpr", + "gpr_test_util", + "grpc", + "grpc_test_util" + ], + "headers": [], + "language": "c", "name": "dns_resolver_connectivity_test", "src": [ "test/core/client_config/resolvers/dns_resolver_connectivity_test.c" @@ -2482,6 +2498,20 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "grpc_plugin_support" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "grpc_php_plugin", + "src": [ + "src/compiler/php_plugin.cc" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "grpc_plugin_support" @@ -5027,6 +5057,8 @@ "src/compiler/node_generator_helpers.h", "src/compiler/objective_c_generator.h", "src/compiler/objective_c_generator_helpers.h", + "src/compiler/php_generator.h", + "src/compiler/php_generator_helpers.h", "src/compiler/python_generator.h", "src/compiler/ruby_generator.h", "src/compiler/ruby_generator_helpers-inl.h", @@ -5051,6 +5083,9 @@ "src/compiler/objective_c_generator.cc", "src/compiler/objective_c_generator.h", "src/compiler/objective_c_generator_helpers.h", + "src/compiler/php_generator.cc", + "src/compiler/php_generator.h", + "src/compiler/php_generator_helpers.h", "src/compiler/python_generator.cc", "src/compiler/python_generator.h", "src/compiler/ruby_generator.cc", diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 355fea5d5f4..65b227e2b82 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -379,6 +379,27 @@ "windows" ] }, + { + "args": [], + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "gtest": false, + "language": "c", + "name": "connection_refused_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ] + }, { "args": [], "ci_platforms": [ diff --git a/tools/tsan_suppressions.txt b/tools/tsan_suppressions.txt index 09e68cd2335..765fa098f92 100644 --- a/tools/tsan_suppressions.txt +++ b/tools/tsan_suppressions.txt @@ -6,3 +6,6 @@ race:cleanse_ctr race:ssleay_rand_add race:ssleay_rand_bytes race:__sleep_for +# protobuf has an idempotent write race in ByteSize +# https://github.com/google/protobuf/issues/2169 +race:ByteSize diff --git a/vsprojects/buildtests_c.sln b/vsprojects/buildtests_c.sln index 4345b9134db..f8824cc94c7 100644 --- a/vsprojects/buildtests_c.sln +++ b/vsprojects/buildtests_c.sln @@ -231,6 +231,17 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "connection_prefix_bad_clien {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "connection_refused_test", "vcxproj\test\connection_refused_test\connection_refused_test.vcxproj", "{961DFABF-18F2-7D46-4D69-B82A5E9A78B2}" + ProjectSection(myProperties) = preProject + lib = "False" + EndProjectSection + ProjectSection(ProjectDependencies) = postProject + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} = {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} + {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9} + {EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037} + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + EndProjectSection +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dns_resolver_connectivity_test", "vcxproj\test\dns_resolver_connectivity_test\dns_resolver_connectivity_test.vcxproj", "{F7B6FE68-E847-D7CA-4062-E737E542BCC3}" ProjectSection(myProperties) = preProject lib = "False" @@ -1855,6 +1866,22 @@ Global {AF9D0EB2-2A53-B815-3A63-E82C7F91DB29}.Release-DLL|Win32.Build.0 = Release|Win32 {AF9D0EB2-2A53-B815-3A63-E82C7F91DB29}.Release-DLL|x64.ActiveCfg = Release|x64 {AF9D0EB2-2A53-B815-3A63-E82C7F91DB29}.Release-DLL|x64.Build.0 = Release|x64 + {961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Debug|Win32.ActiveCfg = Debug|Win32 + {961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Debug|x64.ActiveCfg = Debug|x64 + {961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Release|Win32.ActiveCfg = Release|Win32 + {961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Release|x64.ActiveCfg = Release|x64 + {961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Debug|Win32.Build.0 = Debug|Win32 + {961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Debug|x64.Build.0 = Debug|x64 + {961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Release|Win32.Build.0 = Release|Win32 + {961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Release|x64.Build.0 = Release|x64 + {961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Debug-DLL|Win32.ActiveCfg = Debug|Win32 + {961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Debug-DLL|Win32.Build.0 = Debug|Win32 + {961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Debug-DLL|x64.ActiveCfg = Debug|x64 + {961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Debug-DLL|x64.Build.0 = Debug|x64 + {961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Release-DLL|Win32.ActiveCfg = Release|Win32 + {961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Release-DLL|Win32.Build.0 = Release|Win32 + {961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Release-DLL|x64.ActiveCfg = Release|x64 + {961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Release-DLL|x64.Build.0 = Release|x64 {F7B6FE68-E847-D7CA-4062-E737E542BCC3}.Debug|Win32.ActiveCfg = Debug|Win32 {F7B6FE68-E847-D7CA-4062-E737E542BCC3}.Debug|x64.ActiveCfg = Debug|x64 {F7B6FE68-E847-D7CA-4062-E737E542BCC3}.Release|Win32.ActiveCfg = Release|Win32 diff --git a/vsprojects/grpc_protoc_plugins.sln b/vsprojects/grpc_protoc_plugins.sln index 2e55720f28c..c1d0ea2eb1e 100644 --- a/vsprojects/grpc_protoc_plugins.sln +++ b/vsprojects/grpc_protoc_plugins.sln @@ -35,6 +35,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_objective_c_plugin", " {B6E81D84-2ACB-41B8-8781-493A944C7817} = {B6E81D84-2ACB-41B8-8781-493A944C7817} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_php_plugin", "vcxproj\.\grpc_php_plugin\grpc_php_plugin.vcxproj", "{2C5F74B5-2F1E-A7A7-45EA-250AF73A1CEC}" + ProjectSection(myProperties) = preProject + lib = "False" + EndProjectSection + ProjectSection(ProjectDependencies) = postProject + {B6E81D84-2ACB-41B8-8781-493A944C7817} = {B6E81D84-2ACB-41B8-8781-493A944C7817} + EndProjectSection +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_plugin_support", "vcxproj\.\grpc_plugin_support\grpc_plugin_support.vcxproj", "{B6E81D84-2ACB-41B8-8781-493A944C7817}" ProjectSection(myProperties) = preProject lib = "True" @@ -96,6 +104,14 @@ Global {19564640-CEE6-4921-ABA5-676ED79A36F6}.Debug|x64.Build.0 = Debug|x64 {19564640-CEE6-4921-ABA5-676ED79A36F6}.Release|Win32.Build.0 = Release|Win32 {19564640-CEE6-4921-ABA5-676ED79A36F6}.Release|x64.Build.0 = Release|x64 + {2C5F74B5-2F1E-A7A7-45EA-250AF73A1CEC}.Debug|Win32.ActiveCfg = Debug|Win32 + {2C5F74B5-2F1E-A7A7-45EA-250AF73A1CEC}.Debug|x64.ActiveCfg = Debug|x64 + {2C5F74B5-2F1E-A7A7-45EA-250AF73A1CEC}.Release|Win32.ActiveCfg = Release|Win32 + {2C5F74B5-2F1E-A7A7-45EA-250AF73A1CEC}.Release|x64.ActiveCfg = Release|x64 + {2C5F74B5-2F1E-A7A7-45EA-250AF73A1CEC}.Debug|Win32.Build.0 = Debug|Win32 + {2C5F74B5-2F1E-A7A7-45EA-250AF73A1CEC}.Debug|x64.Build.0 = Debug|x64 + {2C5F74B5-2F1E-A7A7-45EA-250AF73A1CEC}.Release|Win32.Build.0 = Release|Win32 + {2C5F74B5-2F1E-A7A7-45EA-250AF73A1CEC}.Release|x64.Build.0 = Release|x64 {B6E81D84-2ACB-41B8-8781-493A944C7817}.Debug|Win32.ActiveCfg = Debug|Win32 {B6E81D84-2ACB-41B8-8781-493A944C7817}.Debug|x64.ActiveCfg = Debug|x64 {B6E81D84-2ACB-41B8-8781-493A944C7817}.Release|Win32.ActiveCfg = Release|Win32 diff --git a/vsprojects/vcxproj/grpc_php_plugin/grpc_php_plugin.vcxproj b/vsprojects/vcxproj/grpc_php_plugin/grpc_php_plugin.vcxproj new file mode 100644 index 00000000000..1648ba9010f --- /dev/null +++ b/vsprojects/vcxproj/grpc_php_plugin/grpc_php_plugin.vcxproj @@ -0,0 +1,168 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {2C5F74B5-2F1E-A7A7-45EA-250AF73A1CEC} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + grpc_php_plugin + + + grpc_php_plugin + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + + + + + {B6E81D84-2ACB-41B8-8781-493A944C7817} + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + diff --git a/vsprojects/vcxproj/grpc_php_plugin/grpc_php_plugin.vcxproj.filters b/vsprojects/vcxproj/grpc_php_plugin/grpc_php_plugin.vcxproj.filters new file mode 100644 index 00000000000..e131753f8d6 --- /dev/null +++ b/vsprojects/vcxproj/grpc_php_plugin/grpc_php_plugin.vcxproj.filters @@ -0,0 +1,18 @@ + + + + + src\compiler + + + + + + {d7fb4039-77f4-10f2-59fe-bb98fb56950a} + + + {5560fb58-2ae8-75cc-fbca-e630a50c15bf} + + + + diff --git a/vsprojects/vcxproj/grpc_plugin_support/grpc_plugin_support.vcxproj b/vsprojects/vcxproj/grpc_plugin_support/grpc_plugin_support.vcxproj index 9828b8bcaf0..05165d6fb80 100644 --- a/vsprojects/vcxproj/grpc_plugin_support/grpc_plugin_support.vcxproj +++ b/vsprojects/vcxproj/grpc_plugin_support/grpc_plugin_support.vcxproj @@ -161,6 +161,8 @@ + + @@ -176,6 +178,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_plugin_support/grpc_plugin_support.vcxproj.filters b/vsprojects/vcxproj/grpc_plugin_support/grpc_plugin_support.vcxproj.filters index 27eb935e074..c8b893221d3 100644 --- a/vsprojects/vcxproj/grpc_plugin_support/grpc_plugin_support.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_plugin_support/grpc_plugin_support.vcxproj.filters @@ -13,6 +13,9 @@ src\compiler + + src\compiler + src\compiler @@ -56,6 +59,12 @@ src\compiler + + src\compiler + + + src\compiler + src\compiler diff --git a/vsprojects/vcxproj/test/connection_refused_test/connection_refused_test.vcxproj b/vsprojects/vcxproj/test/connection_refused_test/connection_refused_test.vcxproj new file mode 100644 index 00000000000..2f13d09bdfb --- /dev/null +++ b/vsprojects/vcxproj/test/connection_refused_test/connection_refused_test.vcxproj @@ -0,0 +1,199 @@ + + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {961DFABF-18F2-7D46-4D69-B82A5E9A78B2} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + connection_refused_test + static + Debug + static + Debug + + + connection_refused_test + static + Release + static + Release + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + + + + + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} + + + {29D16885-7228-4C31-81ED-5F9187C7F2A9} + + + {EAB0A629-17A9-44DB-B5FF-E91A721FE037} + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + diff --git a/vsprojects/vcxproj/test/connection_refused_test/connection_refused_test.vcxproj.filters b/vsprojects/vcxproj/test/connection_refused_test/connection_refused_test.vcxproj.filters new file mode 100644 index 00000000000..241a2e381c9 --- /dev/null +++ b/vsprojects/vcxproj/test/connection_refused_test/connection_refused_test.vcxproj.filters @@ -0,0 +1,21 @@ + + + + + test\core\end2end + + + + + + {4b0c4345-e702-8911-ab5a-c8fb187ff62a} + + + {bf069703-6525-081f-b965-b73017288d02} + + + {4700e535-ec1c-027a-7d48-afa5ba66e3d3} + + + +