Merge branch 'master' into roll-forward-grpcio-reflection

pull/22739/head
Lidi Zheng 5 years ago committed by GitHub
commit cf6c640339
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 37
      BUILD
  2. 3
      BUILD.gn
  3. 39
      CMakeLists.txt
  4. 48
      Makefile
  5. 18
      build_autogenerated.yaml
  6. 12
      doc/python/sphinx/conf.py
  7. 21
      doc/python/sphinx/glossary.rst
  8. 6
      gRPC-C++.podspec
  9. 6
      gRPC-Core.podspec
  10. 3
      grpc.gemspec
  11. 3
      package.xml
  12. 4
      src/core/ext/filters/client_channel/backend_metric.cc
  13. 58
      src/core/ext/filters/client_channel/client_channel.cc
  14. 7
      src/core/ext/filters/client_channel/health/health_check_client.cc
  15. 6
      src/core/ext/filters/client_channel/health/health_check_client.h
  16. 5
      src/core/ext/filters/client_channel/lb_policy.h
  17. 8
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
  18. 6
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc
  19. 5
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h
  20. 2
      src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
  21. 7
      src/core/ext/filters/client_channel/lb_policy/subchannel_list.h
  22. 15
      src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc
  23. 6
      src/core/ext/filters/client_channel/lb_policy_registry.cc
  24. 6
      src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
  25. 4
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
  26. 4
      src/core/ext/filters/client_channel/resolver_registry.cc
  27. 1
      src/core/ext/filters/client_channel/resolver_registry.h
  28. 23
      src/core/ext/filters/client_channel/resolver_result_parsing.cc
  29. 21
      src/core/ext/filters/client_channel/resolver_result_parsing.h
  30. 1
      src/core/ext/filters/client_channel/resolving_lb_policy.cc
  31. 5
      src/core/ext/filters/client_channel/resolving_lb_policy.h
  32. 5
      src/core/ext/filters/client_channel/server_address.h
  33. 6
      src/core/ext/filters/client_channel/service_config.cc
  34. 10
      src/core/ext/filters/client_channel/service_config.h
  35. 43
      src/core/ext/filters/client_channel/subchannel.cc
  36. 18
      src/core/ext/filters/client_channel/subchannel.h
  37. 1
      src/core/ext/filters/client_channel/xds/xds_api.cc
  38. 5
      src/core/ext/filters/client_channel/xds/xds_api.h
  39. 16
      src/core/ext/filters/client_channel/xds/xds_bootstrap.cc
  40. 8
      src/core/ext/filters/client_channel/xds/xds_bootstrap.h
  41. 6
      src/core/ext/filters/client_channel/xds/xds_channel_secure.cc
  42. 6
      src/core/ext/filters/client_channel/xds/xds_client.cc
  43. 2
      src/core/ext/filters/client_channel/xds/xds_client.h
  44. 5
      src/core/ext/filters/client_channel/xds/xds_client_stats.h
  45. 40
      src/core/ext/transport/chttp2/transport/hpack_encoder.cc
  46. 7
      src/core/lib/channel/channelz.h
  47. 8
      src/core/lib/channel/channelz_registry.cc
  48. 3
      src/core/lib/channel/channelz_registry.h
  49. 6
      src/core/lib/channel/handshaker.h
  50. 5
      src/core/lib/channel/handshaker_registry.cc
  51. 37
      src/core/lib/gprpp/inlined_vector.h
  52. 59
      src/core/lib/gprpp/map.h
  53. 33
      src/core/lib/gprpp/optional.h
  54. 5
      src/core/lib/gprpp/ref_counted_ptr.h
  55. 43
      src/core/lib/iomgr/buffer_list.h
  56. 5
      src/core/lib/iomgr/call_combiner.h
  57. 1
      src/core/lib/iomgr/error.h
  58. 5
      src/core/lib/iomgr/udp_server.cc
  59. 6
      src/core/lib/security/credentials/composite/composite_credentials.h
  60. 5
      src/core/lib/security/credentials/oauth2/oauth2_credentials.cc
  61. 6
      src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h
  62. 5
      src/core/lib/security/security_connector/load_system_roots_linux.cc
  63. 27
      src/core/lib/surface/server.cc
  64. 3
      src/core/lib/transport/connectivity_state.h
  65. 7
      src/cpp/common/tls_credentials_options.cc
  66. 6
      src/cpp/common/tls_credentials_options_util.cc
  67. 2
      src/csharp/generate_proto_csharp.sh
  68. 8
      src/php/README.md
  69. 29
      src/php/bin/generate_proto_php.sh
  70. 36
      src/php/tests/generated_code/GPBMetadata/Math.php
  71. 85
      src/php/tests/generated_code/Math/DivArgs.php
  72. 85
      src/php/tests/generated_code/Math/DivReply.php
  73. 58
      src/php/tests/generated_code/Math/FibArgs.php
  74. 58
      src/php/tests/generated_code/Math/FibReply.php
  75. 56
      src/php/tests/generated_code/Math/MathClient.php
  76. 58
      src/php/tests/generated_code/Math/Num.php
  77. 86
      src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/Messages.php
  78. 10
      src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/PBEmpty.php
  79. 66
      src/php/tests/interop/GPBMetadata/Src/Proto/Grpc/Testing/Test.php
  80. 69
      src/php/tests/interop/Grpc/Testing/BoolValue.php
  81. 88
      src/php/tests/interop/Grpc/Testing/EchoStatus.php
  82. 18
      src/php/tests/interop/Grpc/Testing/EmptyMessage.php
  83. 38
      src/php/tests/interop/Grpc/Testing/EmptyMessageMessage.php
  84. 66
      src/php/tests/interop/Grpc/Testing/GrpclbRouteType.php
  85. 99
      src/php/tests/interop/Grpc/Testing/LoadBalancerStatsRequest.php
  86. 99
      src/php/tests/interop/Grpc/Testing/LoadBalancerStatsResponse.php
  87. 52
      src/php/tests/interop/Grpc/Testing/LoadBalancerStatsServiceClient.php
  88. 101
      src/php/tests/interop/Grpc/Testing/Payload.php
  89. 47
      src/php/tests/interop/Grpc/Testing/PayloadType.php
  90. 89
      src/php/tests/interop/Grpc/Testing/ReconnectInfo.php
  91. 61
      src/php/tests/interop/Grpc/Testing/ReconnectParams.php
  92. 29
      src/php/tests/interop/Grpc/Testing/ReconnectServiceClient.php
  93. 151
      src/php/tests/interop/Grpc/Testing/ResponseParameters.php
  94. 389
      src/php/tests/interop/Grpc/Testing/SimpleRequest.php
  95. 245
      src/php/tests/interop/Grpc/Testing/SimpleResponse.php
  96. 113
      src/php/tests/interop/Grpc/Testing/StreamingInputCallRequest.php
  97. 67
      src/php/tests/interop/Grpc/Testing/StreamingInputCallResponse.php
  98. 181
      src/php/tests/interop/Grpc/Testing/StreamingOutputCallRequest.php
  99. 67
      src/php/tests/interop/Grpc/Testing/StreamingOutputCallResponse.php
  100. 152
      src/php/tests/interop/Grpc/Testing/TestServiceClient.php
  101. Some files were not shown because too many files have changed in this diff Show More

37
BUILD

@ -551,7 +551,6 @@ grpc_cc_library(
"src/core/lib/gprpp/global_config_generic.h",
"src/core/lib/gprpp/host_port.h",
"src/core/lib/gprpp/manual_constructor.h",
"src/core/lib/gprpp/map.h",
"src/core/lib/gprpp/memory.h",
"src/core/lib/gprpp/mpscq.h",
"src/core/lib/gprpp/string_view.h",
@ -618,40 +617,12 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "inlined_vector",
external_deps = [
"absl/container:inlined_vector",
],
language = "c++",
public_hdrs = [
"src/core/lib/gprpp/inlined_vector.h",
],
deps = [
"gpr_base",
],
)
grpc_cc_library(
name = "debug_location",
language = "c++",
public_hdrs = ["src/core/lib/gprpp/debug_location.h"],
)
grpc_cc_library(
name = "optional",
external_deps = [
"absl/types:optional",
],
language = "c++",
public_hdrs = [
"src/core/lib/gprpp/optional.h",
],
deps = [
"gpr_base",
],
)
grpc_cc_library(
name = "orphanable",
language = "c++",
@ -990,6 +961,8 @@ grpc_cc_library(
],
external_deps = [
"madler_zlib",
"absl/container:inlined_vector",
"absl/types:optional",
],
language = "c++",
public_hdrs = GRPC_PUBLIC_HDRS,
@ -998,8 +971,6 @@ grpc_cc_library(
"gpr_base",
"grpc_codegen",
"grpc_trace",
"inlined_vector",
"optional",
"orphanable",
"ref_counted",
"ref_counted_ptr",
@ -1107,6 +1078,9 @@ grpc_cc_library(
"src/core/ext/filters/client_channel/subchannel_interface.h",
"src/core/ext/filters/client_channel/subchannel_pool_interface.h",
],
external_deps = [
"absl/container:inlined_vector",
],
language = "c++",
deps = [
"gpr_base",
@ -1114,7 +1088,6 @@ grpc_cc_library(
"grpc_client_authority_filter",
"grpc_deadline_filter",
"grpc_health_upb",
"inlined_vector",
"orphanable",
"ref_counted",
"ref_counted_ptr",

@ -156,7 +156,6 @@ config("grpc_config") {
"src/core/lib/gprpp/host_port.cc",
"src/core/lib/gprpp/host_port.h",
"src/core/lib/gprpp/manual_constructor.h",
"src/core/lib/gprpp/map.h",
"src/core/lib/gprpp/memory.h",
"src/core/lib/gprpp/mpscq.cc",
"src/core/lib/gprpp/mpscq.h",
@ -570,8 +569,6 @@ config("grpc_config") {
"src/core/lib/debug/trace.h",
"src/core/lib/gprpp/atomic.h",
"src/core/lib/gprpp/debug_location.h",
"src/core/lib/gprpp/inlined_vector.h",
"src/core/lib/gprpp/optional.h",
"src/core/lib/gprpp/orphanable.h",
"src/core/lib/gprpp/ref_counted.h",
"src/core/lib/gprpp/ref_counted_ptr.h",

@ -756,7 +756,6 @@ if(gRPC_BUILD_TESTS)
add_dependencies(buildtests_cxx mock_test)
add_dependencies(buildtests_cxx nonblocking_test)
add_dependencies(buildtests_cxx noop-benchmark)
add_dependencies(buildtests_cxx optional_test)
add_dependencies(buildtests_cxx orphanable_test)
add_dependencies(buildtests_cxx out_of_bounds_bad_client_test)
add_dependencies(buildtests_cxx pid_controller_test)
@ -12166,44 +12165,6 @@ target_link_libraries(noop-benchmark
)
endif()
if(gRPC_BUILD_TESTS)
add_executable(optional_test
test/core/gprpp/optional_test.cc
third_party/googletest/googletest/src/gtest-all.cc
third_party/googletest/googlemock/src/gmock-all.cc
)
target_include_directories(optional_test
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include
${_gRPC_ADDRESS_SORTING_INCLUDE_DIR}
${_gRPC_SSL_INCLUDE_DIR}
${_gRPC_UPB_GENERATED_DIR}
${_gRPC_UPB_GRPC_GENERATED_DIR}
${_gRPC_UPB_INCLUDE_DIR}
${_gRPC_ZLIB_INCLUDE_DIR}
third_party/googletest/googletest/include
third_party/googletest/googletest
third_party/googletest/googlemock/include
third_party/googletest/googlemock
${_gRPC_PROTO_GENS_DIR}
)
target_link_libraries(optional_test
${_gRPC_PROTOBUF_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES}
grpc_test_util
grpc
gpr
address_sorting
upb
${_gRPC_GFLAGS_LIBRARIES}
)
endif()
if(gRPC_BUILD_TESTS)

@ -1251,7 +1251,6 @@ nanopb_fuzzer_response_test: $(BINDIR)/$(CONFIG)/nanopb_fuzzer_response_test
nanopb_fuzzer_serverlist_test: $(BINDIR)/$(CONFIG)/nanopb_fuzzer_serverlist_test
nonblocking_test: $(BINDIR)/$(CONFIG)/nonblocking_test
noop-benchmark: $(BINDIR)/$(CONFIG)/noop-benchmark
optional_test: $(BINDIR)/$(CONFIG)/optional_test
orphanable_test: $(BINDIR)/$(CONFIG)/orphanable_test
out_of_bounds_bad_client_test: $(BINDIR)/$(CONFIG)/out_of_bounds_bad_client_test
percent_decode_fuzzer: $(BINDIR)/$(CONFIG)/percent_decode_fuzzer
@ -1616,7 +1615,6 @@ buildtests_cxx: privatelibs_cxx \
$(BINDIR)/$(CONFIG)/mock_test \
$(BINDIR)/$(CONFIG)/nonblocking_test \
$(BINDIR)/$(CONFIG)/noop-benchmark \
$(BINDIR)/$(CONFIG)/optional_test \
$(BINDIR)/$(CONFIG)/orphanable_test \
$(BINDIR)/$(CONFIG)/out_of_bounds_bad_client_test \
$(BINDIR)/$(CONFIG)/pid_controller_test \
@ -1774,7 +1772,6 @@ buildtests_cxx: privatelibs_cxx \
$(BINDIR)/$(CONFIG)/mock_test \
$(BINDIR)/$(CONFIG)/nonblocking_test \
$(BINDIR)/$(CONFIG)/noop-benchmark \
$(BINDIR)/$(CONFIG)/optional_test \
$(BINDIR)/$(CONFIG)/orphanable_test \
$(BINDIR)/$(CONFIG)/out_of_bounds_bad_client_test \
$(BINDIR)/$(CONFIG)/pid_controller_test \
@ -2276,8 +2273,6 @@ test_cxx: buildtests_cxx
$(Q) $(BINDIR)/$(CONFIG)/nonblocking_test || ( echo test nonblocking_test failed ; exit 1 )
$(E) "[RUN] Testing noop-benchmark"
$(Q) $(BINDIR)/$(CONFIG)/noop-benchmark || ( echo test noop-benchmark failed ; exit 1 )
$(E) "[RUN] Testing optional_test"
$(Q) $(BINDIR)/$(CONFIG)/optional_test || ( echo test optional_test failed ; exit 1 )
$(E) "[RUN] Testing orphanable_test"
$(Q) $(BINDIR)/$(CONFIG)/orphanable_test || ( echo test orphanable_test failed ; exit 1 )
$(E) "[RUN] Testing out_of_bounds_bad_client_test"
@ -16213,49 +16208,6 @@ endif
endif
OPTIONAL_TEST_SRC = \
test/core/gprpp/optional_test.cc \
OPTIONAL_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(OPTIONAL_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/optional_test: openssl_dep_error
else
ifeq ($(NO_PROTOBUF),true)
# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.5.0+.
$(BINDIR)/$(CONFIG)/optional_test: protobuf_dep_error
else
$(BINDIR)/$(CONFIG)/optional_test: $(PROTOBUF_DEP) $(OPTIONAL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(OPTIONAL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/optional_test
endif
endif
$(OBJDIR)/$(CONFIG)/test/core/gprpp/optional_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a
deps_optional_test: $(OPTIONAL_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(OPTIONAL_TEST_OBJS:.o=.dep)
endif
endif
ORPHANABLE_TEST_SRC = \
test/core/gprpp/orphanable_test.cc \

@ -299,7 +299,6 @@ libs:
- src/core/lib/gprpp/global_config_generic.h
- src/core/lib/gprpp/host_port.h
- src/core/lib/gprpp/manual_constructor.h
- src/core/lib/gprpp/map.h
- src/core/lib/gprpp/memory.h
- src/core/lib/gprpp/mpscq.h
- src/core/lib/gprpp/string_view.h
@ -548,8 +547,6 @@ libs:
- src/core/lib/debug/trace.h
- src/core/lib/gprpp/atomic.h
- src/core/lib/gprpp/debug_location.h
- src/core/lib/gprpp/inlined_vector.h
- src/core/lib/gprpp/optional.h
- src/core/lib/gprpp/orphanable.h
- src/core/lib/gprpp/ref_counted.h
- src/core/lib/gprpp/ref_counted_ptr.h
@ -1451,8 +1448,6 @@ libs:
- src/core/lib/debug/trace.h
- src/core/lib/gprpp/atomic.h
- src/core/lib/gprpp/debug_location.h
- src/core/lib/gprpp/inlined_vector.h
- src/core/lib/gprpp/optional.h
- src/core/lib/gprpp/orphanable.h
- src/core/lib/gprpp/ref_counted.h
- src/core/lib/gprpp/ref_counted_ptr.h
@ -6538,19 +6533,6 @@ targets:
- benchmark
benchmark: true
defaults: benchmark
- name: optional_test
gtest: true
build: test
language: c++
headers: []
src:
- test/core/gprpp/optional_test.cc
deps:
- grpc_test_util
- grpc
- gpr
- address_sorting
- upb
- name: orphanable_test
gtest: true
build: test

@ -28,13 +28,17 @@ sys.path.insert(0, os.path.join(PYTHON_FOLDER, 'grpcio_testing'))
# -- Project information -----------------------------------------------------
project = 'gRPC Python'
copyright = '2018, The gRPC Authors'
copyright = '2020, The gRPC Authors'
author = 'The gRPC Authors'
# Import generated grpc_version after the path been modified
import grpc_version
version = ".".join(grpc_version.VERSION.split(".")[:3])
version = '.'.join(grpc_version.VERSION.split('.')[:3])
release = grpc_version.VERSION
if 'dev' in grpc_version.VERSION:
branch = 'master'
else:
branch = 'v%s.%s.x' % tuple(grpc_version.VERSION.split('.')[:2])
# -- General configuration ---------------------------------------------------
@ -100,3 +104,7 @@ epub_exclude_files = ['search.html']
# -- Options for todo extension ----------------------------------------------
todo_include_todos = True
# -- Options for substitutions -----------------------------------------------
rst_epilog = '.. |grpc_types_link| replace:: https://github.com/grpc/grpc/blob/%s/include/grpc/impl/codegen/grpc_types.h' % branch

@ -27,3 +27,24 @@ Glossary
the returned object doesn't have restrictions (i.e. ``None`` allowed). The
deserializer is invoked with inbound message bytes on both the server side
and the client-side.
wait_for_ready
If an RPC is issued but the channel is in the TRANSIENT_FAILURE or SHUTDOWN
states, the library cannot transmit the RPC at the moment. By default, the
gRPC library will fail such RPCs immediately. This is known as "fail fast."
RPCs will not fail as a result of the channel being in other states
(CONNECTING, READY, or IDLE).
When the wait_for_ready option is specified, the library will queue RPCs
until the channel is READY. Any submitted RPCs may still fail before the
READY state is reached for other reasons, e.g., the client channel has been
shut down or the RPC's deadline has been reached.
channel_arguments
A list of key-value pairs to configure the underlying gRPC Core channel or
server object. Channel arguments are meant for advanced usages and contain
experimental API (some may not labeled as experimental). Full list of
available channel arguments and documentation can be found under the
"grpc_arg_keys" section of "grpc_types.h" header file (|grpc_types_link|).
For example, if you want to disable TCP port reuse, you may construct
channel arguments like: ``options = (('grpc.so_reuseport', 0),)``.

@ -418,12 +418,9 @@ Pod::Spec.new do |s|
'src/core/lib/gprpp/global_config_env.h',
'src/core/lib/gprpp/global_config_generic.h',
'src/core/lib/gprpp/host_port.h',
'src/core/lib/gprpp/inlined_vector.h',
'src/core/lib/gprpp/manual_constructor.h',
'src/core/lib/gprpp/map.h',
'src/core/lib/gprpp/memory.h',
'src/core/lib/gprpp/mpscq.h',
'src/core/lib/gprpp/optional.h',
'src/core/lib/gprpp/orphanable.h',
'src/core/lib/gprpp/ref_counted.h',
'src/core/lib/gprpp/ref_counted_ptr.h',
@ -870,12 +867,9 @@ Pod::Spec.new do |s|
'src/core/lib/gprpp/global_config_env.h',
'src/core/lib/gprpp/global_config_generic.h',
'src/core/lib/gprpp/host_port.h',
'src/core/lib/gprpp/inlined_vector.h',
'src/core/lib/gprpp/manual_constructor.h',
'src/core/lib/gprpp/map.h',
'src/core/lib/gprpp/memory.h',
'src/core/lib/gprpp/mpscq.h',
'src/core/lib/gprpp/optional.h',
'src/core/lib/gprpp/orphanable.h',
'src/core/lib/gprpp/ref_counted.h',
'src/core/lib/gprpp/ref_counted_ptr.h',

@ -610,13 +610,10 @@ Pod::Spec.new do |s|
'src/core/lib/gprpp/global_config_generic.h',
'src/core/lib/gprpp/host_port.cc',
'src/core/lib/gprpp/host_port.h',
'src/core/lib/gprpp/inlined_vector.h',
'src/core/lib/gprpp/manual_constructor.h',
'src/core/lib/gprpp/map.h',
'src/core/lib/gprpp/memory.h',
'src/core/lib/gprpp/mpscq.cc',
'src/core/lib/gprpp/mpscq.h',
'src/core/lib/gprpp/optional.h',
'src/core/lib/gprpp/orphanable.h',
'src/core/lib/gprpp/ref_counted.h',
'src/core/lib/gprpp/ref_counted_ptr.h',
@ -1226,12 +1223,9 @@ Pod::Spec.new do |s|
'src/core/lib/gprpp/global_config_env.h',
'src/core/lib/gprpp/global_config_generic.h',
'src/core/lib/gprpp/host_port.h',
'src/core/lib/gprpp/inlined_vector.h',
'src/core/lib/gprpp/manual_constructor.h',
'src/core/lib/gprpp/map.h',
'src/core/lib/gprpp/memory.h',
'src/core/lib/gprpp/mpscq.h',
'src/core/lib/gprpp/optional.h',
'src/core/lib/gprpp/orphanable.h',
'src/core/lib/gprpp/ref_counted.h',
'src/core/lib/gprpp/ref_counted_ptr.h',

@ -532,13 +532,10 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/gprpp/global_config_generic.h )
s.files += %w( src/core/lib/gprpp/host_port.cc )
s.files += %w( src/core/lib/gprpp/host_port.h )
s.files += %w( src/core/lib/gprpp/inlined_vector.h )
s.files += %w( src/core/lib/gprpp/manual_constructor.h )
s.files += %w( src/core/lib/gprpp/map.h )
s.files += %w( src/core/lib/gprpp/memory.h )
s.files += %w( src/core/lib/gprpp/mpscq.cc )
s.files += %w( src/core/lib/gprpp/mpscq.h )
s.files += %w( src/core/lib/gprpp/optional.h )
s.files += %w( src/core/lib/gprpp/orphanable.h )
s.files += %w( src/core/lib/gprpp/ref_counted.h )
s.files += %w( src/core/lib/gprpp/ref_counted_ptr.h )

@ -512,13 +512,10 @@
<file baseinstalldir="/" name="src/core/lib/gprpp/global_config_generic.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/host_port.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/host_port.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/inlined_vector.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/manual_constructor.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/map.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/memory.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/mpscq.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/mpscq.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/optional.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/orphanable.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/ref_counted.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/ref_counted_ptr.h" role="src" />

@ -26,12 +26,12 @@ namespace grpc_core {
namespace {
template <typename EntryType>
std::map<StringView, double, StringLess> ParseMap(
std::map<StringView, double> ParseMap(
udpa_data_orca_v1_OrcaLoadReport* msg,
EntryType** (*entry_func)(udpa_data_orca_v1_OrcaLoadReport*, size_t*),
upb_strview (*key_func)(const EntryType*),
double (*value_func)(const EntryType*), Arena* arena) {
std::map<StringView, double, StringLess> result;
std::map<StringView, double> result;
size_t size;
const auto* const* entries = entry_func(msg, &size);
for (size_t i = 0; i < size; ++i) {

@ -26,6 +26,7 @@
#include <stdio.h>
#include <string.h>
#include <map>
#include <set>
#include <grpc/support/alloc.h>
@ -33,6 +34,9 @@
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
#include "absl/container/inlined_vector.h"
#include "absl/types/optional.h"
#include "src/core/ext/filters/client_channel/backend_metric.h"
#include "src/core/ext/filters/client_channel/backup_poller.h"
#include "src/core/ext/filters/client_channel/global_subchannel_pool.h"
@ -52,9 +56,7 @@
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/channel/status_util.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/gprpp/map.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/iomgr/polling_entity.h"
@ -293,7 +295,7 @@ class ChannelData {
RefCountedPtr<SubchannelPoolInterface> subchannel_pool_;
OrphanablePtr<ResolvingLoadBalancingPolicy> resolving_lb_policy_;
ConnectivityStateTracker state_tracker_;
grpc_core::UniquePtr<char> health_check_service_name_;
std::string health_check_service_name_;
RefCountedPtr<ServiceConfig> saved_service_config_;
bool received_first_resolver_result_ = false;
// The number of SubchannelWrapper instances referencing a given Subchannel.
@ -305,8 +307,7 @@ class ChannelData {
// Pending ConnectedSubchannel updates for each SubchannelWrapper.
// Updates are queued here in the control plane work_serializer and then
// applied in the data plane mutex when the picker is updated.
std::map<RefCountedPtr<SubchannelWrapper>, RefCountedPtr<ConnectedSubchannel>,
RefCountedPtrLess<SubchannelWrapper>>
std::map<RefCountedPtr<SubchannelWrapper>, RefCountedPtr<ConnectedSubchannel>>
pending_subchannel_updates_;
//
@ -827,7 +828,7 @@ class CallData {
// Note: We inline the cache for the first 3 send_message ops and use
// dynamic allocation after that. This number was essentially picked
// at random; it could be changed in the future to tune performance.
InlinedVector<ByteStreamCache*, 3> send_messages_;
absl::InlinedVector<ByteStreamCache*, 3> send_messages_;
// send_trailing_metadata
bool seen_send_trailing_metadata_ = false;
grpc_linked_mdelem* send_trailing_metadata_storage_ = nullptr;
@ -849,7 +850,7 @@ class CallData {
class ChannelData::SubchannelWrapper : public SubchannelInterface {
public:
SubchannelWrapper(ChannelData* chand, Subchannel* subchannel,
grpc_core::UniquePtr<char> health_check_service_name)
std::string health_check_service_name)
: SubchannelInterface(&grpc_client_channel_routing_trace),
chand_(chand),
subchannel_(subchannel),
@ -896,7 +897,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
grpc_connectivity_state CheckConnectivityState() override {
RefCountedPtr<ConnectedSubchannel> connected_subchannel;
grpc_connectivity_state connectivity_state =
subchannel_->CheckConnectivityState(health_check_service_name_.get(),
subchannel_->CheckConnectivityState(health_check_service_name_,
&connected_subchannel);
MaybeUpdateConnectedSubchannel(std::move(connected_subchannel));
return connectivity_state;
@ -911,9 +912,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
Ref(DEBUG_LOCATION, "WatcherWrapper"),
initial_state);
subchannel_->WatchConnectivityState(
initial_state,
grpc_core::UniquePtr<char>(
gpr_strdup(health_check_service_name_.get())),
initial_state, health_check_service_name_,
RefCountedPtr<Subchannel::ConnectivityStateWatcherInterface>(
watcher_wrapper));
}
@ -922,7 +921,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
ConnectivityStateWatcherInterface* watcher) override {
auto it = watcher_map_.find(watcher);
GPR_ASSERT(it != watcher_map_.end());
subchannel_->CancelConnectivityStateWatch(health_check_service_name_.get(),
subchannel_->CancelConnectivityStateWatch(health_check_service_name_,
it->second);
watcher_map_.erase(it);
}
@ -935,14 +934,13 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
return subchannel_->channel_args();
}
void UpdateHealthCheckServiceName(
grpc_core::UniquePtr<char> health_check_service_name) {
void UpdateHealthCheckServiceName(std::string health_check_service_name) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
gpr_log(GPR_INFO,
"chand=%p: subchannel wrapper %p: updating health check service "
"name from \"%s\" to \"%s\"",
chand_, this, health_check_service_name_.get(),
health_check_service_name.get());
chand_, this, health_check_service_name_.c_str(),
health_check_service_name.c_str());
}
for (auto& p : watcher_map_) {
WatcherWrapper*& watcher_wrapper = p.second;
@ -957,13 +955,11 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
// problem, we may be able to handle it by waiting for the new
// watcher to report READY before we use it to replace the old one.
WatcherWrapper* replacement = watcher_wrapper->MakeReplacement();
subchannel_->CancelConnectivityStateWatch(
health_check_service_name_.get(), watcher_wrapper);
subchannel_->CancelConnectivityStateWatch(health_check_service_name_,
watcher_wrapper);
watcher_wrapper = replacement;
subchannel_->WatchConnectivityState(
replacement->last_seen_state(),
grpc_core::UniquePtr<char>(
gpr_strdup(health_check_service_name.get())),
replacement->last_seen_state(), health_check_service_name,
RefCountedPtr<Subchannel::ConnectivityStateWatcherInterface>(
replacement));
}
@ -1101,7 +1097,7 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
ChannelData* chand_;
Subchannel* subchannel_;
grpc_core::UniquePtr<char> health_check_service_name_;
std::string health_check_service_name_;
// Maps from the address of the watcher passed to us by the LB policy
// to the address of the WrapperWatcher that we passed to the underlying
// subchannel. This is needed so that when the LB policy calls
@ -1264,10 +1260,9 @@ class ChannelData::ClientChannelControlHelper
const grpc_channel_args& args) override {
bool inhibit_health_checking = grpc_channel_arg_get_bool(
grpc_channel_args_find(&args, GRPC_ARG_INHIBIT_HEALTH_CHECKING), false);
grpc_core::UniquePtr<char> health_check_service_name;
std::string health_check_service_name;
if (!inhibit_health_checking) {
health_check_service_name.reset(
gpr_strdup(chand_->health_check_service_name_.get()));
health_check_service_name = chand_->health_check_service_name_;
}
static const char* args_to_remove[] = {
GRPC_ARG_INHIBIT_HEALTH_CHECKING,
@ -1462,7 +1457,7 @@ void ChannelData::UpdateStateAndPickerLocked(
std::unique_ptr<LoadBalancingPolicy::SubchannelPicker> picker) {
// Clean the control plane when entering IDLE.
if (picker_ == nullptr) {
health_check_service_name_.reset();
health_check_service_name_.clear();
saved_service_config_.reset();
received_first_resolver_result_ = false;
}
@ -1705,16 +1700,15 @@ bool ChannelData::ProcessResolverResultLocked(
}
// Save health check service name.
if (service_config != nullptr) {
chand->health_check_service_name_.reset(
gpr_strdup(parsed_service_config->health_check_service_name()));
chand->health_check_service_name_ =
parsed_service_config->health_check_service_name();
} else {
chand->health_check_service_name_.reset();
chand->health_check_service_name_.clear();
}
// Update health check service name used by existing subchannel wrappers.
for (auto* subchannel_wrapper : chand->subchannel_wrappers_) {
subchannel_wrapper->UpdateHealthCheckServiceName(
grpc_core::UniquePtr<char>(
gpr_strdup(chand->health_check_service_name_.get())));
chand->health_check_service_name_);
}
// Save service config.
chand->saved_service_config_ = std::move(service_config);
@ -1726,7 +1720,7 @@ bool ChannelData::ProcessResolverResultLocked(
chand->received_first_resolver_result_ = true;
RefCountedPtr<ServerRetryThrottleData> retry_throttle_data;
if (parsed_service_config != nullptr) {
Optional<internal::ClientChannelGlobalParsedConfig::RetryThrottling>
absl::optional<internal::ClientChannelGlobalParsedConfig::RetryThrottling>
retry_throttle_config = parsed_service_config->retry_throttling();
if (retry_throttle_config.has_value()) {
retry_throttle_data =

@ -44,7 +44,7 @@ TraceFlag grpc_health_check_client_trace(false, "health_check_client");
//
HealthCheckClient::HealthCheckClient(
const char* service_name,
absl::string_view service_name,
RefCountedPtr<ConnectedSubchannel> connected_subchannel,
grpc_pollset_set* interested_parties,
RefCountedPtr<channelz::SubchannelNode> channelz_node,
@ -171,13 +171,14 @@ void HealthCheckClient::OnRetryTimer(void* arg, grpc_error* error) {
namespace {
void EncodeRequest(const char* service_name,
void EncodeRequest(absl::string_view service_name,
ManualConstructor<SliceBufferByteStream>* send_message) {
upb::Arena arena;
grpc_health_v1_HealthCheckRequest* request_struct =
grpc_health_v1_HealthCheckRequest_new(arena.ptr());
grpc_health_v1_HealthCheckRequest_set_service(
request_struct, upb_strview_makez(service_name));
request_struct,
upb_strview_make(service_name.data(), service_name.size()));
size_t buf_length;
char* buf = grpc_health_v1_HealthCheckRequest_serialize(
request_struct, arena.ptr(), &buf_length);

@ -21,6 +21,8 @@
#include <grpc/support/port_platform.h>
#include "absl/strings/string_view.h"
#include <grpc/grpc.h>
#include <grpc/support/sync.h>
@ -44,7 +46,7 @@ namespace grpc_core {
class HealthCheckClient : public InternallyRefCounted<HealthCheckClient> {
public:
HealthCheckClient(const char* service_name,
HealthCheckClient(absl::string_view service_name,
RefCountedPtr<ConnectedSubchannel> connected_subchannel,
grpc_pollset_set* interested_parties,
RefCountedPtr<channelz::SubchannelNode> channelz_node,
@ -150,7 +152,7 @@ class HealthCheckClient : public InternallyRefCounted<HealthCheckClient> {
void SetHealthStatusLocked(grpc_connectivity_state state,
const char* reason); // Requires holding mu_.
const char* service_name_; // Do not own.
absl::string_view service_name_;
RefCountedPtr<ConnectedSubchannel> connected_subchannel_;
grpc_pollset_set* interested_parties_; // Do not own.
RefCountedPtr<channelz::SubchannelNode> channelz_node_;

@ -27,7 +27,6 @@
#include "src/core/ext/filters/client_channel/server_address.h"
#include "src/core/ext/filters/client_channel/service_config.h"
#include "src/core/ext/filters/client_channel/subchannel_interface.h"
#include "src/core/lib/gprpp/map.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/string_view.h"
@ -93,11 +92,11 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
/// Application-specific requests cost metrics. Metric names are
/// determined by the application. Each value is an absolute cost
/// (e.g. 3487 bytes of storage) associated with the request.
std::map<StringView, double, StringLess> request_cost;
std::map<StringView, double> request_cost;
/// Application-specific resource utilization metrics. Metric names
/// are determined by the application. Each value is expressed as a
/// fraction of total resources available.
std::map<StringView, double, StringLess> utilization;
std::map<StringView, double> utilization;
};
/// Interface for accessing per-call state.

@ -64,6 +64,8 @@
#include <limits.h>
#include <string.h>
#include "absl/container/inlined_vector.h"
#include <grpc/byte_buffer_reader.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
@ -555,7 +557,7 @@ ServerAddressList GrpcLb::Serverlist::GetServerAddressList(
lb_token[0] = '\0';
}
// Add address.
InlinedVector<grpc_arg, 2> args_to_add;
absl::InlinedVector<grpc_arg, 2> args_to_add;
args_to_add.emplace_back(grpc_channel_arg_pointer_create(
const_cast<char*>(GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN), lb_token,
&lb_token_arg_vtable));
@ -1273,7 +1275,7 @@ grpc_channel_args* BuildBalancerChannelArgs(
GRPC_ARG_CHANNELZ_CHANNEL_NODE,
};
// Channel args to add.
InlinedVector<grpc_arg, 3> args_to_add;
absl::InlinedVector<grpc_arg, 3> args_to_add;
// The fake resolver response generator, which we use to inject
// address updates into the LB channel.
args_to_add.emplace_back(
@ -1595,7 +1597,7 @@ void GrpcLb::OnFallbackTimerLocked(grpc_error* error) {
grpc_channel_args* GrpcLb::CreateChildPolicyArgsLocked(
bool is_backend_from_grpclb_load_balancer) {
InlinedVector<grpc_arg, 2> args_to_add;
absl::InlinedVector<grpc_arg, 2> args_to_add;
args_to_add.emplace_back(grpc_channel_arg_integer_create(
const_cast<char*>(GRPC_ARG_ADDRESS_IS_BACKEND_FROM_GRPCLB_LOAD_BALANCER),
is_backend_from_grpclb_load_balancer));

@ -22,6 +22,8 @@
#include <string.h>
#include "absl/container/inlined_vector.h"
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
@ -71,8 +73,8 @@ RefCountedPtr<TargetAuthorityTable> CreateTargetAuthorityTable(
grpc_channel_args* ModifyGrpclbBalancerChannelArgs(
const ServerAddressList& addresses, grpc_channel_args* args) {
InlinedVector<const char*, 1> args_to_remove;
InlinedVector<grpc_arg, 2> args_to_add;
absl::InlinedVector<const char*, 1> args_to_remove;
absl::InlinedVector<grpc_arg, 2> args_to_add;
// Add arg for targets info table.
RefCountedPtr<TargetAuthorityTable> target_authority_table =
CreateTargetAuthorityTable(addresses);

@ -23,7 +23,8 @@
#include <grpc/support/atm.h>
#include "src/core/lib/gprpp/inlined_vector.h"
#include "absl/container/inlined_vector.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/sync.h"
@ -40,7 +41,7 @@ class GrpcLbClientStats : public RefCounted<GrpcLbClientStats> {
: token(std::move(token)), count(count) {}
};
typedef InlinedVector<DropTokenCount, 10> DroppedCallCounts;
typedef absl::InlinedVector<DropTokenCount, 10> DroppedCallCounts;
void AddCallStarted();
void AddCallFinished(bool finished_with_client_failed_to_send,

@ -160,7 +160,7 @@ class RoundRobin : public LoadBalancingPolicy {
RoundRobin* parent_;
size_t last_picked_index_;
InlinedVector<RefCountedPtr<SubchannelInterface>, 10> subchannels_;
absl::InlinedVector<RefCountedPtr<SubchannelInterface>, 10> subchannels_;
};
void ShutdownLocked() override;

@ -25,6 +25,8 @@
#include <grpc/support/alloc.h>
#include "absl/container/inlined_vector.h"
#include "src/core/ext/filters/client_channel/lb_policy_registry.h"
#include "src/core/ext/filters/client_channel/server_address.h"
// TODO(roth): Should not need the include of subchannel.h here, since
@ -33,7 +35,6 @@
#include "src/core/ext/filters/client_channel/subchannel_interface.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
@ -172,7 +173,7 @@ class SubchannelData {
template <typename SubchannelListType, typename SubchannelDataType>
class SubchannelList : public InternallyRefCounted<SubchannelListType> {
public:
typedef InlinedVector<SubchannelDataType, 10> SubchannelVector;
typedef absl::InlinedVector<SubchannelDataType, 10> SubchannelVector;
// The number of subchannels in the list.
size_t num_subchannels() const { return subchannels_.size(); }
@ -370,7 +371,7 @@ SubchannelList<SubchannelListType, SubchannelDataType>::SubchannelList(
GRPC_ARG_SERVICE_CONFIG};
// Create a subchannel for each address.
for (size_t i = 0; i < addresses.size(); i++) {
InlinedVector<grpc_arg, 3> args_to_add;
absl::InlinedVector<grpc_arg, 3> args_to_add;
const size_t subchannel_address_arg_index = args_to_add.size();
args_to_add.emplace_back(
Subchannel::CreateSubchannelAddressArg(&addresses[i].address()));

@ -20,6 +20,7 @@
#include <limits.h>
#include <string.h>
#include "absl/container/inlined_vector.h"
#include "absl/strings/str_cat.h"
#include <grpc/grpc.h>
@ -99,9 +100,8 @@ class WeightedTargetLb : public LoadBalancingPolicy {
// ready state. The first element in the pair represents the end of a
// range proportional to the child's weight. The start of the range
// is the previous value in the vector and is 0 for the first element.
using PickerList =
InlinedVector<std::pair<uint32_t, RefCountedPtr<ChildPickerWrapper>>,
1>;
using PickerList = absl::InlinedVector<
std::pair<uint32_t, RefCountedPtr<ChildPickerWrapper>>, 1>;
explicit WeightedPicker(PickerList pickers)
: pickers_(std::move(pickers)) {}
@ -675,14 +675,15 @@ class WeightedTargetLbFactory : public LoadBalancingPolicyFactory {
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"field:weight error:must be of type number"));
} else {
child_config->weight =
gpr_parse_nonnegative_int(it->second.string_value().c_str());
if (child_config->weight == -1) {
int weight = gpr_parse_nonnegative_int(it->second.string_value().c_str());
if (weight == -1) {
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"field:weight error:unparseable value"));
} else if (child_config->weight == 0) {
} else if (weight == 0) {
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"field:weight error:value must be greater than zero"));
} else {
child_config->weight = weight;
}
}
// Child policy.

@ -22,8 +22,9 @@
#include <string.h>
#include "absl/container/inlined_vector.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/inlined_vector.h"
namespace grpc_core {
@ -54,7 +55,8 @@ class RegistryState {
}
private:
InlinedVector<std::unique_ptr<LoadBalancingPolicyFactory>, 10> factories_;
absl::InlinedVector<std::unique_ptr<LoadBalancingPolicyFactory>, 10>
factories_;
};
RegistryState* g_state = nullptr;

@ -24,6 +24,8 @@
#include <stdio.h>
#include <string.h>
#include "absl/container/inlined_vector.h"
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
@ -249,7 +251,7 @@ std::string ChooseServiceConfig(char* service_config_choice_json,
return "";
}
const Json* service_config = nullptr;
InlinedVector<grpc_error*, 4> error_list;
absl::InlinedVector<grpc_error*, 4> error_list;
for (const Json& choice : json.array_value()) {
if (choice.type() != Json::Type::OBJECT) {
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
@ -352,7 +354,7 @@ void AresDnsResolver::OnResolvedLocked(grpc_error* error) {
service_config_string, &result.service_config_error);
}
}
InlinedVector<grpc_arg, 1> new_args;
absl::InlinedVector<grpc_arg, 1> new_args;
if (balancer_addresses_ != nullptr) {
new_args.push_back(
CreateGrpclbBalancerAddressesArg(balancer_addresses_.get()));

@ -26,6 +26,8 @@
#include <string.h>
#include <sys/types.h>
#include "absl/container/inlined_vector.h"
#include <ares.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@ -200,7 +202,7 @@ static void on_hostbyname_done_locked(void* arg, int status, int /*timeouts*/,
}
ServerAddressList& addresses = **address_list_ptr;
for (size_t i = 0; hostent->h_addr_list[i] != nullptr; ++i) {
grpc_core::InlinedVector<grpc_arg, 1> args_to_add;
absl::InlinedVector<grpc_arg, 1> args_to_add;
if (hr->is_balancer) {
args_to_add.emplace_back(
grpc_core::CreateGrpclbBalancerNameArg(hr->host));

@ -22,6 +22,8 @@
#include <string.h>
#include "absl/container/inlined_vector.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
@ -90,7 +92,7 @@ class RegistryState {
// more factories are needed and the additional allocations are
// hurting performance (which is unlikely, since these allocations
// only occur at gRPC initialization time).
InlinedVector<std::unique_ptr<ResolverFactory>, 10> factories_;
absl::InlinedVector<std::unique_ptr<ResolverFactory>, 10> factories_;
grpc_core::UniquePtr<char> default_prefix_;
};

@ -22,7 +22,6 @@
#include <grpc/support/port_platform.h>
#include "src/core/ext/filters/client_channel/resolver_factory.h"
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/iomgr/pollset_set.h"

@ -24,6 +24,8 @@
#include <stdio.h>
#include <string.h>
#include "absl/types/optional.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
@ -35,7 +37,6 @@
#include "src/core/lib/channel/status_util.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/optional.h"
#include "src/core/lib/uri/uri_parser.h"
// As per the retry design, we do not allow more than 5 retry attempts.
@ -283,13 +284,13 @@ grpc_error* ParseRetryThrottling(
return GRPC_ERROR_CREATE_FROM_VECTOR("retryPolicy", &error_list);
}
const char* ParseHealthCheckConfig(const Json& field, grpc_error** error) {
std::string ParseHealthCheckConfig(const Json& field, grpc_error** error) {
GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE);
const char* service_name = nullptr;
std::string service_name;
if (field.type() != Json::Type::OBJECT) {
*error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"field:healthCheckConfig error:should be of type object");
return nullptr;
return service_name;
}
std::vector<grpc_error*> error_list;
auto it = field.object_value().find("serviceName");
@ -298,12 +299,9 @@ const char* ParseHealthCheckConfig(const Json& field, grpc_error** error) {
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"field:serviceName error:should be of type string"));
} else {
service_name = it->second.string_value().c_str();
service_name = it->second.string_value();
}
}
if (!error_list.empty()) {
return nullptr;
}
*error =
GRPC_ERROR_CREATE_FROM_VECTOR("field:healthCheckConfig", &error_list);
return service_name;
@ -318,8 +316,9 @@ ClientChannelServiceConfigParser::ParseGlobalParams(const Json& json,
std::vector<grpc_error*> error_list;
RefCountedPtr<LoadBalancingPolicy::Config> parsed_lb_config;
std::string lb_policy_name;
Optional<ClientChannelGlobalParsedConfig::RetryThrottling> retry_throttling;
const char* health_check_service_name = nullptr;
absl::optional<ClientChannelGlobalParsedConfig::RetryThrottling>
retry_throttling;
std::string health_check_service_name;
// Parse LB config.
auto it = json.object_value().find("loadBalancingConfig");
if (it != json.object_value().end()) {
@ -386,7 +385,7 @@ ClientChannelServiceConfigParser::ParseGlobalParams(const Json& json,
if (*error == GRPC_ERROR_NONE) {
return absl::make_unique<ClientChannelGlobalParsedConfig>(
std::move(parsed_lb_config), std::move(lb_policy_name),
retry_throttling, health_check_service_name);
retry_throttling, std::move(health_check_service_name));
}
return nullptr;
}
@ -396,7 +395,7 @@ ClientChannelServiceConfigParser::ParsePerMethodParams(const Json& json,
grpc_error** error) {
GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE);
std::vector<grpc_error*> error_list;
Optional<bool> wait_for_ready;
absl::optional<bool> wait_for_ready;
grpc_millis timeout = 0;
std::unique_ptr<ClientChannelMethodParsedConfig::RetryPolicy> retry_policy;
// Parse waitForReady.

@ -21,13 +21,14 @@
#include <grpc/support/port_platform.h>
#include "absl/types/optional.h"
#include "src/core/ext/filters/client_channel/lb_policy.h"
#include "src/core/ext/filters/client_channel/lb_policy_factory.h"
#include "src/core/ext/filters/client_channel/resolver.h"
#include "src/core/ext/filters/client_channel/retry_throttle.h"
#include "src/core/ext/filters/client_channel/service_config.h"
#include "src/core/lib/channel/status_util.h"
#include "src/core/lib/gprpp/optional.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/exec_ctx.h" // for grpc_millis
@ -47,14 +48,14 @@ class ClientChannelGlobalParsedConfig : public ServiceConfig::ParsedConfig {
ClientChannelGlobalParsedConfig(
RefCountedPtr<LoadBalancingPolicy::Config> parsed_lb_config,
std::string parsed_deprecated_lb_policy,
const Optional<RetryThrottling>& retry_throttling,
const char* health_check_service_name)
const absl::optional<RetryThrottling>& retry_throttling,
std::string health_check_service_name)
: parsed_lb_config_(std::move(parsed_lb_config)),
parsed_deprecated_lb_policy_(std::move(parsed_deprecated_lb_policy)),
retry_throttling_(retry_throttling),
health_check_service_name_(health_check_service_name) {}
Optional<RetryThrottling> retry_throttling() const {
absl::optional<RetryThrottling> retry_throttling() const {
return retry_throttling_;
}
@ -66,15 +67,15 @@ class ClientChannelGlobalParsedConfig : public ServiceConfig::ParsedConfig {
return parsed_deprecated_lb_policy_;
}
const char* health_check_service_name() const {
const std::string& health_check_service_name() const {
return health_check_service_name_;
}
private:
RefCountedPtr<LoadBalancingPolicy::Config> parsed_lb_config_;
std::string parsed_deprecated_lb_policy_;
Optional<RetryThrottling> retry_throttling_;
const char* health_check_service_name_;
absl::optional<RetryThrottling> retry_throttling_;
std::string health_check_service_name_;
};
class ClientChannelMethodParsedConfig : public ServiceConfig::ParsedConfig {
@ -88,7 +89,7 @@ class ClientChannelMethodParsedConfig : public ServiceConfig::ParsedConfig {
};
ClientChannelMethodParsedConfig(grpc_millis timeout,
const Optional<bool>& wait_for_ready,
const absl::optional<bool>& wait_for_ready,
std::unique_ptr<RetryPolicy> retry_policy)
: timeout_(timeout),
wait_for_ready_(wait_for_ready),
@ -96,13 +97,13 @@ class ClientChannelMethodParsedConfig : public ServiceConfig::ParsedConfig {
grpc_millis timeout() const { return timeout_; }
Optional<bool> wait_for_ready() const { return wait_for_ready_; }
absl::optional<bool> wait_for_ready() const { return wait_for_ready_; }
const RetryPolicy* retry_policy() const { return retry_policy_.get(); }
private:
grpc_millis timeout_ = 0;
Optional<bool> wait_for_ready_;
absl::optional<bool> wait_for_ready_;
std::unique_ptr<RetryPolicy> retry_policy_;
};

@ -47,7 +47,6 @@
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/channel/status_util.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/iomgr/iomgr.h"

@ -21,13 +21,14 @@
#include <grpc/support/port_platform.h>
#include "absl/container/inlined_vector.h"
#include "src/core/ext/filters/client_channel/lb_policy.h"
#include "src/core/ext/filters/client_channel/lb_policy_factory.h"
#include "src/core/ext/filters/client_channel/resolver.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/iomgr/call_combiner.h"
#include "src/core/lib/iomgr/closure.h"
@ -80,7 +81,7 @@ class ResolvingLoadBalancingPolicy : public LoadBalancingPolicy {
void ResetBackoffLocked() override;
private:
using TraceStringVector = InlinedVector<char*, 3>;
using TraceStringVector = absl::InlinedVector<char*, 3>;
class ResolverResultHandler;
class ResolvingControlHelper;

@ -21,8 +21,9 @@
#include <grpc/support/port_platform.h>
#include "absl/container/inlined_vector.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/iomgr/resolve_address.h"
namespace grpc_core {
@ -82,7 +83,7 @@ class ServerAddress {
// ServerAddressList
//
typedef InlinedVector<ServerAddress, 1> ServerAddressList;
typedef absl::InlinedVector<ServerAddress, 1> ServerAddressList;
} // namespace grpc_core

@ -34,8 +34,8 @@
namespace grpc_core {
namespace {
typedef InlinedVector<std::unique_ptr<ServiceConfig::Parser>,
ServiceConfig::kNumPreallocatedParsers>
typedef absl::InlinedVector<std::unique_ptr<ServiceConfig::Parser>,
ServiceConfig::kNumPreallocatedParsers>
ServiceConfigParserList;
ServiceConfigParserList* g_registered_parsers;
} // namespace
@ -100,7 +100,7 @@ grpc_error* ServiceConfig::ParseGlobalParams() {
grpc_error* ServiceConfig::ParseJsonMethodConfig(const Json& json) {
// Parse method config with each registered parser.
auto objs_vector = absl::make_unique<ParsedConfigVector>();
InlinedVector<grpc_error*, 4> error_list;
std::vector<grpc_error*> error_list;
for (size_t i = 0; i < g_registered_parsers->size(); i++) {
grpc_error* parser_error = GRPC_ERROR_NONE;
auto parsed_obj =

@ -21,10 +21,11 @@
#include <unordered_map>
#include "absl/container/inlined_vector.h"
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/error.h"
@ -89,7 +90,8 @@ class ServiceConfig : public RefCounted<ServiceConfig> {
};
static constexpr int kNumPreallocatedParsers = 4;
typedef InlinedVector<std::unique_ptr<ParsedConfig>, kNumPreallocatedParsers>
typedef absl::InlinedVector<std::unique_ptr<ParsedConfig>,
kNumPreallocatedParsers>
ParsedConfigVector;
/// When a service config is applied to a call in the client_channel_filter,
@ -175,7 +177,7 @@ class ServiceConfig : public RefCounted<ServiceConfig> {
std::string json_string_;
Json json_;
InlinedVector<std::unique_ptr<ParsedConfig>, kNumPreallocatedParsers>
absl::InlinedVector<std::unique_ptr<ParsedConfig>, kNumPreallocatedParsers>
parsed_global_configs_;
// A map from the method name to the parsed config vector. Note that we are
// using a raw pointer and not a unique pointer so that we can use the same
@ -186,7 +188,7 @@ class ServiceConfig : public RefCounted<ServiceConfig> {
const ParsedConfigVector* default_method_config_vector_ = nullptr;
// Storage for all the vectors that are being used in
// parsed_method_configs_table_.
InlinedVector<std::unique_ptr<ParsedConfigVector>, 32>
absl::InlinedVector<std::unique_ptr<ParsedConfigVector>, 32>
parsed_method_config_vectors_storage_;
};

@ -424,11 +424,10 @@ void Subchannel::ConnectivityStateWatcherList::NotifyLocked(
class Subchannel::HealthWatcherMap::HealthWatcher
: public AsyncConnectivityStateWatcherInterface {
public:
HealthWatcher(Subchannel* c,
grpc_core::UniquePtr<char> health_check_service_name,
HealthWatcher(Subchannel* c, absl::string_view health_check_service_name,
grpc_connectivity_state subchannel_state)
: subchannel_(c),
health_check_service_name_(std::move(health_check_service_name)),
health_check_service_name_(std::string(health_check_service_name)),
state_(subchannel_state == GRPC_CHANNEL_READY ? GRPC_CHANNEL_CONNECTING
: subchannel_state) {
GRPC_SUBCHANNEL_WEAK_REF(subchannel_, "health_watcher");
@ -440,8 +439,8 @@ class Subchannel::HealthWatcherMap::HealthWatcher
GRPC_SUBCHANNEL_WEAK_UNREF(subchannel_, "health_watcher");
}
const char* health_check_service_name() const {
return health_check_service_name_.get();
absl::string_view health_check_service_name() const {
return health_check_service_name_;
}
grpc_connectivity_state state() const { return state_; }
@ -500,12 +499,12 @@ class Subchannel::HealthWatcherMap::HealthWatcher
void StartHealthCheckingLocked() {
GPR_ASSERT(health_check_client_ == nullptr);
health_check_client_ = MakeOrphanable<HealthCheckClient>(
health_check_service_name_.get(), subchannel_->connected_subchannel_,
health_check_service_name_, subchannel_->connected_subchannel_,
subchannel_->pollset_set_, subchannel_->channelz_node_, Ref());
}
Subchannel* subchannel_;
grpc_core::UniquePtr<char> health_check_service_name_;
std::string health_check_service_name_;
OrphanablePtr<HealthCheckClient> health_check_client_;
grpc_connectivity_state state_;
ConnectivityStateWatcherList watcher_list_;
@ -517,18 +516,17 @@ class Subchannel::HealthWatcherMap::HealthWatcher
void Subchannel::HealthWatcherMap::AddWatcherLocked(
Subchannel* subchannel, grpc_connectivity_state initial_state,
grpc_core::UniquePtr<char> health_check_service_name,
absl::string_view health_check_service_name,
RefCountedPtr<ConnectivityStateWatcherInterface> watcher) {
// If the health check service name is not already present in the map,
// add it.
auto it = map_.find(health_check_service_name.get());
auto it = map_.find(health_check_service_name);
HealthWatcher* health_watcher;
if (it == map_.end()) {
const char* key = health_check_service_name.get();
auto w = MakeOrphanable<HealthWatcher>(
subchannel, std::move(health_check_service_name), subchannel->state_);
subchannel, health_check_service_name, subchannel->state_);
health_watcher = w.get();
map_[key] = std::move(w);
map_[w->health_check_service_name()] = std::move(w);
} else {
health_watcher = it->second.get();
}
@ -537,7 +535,7 @@ void Subchannel::HealthWatcherMap::AddWatcherLocked(
}
void Subchannel::HealthWatcherMap::RemoveWatcherLocked(
const char* health_check_service_name,
absl::string_view health_check_service_name,
ConnectivityStateWatcherInterface* watcher) {
auto it = map_.find(health_check_service_name);
GPR_ASSERT(it != map_.end());
@ -555,7 +553,7 @@ void Subchannel::HealthWatcherMap::NotifyLocked(grpc_connectivity_state state) {
grpc_connectivity_state
Subchannel::HealthWatcherMap::CheckConnectivityStateLocked(
Subchannel* subchannel, const char* health_check_service_name) {
Subchannel* subchannel, absl::string_view health_check_service_name) {
auto it = map_.find(health_check_service_name);
if (it == map_.end()) {
// If the health check service name is not found in the map, we're
@ -799,11 +797,11 @@ channelz::SubchannelNode* Subchannel::channelz_node() {
}
grpc_connectivity_state Subchannel::CheckConnectivityState(
const char* health_check_service_name,
absl::string_view health_check_service_name,
RefCountedPtr<ConnectedSubchannel>* connected_subchannel) {
MutexLock lock(&mu_);
grpc_connectivity_state state;
if (health_check_service_name == nullptr) {
if (health_check_service_name.empty()) {
state = state_;
} else {
state = health_watcher_map_.CheckConnectivityStateLocked(
@ -817,34 +815,33 @@ grpc_connectivity_state Subchannel::CheckConnectivityState(
void Subchannel::WatchConnectivityState(
grpc_connectivity_state initial_state,
grpc_core::UniquePtr<char> health_check_service_name,
absl::string_view health_check_service_name,
RefCountedPtr<ConnectivityStateWatcherInterface> watcher) {
MutexLock lock(&mu_);
grpc_pollset_set* interested_parties = watcher->interested_parties();
if (interested_parties != nullptr) {
grpc_pollset_set_add_pollset_set(pollset_set_, interested_parties);
}
if (health_check_service_name == nullptr) {
if (health_check_service_name.empty()) {
if (state_ != initial_state) {
new AsyncWatcherNotifierLocked(watcher, this, state_);
}
watcher_list_.AddWatcherLocked(std::move(watcher));
} else {
health_watcher_map_.AddWatcherLocked(this, initial_state,
std::move(health_check_service_name),
std::move(watcher));
health_watcher_map_.AddWatcherLocked(
this, initial_state, health_check_service_name, std::move(watcher));
}
}
void Subchannel::CancelConnectivityStateWatch(
const char* health_check_service_name,
absl::string_view health_check_service_name,
ConnectivityStateWatcherInterface* watcher) {
MutexLock lock(&mu_);
grpc_pollset_set* interested_parties = watcher->interested_parties();
if (interested_parties != nullptr) {
grpc_pollset_set_del_pollset_set(pollset_set_, interested_parties);
}
if (health_check_service_name == nullptr) {
if (health_check_service_name.empty()) {
watcher_list_.RemoveWatcherLocked(watcher);
} else {
health_watcher_map_.RemoveWatcherLocked(health_check_service_name, watcher);

@ -23,6 +23,8 @@
#include <deque>
#include "absl/strings/string_view.h"
#include "src/core/ext/filters/client_channel/client_channel_channelz.h"
#include "src/core/ext/filters/client_channel/connector.h"
#include "src/core/ext/filters/client_channel/subchannel_pool_interface.h"
@ -30,7 +32,6 @@
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/map.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/sync.h"
@ -251,7 +252,7 @@ class Subchannel {
// service name.
// If the return value is GRPC_CHANNEL_READY, also sets *connected_subchannel.
grpc_connectivity_state CheckConnectivityState(
const char* health_check_service_name,
absl::string_view health_check_service_name,
RefCountedPtr<ConnectedSubchannel>* connected_subchannel);
// Starts watching the subchannel's connectivity state.
@ -264,12 +265,12 @@ class Subchannel {
// destroyed or when CancelConnectivityStateWatch() is called.
void WatchConnectivityState(
grpc_connectivity_state initial_state,
grpc_core::UniquePtr<char> health_check_service_name,
absl::string_view health_check_service_name,
RefCountedPtr<ConnectivityStateWatcherInterface> watcher);
// Cancels a connectivity state watch.
// If the watcher has already been destroyed, this is a no-op.
void CancelConnectivityStateWatch(const char* health_check_service_name,
void CancelConnectivityStateWatch(absl::string_view health_check_service_name,
ConnectivityStateWatcherInterface* watcher);
// Attempt to connect to the backend. Has no effect if already connected.
@ -333,23 +334,24 @@ class Subchannel {
public:
void AddWatcherLocked(
Subchannel* subchannel, grpc_connectivity_state initial_state,
grpc_core::UniquePtr<char> health_check_service_name,
absl::string_view health_check_service_name,
RefCountedPtr<ConnectivityStateWatcherInterface> watcher);
void RemoveWatcherLocked(const char* health_check_service_name,
void RemoveWatcherLocked(absl::string_view health_check_service_name,
ConnectivityStateWatcherInterface* watcher);
// Notifies the watcher when the subchannel's state changes.
void NotifyLocked(grpc_connectivity_state state);
grpc_connectivity_state CheckConnectivityStateLocked(
Subchannel* subchannel, const char* health_check_service_name);
Subchannel* subchannel, absl::string_view health_check_service_name);
void ShutdownLocked();
private:
class HealthWatcher;
std::map<const char*, OrphanablePtr<HealthWatcher>, StringLess> map_;
// Key points to the health_check_service_name_ field in the value object.
std::map<absl::string_view, OrphanablePtr<HealthWatcher>> map_;
};
class ConnectedSubchannelStateWatcher;

@ -31,7 +31,6 @@
#include <grpc/support/string_util.h>
#include "src/core/ext/filters/client_channel/xds/xds_api.h"
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"

@ -25,6 +25,7 @@
#include <set>
#include "absl/container/inlined_vector.h"
#include "absl/types/optional.h"
#include <grpc/slice_buffer.h>
@ -150,7 +151,7 @@ class XdsApi {
}
private:
InlinedVector<LocalityMap, 2> priorities_;
absl::InlinedVector<LocalityMap, 2> priorities_;
};
// There are two phases of accessing this class's content:
@ -169,7 +170,7 @@ class XdsApi {
const uint32_t parts_per_million;
};
using DropCategoryList = InlinedVector<DropCategory, 2>;
using DropCategoryList = absl::InlinedVector<DropCategory, 2>;
void AddCategory(std::string name, uint32_t parts_per_million) {
drop_category_list_.emplace_back(

@ -18,6 +18,8 @@
#include "src/core/ext/filters/client_channel/xds/xds_bootstrap.h"
#include <vector>
#include <errno.h>
#include <stdlib.h>
@ -128,7 +130,7 @@ XdsBootstrap::XdsBootstrap(Json json, grpc_error** error) {
"malformed JSON in bootstrap file");
return;
}
InlinedVector<grpc_error*, 1> error_list;
std::vector<grpc_error*> error_list;
auto it = json.mutable_object()->find("xds_servers");
if (it == json.mutable_object()->end()) {
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
@ -155,7 +157,7 @@ XdsBootstrap::XdsBootstrap(Json json, grpc_error** error) {
}
grpc_error* XdsBootstrap::ParseXdsServerList(Json* json) {
InlinedVector<grpc_error*, 1> error_list;
std::vector<grpc_error*> error_list;
for (size_t i = 0; i < json->mutable_array()->size(); ++i) {
Json& child = json->mutable_array()->at(i);
if (child.type() != Json::Type::OBJECT) {
@ -173,7 +175,7 @@ grpc_error* XdsBootstrap::ParseXdsServerList(Json* json) {
}
grpc_error* XdsBootstrap::ParseXdsServer(Json* json, size_t idx) {
InlinedVector<grpc_error*, 1> error_list;
std::vector<grpc_error*> error_list;
servers_.emplace_back();
XdsServer& server = servers_[servers_.size() - 1];
auto it = json->mutable_object()->find("server_uri");
@ -211,7 +213,7 @@ grpc_error* XdsBootstrap::ParseXdsServer(Json* json, size_t idx) {
grpc_error* XdsBootstrap::ParseChannelCredsArray(Json* json,
XdsServer* server) {
InlinedVector<grpc_error*, 1> error_list;
std::vector<grpc_error*> error_list;
for (size_t i = 0; i < json->mutable_array()->size(); ++i) {
Json& child = json->mutable_array()->at(i);
if (child.type() != Json::Type::OBJECT) {
@ -230,7 +232,7 @@ grpc_error* XdsBootstrap::ParseChannelCredsArray(Json* json,
grpc_error* XdsBootstrap::ParseChannelCreds(Json* json, size_t idx,
XdsServer* server) {
InlinedVector<grpc_error*, 1> error_list;
std::vector<grpc_error*> error_list;
ChannelCreds channel_creds;
auto it = json->mutable_object()->find("type");
if (it == json->mutable_object()->end()) {
@ -268,7 +270,7 @@ grpc_error* XdsBootstrap::ParseChannelCreds(Json* json, size_t idx,
}
grpc_error* XdsBootstrap::ParseNode(Json* json) {
InlinedVector<grpc_error*, 1> error_list;
std::vector<grpc_error*> error_list;
node_ = absl::make_unique<Node>();
auto it = json->mutable_object()->find("id");
if (it != json->mutable_object()->end()) {
@ -312,7 +314,7 @@ grpc_error* XdsBootstrap::ParseNode(Json* json) {
}
grpc_error* XdsBootstrap::ParseLocality(Json* json) {
InlinedVector<grpc_error*, 1> error_list;
std::vector<grpc_error*> error_list;
auto it = json->mutable_object()->find("region");
if (it != json->mutable_object()->end()) {
if (it->second.type() != Json::Type::STRING) {

@ -23,10 +23,10 @@
#include <string>
#include <vector>
#include "absl/container/inlined_vector.h"
#include <grpc/impl/codegen/slice.h>
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/gprpp/map.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/json/json.h"
@ -53,7 +53,7 @@ class XdsBootstrap {
struct XdsServer {
std::string server_uri;
InlinedVector<ChannelCreds, 1> channel_creds;
absl::InlinedVector<ChannelCreds, 1> channel_creds;
};
// If *error is not GRPC_ERROR_NONE after returning, then there was an
@ -78,7 +78,7 @@ class XdsBootstrap {
grpc_error* ParseNode(Json* json);
grpc_error* ParseLocality(Json* json);
InlinedVector<XdsServer, 1> servers_;
absl::InlinedVector<XdsServer, 1> servers_;
std::unique_ptr<Node> node_;
};

@ -22,6 +22,8 @@
#include <string.h>
#include "absl/container/inlined_vector.h"
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
@ -39,8 +41,8 @@
namespace grpc_core {
grpc_channel_args* ModifyXdsChannelArgs(grpc_channel_args* args) {
InlinedVector<const char*, 1> args_to_remove;
InlinedVector<grpc_arg, 2> args_to_add;
absl::InlinedVector<const char*, 1> args_to_remove;
absl::InlinedVector<grpc_arg, 2> args_to_add;
// Substitute the channel credentials with a version without call
// credentials: the load balancer is not necessarily trusted to handle
// bearer token credentials.

@ -22,6 +22,9 @@
#include <limits.h>
#include <string.h>
#include <map>
#include "absl/container/inlined_vector.h"
#include "absl/strings/str_format.h"
#include "absl/strings/str_join.h"
@ -44,7 +47,6 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/map.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
@ -447,7 +449,7 @@ grpc_channel_args* BuildXdsChannelArgs(const grpc_channel_args& args) {
GRPC_ARG_KEEPALIVE_TIME_MS,
};
// Channel args to add.
InlinedVector<grpc_arg, 3> args_to_add;
absl::InlinedVector<grpc_arg, 3> args_to_add;
// Keepalive interval.
args_to_add.emplace_back(grpc_channel_arg_integer_create(
const_cast<char*>(GRPC_ARG_KEEPALIVE_TIME_MS), 5000));

@ -19,6 +19,7 @@
#include <grpc/support/port_platform.h>
#include <map>
#include <set>
#include "absl/types/optional.h"
@ -27,7 +28,6 @@
#include "src/core/ext/filters/client_channel/xds/xds_api.h"
#include "src/core/ext/filters/client_channel/xds/xds_bootstrap.h"
#include "src/core/ext/filters/client_channel/xds/xds_client_stats.h"
#include "src/core/lib/gprpp/map.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted.h"

@ -21,13 +21,14 @@
#include <grpc/support/port_platform.h>
#include <map>
#include <grpc/support/string_util.h>
#include "src/core/lib/gprpp/atomic.h"
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/gprpp/map.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/string_view.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/iomgr/exec_ctx.h"

@ -277,6 +277,7 @@ typedef struct {
/* maximum size of a frame */
size_t max_frame_size;
bool use_true_binary_metadata;
bool is_end_of_stream;
} framer_state;
/* fills p (which is expected to be kDataFrameHeaderSize bytes long)
@ -315,17 +316,29 @@ static size_t current_frame_size(framer_state* st) {
}
/* finish a frame - fill in the previously reserved header */
static void finish_frame(framer_state* st, int is_header_boundary,
int is_last_in_stream) {
static void finish_frame(framer_state* st, int is_header_boundary) {
uint8_t type = 0xff;
type = st->is_first_frame ? GRPC_CHTTP2_FRAME_HEADER
: GRPC_CHTTP2_FRAME_CONTINUATION;
fill_header(
GRPC_SLICE_START_PTR(st->output->slices[st->header_idx]), type,
st->stream_id, current_frame_size(st),
static_cast<uint8_t>(
(is_last_in_stream ? GRPC_CHTTP2_DATA_FLAG_END_STREAM : 0) |
(is_header_boundary ? GRPC_CHTTP2_DATA_FLAG_END_HEADERS : 0)));
type =
static_cast<uint8_t>(st->is_first_frame ? GRPC_CHTTP2_FRAME_HEADER
: GRPC_CHTTP2_FRAME_CONTINUATION);
uint8_t flags = 0xff;
/* per the HTTP/2 spec:
A HEADERS frame carries the END_STREAM flag that signals the end of a
stream. However, a HEADERS frame with the END_STREAM flag set can be
followed by CONTINUATION frames on the same stream. Logically, the
CONTINUATION frames are part of the HEADERS frame.
Thus, we add the END_STREAM flag to the HEADER frame (the first frame). */
flags = static_cast<uint8_t>(st->is_first_frame && st->is_end_of_stream
? GRPC_CHTTP2_DATA_FLAG_END_STREAM
: 0);
/* per the HTTP/2 spec:
A HEADERS frame without the END_HEADERS flag set MUST be followed by
a CONTINUATION frame for the same stream.
Thus, we add the END_HEADER flag to the last frame. */
flags |= static_cast<uint8_t>(
is_header_boundary ? GRPC_CHTTP2_DATA_FLAG_END_HEADERS : 0);
fill_header(GRPC_SLICE_START_PTR(st->output->slices[st->header_idx]), type,
st->stream_id, current_frame_size(st), flags);
st->stats->framing_bytes += kDataFrameHeaderSize;
st->is_first_frame = 0;
}
@ -347,7 +360,7 @@ static void ensure_space(framer_state* st, size_t need_bytes) {
if (GPR_LIKELY(current_frame_size(st) + need_bytes <= st->max_frame_size)) {
return;
}
finish_frame(st, 0, 0);
finish_frame(st, 0);
begin_frame(st);
}
@ -362,7 +375,7 @@ static void add_header_data(framer_state* st, grpc_slice slice) {
} else {
st->stats->header_bytes += remaining;
grpc_slice_buffer_add(st->output, grpc_slice_split_head(&slice, remaining));
finish_frame(st, 0, 0);
finish_frame(st, 0);
begin_frame(st);
add_header_data(st, slice);
}
@ -841,6 +854,7 @@ void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor* c,
st.stats = options->stats;
st.max_frame_size = options->max_frame_size;
st.use_true_binary_metadata = options->use_true_binary_metadata;
st.is_end_of_stream = options->is_eof;
/* Encode a metadata batch; store the returned values, representing
a metadata element that needs to be unreffed back into the metadata
@ -883,5 +897,5 @@ void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor* c,
deadline_enc(c, deadline, &st);
}
finish_frame(&st, 1, options->is_eof);
finish_frame(&st, 1);
}

@ -23,14 +23,15 @@
#include <grpc/grpc.h>
#include <map>
#include <string>
#include "absl/container/inlined_vector.h"
#include "src/core/lib/channel/channel_trace.h"
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gprpp/atomic.h"
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/gprpp/map.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/sync.h"
@ -167,7 +168,7 @@ class CallCountingHelper {
void CollectData(CounterData* out);
// Really zero-sized, but 0-sized arrays are illegal on MSVC.
InlinedVector<AtomicCounterData, 1> per_cpu_counter_data_storage_;
absl::InlinedVector<AtomicCounterData, 1> per_cpu_counter_data_storage_;
size_t num_cores_ = 0;
};

@ -21,6 +21,8 @@
#include <algorithm>
#include <cstring>
#include "absl/container/inlined_vector.h"
#include "src/core/lib/channel/channel_trace.h"
#include "src/core/lib/channel/channelz.h"
#include "src/core/lib/channel/channelz_registry.h"
@ -82,7 +84,7 @@ RefCountedPtr<BaseNode> ChannelzRegistry::InternalGet(intptr_t uuid) {
std::string ChannelzRegistry::InternalGetTopChannels(
intptr_t start_channel_id) {
InlinedVector<RefCountedPtr<BaseNode>, 10> top_level_channels;
absl::InlinedVector<RefCountedPtr<BaseNode>, 10> top_level_channels;
RefCountedPtr<BaseNode> node_after_pagination_limit;
{
MutexLock lock(&mu_);
@ -120,7 +122,7 @@ std::string ChannelzRegistry::InternalGetTopChannels(
}
std::string ChannelzRegistry::InternalGetServers(intptr_t start_server_id) {
InlinedVector<RefCountedPtr<BaseNode>, 10> servers;
absl::InlinedVector<RefCountedPtr<BaseNode>, 10> servers;
RefCountedPtr<BaseNode> node_after_pagination_limit;
{
MutexLock lock(&mu_);
@ -158,7 +160,7 @@ std::string ChannelzRegistry::InternalGetServers(intptr_t start_server_id) {
}
void ChannelzRegistry::InternalLogAllEntities() {
InlinedVector<RefCountedPtr<BaseNode>, 10> nodes;
absl::InlinedVector<RefCountedPtr<BaseNode>, 10> nodes;
{
MutexLock lock(&mu_);
for (auto& p : node_map_) {

@ -23,9 +23,10 @@
#include <stdint.h>
#include <map>
#include "src/core/lib/channel/channel_trace.h"
#include "src/core/lib/channel/channelz.h"
#include "src/core/lib/gprpp/map.h"
#include "src/core/lib/gprpp/sync.h"
namespace grpc_core {

@ -21,12 +21,13 @@
#include <grpc/support/port_platform.h>
#include "absl/container/inlined_vector.h"
#include <grpc/support/string_util.h>
#include <grpc/impl/codegen/grpc_types.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/iomgr/closure.h"
@ -146,7 +147,8 @@ class HandshakeManager : public RefCounted<HandshakeManager> {
gpr_mu mu_;
bool is_shutdown_ = false;
// An array of handshakers added via grpc_handshake_manager_add().
InlinedVector<RefCountedPtr<Handshaker>, HANDSHAKERS_INIT_SIZE> handshakers_;
absl::InlinedVector<RefCountedPtr<Handshaker>, HANDSHAKERS_INIT_SIZE>
handshakers_;
// The index of the handshaker to invoke next and closure to invoke it.
size_t index_ = 0;
grpc_closure call_next_handshaker_;

@ -18,9 +18,10 @@
#include <grpc/support/port_platform.h>
#include "absl/container/inlined_vector.h"
#include "src/core/lib/channel/handshaker_registry.h"
#include "src/core/lib/gpr/alloc.h"
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/gprpp/memory.h"
#include <string.h>
@ -44,7 +45,7 @@ class HandshakerFactoryList {
HandshakeManager* handshake_mgr);
private:
InlinedVector<std::unique_ptr<HandshakerFactory>, 2> factories_;
absl::InlinedVector<std::unique_ptr<HandshakerFactory>, 2> factories_;
};
HandshakerFactoryList* g_handshaker_factory_lists = nullptr;

@ -1,37 +0,0 @@
/*
*
* Copyright 2017 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GRPC_CORE_LIB_GPRPP_INLINED_VECTOR_H
#define GRPC_CORE_LIB_GPRPP_INLINED_VECTOR_H
#include <grpc/support/port_platform.h>
#include <cassert>
#include <cstring>
#include "absl/container/inlined_vector.h"
#include "src/core/lib/gprpp/memory.h"
namespace grpc_core {
template <typename T, size_t N, typename A = std::allocator<T>>
using InlinedVector = absl::InlinedVector<T, N, A>;
} // namespace grpc_core
#endif /* GRPC_CORE_LIB_GPRPP_INLINED_VECTOR_H */

@ -1,59 +0,0 @@
/*
*
* Copyright 2017 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GRPC_CORE_LIB_GPRPP_MAP_H
#define GRPC_CORE_LIB_GPRPP_MAP_H
#include <grpc/support/port_platform.h>
#include <string.h>
#include <map>
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/string_view.h"
namespace grpc_core {
struct StringLess {
bool operator()(const char* a, const char* b) const {
return strcmp(a, b) < 0;
}
bool operator()(const grpc_core::UniquePtr<char>& a,
const grpc_core::UniquePtr<char>& b) const {
return strcmp(a.get(), b.get()) < 0;
}
bool operator()(const StringView& a, const StringView& b) const {
const size_t min_size = std::min(a.size(), b.size());
int c = strncmp(a.data(), b.data(), min_size);
if (c != 0) return c < 0;
return a.size() < b.size();
}
};
template <typename T>
struct RefCountedPtrLess {
bool operator()(const RefCountedPtr<T>& p1,
const RefCountedPtr<T>& p2) const {
return p1.get() < p2.get();
}
};
} // namespace grpc_core
#endif /* GRPC_CORE_LIB_GPRPP_MAP_H */

@ -1,33 +0,0 @@
/*
*
* Copyright 2019 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GRPC_CORE_LIB_GPRPP_OPTIONAL_H
#define GRPC_CORE_LIB_GPRPP_OPTIONAL_H
#include <grpc/support/port_platform.h>
#include "absl/types/optional.h"
namespace grpc_core {
template <typename T>
using Optional = absl::optional<T>;
} // namespace grpc_core
#endif /* GRPC_CORE_LIB_GPRPP_OPTIONAL_H */

@ -182,6 +182,11 @@ inline RefCountedPtr<T> MakeRefCounted(Args&&... args) {
return RefCountedPtr<T>(new T(std::forward<Args>(args)...));
}
template <typename T>
bool operator<(const RefCountedPtr<T>& p1, const RefCountedPtr<T>& p2) {
return p1.get() < p2.get();
}
} // namespace grpc_core
#endif /* GRPC_CORE_LIB_GPRPP_REF_COUNTED_PTR_H */

@ -21,12 +21,13 @@
#include <grpc/support/port_platform.h>
#include "absl/types/optional.h"
#include "src/core/lib/iomgr/port.h"
#include <grpc/support/time.h>
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/optional.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/internal_errqueue.h"
@ -34,52 +35,52 @@ namespace grpc_core {
struct ConnectionMetrics {
/* Delivery rate in Bytes/s. */
Optional<uint64_t> delivery_rate;
absl::optional<uint64_t> delivery_rate;
/* If the delivery rate is limited by the application, this is set to true. */
Optional<bool> is_delivery_rate_app_limited;
absl::optional<bool> is_delivery_rate_app_limited;
/* Total packets retransmitted. */
Optional<uint32_t> packet_retx;
absl::optional<uint32_t> packet_retx;
/* Total packets retransmitted spuriously. This metric is smaller than or
equal to packet_retx. */
Optional<uint32_t> packet_spurious_retx;
absl::optional<uint32_t> packet_spurious_retx;
/* Total packets sent. */
Optional<uint32_t> packet_sent;
absl::optional<uint32_t> packet_sent;
/* Total packets delivered. */
Optional<uint32_t> packet_delivered;
absl::optional<uint32_t> packet_delivered;
/* Total packets delivered with ECE marked. This metric is smaller than or
equal to packet_delivered. */
Optional<uint32_t> packet_delivered_ce;
absl::optional<uint32_t> packet_delivered_ce;
/* Total bytes lost so far. */
Optional<uint64_t> data_retx;
absl::optional<uint64_t> data_retx;
/* Total bytes sent so far. */
Optional<uint64_t> data_sent;
absl::optional<uint64_t> data_sent;
/* Total bytes in write queue but not sent. */
Optional<uint64_t> data_notsent;
absl::optional<uint64_t> data_notsent;
/* Pacing rate of the connection in Bps */
Optional<uint64_t> pacing_rate;
absl::optional<uint64_t> pacing_rate;
/* Minimum RTT observed in usec. */
Optional<uint32_t> min_rtt;
absl::optional<uint32_t> min_rtt;
/* Smoothed RTT in usec */
Optional<uint32_t> srtt;
absl::optional<uint32_t> srtt;
/* Send congestion window. */
Optional<uint32_t> congestion_window;
absl::optional<uint32_t> congestion_window;
/* Slow start threshold in packets. */
Optional<uint32_t> snd_ssthresh;
absl::optional<uint32_t> snd_ssthresh;
/* Maximum degree of reordering (i.e., maximum number of packets reodered)
on the connection. */
Optional<uint32_t> reordering;
absl::optional<uint32_t> reordering;
/* Represents the number of recurring retransmissions of the first sequence
that is not acknowledged yet. */
Optional<uint8_t> recurring_retrans;
absl::optional<uint8_t> recurring_retrans;
/* The cumulative time (in usec) that the transport protocol was busy
sending data. */
Optional<uint64_t> busy_usec;
absl::optional<uint64_t> busy_usec;
/* The cumulative time (in usec) that the transport protocol was limited by
the receive window size. */
Optional<uint64_t> rwnd_limited_usec;
absl::optional<uint64_t> rwnd_limited_usec;
/* The cumulative time (in usec) that the transport protocol was limited by
the send buffer size. */
Optional<uint64_t> sndbuf_limited_usec;
absl::optional<uint64_t> sndbuf_limited_usec;
};
struct Timestamp {

@ -23,9 +23,10 @@
#include <stddef.h>
#include "absl/container/inlined_vector.h"
#include <grpc/support/atm.h>
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/gprpp/mpscq.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
@ -208,7 +209,7 @@ class CallCombinerClosureList {
// There are generally a maximum of 6 closures to run in the call
// combiner, one for each pending op.
InlinedVector<CallCombinerClosure, 6> closures_;
absl::InlinedVector<CallCombinerClosure, 6> closures_;
};
} // namespace grpc_core

@ -30,7 +30,6 @@
#include <grpc/support/time.h>
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/inlined_vector.h"
/// Opaque representation of an error.
/// See https://github.com/grpc/grpc/blob/master/doc/core/grpc-error.md for a

@ -44,6 +44,8 @@
#include <sys/types.h>
#include <unistd.h>
#include "absl/container/inlined_vector.h"
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@ -52,7 +54,6 @@
#include <grpc/support/time.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/ev_posix.h"
@ -177,7 +178,7 @@ struct grpc_udp_server {
int shutdown;
/* An array of listeners */
grpc_core::InlinedVector<GrpcUdpListener, 16> listeners;
absl::InlinedVector<GrpcUdpListener, 16> listeners;
/* factory for use to create udp listeners */
GrpcUdpHandlerFactory* handler_factory;

@ -23,7 +23,8 @@
#include <string>
#include "src/core/lib/gprpp/inlined_vector.h"
#include "absl/container/inlined_vector.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/security/credentials/credentials.h"
@ -71,8 +72,7 @@ class grpc_composite_channel_credentials : public grpc_channel_credentials {
class grpc_composite_call_credentials : public grpc_call_credentials {
public:
using CallCredentialsList =
grpc_core::InlinedVector<grpc_core::RefCountedPtr<grpc_call_credentials>,
2>;
absl::InlinedVector<grpc_core::RefCountedPtr<grpc_call_credentials>, 2>;
grpc_composite_call_credentials(
grpc_core::RefCountedPtr<grpc_call_credentials> creds1,

@ -23,6 +23,8 @@
#include <string.h>
#include "absl/container/inlined_vector.h"
#include <grpc/grpc_security.h>
#include <grpc/impl/codegen/slice.h>
#include <grpc/slice.h>
@ -32,7 +34,6 @@
#include "absl/strings/str_format.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/load_file.h"
@ -669,7 +670,7 @@ grpc_error* ValidateStsCredentialsOptions(
void operator()(grpc_uri* uri) { grpc_uri_destroy(uri); }
};
*sts_url_out = nullptr;
InlinedVector<grpc_error*, 3> error_list;
absl::InlinedVector<grpc_error*, 3> error_list;
std::unique_ptr<grpc_uri, GrpcUriDeleter> sts_url(
options->token_exchange_service_uri != nullptr
? grpc_uri_parse(options->token_exchange_service_uri, false)

@ -23,7 +23,8 @@
#include <grpc/grpc_security.h>
#include "src/core/lib/gprpp/inlined_vector.h"
#include "absl/container/inlined_vector.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/security/security_connector/ssl_utils.h"
@ -44,8 +45,7 @@ struct grpc_tls_error_details
struct grpc_tls_key_materials_config
: public grpc_core::RefCounted<grpc_tls_key_materials_config> {
public:
typedef grpc_core::InlinedVector<grpc_core::PemKeyCertPair, 1>
PemKeyCertPairList;
typedef absl::InlinedVector<grpc_core::PemKeyCertPair, 1> PemKeyCertPairList;
/** Getters for member fields. **/
const char* pem_root_certs() const { return pem_root_certs_.get(); }

@ -34,6 +34,8 @@
#include <sys/types.h>
#include <unistd.h>
#include "absl/container/inlined_vector.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
@ -41,7 +43,6 @@
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/global_config.h"
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/iomgr/load_file.h"
GPR_GLOBAL_CONFIG_DEFINE_STRING(grpc_system_ssl_roots_dir, "",
@ -100,7 +101,7 @@ grpc_slice CreateRootCertsBundle(const char* certs_directory) {
char path[MAXPATHLEN];
off_t size;
};
InlinedVector<FileData, 2> roots_filenames;
absl::InlinedVector<FileData, 2> roots_filenames;
size_t total_bundle_size = 0;
struct dirent* directory_entry;
while ((directory_entry = readdir(ca_directory)) != nullptr) {

@ -274,18 +274,15 @@ struct registered_method {
const char* method_arg, const char* host_arg,
grpc_server_register_method_payload_handling payload_handling_arg,
uint32_t flags_arg)
: method(gpr_strdup(method_arg)),
host(gpr_strdup(host_arg)),
: method(method_arg == nullptr ? "" : method_arg),
host(host_arg == nullptr ? "" : host_arg),
payload_handling(payload_handling_arg),
flags(flags_arg) {}
~registered_method() {
gpr_free(method);
gpr_free(host);
}
~registered_method() = default;
char* const method;
char* const host;
const std::string method;
const std::string host;
const grpc_server_register_method_payload_handling payload_handling;
const uint32_t flags;
/* one request matcher per method */
@ -1183,11 +1180,9 @@ void register_completion_queue(grpc_server* server, grpc_completion_queue* cq,
server->cqs[n] = cq;
}
int streq(const char* a, const char* b) {
if (a == nullptr && b == nullptr) return 1;
if (a == nullptr) return 0;
if (b == nullptr) return 0;
return 0 == strcmp(a, b);
bool streq(const std::string& a, const char* b) {
return (a.empty() && b == nullptr) ||
((b != nullptr) && !strcmp(a.c_str(), b));
}
class ConnectivityWatcher
@ -1491,10 +1486,10 @@ void grpc_server_setup_transport(
static_cast<channel_registered_method*>(gpr_zalloc(alloc));
for (rm = s->registered_methods; rm; rm = rm->next) {
grpc_core::ExternallyManagedSlice host;
grpc_core::ExternallyManagedSlice method(rm->method);
const bool has_host = rm->host != nullptr;
grpc_core::ExternallyManagedSlice method(rm->method.c_str());
const bool has_host = !rm->host.empty();
if (has_host) {
host = grpc_core::ExternallyManagedSlice(rm->host);
host = grpc_core::ExternallyManagedSlice(rm->host.c_str());
}
hash = GRPC_MDSTR_KV_HASH(has_host ? host.Hash() : 0, method.Hash());
for (probes = 0; chand->registered_methods[(hash + probes) % slots]

@ -21,11 +21,12 @@
#include <grpc/support/port_platform.h>
#include <map>
#include <grpc/grpc.h>
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/atomic.h"
#include "src/core/lib/gprpp/map.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/exec_ctx.h"

@ -18,6 +18,9 @@
#include <grpc/support/alloc.h>
#include <grpcpp/security/tls_credentials_options.h>
#include "absl/container/inlined_vector.h"
#include "src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h"
#include "src/cpp/common/tls_credentials_options_util.h"
@ -111,7 +114,7 @@ void TlsCredentialReloadArg::set_key_materials(
c_arg_->key_materials_config = grpc_tls_key_materials_config_create();
}
/** Convert |pem_key_cert_pair_list| to an inlined vector of ssl pairs. **/
::grpc_core::InlinedVector<::grpc_core::PemKeyCertPair, 1>
::absl::InlinedVector<::grpc_core::PemKeyCertPair, 1>
c_pem_key_cert_pair_list;
for (const auto& key_cert_pair : pem_key_cert_pair_list) {
c_pem_key_cert_pair_list.emplace_back(
@ -128,7 +131,7 @@ void TlsCredentialReloadArg::set_key_materials_config(
c_arg_->key_materials_config = nullptr;
return;
}
::grpc_core::InlinedVector<::grpc_core::PemKeyCertPair, 1>
::absl::InlinedVector<::grpc_core::PemKeyCertPair, 1>
c_pem_key_cert_pair_list;
for (const auto& key_cert_pair :
key_materials_config->pem_key_cert_pair_list()) {

@ -16,8 +16,10 @@
*
*/
#include "src/cpp/common/tls_credentials_options_util.h"
#include "absl/container/inlined_vector.h"
#include <grpcpp/security/tls_credentials_options.h>
#include "src/cpp/common/tls_credentials_options_util.h"
namespace grpc_impl {
namespace experimental {
@ -35,7 +37,7 @@ grpc_tls_key_materials_config* ConvertToCKeyMaterialsConfig(
}
grpc_tls_key_materials_config* c_config =
grpc_tls_key_materials_config_create();
::grpc_core::InlinedVector<::grpc_core::PemKeyCertPair, 1>
::absl::InlinedVector<::grpc_core::PemKeyCertPair, 1>
c_pem_key_cert_pair_list;
for (const auto& key_cert_pair : config->pem_key_cert_pair_list()) {
grpc_ssl_pem_key_cert_pair* ssl_pair =

@ -36,7 +36,7 @@ $PROTOC --plugin=$PLUGIN --csharp_out=$HEALTHCHECK_DIR --grpc_out=$HEALTHCHECK_D
$PROTOC --plugin=$PLUGIN --csharp_out=$REFLECTION_DIR --grpc_out=$REFLECTION_DIR \
-I src/proto src/proto/grpc/reflection/v1alpha/reflection.proto
# Put grp/core/stats.proto in a subdirectory to avoid collision with grpc/testing/stats.proto
# Put grpc/core/stats.proto in a subdirectory to avoid collision with grpc/testing/stats.proto
mkdir -p $TESTING_DIR/CoreStats
$PROTOC --plugin=$PLUGIN --csharp_out=$TESTING_DIR/CoreStats --grpc_out=$TESTING_DIR/CoreStats \
-I src/proto src/proto/grpc/core/stats.proto

@ -275,12 +275,8 @@ $ composer install
### Client Stub
Generate client stub classes from `.proto` files
```sh
$ cd grpc/src/php
$ ./bin/generate_proto_php.sh
```
The generate client stub classes have already been generated from `.proto` files
by the `./bin/generate_proto_php.sh` script.
### Run test server

@ -16,16 +16,15 @@
set -e
cd $(dirname $0)/../../..
# TODO(jtattermusch): unlike for e.g. ruby and csharp,
# PHP runs the code generator as part of the build, so we cannot
# easily use bazel-built "protoc" and "grpc_php_plugin" binaries.
# TODO(jtattermusch): the generated code for qps tests
# is actually checked into the repository, but for other tests
# (e.g. interop or unit tests) it's not. This should made consistent.
protoc --proto_path=src/proto/math \
# protoc and grpc_*_plugin binaries can be obtained by running
# $ bazel build @com_google_protobuf//:protoc //src/compiler:all
PROTOC=bazel-bin/external/com_google_protobuf/protoc
PLUGIN=protoc-gen-grpc=bazel-bin/src/compiler/grpc_php_plugin
$PROTOC --proto_path=src/proto/math \
--php_out=src/php/tests/generated_code \
--grpc_out=src/php/tests/generated_code \
--plugin=protoc-gen-grpc=bins/opt/grpc_php_plugin \
--plugin=$PLUGIN \
src/proto/math/math.proto
# replace the Empty message with EmptyMessage
@ -38,14 +37,23 @@ sed 's/grpc\.testing\.Empty/grpc\.testing\.EmptyMessage/g' \
src/proto/grpc/testing/test.proto > $output_file
mv $output_file ./src/proto/grpc/testing/test.proto
protoc --proto_path=. \
# interop test protos
$PROTOC --proto_path=. \
--php_out=src/php/tests/interop \
--grpc_out=src/php/tests/interop \
--plugin=protoc-gen-grpc=bins/opt/grpc_php_plugin \
--plugin=$PLUGIN \
src/proto/grpc/testing/messages.proto \
src/proto/grpc/testing/empty.proto \
src/proto/grpc/testing/test.proto
# qps test protos
$PROTOC --proto_path=. \
--php_out=src/php/tests/qps/generated_code \
--grpc_out=src/php/tests/qps/generated_code \
--plugin=$PLUGIN \
src/proto/grpc/core/stats.proto \
src/proto/grpc/testing/{benchmark_service,compiler_test,control,echo_messages,empty,empty_service,messages,payloads,proxy-service,report_qps_scenario_service,stats,test,worker_service}.proto
# change it back
sed 's/message EmptyMessage/message Empty/g' \
src/proto/grpc/testing/empty.proto > $output_file
@ -53,4 +61,3 @@ mv $output_file ./src/proto/grpc/testing/empty.proto
sed 's/grpc\.testing\.EmptyMessage/grpc\.testing\.Empty/g' \
src/proto/grpc/testing/test.proto > $output_file
mv $output_file ./src/proto/grpc/testing/test.proto

@ -0,0 +1,36 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: math.proto
namespace GPBMetadata;
class Math
{
public static $is_initialized = false;
public static function initOnce() {
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
if (static::$is_initialized == true) {
return;
}
$pool->internalAddGeneratedFile(hex2bin(
"0ae9020a0a6d6174682e70726f746f12046d617468222c0a074469764172" .
"677312100a086469766964656e64180120012803120f0a0764697669736f" .
"72180220012803222f0a084469765265706c7912100a0871756f7469656e" .
"7418012001280312110a0972656d61696e64657218022001280322180a07" .
"46696241726773120d0a056c696d697418012001280322120a034e756d12" .
"0b0a036e756d18012001280322190a084669625265706c79120d0a05636f" .
"756e7418012001280332a4010a044d61746812260a03446976120d2e6d61" .
"74682e446976417267731a0e2e6d6174682e4469765265706c792200122e" .
"0a074469764d616e79120d2e6d6174682e446976417267731a0e2e6d6174" .
"682e4469765265706c7922002801300112230a03466962120d2e6d617468" .
"2e466962417267731a092e6d6174682e4e756d22003001121f0a0353756d" .
"12092e6d6174682e4e756d1a092e6d6174682e4e756d2200280162067072" .
"6f746f33"
), true);
static::$is_initialized = true;
}
}

@ -0,0 +1,85 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: math.proto
namespace Math;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Generated from protobuf message <code>math.DivArgs</code>
*/
class DivArgs extends \Google\Protobuf\Internal\Message
{
/**
* Generated from protobuf field <code>int64 dividend = 1;</code>
*/
protected $dividend = 0;
/**
* Generated from protobuf field <code>int64 divisor = 2;</code>
*/
protected $divisor = 0;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int|string $dividend
* @type int|string $divisor
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Math::initOnce();
parent::__construct($data);
}
/**
* Generated from protobuf field <code>int64 dividend = 1;</code>
* @return int|string
*/
public function getDividend()
{
return $this->dividend;
}
/**
* Generated from protobuf field <code>int64 dividend = 1;</code>
* @param int|string $var
* @return $this
*/
public function setDividend($var)
{
GPBUtil::checkInt64($var);
$this->dividend = $var;
return $this;
}
/**
* Generated from protobuf field <code>int64 divisor = 2;</code>
* @return int|string
*/
public function getDivisor()
{
return $this->divisor;
}
/**
* Generated from protobuf field <code>int64 divisor = 2;</code>
* @param int|string $var
* @return $this
*/
public function setDivisor($var)
{
GPBUtil::checkInt64($var);
$this->divisor = $var;
return $this;
}
}

@ -0,0 +1,85 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: math.proto
namespace Math;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Generated from protobuf message <code>math.DivReply</code>
*/
class DivReply extends \Google\Protobuf\Internal\Message
{
/**
* Generated from protobuf field <code>int64 quotient = 1;</code>
*/
protected $quotient = 0;
/**
* Generated from protobuf field <code>int64 remainder = 2;</code>
*/
protected $remainder = 0;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int|string $quotient
* @type int|string $remainder
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Math::initOnce();
parent::__construct($data);
}
/**
* Generated from protobuf field <code>int64 quotient = 1;</code>
* @return int|string
*/
public function getQuotient()
{
return $this->quotient;
}
/**
* Generated from protobuf field <code>int64 quotient = 1;</code>
* @param int|string $var
* @return $this
*/
public function setQuotient($var)
{
GPBUtil::checkInt64($var);
$this->quotient = $var;
return $this;
}
/**
* Generated from protobuf field <code>int64 remainder = 2;</code>
* @return int|string
*/
public function getRemainder()
{
return $this->remainder;
}
/**
* Generated from protobuf field <code>int64 remainder = 2;</code>
* @param int|string $var
* @return $this
*/
public function setRemainder($var)
{
GPBUtil::checkInt64($var);
$this->remainder = $var;
return $this;
}
}

@ -0,0 +1,58 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: math.proto
namespace Math;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Generated from protobuf message <code>math.FibArgs</code>
*/
class FibArgs extends \Google\Protobuf\Internal\Message
{
/**
* Generated from protobuf field <code>int64 limit = 1;</code>
*/
protected $limit = 0;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int|string $limit
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Math::initOnce();
parent::__construct($data);
}
/**
* Generated from protobuf field <code>int64 limit = 1;</code>
* @return int|string
*/
public function getLimit()
{
return $this->limit;
}
/**
* Generated from protobuf field <code>int64 limit = 1;</code>
* @param int|string $var
* @return $this
*/
public function setLimit($var)
{
GPBUtil::checkInt64($var);
$this->limit = $var;
return $this;
}
}

@ -0,0 +1,58 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: math.proto
namespace Math;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Generated from protobuf message <code>math.FibReply</code>
*/
class FibReply extends \Google\Protobuf\Internal\Message
{
/**
* Generated from protobuf field <code>int64 count = 1;</code>
*/
protected $count = 0;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int|string $count
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Math::initOnce();
parent::__construct($data);
}
/**
* Generated from protobuf field <code>int64 count = 1;</code>
* @return int|string
*/
public function getCount()
{
return $this->count;
}
/**
* Generated from protobuf field <code>int64 count = 1;</code>
* @param int|string $var
* @return $this
*/
public function setCount($var)
{
GPBUtil::checkInt64($var);
$this->count = $var;
return $this;
}
}

@ -16,11 +16,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
namespace Grpc\Testing;
namespace Math;
/**
*/
class EchoTestServiceClient extends \Grpc\BaseStub {
class MathClient extends \Grpc\BaseStub {
/**
* @param string $hostname hostname
@ -32,61 +32,59 @@ class EchoTestServiceClient extends \Grpc\BaseStub {
}
/**
* @param \Grpc\Testing\EchoRequest $argument input argument
* Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
* and remainder.
* @param \Math\DivArgs $argument input argument
* @param array $metadata metadata
* @param array $options call options
*/
public function Echo(\Grpc\Testing\EchoRequest $argument,
public function Div(\Math\DivArgs $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/grpc.testing.EchoTestService/Echo',
return $this->_simpleRequest('/math.Math/Div',
$argument,
['\Grpc\Testing\EchoResponse', 'decode'],
['\Math\DivReply', 'decode'],
$metadata, $options);
}
/**
* DivMany accepts an arbitrary number of division args from the client stream
* and sends back the results in the reply stream. The stream continues until
* the client closes its end; the server does the same after sending all the
* replies. The stream ends immediately if either end aborts.
* @param array $metadata metadata
* @param array $options call options
*/
public function RequestStream($metadata = [], $options = []) {
return $this->_clientStreamRequest('/grpc.testing.EchoTestService/RequestStream',
['\Grpc\Testing\EchoResponse','decode'],
public function DivMany($metadata = [], $options = []) {
return $this->_bidiRequest('/math.Math/DivMany',
['\Math\DivReply','decode'],
$metadata, $options);
}
/**
* @param \Grpc\Testing\EchoRequest $argument input argument
* Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib
* generates up to limit numbers; otherwise it continues until the call is
* canceled. Unlike Fib above, Fib has no final FibReply.
* @param \Math\FibArgs $argument input argument
* @param array $metadata metadata
* @param array $options call options
*/
public function ResponseStream(\Grpc\Testing\EchoRequest $argument,
public function Fib(\Math\FibArgs $argument,
$metadata = [], $options = []) {
return $this->_serverStreamRequest('/grpc.testing.EchoTestService/ResponseStream',
return $this->_serverStreamRequest('/math.Math/Fib',
$argument,
['\Grpc\Testing\EchoResponse', 'decode'],
['\Math\Num', 'decode'],
$metadata, $options);
}
/**
* Sum sums a stream of numbers, returning the final result once the stream
* is closed.
* @param array $metadata metadata
* @param array $options call options
*/
public function BidiStream($metadata = [], $options = []) {
return $this->_bidiRequest('/grpc.testing.EchoTestService/BidiStream',
['\Grpc\Testing\EchoResponse','decode'],
$metadata, $options);
}
/**
* @param \Grpc\Testing\EchoRequest $argument input argument
* @param array $metadata metadata
* @param array $options call options
*/
public function Unimplemented(\Grpc\Testing\EchoRequest $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/grpc.testing.EchoTestService/Unimplemented',
$argument,
['\Grpc\Testing\EchoResponse', 'decode'],
public function Sum($metadata = [], $options = []) {
return $this->_clientStreamRequest('/math.Math/Sum',
['\Math\Num','decode'],
$metadata, $options);
}

@ -0,0 +1,58 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: math.proto
namespace Math;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Generated from protobuf message <code>math.Num</code>
*/
class Num extends \Google\Protobuf\Internal\Message
{
/**
* Generated from protobuf field <code>int64 num = 1;</code>
*/
protected $num = 0;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int|string $num
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Math::initOnce();
parent::__construct($data);
}
/**
* Generated from protobuf field <code>int64 num = 1;</code>
* @return int|string
*/
public function getNum()
{
return $this->num;
}
/**
* Generated from protobuf field <code>int64 num = 1;</code>
* @param int|string $var
* @return $this
*/
public function setNum($var)
{
GPBUtil::checkInt64($var);
$this->num = $var;
return $this;
}
}

@ -0,0 +1,86 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: src/proto/grpc/testing/messages.proto
namespace GPBMetadata\Src\Proto\Grpc\Testing;
class Messages
{
public static $is_initialized = false;
public static function initOnce() {
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
if (static::$is_initialized == true) {
return;
}
$pool->internalAddGeneratedFile(hex2bin(
"0ad70e0a257372632f70726f746f2f677270632f74657374696e672f6d65" .
"7373616765732e70726f746f120c677270632e74657374696e67221a0a09" .
"426f6f6c56616c7565120d0a0576616c756518012001280822400a075061" .
"796c6f616412270a047479706518012001280e32192e677270632e746573" .
"74696e672e5061796c6f616454797065120c0a04626f647918022001280c" .
"222b0a0a4563686f537461747573120c0a04636f6465180120012805120f" .
"0a076d6573736167651802200128092286030a0d53696d706c6552657175" .
"65737412300a0d726573706f6e73655f7479706518012001280e32192e67" .
"7270632e74657374696e672e5061796c6f61645479706512150a0d726573" .
"706f6e73655f73697a6518022001280512260a077061796c6f6164180320" .
"01280b32152e677270632e74657374696e672e5061796c6f616412150a0d" .
"66696c6c5f757365726e616d6518042001280812180a1066696c6c5f6f61" .
"7574685f73636f706518052001280812340a13726573706f6e73655f636f" .
"6d7072657373656418062001280b32172e677270632e74657374696e672e" .
"426f6f6c56616c756512310a0f726573706f6e73655f7374617475731807" .
"2001280b32182e677270632e74657374696e672e4563686f537461747573" .
"12320a116578706563745f636f6d7072657373656418082001280b32172e" .
"677270632e74657374696e672e426f6f6c56616c756512160a0e66696c6c" .
"5f7365727665725f6964180920012808121e0a1666696c6c5f677270636c" .
"625f726f7574655f74797065180a2001280822be010a0e53696d706c6552" .
"6573706f6e736512260a077061796c6f616418012001280b32152e677270" .
"632e74657374696e672e5061796c6f616412100a08757365726e616d6518" .
"022001280912130a0b6f617574685f73636f706518032001280912110a09" .
"7365727665725f696418042001280912380a11677270636c625f726f7574" .
"655f7479706518052001280e321d2e677270632e74657374696e672e4772" .
"70636c62526f7574655479706512100a08686f73746e616d651806200128" .
"0922770a1953747265616d696e67496e70757443616c6c52657175657374" .
"12260a077061796c6f616418012001280b32152e677270632e7465737469" .
"6e672e5061796c6f616412320a116578706563745f636f6d707265737365" .
"6418022001280b32172e677270632e74657374696e672e426f6f6c56616c" .
"7565223d0a1a53747265616d696e67496e70757443616c6c526573706f6e" .
"7365121f0a17616767726567617465645f7061796c6f61645f73697a6518" .
"012001280522640a12526573706f6e7365506172616d6574657273120c0a" .
"0473697a6518012001280512130a0b696e74657276616c5f757318022001" .
"2805122b0a0a636f6d7072657373656418032001280b32172e677270632e" .
"74657374696e672e426f6f6c56616c756522e8010a1a53747265616d696e" .
"674f757470757443616c6c5265717565737412300a0d726573706f6e7365" .
"5f7479706518012001280e32192e677270632e74657374696e672e506179" .
"6c6f616454797065123d0a13726573706f6e73655f706172616d65746572" .
"7318022003280b32202e677270632e74657374696e672e526573706f6e73" .
"65506172616d657465727312260a077061796c6f616418032001280b3215" .
"2e677270632e74657374696e672e5061796c6f616412310a0f726573706f" .
"6e73655f73746174757318072001280b32182e677270632e74657374696e" .
"672e4563686f53746174757322450a1b53747265616d696e674f75747075" .
"7443616c6c526573706f6e736512260a077061796c6f616418012001280b" .
"32152e677270632e74657374696e672e5061796c6f616422330a0f526563" .
"6f6e6e656374506172616d7312200a186d61785f7265636f6e6e6563745f" .
"6261636b6f66665f6d7318012001280522330a0d5265636f6e6e65637449" .
"6e666f120e0a0670617373656418012001280812120a0a6261636b6f6666" .
"5f6d7318022003280522410a184c6f616442616c616e6365725374617473" .
"5265717565737412100a086e756d5f7270637318012001280512130a0b74" .
"696d656f75745f73656318022001280522b3010a194c6f616442616c616e" .
"6365725374617473526573706f6e7365124d0a0c727063735f62795f7065" .
"657218012003280b32372e677270632e74657374696e672e4c6f61644261" .
"6c616e6365725374617473526573706f6e73652e52706373427950656572" .
"456e74727912140a0c6e756d5f6661696c757265731802200128051a310a" .
"0f52706373427950656572456e747279120b0a036b657918012001280912" .
"0d0a0576616c75651802200128053a0238012a1f0a0b5061796c6f616454" .
"79706512100a0c434f4d505245535341424c4510002a6f0a0f477270636c" .
"62526f75746554797065121d0a19475250434c425f524f5554455f545950" .
"455f554e4b4e4f574e1000121e0a1a475250434c425f524f5554455f5459" .
"50455f46414c4c4241434b1001121d0a19475250434c425f524f5554455f" .
"545950455f4241434b454e441002620670726f746f33"
), true);
static::$is_initialized = true;
}
}

@ -4,7 +4,7 @@
namespace GPBMetadata\Src\Proto\Grpc\Testing;
class GPBEmpty
class PBEmpty
{
public static $is_initialized = false;
@ -15,10 +15,10 @@ class GPBEmpty
return;
}
$pool->internalAddGeneratedFile(hex2bin(
"0a430a227372632f70726f746f2f677270632f74657374696e672f656d70" .
"74792e70726f746f120c677270632e74657374696e6722070a05456d7074" .
"79620670726f746f33"
));
"0a4a0a227372632f70726f746f2f677270632f74657374696e672f656d70" .
"74792e70726f746f120c677270632e74657374696e67220e0a0c456d7074" .
"794d657373616765620670726f746f33"
), true);
static::$is_initialized = true;
}

@ -0,0 +1,66 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: src/proto/grpc/testing/test.proto
namespace GPBMetadata\Src\Proto\Grpc\Testing;
class Test
{
public static $is_initialized = false;
public static function initOnce() {
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
if (static::$is_initialized == true) {
return;
}
\GPBMetadata\Src\Proto\Grpc\Testing\PBEmpty::initOnce();
\GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce();
$pool->internalAddGeneratedFile(hex2bin(
"0aca090a217372632f70726f746f2f677270632f74657374696e672f7465" .
"73742e70726f746f120c677270632e74657374696e671a257372632f7072" .
"6f746f2f677270632f74657374696e672f6d657373616765732e70726f74" .
"6f32e7050a0b546573745365727669636512430a09456d70747943616c6c" .
"121a2e677270632e74657374696e672e456d7074794d6573736167651a1a" .
"2e677270632e74657374696e672e456d7074794d65737361676512460a09" .
"556e61727943616c6c121b2e677270632e74657374696e672e53696d706c" .
"65526571756573741a1c2e677270632e74657374696e672e53696d706c65" .
"526573706f6e7365124f0a12436163686561626c65556e61727943616c6c" .
"121b2e677270632e74657374696e672e53696d706c65526571756573741a" .
"1c2e677270632e74657374696e672e53696d706c65526573706f6e736512" .
"6c0a1353747265616d696e674f757470757443616c6c12282e677270632e" .
"74657374696e672e53747265616d696e674f757470757443616c6c526571" .
"756573741a292e677270632e74657374696e672e53747265616d696e674f" .
"757470757443616c6c526573706f6e7365300112690a1253747265616d69" .
"6e67496e70757443616c6c12272e677270632e74657374696e672e537472" .
"65616d696e67496e70757443616c6c526571756573741a282e677270632e" .
"74657374696e672e53747265616d696e67496e70757443616c6c52657370" .
"6f6e7365280112690a0e46756c6c4475706c657843616c6c12282e677270" .
"632e74657374696e672e53747265616d696e674f757470757443616c6c52" .
"6571756573741a292e677270632e74657374696e672e53747265616d696e" .
"674f757470757443616c6c526573706f6e73652801300112690a0e48616c" .
"664475706c657843616c6c12282e677270632e74657374696e672e537472" .
"65616d696e674f757470757443616c6c526571756573741a292e67727063" .
"2e74657374696e672e53747265616d696e674f757470757443616c6c5265" .
"73706f6e736528013001124b0a11556e696d706c656d656e74656443616c" .
"6c121a2e677270632e74657374696e672e456d7074794d6573736167651a" .
"1a2e677270632e74657374696e672e456d7074794d65737361676532630a" .
"14556e696d706c656d656e74656453657276696365124b0a11556e696d70" .
"6c656d656e74656443616c6c121a2e677270632e74657374696e672e456d" .
"7074794d6573736167651a1a2e677270632e74657374696e672e456d7074" .
"794d6573736167653297010a105265636f6e6e6563745365727669636512" .
"420a055374617274121d2e677270632e74657374696e672e5265636f6e6e" .
"656374506172616d731a1a2e677270632e74657374696e672e456d707479" .
"4d657373616765123f0a0453746f70121a2e677270632e74657374696e67" .
"2e456d7074794d6573736167651a1b2e677270632e74657374696e672e52" .
"65636f6e6e656374496e666f327f0a184c6f616442616c616e6365725374" .
"6174735365727669636512630a0e476574436c69656e7453746174731226" .
"2e677270632e74657374696e672e4c6f616442616c616e63657253746174" .
"73526571756573741a272e677270632e74657374696e672e4c6f61644261" .
"6c616e6365725374617473526573706f6e73652200620670726f746f33"
), true);
static::$is_initialized = true;
}
}

@ -0,0 +1,69 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: src/proto/grpc/testing/messages.proto
namespace Grpc\Testing;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* TODO(dgq): Go back to using well-known types once
* https://github.com/grpc/grpc/issues/6980 has been fixed.
* import "google/protobuf/wrappers.proto";
*
* Generated from protobuf message <code>grpc.testing.BoolValue</code>
*/
class BoolValue extends \Google\Protobuf\Internal\Message
{
/**
* The bool value.
*
* Generated from protobuf field <code>bool value = 1;</code>
*/
protected $value = false;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type bool $value
* The bool value.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce();
parent::__construct($data);
}
/**
* The bool value.
*
* Generated from protobuf field <code>bool value = 1;</code>
* @return bool
*/
public function getValue()
{
return $this->value;
}
/**
* The bool value.
*
* Generated from protobuf field <code>bool value = 1;</code>
* @param bool $var
* @return $this
*/
public function setValue($var)
{
GPBUtil::checkBool($var);
$this->value = $var;
return $this;
}
}

@ -0,0 +1,88 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: src/proto/grpc/testing/messages.proto
namespace Grpc\Testing;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* A protobuf representation for grpc status. This is used by test
* clients to specify a status that the server should attempt to return.
*
* Generated from protobuf message <code>grpc.testing.EchoStatus</code>
*/
class EchoStatus extends \Google\Protobuf\Internal\Message
{
/**
* Generated from protobuf field <code>int32 code = 1;</code>
*/
protected $code = 0;
/**
* Generated from protobuf field <code>string message = 2;</code>
*/
protected $message = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int $code
* @type string $message
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce();
parent::__construct($data);
}
/**
* Generated from protobuf field <code>int32 code = 1;</code>
* @return int
*/
public function getCode()
{
return $this->code;
}
/**
* Generated from protobuf field <code>int32 code = 1;</code>
* @param int $var
* @return $this
*/
public function setCode($var)
{
GPBUtil::checkInt32($var);
$this->code = $var;
return $this;
}
/**
* Generated from protobuf field <code>string message = 2;</code>
* @return string
*/
public function getMessage()
{
return $this->message;
}
/**
* Generated from protobuf field <code>string message = 2;</code>
* @param string $var
* @return $this
*/
public function setMessage($var)
{
GPBUtil::checkString($var, True);
$this->message = $var;
return $this;
}
}

@ -16,14 +16,22 @@ use Google\Protobuf\Internal\GPBUtil;
* rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { };
* };
*
* Generated from protobuf message <code>grpc.testing.Empty</code>
* Generated from protobuf message <code>grpc.testing.EmptyMessage</code>
*/
class PBEmpty extends \Google\Protobuf\Internal\Message
class EmptyMessage extends \Google\Protobuf\Internal\Message
{
public function __construct() {
\GPBMetadata\Src\Proto\Grpc\Testing\GPBEmpty::initOnce();
parent::__construct();
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Src\Proto\Grpc\Testing\PBEmpty::initOnce();
parent::__construct($data);
}
}

@ -0,0 +1,38 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: src/proto/grpc/testing/empty.proto
namespace Grpc\Testing;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* 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.Empty) returns (grpc.testing.Empty) { };
* };
*
* Generated from protobuf message <code>grpc.testing.EmptyMessageMessage</code>
*/
class EmptyMessageMessage extends \Google\Protobuf\Internal\Message
{
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Src\Proto\Grpc\Testing\PBEmpty::initOnce();
parent::__construct($data);
}
}

@ -0,0 +1,66 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: src/proto/grpc/testing/messages.proto
namespace Grpc\Testing;
use UnexpectedValueException;
/**
* The type of route that a client took to reach a server w.r.t. gRPCLB.
* The server must fill in "fallback" if it detects that the RPC reached
* the server via the "gRPCLB fallback" path, and "backend" if it detects
* that the RPC reached the server via "gRPCLB backend" path (i.e. if it got
* the address of this server from the gRPCLB server BalanceLoad RPC). Exactly
* how this detection is done is context and server dependent.
*
* Protobuf type <code>grpc.testing.GrpclbRouteType</code>
*/
class GrpclbRouteType
{
/**
* Server didn't detect the route that a client took to reach it.
*
* Generated from protobuf enum <code>GRPCLB_ROUTE_TYPE_UNKNOWN = 0;</code>
*/
const GRPCLB_ROUTE_TYPE_UNKNOWN = 0;
/**
* Indicates that a client reached a server via gRPCLB fallback.
*
* Generated from protobuf enum <code>GRPCLB_ROUTE_TYPE_FALLBACK = 1;</code>
*/
const GRPCLB_ROUTE_TYPE_FALLBACK = 1;
/**
* Indicates that a client reached a server as a gRPCLB-given backend.
*
* Generated from protobuf enum <code>GRPCLB_ROUTE_TYPE_BACKEND = 2;</code>
*/
const GRPCLB_ROUTE_TYPE_BACKEND = 2;
private static $valueToName = [
self::GRPCLB_ROUTE_TYPE_UNKNOWN => 'GRPCLB_ROUTE_TYPE_UNKNOWN',
self::GRPCLB_ROUTE_TYPE_FALLBACK => 'GRPCLB_ROUTE_TYPE_FALLBACK',
self::GRPCLB_ROUTE_TYPE_BACKEND => 'GRPCLB_ROUTE_TYPE_BACKEND',
];
public static function name($value)
{
if (!isset(self::$valueToName[$value])) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no name defined for value %s', __CLASS__, $value));
}
return self::$valueToName[$value];
}
public static function value($name)
{
$const = __CLASS__ . '::' . strtoupper($name);
if (!defined($const)) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no value defined for name %s', __CLASS__, $name));
}
return constant($const);
}
}

@ -0,0 +1,99 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: src/proto/grpc/testing/messages.proto
namespace Grpc\Testing;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Generated from protobuf message <code>grpc.testing.LoadBalancerStatsRequest</code>
*/
class LoadBalancerStatsRequest extends \Google\Protobuf\Internal\Message
{
/**
* Request stats for the next num_rpcs sent by client.
*
* Generated from protobuf field <code>int32 num_rpcs = 1;</code>
*/
protected $num_rpcs = 0;
/**
* If num_rpcs have not completed within timeout_sec, return partial results.
*
* Generated from protobuf field <code>int32 timeout_sec = 2;</code>
*/
protected $timeout_sec = 0;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int $num_rpcs
* Request stats for the next num_rpcs sent by client.
* @type int $timeout_sec
* If num_rpcs have not completed within timeout_sec, return partial results.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce();
parent::__construct($data);
}
/**
* Request stats for the next num_rpcs sent by client.
*
* Generated from protobuf field <code>int32 num_rpcs = 1;</code>
* @return int
*/
public function getNumRpcs()
{
return $this->num_rpcs;
}
/**
* Request stats for the next num_rpcs sent by client.
*
* Generated from protobuf field <code>int32 num_rpcs = 1;</code>
* @param int $var
* @return $this
*/
public function setNumRpcs($var)
{
GPBUtil::checkInt32($var);
$this->num_rpcs = $var;
return $this;
}
/**
* If num_rpcs have not completed within timeout_sec, return partial results.
*
* Generated from protobuf field <code>int32 timeout_sec = 2;</code>
* @return int
*/
public function getTimeoutSec()
{
return $this->timeout_sec;
}
/**
* If num_rpcs have not completed within timeout_sec, return partial results.
*
* Generated from protobuf field <code>int32 timeout_sec = 2;</code>
* @param int $var
* @return $this
*/
public function setTimeoutSec($var)
{
GPBUtil::checkInt32($var);
$this->timeout_sec = $var;
return $this;
}
}

@ -0,0 +1,99 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: src/proto/grpc/testing/messages.proto
namespace Grpc\Testing;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Generated from protobuf message <code>grpc.testing.LoadBalancerStatsResponse</code>
*/
class LoadBalancerStatsResponse extends \Google\Protobuf\Internal\Message
{
/**
* The number of completed RPCs for each peer.
*
* Generated from protobuf field <code>map<string, int32> rpcs_by_peer = 1;</code>
*/
private $rpcs_by_peer;
/**
* The number of RPCs that failed to record a remote peer.
*
* Generated from protobuf field <code>int32 num_failures = 2;</code>
*/
protected $num_failures = 0;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type array|\Google\Protobuf\Internal\MapField $rpcs_by_peer
* The number of completed RPCs for each peer.
* @type int $num_failures
* The number of RPCs that failed to record a remote peer.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce();
parent::__construct($data);
}
/**
* The number of completed RPCs for each peer.
*
* Generated from protobuf field <code>map<string, int32> rpcs_by_peer = 1;</code>
* @return \Google\Protobuf\Internal\MapField
*/
public function getRpcsByPeer()
{
return $this->rpcs_by_peer;
}
/**
* The number of completed RPCs for each peer.
*
* Generated from protobuf field <code>map<string, int32> rpcs_by_peer = 1;</code>
* @param array|\Google\Protobuf\Internal\MapField $var
* @return $this
*/
public function setRpcsByPeer($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT32);
$this->rpcs_by_peer = $arr;
return $this;
}
/**
* The number of RPCs that failed to record a remote peer.
*
* Generated from protobuf field <code>int32 num_failures = 2;</code>
* @return int
*/
public function getNumFailures()
{
return $this->num_failures;
}
/**
* The number of RPCs that failed to record a remote peer.
*
* Generated from protobuf field <code>int32 num_failures = 2;</code>
* @param int $var
* @return $this
*/
public function setNumFailures($var)
{
GPBUtil::checkInt32($var);
$this->num_failures = $var;
return $this;
}
}

@ -0,0 +1,52 @@
<?php
// GENERATED CODE -- DO NOT EDIT!
// Original file comments:
// Copyright 2015-2016 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// An integration test service that covers all the method signature permutations
// of unary/streaming requests/responses.
//
namespace Grpc\Testing;
/**
* A service used to obtain stats for verifying LB behavior.
*/
class LoadBalancerStatsServiceClient extends \Grpc\BaseStub {
/**
* @param string $hostname hostname
* @param array $opts channel options
* @param \Grpc\Channel $channel (optional) re-use channel object
*/
public function __construct($hostname, $opts, $channel = null) {
parent::__construct($hostname, $opts, $channel);
}
/**
* Gets the backend distribution for RPCs sent by a test client.
* @param \Grpc\Testing\LoadBalancerStatsRequest $argument input argument
* @param array $metadata metadata
* @param array $options call options
*/
public function GetClientStats(\Grpc\Testing\LoadBalancerStatsRequest $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/grpc.testing.LoadBalancerStatsService/GetClientStats',
$argument,
['\Grpc\Testing\LoadBalancerStatsResponse', 'decode'],
$metadata, $options);
}
}

@ -0,0 +1,101 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: src/proto/grpc/testing/messages.proto
namespace Grpc\Testing;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* A block of data, to simply increase gRPC message size.
*
* Generated from protobuf message <code>grpc.testing.Payload</code>
*/
class Payload extends \Google\Protobuf\Internal\Message
{
/**
* The type of data in body.
*
* Generated from protobuf field <code>.grpc.testing.PayloadType type = 1;</code>
*/
protected $type = 0;
/**
* Primary contents of payload.
*
* Generated from protobuf field <code>bytes body = 2;</code>
*/
protected $body = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int $type
* The type of data in body.
* @type string $body
* Primary contents of payload.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce();
parent::__construct($data);
}
/**
* The type of data in body.
*
* Generated from protobuf field <code>.grpc.testing.PayloadType type = 1;</code>
* @return int
*/
public function getType()
{
return $this->type;
}
/**
* The type of data in body.
*
* Generated from protobuf field <code>.grpc.testing.PayloadType type = 1;</code>
* @param int $var
* @return $this
*/
public function setType($var)
{
GPBUtil::checkEnum($var, \Grpc\Testing\PayloadType::class);
$this->type = $var;
return $this;
}
/**
* Primary contents of payload.
*
* Generated from protobuf field <code>bytes body = 2;</code>
* @return string
*/
public function getBody()
{
return $this->body;
}
/**
* Primary contents of payload.
*
* Generated from protobuf field <code>bytes body = 2;</code>
* @param string $var
* @return $this
*/
public function setBody($var)
{
GPBUtil::checkString($var, False);
$this->body = $var;
return $this;
}
}

@ -0,0 +1,47 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: src/proto/grpc/testing/messages.proto
namespace Grpc\Testing;
use UnexpectedValueException;
/**
* The type of payload that should be returned.
*
* Protobuf type <code>grpc.testing.PayloadType</code>
*/
class PayloadType
{
/**
* Compressable text format.
*
* Generated from protobuf enum <code>COMPRESSABLE = 0;</code>
*/
const COMPRESSABLE = 0;
private static $valueToName = [
self::COMPRESSABLE => 'COMPRESSABLE',
];
public static function name($value)
{
if (!isset(self::$valueToName[$value])) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no name defined for value %s', __CLASS__, $value));
}
return self::$valueToName[$value];
}
public static function value($name)
{
$const = __CLASS__ . '::' . strtoupper($name);
if (!defined($const)) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no value defined for name %s', __CLASS__, $name));
}
return constant($const);
}
}

@ -0,0 +1,89 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: src/proto/grpc/testing/messages.proto
namespace Grpc\Testing;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* For reconnect interop test only.
* Server tells client whether its reconnects are following the spec and the
* reconnect backoffs it saw.
*
* Generated from protobuf message <code>grpc.testing.ReconnectInfo</code>
*/
class ReconnectInfo extends \Google\Protobuf\Internal\Message
{
/**
* Generated from protobuf field <code>bool passed = 1;</code>
*/
protected $passed = false;
/**
* Generated from protobuf field <code>repeated int32 backoff_ms = 2;</code>
*/
private $backoff_ms;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type bool $passed
* @type int[]|\Google\Protobuf\Internal\RepeatedField $backoff_ms
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce();
parent::__construct($data);
}
/**
* Generated from protobuf field <code>bool passed = 1;</code>
* @return bool
*/
public function getPassed()
{
return $this->passed;
}
/**
* Generated from protobuf field <code>bool passed = 1;</code>
* @param bool $var
* @return $this
*/
public function setPassed($var)
{
GPBUtil::checkBool($var);
$this->passed = $var;
return $this;
}
/**
* Generated from protobuf field <code>repeated int32 backoff_ms = 2;</code>
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getBackoffMs()
{
return $this->backoff_ms;
}
/**
* Generated from protobuf field <code>repeated int32 backoff_ms = 2;</code>
* @param int[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setBackoffMs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
$this->backoff_ms = $arr;
return $this;
}
}

@ -0,0 +1,61 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: src/proto/grpc/testing/messages.proto
namespace Grpc\Testing;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* For reconnect interop test only.
* Client tells server what reconnection parameters it used.
*
* Generated from protobuf message <code>grpc.testing.ReconnectParams</code>
*/
class ReconnectParams extends \Google\Protobuf\Internal\Message
{
/**
* Generated from protobuf field <code>int32 max_reconnect_backoff_ms = 1;</code>
*/
protected $max_reconnect_backoff_ms = 0;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int $max_reconnect_backoff_ms
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce();
parent::__construct($data);
}
/**
* Generated from protobuf field <code>int32 max_reconnect_backoff_ms = 1;</code>
* @return int
*/
public function getMaxReconnectBackoffMs()
{
return $this->max_reconnect_backoff_ms;
}
/**
* Generated from protobuf field <code>int32 max_reconnect_backoff_ms = 1;</code>
* @param int $var
* @return $this
*/
public function setMaxReconnectBackoffMs($var)
{
GPBUtil::checkInt32($var);
$this->max_reconnect_backoff_ms = $var;
return $this;
}
}

@ -16,17 +16,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Contains the definitions for a metrics service and the type of metrics
// exposed by the service.
// An integration test service that covers all the method signature permutations
// of unary/streaming requests/responses.
//
// Currently, 'Gauge' (i.e a metric that represents the measured value of
// something at an instant of time) is the only metric type supported by the
// service.
namespace Grpc\Testing;
/**
* A service used to control reconnect server.
*/
class MetricsServiceClient extends \Grpc\BaseStub {
class ReconnectServiceClient extends \Grpc\BaseStub {
/**
* @param string $hostname hostname
@ -38,31 +36,28 @@ class MetricsServiceClient extends \Grpc\BaseStub {
}
/**
* Returns the values of all the gauges that are currently being maintained by
* the service
* @param \Grpc\Testing\EmptyMessage $argument input argument
* @param \Grpc\Testing\ReconnectParams $argument input argument
* @param array $metadata metadata
* @param array $options call options
*/
public function GetAllGauges(\Grpc\Testing\EmptyMessage $argument,
public function Start(\Grpc\Testing\ReconnectParams $argument,
$metadata = [], $options = []) {
return $this->_serverStreamRequest('/grpc.testing.MetricsService/GetAllGauges',
return $this->_simpleRequest('/grpc.testing.ReconnectService/Start',
$argument,
['\Grpc\Testing\GaugeResponse', 'decode'],
['\Grpc\Testing\EmptyMessage', 'decode'],
$metadata, $options);
}
/**
* Returns the value of one gauge
* @param \Grpc\Testing\GaugeRequest $argument input argument
* @param \Grpc\Testing\EmptyMessage $argument input argument
* @param array $metadata metadata
* @param array $options call options
*/
public function GetGauge(\Grpc\Testing\GaugeRequest $argument,
public function Stop(\Grpc\Testing\EmptyMessage $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/grpc.testing.MetricsService/GetGauge',
return $this->_simpleRequest('/grpc.testing.ReconnectService/Stop',
$argument,
['\Grpc\Testing\GaugeResponse', 'decode'],
['\Grpc\Testing\ReconnectInfo', 'decode'],
$metadata, $options);
}

@ -0,0 +1,151 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: src/proto/grpc/testing/messages.proto
namespace Grpc\Testing;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Configuration for a particular response.
*
* Generated from protobuf message <code>grpc.testing.ResponseParameters</code>
*/
class ResponseParameters extends \Google\Protobuf\Internal\Message
{
/**
* Desired payload sizes in responses from the server.
*
* Generated from protobuf field <code>int32 size = 1;</code>
*/
protected $size = 0;
/**
* Desired interval between consecutive responses in the response stream in
* microseconds.
*
* Generated from protobuf field <code>int32 interval_us = 2;</code>
*/
protected $interval_us = 0;
/**
* Whether to request the server to compress the response. This field is
* "nullable" in order to interoperate seamlessly with clients not able to
* implement the full compression tests by introspecting the call to verify
* the response's compression status.
*
* Generated from protobuf field <code>.grpc.testing.BoolValue compressed = 3;</code>
*/
protected $compressed = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int $size
* Desired payload sizes in responses from the server.
* @type int $interval_us
* Desired interval between consecutive responses in the response stream in
* microseconds.
* @type \Grpc\Testing\BoolValue $compressed
* Whether to request the server to compress the response. This field is
* "nullable" in order to interoperate seamlessly with clients not able to
* implement the full compression tests by introspecting the call to verify
* the response's compression status.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce();
parent::__construct($data);
}
/**
* Desired payload sizes in responses from the server.
*
* Generated from protobuf field <code>int32 size = 1;</code>
* @return int
*/
public function getSize()
{
return $this->size;
}
/**
* Desired payload sizes in responses from the server.
*
* Generated from protobuf field <code>int32 size = 1;</code>
* @param int $var
* @return $this
*/
public function setSize($var)
{
GPBUtil::checkInt32($var);
$this->size = $var;
return $this;
}
/**
* Desired interval between consecutive responses in the response stream in
* microseconds.
*
* Generated from protobuf field <code>int32 interval_us = 2;</code>
* @return int
*/
public function getIntervalUs()
{
return $this->interval_us;
}
/**
* Desired interval between consecutive responses in the response stream in
* microseconds.
*
* Generated from protobuf field <code>int32 interval_us = 2;</code>
* @param int $var
* @return $this
*/
public function setIntervalUs($var)
{
GPBUtil::checkInt32($var);
$this->interval_us = $var;
return $this;
}
/**
* Whether to request the server to compress the response. This field is
* "nullable" in order to interoperate seamlessly with clients not able to
* implement the full compression tests by introspecting the call to verify
* the response's compression status.
*
* Generated from protobuf field <code>.grpc.testing.BoolValue compressed = 3;</code>
* @return \Grpc\Testing\BoolValue
*/
public function getCompressed()
{
return $this->compressed;
}
/**
* Whether to request the server to compress the response. This field is
* "nullable" in order to interoperate seamlessly with clients not able to
* implement the full compression tests by introspecting the call to verify
* the response's compression status.
*
* Generated from protobuf field <code>.grpc.testing.BoolValue compressed = 3;</code>
* @param \Grpc\Testing\BoolValue $var
* @return $this
*/
public function setCompressed($var)
{
GPBUtil::checkMessage($var, \Grpc\Testing\BoolValue::class);
$this->compressed = $var;
return $this;
}
}

@ -0,0 +1,389 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: src/proto/grpc/testing/messages.proto
namespace Grpc\Testing;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Unary request.
*
* Generated from protobuf message <code>grpc.testing.SimpleRequest</code>
*/
class SimpleRequest extends \Google\Protobuf\Internal\Message
{
/**
* Desired payload type in the response from the server.
* If response_type is RANDOM, server randomly chooses one from other formats.
*
* Generated from protobuf field <code>.grpc.testing.PayloadType response_type = 1;</code>
*/
protected $response_type = 0;
/**
* Desired payload size in the response from the server.
*
* Generated from protobuf field <code>int32 response_size = 2;</code>
*/
protected $response_size = 0;
/**
* Optional input payload sent along with the request.
*
* Generated from protobuf field <code>.grpc.testing.Payload payload = 3;</code>
*/
protected $payload = null;
/**
* Whether SimpleResponse should include username.
*
* Generated from protobuf field <code>bool fill_username = 4;</code>
*/
protected $fill_username = false;
/**
* Whether SimpleResponse should include OAuth scope.
*
* Generated from protobuf field <code>bool fill_oauth_scope = 5;</code>
*/
protected $fill_oauth_scope = false;
/**
* Whether to request the server to compress the response. This field is
* "nullable" in order to interoperate seamlessly with clients not able to
* implement the full compression tests by introspecting the call to verify
* the response's compression status.
*
* Generated from protobuf field <code>.grpc.testing.BoolValue response_compressed = 6;</code>
*/
protected $response_compressed = null;
/**
* Whether server should return a given status
*
* Generated from protobuf field <code>.grpc.testing.EchoStatus response_status = 7;</code>
*/
protected $response_status = null;
/**
* Whether the server should expect this request to be compressed.
*
* Generated from protobuf field <code>.grpc.testing.BoolValue expect_compressed = 8;</code>
*/
protected $expect_compressed = null;
/**
* Whether SimpleResponse should include server_id.
*
* Generated from protobuf field <code>bool fill_server_id = 9;</code>
*/
protected $fill_server_id = false;
/**
* Whether SimpleResponse should include grpclb_route_type.
*
* Generated from protobuf field <code>bool fill_grpclb_route_type = 10;</code>
*/
protected $fill_grpclb_route_type = false;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int $response_type
* Desired payload type in the response from the server.
* If response_type is RANDOM, server randomly chooses one from other formats.
* @type int $response_size
* Desired payload size in the response from the server.
* @type \Grpc\Testing\Payload $payload
* Optional input payload sent along with the request.
* @type bool $fill_username
* Whether SimpleResponse should include username.
* @type bool $fill_oauth_scope
* Whether SimpleResponse should include OAuth scope.
* @type \Grpc\Testing\BoolValue $response_compressed
* Whether to request the server to compress the response. This field is
* "nullable" in order to interoperate seamlessly with clients not able to
* implement the full compression tests by introspecting the call to verify
* the response's compression status.
* @type \Grpc\Testing\EchoStatus $response_status
* Whether server should return a given status
* @type \Grpc\Testing\BoolValue $expect_compressed
* Whether the server should expect this request to be compressed.
* @type bool $fill_server_id
* Whether SimpleResponse should include server_id.
* @type bool $fill_grpclb_route_type
* Whether SimpleResponse should include grpclb_route_type.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce();
parent::__construct($data);
}
/**
* Desired payload type in the response from the server.
* If response_type is RANDOM, server randomly chooses one from other formats.
*
* Generated from protobuf field <code>.grpc.testing.PayloadType response_type = 1;</code>
* @return int
*/
public function getResponseType()
{
return $this->response_type;
}
/**
* Desired payload type in the response from the server.
* If response_type is RANDOM, server randomly chooses one from other formats.
*
* Generated from protobuf field <code>.grpc.testing.PayloadType response_type = 1;</code>
* @param int $var
* @return $this
*/
public function setResponseType($var)
{
GPBUtil::checkEnum($var, \Grpc\Testing\PayloadType::class);
$this->response_type = $var;
return $this;
}
/**
* Desired payload size in the response from the server.
*
* Generated from protobuf field <code>int32 response_size = 2;</code>
* @return int
*/
public function getResponseSize()
{
return $this->response_size;
}
/**
* Desired payload size in the response from the server.
*
* Generated from protobuf field <code>int32 response_size = 2;</code>
* @param int $var
* @return $this
*/
public function setResponseSize($var)
{
GPBUtil::checkInt32($var);
$this->response_size = $var;
return $this;
}
/**
* Optional input payload sent along with the request.
*
* Generated from protobuf field <code>.grpc.testing.Payload payload = 3;</code>
* @return \Grpc\Testing\Payload
*/
public function getPayload()
{
return $this->payload;
}
/**
* Optional input payload sent along with the request.
*
* Generated from protobuf field <code>.grpc.testing.Payload payload = 3;</code>
* @param \Grpc\Testing\Payload $var
* @return $this
*/
public function setPayload($var)
{
GPBUtil::checkMessage($var, \Grpc\Testing\Payload::class);
$this->payload = $var;
return $this;
}
/**
* Whether SimpleResponse should include username.
*
* Generated from protobuf field <code>bool fill_username = 4;</code>
* @return bool
*/
public function getFillUsername()
{
return $this->fill_username;
}
/**
* Whether SimpleResponse should include username.
*
* Generated from protobuf field <code>bool fill_username = 4;</code>
* @param bool $var
* @return $this
*/
public function setFillUsername($var)
{
GPBUtil::checkBool($var);
$this->fill_username = $var;
return $this;
}
/**
* Whether SimpleResponse should include OAuth scope.
*
* Generated from protobuf field <code>bool fill_oauth_scope = 5;</code>
* @return bool
*/
public function getFillOauthScope()
{
return $this->fill_oauth_scope;
}
/**
* Whether SimpleResponse should include OAuth scope.
*
* Generated from protobuf field <code>bool fill_oauth_scope = 5;</code>
* @param bool $var
* @return $this
*/
public function setFillOauthScope($var)
{
GPBUtil::checkBool($var);
$this->fill_oauth_scope = $var;
return $this;
}
/**
* Whether to request the server to compress the response. This field is
* "nullable" in order to interoperate seamlessly with clients not able to
* implement the full compression tests by introspecting the call to verify
* the response's compression status.
*
* Generated from protobuf field <code>.grpc.testing.BoolValue response_compressed = 6;</code>
* @return \Grpc\Testing\BoolValue
*/
public function getResponseCompressed()
{
return $this->response_compressed;
}
/**
* Whether to request the server to compress the response. This field is
* "nullable" in order to interoperate seamlessly with clients not able to
* implement the full compression tests by introspecting the call to verify
* the response's compression status.
*
* Generated from protobuf field <code>.grpc.testing.BoolValue response_compressed = 6;</code>
* @param \Grpc\Testing\BoolValue $var
* @return $this
*/
public function setResponseCompressed($var)
{
GPBUtil::checkMessage($var, \Grpc\Testing\BoolValue::class);
$this->response_compressed = $var;
return $this;
}
/**
* Whether server should return a given status
*
* Generated from protobuf field <code>.grpc.testing.EchoStatus response_status = 7;</code>
* @return \Grpc\Testing\EchoStatus
*/
public function getResponseStatus()
{
return $this->response_status;
}
/**
* Whether server should return a given status
*
* Generated from protobuf field <code>.grpc.testing.EchoStatus response_status = 7;</code>
* @param \Grpc\Testing\EchoStatus $var
* @return $this
*/
public function setResponseStatus($var)
{
GPBUtil::checkMessage($var, \Grpc\Testing\EchoStatus::class);
$this->response_status = $var;
return $this;
}
/**
* Whether the server should expect this request to be compressed.
*
* Generated from protobuf field <code>.grpc.testing.BoolValue expect_compressed = 8;</code>
* @return \Grpc\Testing\BoolValue
*/
public function getExpectCompressed()
{
return $this->expect_compressed;
}
/**
* Whether the server should expect this request to be compressed.
*
* Generated from protobuf field <code>.grpc.testing.BoolValue expect_compressed = 8;</code>
* @param \Grpc\Testing\BoolValue $var
* @return $this
*/
public function setExpectCompressed($var)
{
GPBUtil::checkMessage($var, \Grpc\Testing\BoolValue::class);
$this->expect_compressed = $var;
return $this;
}
/**
* Whether SimpleResponse should include server_id.
*
* Generated from protobuf field <code>bool fill_server_id = 9;</code>
* @return bool
*/
public function getFillServerId()
{
return $this->fill_server_id;
}
/**
* Whether SimpleResponse should include server_id.
*
* Generated from protobuf field <code>bool fill_server_id = 9;</code>
* @param bool $var
* @return $this
*/
public function setFillServerId($var)
{
GPBUtil::checkBool($var);
$this->fill_server_id = $var;
return $this;
}
/**
* Whether SimpleResponse should include grpclb_route_type.
*
* Generated from protobuf field <code>bool fill_grpclb_route_type = 10;</code>
* @return bool
*/
public function getFillGrpclbRouteType()
{
return $this->fill_grpclb_route_type;
}
/**
* Whether SimpleResponse should include grpclb_route_type.
*
* Generated from protobuf field <code>bool fill_grpclb_route_type = 10;</code>
* @param bool $var
* @return $this
*/
public function setFillGrpclbRouteType($var)
{
GPBUtil::checkBool($var);
$this->fill_grpclb_route_type = $var;
return $this;
}
}

@ -0,0 +1,245 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: src/proto/grpc/testing/messages.proto
namespace Grpc\Testing;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Unary response, as configured by the request.
*
* Generated from protobuf message <code>grpc.testing.SimpleResponse</code>
*/
class SimpleResponse extends \Google\Protobuf\Internal\Message
{
/**
* Payload to increase message size.
*
* Generated from protobuf field <code>.grpc.testing.Payload payload = 1;</code>
*/
protected $payload = null;
/**
* The user the request came from, for verifying authentication was
* successful when the client expected it.
*
* Generated from protobuf field <code>string username = 2;</code>
*/
protected $username = '';
/**
* OAuth scope.
*
* Generated from protobuf field <code>string oauth_scope = 3;</code>
*/
protected $oauth_scope = '';
/**
* Server ID. This must be unique among different server instances,
* but the same across all RPC's made to a particular server instance.
*
* Generated from protobuf field <code>string server_id = 4;</code>
*/
protected $server_id = '';
/**
* gRPCLB Path.
*
* Generated from protobuf field <code>.grpc.testing.GrpclbRouteType grpclb_route_type = 5;</code>
*/
protected $grpclb_route_type = 0;
/**
* Server hostname.
*
* Generated from protobuf field <code>string hostname = 6;</code>
*/
protected $hostname = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Grpc\Testing\Payload $payload
* Payload to increase message size.
* @type string $username
* The user the request came from, for verifying authentication was
* successful when the client expected it.
* @type string $oauth_scope
* OAuth scope.
* @type string $server_id
* Server ID. This must be unique among different server instances,
* but the same across all RPC's made to a particular server instance.
* @type int $grpclb_route_type
* gRPCLB Path.
* @type string $hostname
* Server hostname.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce();
parent::__construct($data);
}
/**
* Payload to increase message size.
*
* Generated from protobuf field <code>.grpc.testing.Payload payload = 1;</code>
* @return \Grpc\Testing\Payload
*/
public function getPayload()
{
return $this->payload;
}
/**
* Payload to increase message size.
*
* Generated from protobuf field <code>.grpc.testing.Payload payload = 1;</code>
* @param \Grpc\Testing\Payload $var
* @return $this
*/
public function setPayload($var)
{
GPBUtil::checkMessage($var, \Grpc\Testing\Payload::class);
$this->payload = $var;
return $this;
}
/**
* The user the request came from, for verifying authentication was
* successful when the client expected it.
*
* Generated from protobuf field <code>string username = 2;</code>
* @return string
*/
public function getUsername()
{
return $this->username;
}
/**
* The user the request came from, for verifying authentication was
* successful when the client expected it.
*
* Generated from protobuf field <code>string username = 2;</code>
* @param string $var
* @return $this
*/
public function setUsername($var)
{
GPBUtil::checkString($var, True);
$this->username = $var;
return $this;
}
/**
* OAuth scope.
*
* Generated from protobuf field <code>string oauth_scope = 3;</code>
* @return string
*/
public function getOauthScope()
{
return $this->oauth_scope;
}
/**
* OAuth scope.
*
* Generated from protobuf field <code>string oauth_scope = 3;</code>
* @param string $var
* @return $this
*/
public function setOauthScope($var)
{
GPBUtil::checkString($var, True);
$this->oauth_scope = $var;
return $this;
}
/**
* Server ID. This must be unique among different server instances,
* but the same across all RPC's made to a particular server instance.
*
* Generated from protobuf field <code>string server_id = 4;</code>
* @return string
*/
public function getServerId()
{
return $this->server_id;
}
/**
* Server ID. This must be unique among different server instances,
* but the same across all RPC's made to a particular server instance.
*
* Generated from protobuf field <code>string server_id = 4;</code>
* @param string $var
* @return $this
*/
public function setServerId($var)
{
GPBUtil::checkString($var, True);
$this->server_id = $var;
return $this;
}
/**
* gRPCLB Path.
*
* Generated from protobuf field <code>.grpc.testing.GrpclbRouteType grpclb_route_type = 5;</code>
* @return int
*/
public function getGrpclbRouteType()
{
return $this->grpclb_route_type;
}
/**
* gRPCLB Path.
*
* Generated from protobuf field <code>.grpc.testing.GrpclbRouteType grpclb_route_type = 5;</code>
* @param int $var
* @return $this
*/
public function setGrpclbRouteType($var)
{
GPBUtil::checkEnum($var, \Grpc\Testing\GrpclbRouteType::class);
$this->grpclb_route_type = $var;
return $this;
}
/**
* Server hostname.
*
* Generated from protobuf field <code>string hostname = 6;</code>
* @return string
*/
public function getHostname()
{
return $this->hostname;
}
/**
* Server hostname.
*
* Generated from protobuf field <code>string hostname = 6;</code>
* @param string $var
* @return $this
*/
public function setHostname($var)
{
GPBUtil::checkString($var, True);
$this->hostname = $var;
return $this;
}
}

@ -0,0 +1,113 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: src/proto/grpc/testing/messages.proto
namespace Grpc\Testing;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Client-streaming request.
*
* Generated from protobuf message <code>grpc.testing.StreamingInputCallRequest</code>
*/
class StreamingInputCallRequest extends \Google\Protobuf\Internal\Message
{
/**
* Optional input payload sent along with the request.
*
* Generated from protobuf field <code>.grpc.testing.Payload payload = 1;</code>
*/
protected $payload = null;
/**
* Whether the server should expect this request to be compressed. This field
* is "nullable" in order to interoperate seamlessly with servers not able to
* implement the full compression tests by introspecting the call to verify
* the request's compression status.
*
* Generated from protobuf field <code>.grpc.testing.BoolValue expect_compressed = 2;</code>
*/
protected $expect_compressed = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Grpc\Testing\Payload $payload
* Optional input payload sent along with the request.
* @type \Grpc\Testing\BoolValue $expect_compressed
* Whether the server should expect this request to be compressed. This field
* is "nullable" in order to interoperate seamlessly with servers not able to
* implement the full compression tests by introspecting the call to verify
* the request's compression status.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce();
parent::__construct($data);
}
/**
* Optional input payload sent along with the request.
*
* Generated from protobuf field <code>.grpc.testing.Payload payload = 1;</code>
* @return \Grpc\Testing\Payload
*/
public function getPayload()
{
return $this->payload;
}
/**
* Optional input payload sent along with the request.
*
* Generated from protobuf field <code>.grpc.testing.Payload payload = 1;</code>
* @param \Grpc\Testing\Payload $var
* @return $this
*/
public function setPayload($var)
{
GPBUtil::checkMessage($var, \Grpc\Testing\Payload::class);
$this->payload = $var;
return $this;
}
/**
* Whether the server should expect this request to be compressed. This field
* is "nullable" in order to interoperate seamlessly with servers not able to
* implement the full compression tests by introspecting the call to verify
* the request's compression status.
*
* Generated from protobuf field <code>.grpc.testing.BoolValue expect_compressed = 2;</code>
* @return \Grpc\Testing\BoolValue
*/
public function getExpectCompressed()
{
return $this->expect_compressed;
}
/**
* Whether the server should expect this request to be compressed. This field
* is "nullable" in order to interoperate seamlessly with servers not able to
* implement the full compression tests by introspecting the call to verify
* the request's compression status.
*
* Generated from protobuf field <code>.grpc.testing.BoolValue expect_compressed = 2;</code>
* @param \Grpc\Testing\BoolValue $var
* @return $this
*/
public function setExpectCompressed($var)
{
GPBUtil::checkMessage($var, \Grpc\Testing\BoolValue::class);
$this->expect_compressed = $var;
return $this;
}
}

@ -0,0 +1,67 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: src/proto/grpc/testing/messages.proto
namespace Grpc\Testing;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Client-streaming response.
*
* Generated from protobuf message <code>grpc.testing.StreamingInputCallResponse</code>
*/
class StreamingInputCallResponse extends \Google\Protobuf\Internal\Message
{
/**
* Aggregated size of payloads received from the client.
*
* Generated from protobuf field <code>int32 aggregated_payload_size = 1;</code>
*/
protected $aggregated_payload_size = 0;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int $aggregated_payload_size
* Aggregated size of payloads received from the client.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce();
parent::__construct($data);
}
/**
* Aggregated size of payloads received from the client.
*
* Generated from protobuf field <code>int32 aggregated_payload_size = 1;</code>
* @return int
*/
public function getAggregatedPayloadSize()
{
return $this->aggregated_payload_size;
}
/**
* Aggregated size of payloads received from the client.
*
* Generated from protobuf field <code>int32 aggregated_payload_size = 1;</code>
* @param int $var
* @return $this
*/
public function setAggregatedPayloadSize($var)
{
GPBUtil::checkInt32($var);
$this->aggregated_payload_size = $var;
return $this;
}
}

@ -0,0 +1,181 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: src/proto/grpc/testing/messages.proto
namespace Grpc\Testing;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Server-streaming request.
*
* Generated from protobuf message <code>grpc.testing.StreamingOutputCallRequest</code>
*/
class StreamingOutputCallRequest extends \Google\Protobuf\Internal\Message
{
/**
* Desired payload type in the response from the server.
* If response_type is RANDOM, the payload from each response in the stream
* might be of different types. This is to simulate a mixed type of payload
* stream.
*
* Generated from protobuf field <code>.grpc.testing.PayloadType response_type = 1;</code>
*/
protected $response_type = 0;
/**
* Configuration for each expected response message.
*
* Generated from protobuf field <code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code>
*/
private $response_parameters;
/**
* Optional input payload sent along with the request.
*
* Generated from protobuf field <code>.grpc.testing.Payload payload = 3;</code>
*/
protected $payload = null;
/**
* Whether server should return a given status
*
* Generated from protobuf field <code>.grpc.testing.EchoStatus response_status = 7;</code>
*/
protected $response_status = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int $response_type
* Desired payload type in the response from the server.
* If response_type is RANDOM, the payload from each response in the stream
* might be of different types. This is to simulate a mixed type of payload
* stream.
* @type \Grpc\Testing\ResponseParameters[]|\Google\Protobuf\Internal\RepeatedField $response_parameters
* Configuration for each expected response message.
* @type \Grpc\Testing\Payload $payload
* Optional input payload sent along with the request.
* @type \Grpc\Testing\EchoStatus $response_status
* Whether server should return a given status
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce();
parent::__construct($data);
}
/**
* Desired payload type in the response from the server.
* If response_type is RANDOM, the payload from each response in the stream
* might be of different types. This is to simulate a mixed type of payload
* stream.
*
* Generated from protobuf field <code>.grpc.testing.PayloadType response_type = 1;</code>
* @return int
*/
public function getResponseType()
{
return $this->response_type;
}
/**
* Desired payload type in the response from the server.
* If response_type is RANDOM, the payload from each response in the stream
* might be of different types. This is to simulate a mixed type of payload
* stream.
*
* Generated from protobuf field <code>.grpc.testing.PayloadType response_type = 1;</code>
* @param int $var
* @return $this
*/
public function setResponseType($var)
{
GPBUtil::checkEnum($var, \Grpc\Testing\PayloadType::class);
$this->response_type = $var;
return $this;
}
/**
* Configuration for each expected response message.
*
* Generated from protobuf field <code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code>
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getResponseParameters()
{
return $this->response_parameters;
}
/**
* Configuration for each expected response message.
*
* Generated from protobuf field <code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code>
* @param \Grpc\Testing\ResponseParameters[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setResponseParameters($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Testing\ResponseParameters::class);
$this->response_parameters = $arr;
return $this;
}
/**
* Optional input payload sent along with the request.
*
* Generated from protobuf field <code>.grpc.testing.Payload payload = 3;</code>
* @return \Grpc\Testing\Payload
*/
public function getPayload()
{
return $this->payload;
}
/**
* Optional input payload sent along with the request.
*
* Generated from protobuf field <code>.grpc.testing.Payload payload = 3;</code>
* @param \Grpc\Testing\Payload $var
* @return $this
*/
public function setPayload($var)
{
GPBUtil::checkMessage($var, \Grpc\Testing\Payload::class);
$this->payload = $var;
return $this;
}
/**
* Whether server should return a given status
*
* Generated from protobuf field <code>.grpc.testing.EchoStatus response_status = 7;</code>
* @return \Grpc\Testing\EchoStatus
*/
public function getResponseStatus()
{
return $this->response_status;
}
/**
* Whether server should return a given status
*
* Generated from protobuf field <code>.grpc.testing.EchoStatus response_status = 7;</code>
* @param \Grpc\Testing\EchoStatus $var
* @return $this
*/
public function setResponseStatus($var)
{
GPBUtil::checkMessage($var, \Grpc\Testing\EchoStatus::class);
$this->response_status = $var;
return $this;
}
}

@ -0,0 +1,67 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: src/proto/grpc/testing/messages.proto
namespace Grpc\Testing;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Server-streaming response, as configured by the request and parameters.
*
* Generated from protobuf message <code>grpc.testing.StreamingOutputCallResponse</code>
*/
class StreamingOutputCallResponse extends \Google\Protobuf\Internal\Message
{
/**
* Payload to increase response size.
*
* Generated from protobuf field <code>.grpc.testing.Payload payload = 1;</code>
*/
protected $payload = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Grpc\Testing\Payload $payload
* Payload to increase response size.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce();
parent::__construct($data);
}
/**
* Payload to increase response size.
*
* Generated from protobuf field <code>.grpc.testing.Payload payload = 1;</code>
* @return \Grpc\Testing\Payload
*/
public function getPayload()
{
return $this->payload;
}
/**
* Payload to increase response size.
*
* Generated from protobuf field <code>.grpc.testing.Payload payload = 1;</code>
* @param \Grpc\Testing\Payload $var
* @return $this
*/
public function setPayload($var)
{
GPBUtil::checkMessage($var, \Grpc\Testing\Payload::class);
$this->payload = $var;
return $this;
}
}

@ -0,0 +1,152 @@
<?php
// GENERATED CODE -- DO NOT EDIT!
// Original file comments:
// Copyright 2015-2016 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// An integration test service that covers all the method signature permutations
// of unary/streaming requests/responses.
//
namespace Grpc\Testing;
/**
* A simple service to test the various types of RPCs and experiment with
* performance with various types of payload.
*/
class TestServiceClient extends \Grpc\BaseStub {
/**
* @param string $hostname hostname
* @param array $opts channel options
* @param \Grpc\Channel $channel (optional) re-use channel object
*/
public function __construct($hostname, $opts, $channel = null) {
parent::__construct($hostname, $opts, $channel);
}
/**
* One empty request followed by one empty response.
* @param \Grpc\Testing\EmptyMessage $argument input argument
* @param array $metadata metadata
* @param array $options call options
*/
public function EmptyCall(\Grpc\Testing\EmptyMessage $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/grpc.testing.TestService/EmptyCall',
$argument,
['\Grpc\Testing\EmptyMessage', 'decode'],
$metadata, $options);
}
/**
* One request followed by one response.
* @param \Grpc\Testing\SimpleRequest $argument input argument
* @param array $metadata metadata
* @param array $options call options
*/
public function UnaryCall(\Grpc\Testing\SimpleRequest $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/grpc.testing.TestService/UnaryCall',
$argument,
['\Grpc\Testing\SimpleResponse', 'decode'],
$metadata, $options);
}
/**
* One request followed by one response. Response has cache control
* headers set such that a caching HTTP proxy (such as GFE) can
* satisfy subsequent requests.
* @param \Grpc\Testing\SimpleRequest $argument input argument
* @param array $metadata metadata
* @param array $options call options
*/
public function CacheableUnaryCall(\Grpc\Testing\SimpleRequest $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/grpc.testing.TestService/CacheableUnaryCall',
$argument,
['\Grpc\Testing\SimpleResponse', 'decode'],
$metadata, $options);
}
/**
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
* @param \Grpc\Testing\StreamingOutputCallRequest $argument input argument
* @param array $metadata metadata
* @param array $options call options
*/
public function StreamingOutputCall(\Grpc\Testing\StreamingOutputCallRequest $argument,
$metadata = [], $options = []) {
return $this->_serverStreamRequest('/grpc.testing.TestService/StreamingOutputCall',
$argument,
['\Grpc\Testing\StreamingOutputCallResponse', 'decode'],
$metadata, $options);
}
/**
* A sequence of requests followed by one response (streamed upload).
* The server returns the aggregated size of client payload as the result.
* @param array $metadata metadata
* @param array $options call options
*/
public function StreamingInputCall($metadata = [], $options = []) {
return $this->_clientStreamRequest('/grpc.testing.TestService/StreamingInputCall',
['\Grpc\Testing\StreamingInputCallResponse','decode'],
$metadata, $options);
}
/**
* A sequence of requests with each request served by the server immediately.
* As one request could lead to multiple responses, this interface
* demonstrates the idea of full duplexing.
* @param array $metadata metadata
* @param array $options call options
*/
public function FullDuplexCall($metadata = [], $options = []) {
return $this->_bidiRequest('/grpc.testing.TestService/FullDuplexCall',
['\Grpc\Testing\StreamingOutputCallResponse','decode'],
$metadata, $options);
}
/**
* A sequence of requests followed by a sequence of responses.
* The server buffers all the client requests and then serves them in order. A
* stream of responses are returned to the client when the server starts with
* first request.
* @param array $metadata metadata
* @param array $options call options
*/
public function HalfDuplexCall($metadata = [], $options = []) {
return $this->_bidiRequest('/grpc.testing.TestService/HalfDuplexCall',
['\Grpc\Testing\StreamingOutputCallResponse','decode'],
$metadata, $options);
}
/**
* The test server will not implement this method. It will be used
* to test the behavior when clients call unimplemented methods.
* @param \Grpc\Testing\EmptyMessage $argument input argument
* @param array $metadata metadata
* @param array $options call options
*/
public function UnimplementedCall(\Grpc\Testing\EmptyMessage $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/grpc.testing.TestService/UnimplementedCall',
$argument,
['\Grpc\Testing\EmptyMessage', 'decode'],
$metadata, $options);
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save