From 04c00cfd061b42f35fd0af42e6dc3d133a71d8cf Mon Sep 17 00:00:00 2001 From: Gary Belvin Date: Tue, 12 May 2020 08:56:45 +0100 Subject: [PATCH] Update grpc to v.1.26.0 --- glide.lock | 2 +- glide.yaml | 2 +- .../grpc/.github/mergeable.yml | 36 + .../google.golang.org/grpc/.github/stale.yml | 58 + vendor/google.golang.org/grpc/.travis.yml | 27 +- .../google.golang.org/grpc/CODE-OF-CONDUCT.md | 3 + vendor/google.golang.org/grpc/CONTRIBUTING.md | 4 +- .../grpc/Documentation/concurrency.md | 12 +- .../server-reflection-tutorial.md | 1 + vendor/google.golang.org/grpc/GOVERNANCE.md | 1 + vendor/google.golang.org/grpc/MAINTAINERS.md | 27 + .../grpc/attributes/attributes.go | 70 + .../grpc/attributes/attributes_test.go | 48 + vendor/google.golang.org/grpc/backoff.go | 20 + .../google.golang.org/grpc/backoff/backoff.go | 52 + .../grpc/balancer/balancer.go | 125 +- .../grpc/balancer/base/balancer.go | 115 +- .../grpc/balancer/base/base.go | 29 + .../grpclb/grpc_lb_v1/load_balancer.pb.go | 335 +- .../grpc/balancer/grpclb/grpclb.go | 73 +- .../grpc/balancer/grpclb/grpclb_picker.go | 25 +- .../balancer/grpclb/grpclb_remote_balancer.go | 182 +- .../grpc/balancer/grpclb/grpclb_test.go | 336 +- .../grpc/balancer/grpclb/grpclb_util.go | 11 +- .../grpc/balancer/grpclb/grpclb_util_test.go | 43 + .../grpc/balancer/roundrobin/roundrobin.go | 18 +- .../balancer/roundrobin/roundrobin_test.go | 2 +- .../grpc/balancer_conn_wrappers.go | 163 +- .../grpc/balancer_conn_wrappers_test.go | 90 + .../grpc/balancer_switching_test.go | 23 +- .../google.golang.org/grpc/balancer_test.go | 6 - .../grpc/balancer_v1_wrapper.go | 34 +- .../grpc/benchmark/benchmain/main.go | 15 +- .../grpc/benchmark/benchresult/main.go | 30 +- .../grpc/benchmark/grpc_testing/control.pb.go | 435 +-- .../benchmark/grpc_testing/messages.pb.go | 103 +- .../benchmark/grpc_testing/payloads.pb.go | 132 +- .../benchmark/grpc_testing/services.pb.go | 90 +- .../grpc/benchmark/grpc_testing/stats.pb.go | 42 +- .../grpc/benchmark/primitives/context_test.go | 31 + .../grpc/benchmark/stats/stats.go | 30 +- .../channelz/grpc_channelz_v1/channelz.pb.go | 970 ++--- vendor/google.golang.org/grpc/clientconn.go | 241 +- .../google.golang.org/grpc/clientconn_test.go | 77 +- .../alts/internal/handshaker/handshaker.go | 30 +- .../internal/proto/grpc_gcp/altscontext.pb.go | 25 +- .../internal/proto/grpc_gcp/handshaker.pb.go | 473 +-- .../grpc_gcp/transport_security_common.pb.go | 36 +- .../grpc/credentials/alts/utils.go | 3 + .../grpc/credentials/alts/utils_test.go | 47 +- .../grpc/credentials/credentials.go | 212 +- .../grpc/credentials/credentials_test.go | 55 +- .../grpc/credentials/{tls13.go => go12.go} | 0 .../google.golang.org/grpc/credentials/tls.go | 220 ++ vendor/google.golang.org/grpc/dialoptions.go | 57 +- .../grpc/encoding/encoding.go | 4 + .../grpc/encoding/gzip/gzip.go | 12 + .../grpc/examples/examples_test.sh | 157 + .../features/authentication/client/main.go | 1 + .../features/authentication/server/main.go | 22 +- .../features/cancellation/server/main.go | 18 +- .../features/compression/client/main.go | 2 +- .../features/compression/server/main.go | 22 +- .../examples/features/deadline/client/main.go | 2 +- .../examples/features/deadline/server/main.go | 12 +- .../examples/features/debugging/README.md | 4 +- .../features/debugging/client/main.go | 5 +- .../features/debugging/server/main.go | 13 +- .../features/encryption/ALTS/client/main.go | 2 +- .../features/encryption/ALTS/server/main.go | 25 +- .../features/encryption/TLS/client/main.go | 2 +- .../features/encryption/TLS/server/main.go | 25 +- .../examples/features/errors/client/main.go | 2 +- .../examples/features/errors/server/main.go | 6 +- .../examples/features/interceptor/README.md | 2 +- .../features/interceptor/client/main.go | 2 +- .../features/interceptor/server/main.go | 25 +- .../features/keepalive/server/main.go | 21 +- .../features/load_balancing/client/main.go | 8 +- .../features/load_balancing/server/main.go | 21 +- .../examples/features/metadata/client/main.go | 2 +- .../examples/features/metadata/server/main.go | 7 +- .../features/multiplex/client/main.go | 2 +- .../features/multiplex/server/main.go | 23 +- .../features/name_resolving/client/main.go | 8 +- .../features/name_resolving/server/main.go | 21 +- .../examples/features/proto/echo/echo.pb.go | 88 +- .../features/reflection/server/main.go | 25 +- .../grpc/examples/features/retry/README.md | 66 + .../examples/features/retry/client/main.go | 78 + .../examples/features/retry/server/main.go | 93 + .../examples/features/wait_for_ready/main.go | 19 +- .../helloworld/greeter_client/main.go | 4 +- .../helloworld/greeter_server/main.go | 8 +- .../helloworld/helloworld/helloworld.pb.go | 69 +- .../helloworld/mock_helloworld/hw_mock.go | 2 +- .../examples/route_guide/client/client.go | 4 +- .../route_guide/mock_routeguide/rg_mock.go | 2 +- .../route_guide/routeguide/route_guide.pb.go | 129 +- .../examples/route_guide/server/server.go | 1 + vendor/google.golang.org/grpc/go.mod | 15 +- vendor/google.golang.org/grpc/go.sum | 36 +- vendor/google.golang.org/grpc/grpc_test.go | 2 + .../google.golang.org/grpc/grpclog/grpclog.go | 2 +- .../google.golang.org/grpc/health/client.go | 42 +- .../grpc/health/client_test.go | 2 +- .../grpc/health/grpc_health_v1/health.pb.go | 96 +- .../google.golang.org/grpc/health/server.go | 10 +- .../grpc/internal/backoff/backoff.go | 27 +- .../grpc/internal/binarylog/binarylog.go | 12 +- .../binarylog/binarylog_end2end_test.go | 1 + .../grpc/internal/binarylog/env_config.go | 4 +- .../grpc/internal/binarylog/sink.go | 2 +- .../grpc/internal/buffer/unbounded.go | 85 + .../grpc/internal/buffer/unbounded_test.go | 111 + .../grpc/internal/cache/timeoutCache.go | 131 + .../grpc/internal/cache/timeoutCache_test.go | 220 ++ .../grpc/internal/internal.go | 15 +- .../grpc/internal/leakcheck/leakcheck.go | 2 +- .../grpc/internal/profiling/buffer/buffer.go | 274 ++ .../profiling/buffer/buffer_appengine.go | 43 + .../internal/profiling/buffer/buffer_test.go | 178 + .../grpc/internal/profiling/goid_modified.go | 81 + .../grpc/internal/profiling/goid_regular.go | 29 + .../grpc/internal/profiling/profiling.go | 220 ++ .../grpc/internal/profiling/profiling_test.go | 147 + .../proto/grpc_service_config/example_test.go | 59 + .../proto/grpc_service_config/regenerate.sh | 35 + .../grpc_service_config/service_config.pb.go | 1131 ++++++ .../internal/resolver/dns/dns_resolver.go | 420 +++ .../resolver/dns/dns_resolver_test.go | 429 +-- .../grpc/internal/resolver/dns/go113.go | 33 + .../resolver/passthrough/passthrough.go | 57 + .../internal/testutils/pipe_listener_test.go | 2 +- .../grpc/internal/transport/controlbuf.go | 12 +- .../grpc/internal/transport/handler_server.go | 8 +- .../grpc/internal/transport/http2_client.go | 202 +- .../grpc/internal/transport/http2_server.go | 157 +- .../grpc/internal/transport/http_util.go | 1 + .../grpc/internal/transport/keepalive_test.go | 653 ++++ .../grpc/internal/transport/transport.go | 70 +- .../grpc/internal/transport/transport_test.go | 456 +-- .../grpc/interop/grpc_testing/test.pb.go | 293 +- .../grpc/interop/grpc_testing/test.proto | 21 + .../grpc/interop/grpclb_fallback/client.go | 224 ++ .../interop/http2/negative_http2_client.go | 2 +- .../grpc/interop/interop_test.sh | 102 + .../google.golang.org/grpc/picker_wrapper.go | 172 +- .../grpc/picker_wrapper_test.go | 15 +- vendor/google.golang.org/grpc/pickfirst.go | 89 +- vendor/google.golang.org/grpc/proxy_test.go | 10 +- .../grpc_reflection_v1alpha/reflection.pb.go | 393 +- .../grpc/reflection/grpc_testing/proto2.pb.go | 21 +- .../reflection/grpc_testing/proto2_ext.pb.go | 21 +- .../reflection/grpc_testing/proto2_ext2.pb.go | 21 +- .../grpc/reflection/grpc_testing/test.pb.go | 87 +- .../grpc/reflection/grpc_testingv3/README.md | 3 + .../reflection/grpc_testingv3/testv3.pb.go | 3 +- .../grpc/reflection/serverreflection_test.go | 4 +- .../grpc/resolver/dns/dns_resolver.go | 435 +-- .../grpc/resolver/manual/manual.go | 23 +- .../grpc/resolver/passthrough/passthrough.go | 39 +- .../grpc/resolver/resolver.go | 100 +- .../grpc/resolver_conn_wrapper.go | 169 +- .../grpc/resolver_conn_wrapper_test.go | 153 + vendor/google.golang.org/grpc/rpc_util.go | 53 +- vendor/google.golang.org/grpc/server.go | 160 +- .../google.golang.org/grpc/service_config.go | 35 +- .../grpc/service_config_test.go | 26 +- .../grpc/serviceconfig/serviceconfig.go | 21 +- .../grpc/stats/grpc_testing/test.pb.go | 82 +- vendor/google.golang.org/grpc/stats/stats.go | 11 + .../grpc/stats/stats_test.go | 114 +- .../grpc/status/status_test.go | 8 +- vendor/google.golang.org/grpc/stream.go | 2 +- .../grpc/stress/client/main.go | 2 +- .../grpc/stress/grpc_testing/metrics.pb.go | 165 +- .../grpc/stress/metrics_client/main.go | 4 +- .../grpc/test/balancer_test.go | 33 +- .../grpc/test/bufconn/bufconn.go | 74 +- .../grpc/test/bufconn/bufconn_test.go | 121 +- .../grpc/test/channelz_test.go | 71 +- .../grpc/test/codec_perf/perf.pb.go | 21 +- .../grpc/test/context_canceled_test.go | 3 +- .../grpc/test/end2end_test.go | 601 +-- .../grpc/test/grpc_testing/test.pb.go | 191 +- .../grpc/test/healthcheck_test.go | 27 +- .../google.golang.org/grpc/test/retry_test.go | 3 +- .../google.golang.org/grpc/test/tools/go.mod | 12 + .../google.golang.org/grpc/test/tools/go.sum | 18 + vendor/google.golang.org/grpc/version.go | 2 +- vendor/google.golang.org/grpc/vet.sh | 87 +- .../grpc/xds/experimental/xds_experimental.go | 10 +- .../balancer/cdsbalancer/cdsbalancer.go | 350 ++ .../balancer/cdsbalancer/cdsbalancer_test.go | 556 +++ .../grpc/xds/internal/balancer/config.go | 117 + .../balancer/edsbalancer/balancergroup.go | 526 ++- .../edsbalancer/balancergroup_test.go | 464 ++- .../balancer/edsbalancer/edsbalancer.go | 341 +- .../balancer/edsbalancer/edsbalancer_test.go | 389 +- .../internal/balancer/edsbalancer/priority.go | 325 ++ .../balancer/edsbalancer/priority_test.go | 650 ++++ .../balancer/edsbalancer/test_util_test.go | 34 +- .../grpc/xds/internal/balancer/lrs/lrs.go | 76 +- .../xds/internal/balancer/lrs/lrs_test.go | 52 +- .../grpc/xds/internal/balancer/orca/orca.go | 2 +- .../xds/internal/balancer/orca/orca_test.go | 2 +- .../grpc/xds/internal/balancer/xds.go | 362 +- .../grpc/xds/internal/balancer/xds_client.go | 297 -- .../xds/internal/balancer/xds_client_test.go | 660 ++-- .../internal/balancer/xds_client_wrapper.go | 305 ++ .../xds/internal/balancer/xds_lrs_test.go | 143 +- .../grpc/xds/internal/balancer/xds_old.go | 46 + .../grpc/xds/internal/balancer/xds_test.go | 1002 ++--- .../internal/client/bootstrap/bootstrap.go | 160 + .../client/bootstrap/bootstrap_test.go | 243 ++ .../grpc/xds/internal/client/cds.go | 91 + .../grpc/xds/internal/client/cds_test.go | 539 +++ .../grpc/xds/internal/client/client.go | 166 + .../xds/internal/client/client_loadreport.go | 63 + .../grpc/xds/internal/client/client_test.go | 295 ++ .../grpc/xds/internal/client/eds.go | 213 ++ .../grpc/xds/internal/client/eds_test.go | 333 ++ .../grpc/xds/internal/client/eds_testutil.go | 128 + .../xds/internal/client/fakexds/fakexds.go | 164 + .../xds/internal/client/fakexds/lrsserver.go | 104 + .../grpc/xds/internal/client/lds.go | 104 + .../grpc/xds/internal/client/lds_test.go | 289 ++ .../grpc/xds/internal/client/rds.go | 155 + .../grpc/xds/internal/client/rds_test.go | 580 +++ .../grpc/xds/internal/client/types.go | 97 + .../grpc/xds/internal/client/v2client.go | 493 +++ .../xds/internal/client/v2client_ack_test.go | 294 ++ .../grpc/xds/internal/client/v2client_test.go | 529 +++ .../grpc/xds/internal/internal.go | 15 +- .../grpc/xds/internal/internal_test.go | 4 +- .../proto/envoy/api/v2/auth/cert/cert.pb.go | 1144 ------ .../internal/proto/envoy/api/v2/cds/cds.pb.go | 1845 ---------- .../circuit_breaker/circuit_breaker.pb.go | 185 - .../outlier_detection/outlier_detection.pb.go | 224 -- .../envoy/api/v2/core/address/address.pb.go | 610 ---- .../proto/envoy/api/v2/core/base/base.pb.go | 1125 ------ .../v2/core/config_source/config_source.pb.go | 446 --- .../v2/core/grpc_service/grpc_service.pb.go | 1196 ------ .../v2/core/health_check/health_check.pb.go | 1007 ------ .../envoy/api/v2/core/protocol/protocol.pb.go | 311 -- .../envoy/api/v2/discovery/discovery.pb.go | 455 --- .../internal/proto/envoy/api/v2/eds/eds.pb.go | 454 --- .../api/v2/endpoint/endpoint/endpoint.pb.go | 394 -- .../v2/endpoint/load_report/load_report.pb.go | 446 --- .../envoy/service/discovery/v2/ads/ads.pb.go | 251 -- .../envoy/service/load_stats/v2/lrs/lrs.pb.go | 272 -- .../proto/envoy/type/percent/percent.pb.go | 160 - .../proto/envoy/type/range/range.pb.go | 132 - .../xds/internal/{const.go => proto/proto.go} | 10 +- .../grpc/xds/internal/proto/regenerate.sh | 40 + .../udpa/data/orca/v1/orca_load_report.pb.go | 139 + .../orca_load_report/orca_load_report.pb.go | 127 - .../service/orca/v1/{orca => }/orca.pb.go | 112 +- .../proto/udpa/type/v1/typed_struct.pb.go | 118 + .../internal/proto/validate/validate.pb.go | 3214 ----------------- .../xds/internal/regenerate_scripts/README.md | 23 - .../regenerate_scripts/envoy-proto-gen.sh | 32 - .../regenerate_scripts/utils/README.md | 2 - .../regenerate_scripts/utils/WORKSPACE | 67 - .../regenerate_scripts/utils/cleanup.sh | 23 - .../utils/data-plane-api.patch | 31 - .../regenerate_scripts/utils/proto-gen.sh | 43 - .../utils/protoc-gen-validate.patch | 26 - .../internal/resolver/old/xds_resolver_old.go | 86 + .../xds/internal/resolver/xds_resolver.go | 210 ++ .../internal/resolver/xds_resolver_test.go | 320 ++ .../grpc/xds/internal/testutils/channel.go | 75 + .../xds/internal/testutils/fakexds/client.go | 150 + .../grpc/xds/internal/testutils/xdsclient.go | 67 + 275 files changed, 21666 insertions(+), 21926 deletions(-) create mode 100644 vendor/google.golang.org/grpc/.github/mergeable.yml create mode 100644 vendor/google.golang.org/grpc/.github/stale.yml create mode 100644 vendor/google.golang.org/grpc/CODE-OF-CONDUCT.md create mode 100644 vendor/google.golang.org/grpc/GOVERNANCE.md create mode 100644 vendor/google.golang.org/grpc/MAINTAINERS.md create mode 100644 vendor/google.golang.org/grpc/attributes/attributes.go create mode 100644 vendor/google.golang.org/grpc/attributes/attributes_test.go create mode 100644 vendor/google.golang.org/grpc/backoff/backoff.go create mode 100644 vendor/google.golang.org/grpc/balancer_conn_wrappers_test.go rename vendor/google.golang.org/grpc/credentials/{tls13.go => go12.go} (100%) create mode 100644 vendor/google.golang.org/grpc/credentials/tls.go create mode 100755 vendor/google.golang.org/grpc/examples/examples_test.sh create mode 100644 vendor/google.golang.org/grpc/examples/features/retry/README.md create mode 100644 vendor/google.golang.org/grpc/examples/features/retry/client/main.go create mode 100644 vendor/google.golang.org/grpc/examples/features/retry/server/main.go create mode 100644 vendor/google.golang.org/grpc/internal/buffer/unbounded.go create mode 100644 vendor/google.golang.org/grpc/internal/buffer/unbounded_test.go create mode 100644 vendor/google.golang.org/grpc/internal/cache/timeoutCache.go create mode 100644 vendor/google.golang.org/grpc/internal/cache/timeoutCache_test.go create mode 100644 vendor/google.golang.org/grpc/internal/profiling/buffer/buffer.go create mode 100644 vendor/google.golang.org/grpc/internal/profiling/buffer/buffer_appengine.go create mode 100644 vendor/google.golang.org/grpc/internal/profiling/buffer/buffer_test.go create mode 100644 vendor/google.golang.org/grpc/internal/profiling/goid_modified.go create mode 100644 vendor/google.golang.org/grpc/internal/profiling/goid_regular.go create mode 100644 vendor/google.golang.org/grpc/internal/profiling/profiling.go create mode 100644 vendor/google.golang.org/grpc/internal/profiling/profiling_test.go create mode 100644 vendor/google.golang.org/grpc/internal/proto/grpc_service_config/example_test.go create mode 100755 vendor/google.golang.org/grpc/internal/proto/grpc_service_config/regenerate.sh create mode 100644 vendor/google.golang.org/grpc/internal/proto/grpc_service_config/service_config.pb.go create mode 100644 vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go rename vendor/google.golang.org/grpc/{ => internal}/resolver/dns/dns_resolver_test.go (76%) create mode 100644 vendor/google.golang.org/grpc/internal/resolver/dns/go113.go create mode 100644 vendor/google.golang.org/grpc/internal/resolver/passthrough/passthrough.go create mode 100644 vendor/google.golang.org/grpc/internal/transport/keepalive_test.go create mode 100644 vendor/google.golang.org/grpc/interop/grpclb_fallback/client.go create mode 100755 vendor/google.golang.org/grpc/interop/interop_test.sh create mode 100644 vendor/google.golang.org/grpc/reflection/grpc_testingv3/README.md create mode 100644 vendor/google.golang.org/grpc/test/tools/go.mod create mode 100644 vendor/google.golang.org/grpc/test/tools/go.sum create mode 100644 vendor/google.golang.org/grpc/xds/internal/balancer/cdsbalancer/cdsbalancer.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/balancer/cdsbalancer/cdsbalancer_test.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/balancer/config.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/priority.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/priority_test.go delete mode 100644 vendor/google.golang.org/grpc/xds/internal/balancer/xds_client.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/balancer/xds_client_wrapper.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/balancer/xds_old.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/client/bootstrap/bootstrap.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/client/bootstrap/bootstrap_test.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/client/cds.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/client/cds_test.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/client/client.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/client/client_loadreport.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/client/client_test.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/client/eds.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/client/eds_test.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/client/eds_testutil.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/client/fakexds/fakexds.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/client/fakexds/lrsserver.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/client/lds.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/client/lds_test.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/client/rds.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/client/rds_test.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/client/types.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/client/v2client.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/client/v2client_ack_test.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/client/v2client_test.go delete mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/auth/cert/cert.pb.go delete mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/cds/cds.pb.go delete mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/cluster/circuit_breaker/circuit_breaker.pb.go delete mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/cluster/outlier_detection/outlier_detection.pb.go delete mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/address/address.pb.go delete mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/base/base.pb.go delete mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/config_source/config_source.pb.go delete mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/grpc_service/grpc_service.pb.go delete mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/health_check/health_check.pb.go delete mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/protocol/protocol.pb.go delete mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/discovery/discovery.pb.go delete mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/eds/eds.pb.go delete mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/endpoint/endpoint/endpoint.pb.go delete mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/endpoint/load_report/load_report.pb.go delete mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/envoy/service/discovery/v2/ads/ads.pb.go delete mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/envoy/service/load_stats/v2/lrs/lrs.pb.go delete mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/envoy/type/percent/percent.pb.go delete mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/envoy/type/range/range.pb.go rename vendor/google.golang.org/grpc/xds/internal/{const.go => proto/proto.go} (73%) create mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/regenerate.sh create mode 100644 vendor/google.golang.org/grpc/xds/internal/proto/udpa/data/orca/v1/orca_load_report.pb.go delete mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/udpa/data/orca/v1/orca_load_report/orca_load_report.pb.go rename vendor/google.golang.org/grpc/xds/internal/proto/udpa/service/orca/v1/{orca => }/orca.pb.go (55%) mode change 100755 => 100644 create mode 100644 vendor/google.golang.org/grpc/xds/internal/proto/udpa/type/v1/typed_struct.pb.go delete mode 100755 vendor/google.golang.org/grpc/xds/internal/proto/validate/validate.pb.go delete mode 100644 vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/README.md delete mode 100755 vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/envoy-proto-gen.sh delete mode 100644 vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/README.md delete mode 100644 vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/WORKSPACE delete mode 100755 vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/cleanup.sh delete mode 100644 vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/data-plane-api.patch delete mode 100755 vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/proto-gen.sh delete mode 100644 vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/protoc-gen-validate.patch create mode 100644 vendor/google.golang.org/grpc/xds/internal/resolver/old/xds_resolver_old.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/resolver/xds_resolver.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/resolver/xds_resolver_test.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/testutils/channel.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/testutils/fakexds/client.go create mode 100644 vendor/google.golang.org/grpc/xds/internal/testutils/xdsclient.go diff --git a/glide.lock b/glide.lock index 9a65ad94c52..cefc964b7a7 100644 --- a/glide.lock +++ b/glide.lock @@ -184,7 +184,7 @@ imports: - googleapis/api/annotations - googleapis/rpc/status - name: google.golang.org/grpc - version: 6eaf6f47437a6b4e2153a190160ef39a92c7eceb + version: f5b0812e6fe574d90da76b205e9eb51f6ddb1919 subpackages: - balancer - balancer/base diff --git a/glide.yaml b/glide.yaml index 32c80c6690b..1702d1c5395 100644 --- a/glide.yaml +++ b/glide.yaml @@ -118,7 +118,7 @@ import: subpackages: - rate - package: google.golang.org/grpc - version: v1.23.0 + version: v1.26.0 subpackages: - balancer - codes diff --git a/vendor/google.golang.org/grpc/.github/mergeable.yml b/vendor/google.golang.org/grpc/.github/mergeable.yml new file mode 100644 index 00000000000..d647dafb7ab --- /dev/null +++ b/vendor/google.golang.org/grpc/.github/mergeable.yml @@ -0,0 +1,36 @@ +version: 2 +mergeable: + - when: pull_request.* + validate: + - do: label + must_include: + regex: '^Type:' + fail: + - do: checks + status: 'failure' + payload: + title: 'Need an appropriate "Type:" label' + summary: 'Need an appropriate "Type:" label' + - when: pull_request.* + # This validator requires either the "no release notes" label OR a "Release" milestone + # to be considered successful. However, validators "pass" in mergeable only if all + # checks pass. So it is implemented in reverse. + # I.e.: !(!no_relnotes && !release_milestone) ==> no_relnotes || release_milestone + # If both validators pass, then it is considered a failure, and if either fails, it is + # considered a success. + validate: + - do: label + must_exclude: + regex: '^no release notes$' + - do: milestone + must_exclude: + regex: 'Release$' + pass: + - do: checks + status: 'failure' # fail on pass + payload: + title: 'Need Release milestone or "no release notes" label' + summary: 'Need Release milestone or "no release notes" label' + fail: + - do: checks + status: 'success' # pass on fail diff --git a/vendor/google.golang.org/grpc/.github/stale.yml b/vendor/google.golang.org/grpc/.github/stale.yml new file mode 100644 index 00000000000..04a26a08d2a --- /dev/null +++ b/vendor/google.golang.org/grpc/.github/stale.yml @@ -0,0 +1,58 @@ +# Configuration for probot-stale - https://github.com/probot/stale + +# Number of days of inactivity before an Issue or Pull Request becomes stale +daysUntilStale: 7 + +# Number of days of inactivity before an Issue or Pull Request with the stale label is closed. +# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. +daysUntilClose: 7 + +# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled) +onlyLabels: + - "Status: Requires Reporter Clarification" + +# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable +exemptLabels: [] + +# Set to true to ignore issues in a project (defaults to false) +exemptProjects: false + +# Set to true to ignore issues in a milestone (defaults to false) +exemptMilestones: false + +# Set to true to ignore issues with an assignee (defaults to false) +exemptAssignees: false + +# Label to use when marking as stale +staleLabel: "stale" + +# Comment to post when marking as stale. Set to `false` to disable +markComment: > + This issue is labeled as requiring an update from the reporter, and no update has been received + after 7 days. If no update is provided in the next 7 days, this issue will be automatically closed. + +# Comment to post when removing the stale label. +# unmarkComment: > +# Your comment here. + +# Comment to post when closing a stale Issue or Pull Request. +# closeComment: > +# Your comment here. + +# Limit the number of actions per hour, from 1-30. Default is 30 +limitPerRun: 1 + +# Limit to only `issues` or `pulls` +# only: issues + +# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls': +# pulls: +# daysUntilStale: 30 +# markComment: > +# This pull request has been automatically marked as stale because it has not had +# recent activity. It will be closed if no further activity occurs. Thank you +# for your contributions. + +# issues: +# exemptLabels: +# - confirmed diff --git a/vendor/google.golang.org/grpc/.travis.yml b/vendor/google.golang.org/grpc/.travis.yml index 024408e6462..819c1e2a922 100644 --- a/vendor/google.golang.org/grpc/.travis.yml +++ b/vendor/google.golang.org/grpc/.travis.yml @@ -2,18 +2,20 @@ language: go matrix: include: - - go: 1.12.x + - go: 1.13.x env: VET=1 GO111MODULE=on - - go: 1.12.x + - go: 1.13.x env: RACE=1 GO111MODULE=on - - go: 1.12.x + - go: 1.13.x env: RUN386=1 - - go: 1.12.x + - go: 1.13.x env: GRPC_GO_RETRY=on + - go: 1.13.x + env: TESTEXTRAS=1 + - go: 1.12.x + env: GO111MODULE=on - go: 1.11.x env: GO111MODULE=on - - go: 1.10.x - - go: 1.9.x - go: 1.9.x env: GAE=1 @@ -23,17 +25,18 @@ before_install: - if [[ "${GO111MODULE}" = "on" ]]; then mkdir "${HOME}/go"; export GOPATH="${HOME}/go"; fi - if [[ -n "${RUN386}" ]]; then export GOARCH=386; fi - if [[ "${TRAVIS_EVENT_TYPE}" = "cron" && -z "${RUN386}" ]]; then RACE=1; fi - - if [[ "${TRAVIS_EVENT_TYPE}" != "cron" ]]; then VET_SKIP_PROTO=1; fi + - if [[ "${TRAVIS_EVENT_TYPE}" != "cron" ]]; then export VET_SKIP_PROTO=1; fi install: - try3() { eval "$*" || eval "$*" || eval "$*"; } - try3 'if [[ "${GO111MODULE}" = "on" ]]; then go mod download; else make testdeps; fi' - - if [[ "${GAE}" = 1 ]]; then source ./install_gae.sh; make testappenginedeps; fi - - if [[ "${VET}" = 1 ]]; then ./vet.sh -install; fi + - if [[ -n "${GAE}" ]]; then source ./install_gae.sh; make testappenginedeps; fi + - if [[ -n "${VET}" ]]; then ./vet.sh -install; fi script: - set -e - - if [[ "${VET}" = 1 ]]; then ./vet.sh; fi - - if [[ "${GAE}" = 1 ]]; then make testappengine; exit 0; fi - - if [[ "${RACE}" = 1 ]]; then make testrace; exit 0; fi + - if [[ -n "${TESTEXTRAS}" ]]; then examples/examples_test.sh; interop/interop_test.sh; exit 0; fi + - if [[ -n "${VET}" ]]; then ./vet.sh; fi + - if [[ -n "${GAE}" ]]; then make testappengine; exit 0; fi + - if [[ -n "${RACE}" ]]; then make testrace; exit 0; fi - make test diff --git a/vendor/google.golang.org/grpc/CODE-OF-CONDUCT.md b/vendor/google.golang.org/grpc/CODE-OF-CONDUCT.md new file mode 100644 index 00000000000..9d4213ebca7 --- /dev/null +++ b/vendor/google.golang.org/grpc/CODE-OF-CONDUCT.md @@ -0,0 +1,3 @@ +## Community Code of Conduct + +gRPC follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md). diff --git a/vendor/google.golang.org/grpc/CONTRIBUTING.md b/vendor/google.golang.org/grpc/CONTRIBUTING.md index 6e69b28c270..4f1567e2f95 100644 --- a/vendor/google.golang.org/grpc/CONTRIBUTING.md +++ b/vendor/google.golang.org/grpc/CONTRIBUTING.md @@ -1,6 +1,8 @@ # How to contribute -We definitely welcome your patches and contributions to gRPC! +We definitely welcome your patches and contributions to gRPC! Please read the gRPC +organization's [governance rules](https://github.com/grpc/grpc-community/blob/master/governance.md) +and [contribution guidelines](https://github.com/grpc/grpc-community/blob/master/CONTRIBUTING.md) before proceeding. If you are new to github, please start by reading [Pull Request howto](https://help.github.com/articles/about-pull-requests/) diff --git a/vendor/google.golang.org/grpc/Documentation/concurrency.md b/vendor/google.golang.org/grpc/Documentation/concurrency.md index d0c1142a081..5f6c631e4d8 100644 --- a/vendor/google.golang.org/grpc/Documentation/concurrency.md +++ b/vendor/google.golang.org/grpc/Documentation/concurrency.md @@ -7,8 +7,12 @@ guidelines. A [ClientConn][client-conn] can safely be accessed concurrently. Using [helloworld][helloworld] as an example, one could share the `ClientConn` across -multiple goroutines to create multiple `GreeterClient` types. In this case, RPCs -would be sent in parallel. +multiple goroutines to create multiple `GreeterClient` types. In this case, +RPCs would be sent in parallel. `GreeterClient`, generated from the proto +definitions and wrapping `ClientConn`, is also concurrency safe, and may be +directly shared in the same way. Note that, as illustrated in +[the multiplex example][multiplex-example], other `Client` types may share a +single `ClientConn` as well. ## Streams @@ -24,10 +28,12 @@ call `RecvMsg` on the same stream in different goroutines. Each RPC handler attached to a registered server will be invoked in its own goroutine. For example, [SayHello][say-hello] will be invoked in its own goroutine. The same is true for service handlers for streaming RPCs, as seen -in the route guide example [here][route-guide-stream]. +in the route guide example [here][route-guide-stream]. Similar to clients, +multiple services can be registered to the same server. [helloworld]: https://github.com/grpc/grpc-go/blob/master/examples/helloworld/greeter_client/main.go#L43 [client-conn]: https://godoc.org/google.golang.org/grpc#ClientConn [stream]: https://godoc.org/google.golang.org/grpc#Stream [say-hello]: https://github.com/grpc/grpc-go/blob/master/examples/helloworld/greeter_server/main.go#L41 [route-guide-stream]: https://github.com/grpc/grpc-go/blob/master/examples/route_guide/server/server.go#L126 +[multiplex-example]: https://github.com/grpc/grpc-go/tree/master/examples/features/multiplex diff --git a/vendor/google.golang.org/grpc/Documentation/server-reflection-tutorial.md b/vendor/google.golang.org/grpc/Documentation/server-reflection-tutorial.md index 6657206933e..78117ff5745 100644 --- a/vendor/google.golang.org/grpc/Documentation/server-reflection-tutorial.md +++ b/vendor/google.golang.org/grpc/Documentation/server-reflection-tutorial.md @@ -51,6 +51,7 @@ To build gRPC CLI: ```sh git clone https://github.com/grpc/grpc cd grpc +git submodule update --init make grpc_cli cd bins/opt # grpc_cli is in directory bins/opt/ ``` diff --git a/vendor/google.golang.org/grpc/GOVERNANCE.md b/vendor/google.golang.org/grpc/GOVERNANCE.md new file mode 100644 index 00000000000..d6ff2674710 --- /dev/null +++ b/vendor/google.golang.org/grpc/GOVERNANCE.md @@ -0,0 +1 @@ +This repository is governed by the gRPC organization's [governance rules](https://github.com/grpc/grpc-community/blob/master/governance.md). diff --git a/vendor/google.golang.org/grpc/MAINTAINERS.md b/vendor/google.golang.org/grpc/MAINTAINERS.md new file mode 100644 index 00000000000..093c82b3afe --- /dev/null +++ b/vendor/google.golang.org/grpc/MAINTAINERS.md @@ -0,0 +1,27 @@ +This page lists all active maintainers of this repository. If you were a +maintainer and would like to add your name to the Emeritus list, please send us a +PR. + +See [GOVERNANCE.md](https://github.com/grpc/grpc-community/blob/master/governance.md) +for governance guidelines and how to become a maintainer. +See [CONTRIBUTING.md](https://github.com/grpc/grpc-community/blob/master/CONTRIBUTING.md) +for general contribution guidelines. + +## Maintainers (in alphabetical order) +- [canguler](https://github.com/canguler), Google LLC +- [cesarghali](https://github.com/cesarghali), Google LLC +- [dfawley](https://github.com/dfawley), Google LLC +- [easwars](https://github.com/easwars), Google LLC +- [jadekler](https://github.com/jadekler), Google LLC +- [menghanl](https://github.com/menghanl), Google LLC +- [srini100](https://github.com/srini100), Google LLC + +## Emeritus Maintainers (in alphabetical order) +- [adelez](https://github.com/adelez), Google LLC +- [iamqizhao](https://github.com/iamqizhao), Google LLC +- [jtattermusch](https://github.com/jtattermusch), Google LLC +- [lyuxuan](https://github.com/lyuxuan), Google LLC +- [makmukhi](https://github.com/makmukhi), Google LLC +- [matt-kwong](https://github.com/matt-kwong), Google LLC +- [nicolasnoble](https://github.com/nicolasnoble), Google LLC +- [yongni](https://github.com/yongni), Google LLC diff --git a/vendor/google.golang.org/grpc/attributes/attributes.go b/vendor/google.golang.org/grpc/attributes/attributes.go new file mode 100644 index 00000000000..68ffc620137 --- /dev/null +++ b/vendor/google.golang.org/grpc/attributes/attributes.go @@ -0,0 +1,70 @@ +/* + * + * 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. + * + */ + +// Package attributes defines a generic key/value store used in various gRPC +// components. +// +// All APIs in this package are EXPERIMENTAL. +package attributes + +import "fmt" + +// Attributes is an immutable struct for storing and retrieving generic +// key/value pairs. Keys must be hashable, and users should define their own +// types for keys. +type Attributes struct { + m map[interface{}]interface{} +} + +// New returns a new Attributes containing all key/value pairs in kvs. If the +// same key appears multiple times, the last value overwrites all previous +// values for that key. Panics if len(kvs) is not even. +func New(kvs ...interface{}) *Attributes { + if len(kvs)%2 != 0 { + panic(fmt.Sprintf("attributes.New called with unexpected input: len(kvs) = %v", len(kvs))) + } + a := &Attributes{m: make(map[interface{}]interface{}, len(kvs)/2)} + for i := 0; i < len(kvs)/2; i++ { + a.m[kvs[i*2]] = kvs[i*2+1] + } + return a +} + +// WithValues returns a new Attributes containing all key/value pairs in a and +// kvs. Panics if len(kvs) is not even. If the same key appears multiple +// times, the last value overwrites all previous values for that key. To +// remove an existing key, use a nil value. +func (a *Attributes) WithValues(kvs ...interface{}) *Attributes { + if len(kvs)%2 != 0 { + panic(fmt.Sprintf("attributes.New called with unexpected input: len(kvs) = %v", len(kvs))) + } + n := &Attributes{m: make(map[interface{}]interface{}, len(a.m)+len(kvs)/2)} + for k, v := range a.m { + n.m[k] = v + } + for i := 0; i < len(kvs)/2; i++ { + n.m[kvs[i*2]] = kvs[i*2+1] + } + return n +} + +// Value returns the value associated with these attributes for key, or nil if +// no value is associated with key. +func (a *Attributes) Value(key interface{}) interface{} { + return a.m[key] +} diff --git a/vendor/google.golang.org/grpc/attributes/attributes_test.go b/vendor/google.golang.org/grpc/attributes/attributes_test.go new file mode 100644 index 00000000000..4cca17b55e9 --- /dev/null +++ b/vendor/google.golang.org/grpc/attributes/attributes_test.go @@ -0,0 +1,48 @@ +/* + * + * 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. + * + */ + +package attributes_test + +import ( + "fmt" + + "google.golang.org/grpc/attributes" +) + +func ExampleAttributes() { + type keyOne struct{} + type keyTwo struct{} + a := attributes.New(keyOne{}, 1, keyTwo{}, "two") + fmt.Println("Key one:", a.Value(keyOne{})) + fmt.Println("Key two:", a.Value(keyTwo{})) + // Output: + // Key one: 1 + // Key two: two +} + +func ExampleAttributes_WithValues() { + type keyOne struct{} + type keyTwo struct{} + a := attributes.New(keyOne{}, 1) + a = a.WithValues(keyTwo{}, "two") + fmt.Println("Key one:", a.Value(keyOne{})) + fmt.Println("Key two:", a.Value(keyTwo{})) + // Output: + // Key one: 1 + // Key two: two +} diff --git a/vendor/google.golang.org/grpc/backoff.go b/vendor/google.golang.org/grpc/backoff.go index 97c6e2568f4..ff7c3ee6f48 100644 --- a/vendor/google.golang.org/grpc/backoff.go +++ b/vendor/google.golang.org/grpc/backoff.go @@ -23,16 +23,36 @@ package grpc import ( "time" + + "google.golang.org/grpc/backoff" ) // DefaultBackoffConfig uses values specified for backoff in // https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. +// +// Deprecated: use ConnectParams instead. Will be supported throughout 1.x. var DefaultBackoffConfig = BackoffConfig{ MaxDelay: 120 * time.Second, } // BackoffConfig defines the parameters for the default gRPC backoff strategy. +// +// Deprecated: use ConnectParams instead. Will be supported throughout 1.x. type BackoffConfig struct { // MaxDelay is the upper bound of backoff delay. MaxDelay time.Duration } + +// ConnectParams defines the parameters for connecting and retrying. Users are +// encouraged to use this instead of the BackoffConfig type defined above. See +// here for more details: +// https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. +// +// This API is EXPERIMENTAL. +type ConnectParams struct { + // Backoff specifies the configuration options for connection backoff. + Backoff backoff.Config + // MinConnectTimeout is the minimum amount of time we are willing to give a + // connection to complete. + MinConnectTimeout time.Duration +} diff --git a/vendor/google.golang.org/grpc/backoff/backoff.go b/vendor/google.golang.org/grpc/backoff/backoff.go new file mode 100644 index 00000000000..0787d0b50ce --- /dev/null +++ b/vendor/google.golang.org/grpc/backoff/backoff.go @@ -0,0 +1,52 @@ +/* + * + * 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. + * + */ + +// Package backoff provides configuration options for backoff. +// +// More details can be found at: +// https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. +// +// All APIs in this package are experimental. +package backoff + +import "time" + +// Config defines the configuration options for backoff. +type Config struct { + // BaseDelay is the amount of time to backoff after the first failure. + BaseDelay time.Duration + // Multiplier is the factor with which to multiply backoffs after a + // failed retry. Should ideally be greater than 1. + Multiplier float64 + // Jitter is the factor with which backoffs are randomized. + Jitter float64 + // MaxDelay is the upper bound of backoff delay. + MaxDelay time.Duration +} + +// DefaultConfig is a backoff configuration with the default values specfied +// at https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. +// +// This should be useful for callers who want to configure backoff with +// non-default values only for a subset of the options. +var DefaultConfig = Config{ + BaseDelay: 1.0 * time.Second, + Multiplier: 1.6, + Jitter: 0.2, + MaxDelay: 120 * time.Second, +} diff --git a/vendor/google.golang.org/grpc/balancer/balancer.go b/vendor/google.golang.org/grpc/balancer/balancer.go index c266f4ec102..531a174a839 100644 --- a/vendor/google.golang.org/grpc/balancer/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/balancer.go @@ -117,6 +117,15 @@ type NewSubConnOptions struct { HealthCheckEnabled bool } +// State contains the balancer's state relevant to the gRPC ClientConn. +type State struct { + // State contains the connectivity state of the balancer, which is used to + // determine the state of the ClientConn. + ConnectivityState connectivity.State + // Picker is used to choose connections (SubConns) for RPCs. + Picker V2Picker +} + // ClientConn represents a gRPC ClientConn. // // This interface is to be implemented by gRPC. Users should not need a @@ -137,10 +146,19 @@ type ClientConn interface { // // gRPC will update the connectivity state of the ClientConn, and will call pick // on the new picker to pick new SubConn. + // + // Deprecated: use UpdateState instead UpdateBalancerState(s connectivity.State, p Picker) + // UpdateState notifies gRPC that the balancer's internal state has + // changed. + // + // gRPC will update the connectivity state of the ClientConn, and will call pick + // on the new picker to pick new SubConns. + UpdateState(State) + // ResolveNow is called by balancer to notify gRPC to do a name resolving. - ResolveNow(resolver.ResolveNowOption) + ResolveNow(resolver.ResolveNowOptions) // Target returns the dial target for this ClientConn. // @@ -185,11 +203,19 @@ type ConfigParser interface { ParseConfig(LoadBalancingConfigJSON json.RawMessage) (serviceconfig.LoadBalancingConfig, error) } -// PickOptions contains addition information for the Pick operation. -type PickOptions struct { +// PickOptions is a type alias of PickInfo for legacy reasons. +// +// Deprecated: use PickInfo instead. +type PickOptions = PickInfo + +// PickInfo contains additional information for the Pick operation. +type PickInfo struct { // FullMethodName is the method name that NewClientStream() is called // with. The canonical format is /service/Method. FullMethodName string + // Ctx is the RPC's context, and may contain relevant RPC-level information + // like the outgoing header metadata. + Ctx context.Context } // DoneInfo contains additional information for done. @@ -215,7 +241,7 @@ var ( ErrNoSubConnAvailable = errors.New("no SubConn is available") // ErrTransientFailure indicates all SubConns are in TransientFailure. // WaitForReady RPCs will block, non-WaitForReady RPCs will fail. - ErrTransientFailure = errors.New("all SubConns are in TransientFailure") + ErrTransientFailure = TransientFailureError(errors.New("all SubConns are in TransientFailure")) ) // Picker is used by gRPC to pick a SubConn to send an RPC. @@ -223,6 +249,8 @@ var ( // internal state has changed. // // The pickers used by gRPC can be updated by ClientConn.UpdateBalancerState(). +// +// Deprecated: use V2Picker instead type Picker interface { // Pick returns the SubConn to be used to send the RPC. // The returned SubConn must be one returned by NewSubConn(). @@ -243,18 +271,76 @@ type Picker interface { // // If the returned error is not nil: // - If the error is ErrNoSubConnAvailable, gRPC will block until UpdateBalancerState() - // - If the error is ErrTransientFailure: + // - If the error is ErrTransientFailure or implements IsTransientFailure() + // bool, returning true: // - If the RPC is wait-for-ready, gRPC will block until UpdateBalancerState() // is called to pick again; // - Otherwise, RPC will fail with unavailable error. // - Else (error is other non-nil error): - // - The RPC will fail with unavailable error. + // - The RPC will fail with the error's status code, or Unknown if it is + // not a status error. // // The returned done() function will be called once the rpc has finished, // with the final status of that RPC. If the SubConn returned is not a // valid SubConn type, done may not be called. done may be nil if balancer // doesn't care about the RPC status. - Pick(ctx context.Context, opts PickOptions) (conn SubConn, done func(DoneInfo), err error) + Pick(ctx context.Context, info PickInfo) (conn SubConn, done func(DoneInfo), err error) +} + +// PickResult contains information related to a connection chosen for an RPC. +type PickResult struct { + // SubConn is the connection to use for this pick, if its state is Ready. + // If the state is not Ready, gRPC will block the RPC until a new Picker is + // provided by the balancer (using ClientConn.UpdateState). The SubConn + // must be one returned by ClientConn.NewSubConn. + SubConn SubConn + + // Done is called when the RPC is completed. If the SubConn is not ready, + // this will be called with a nil parameter. If the SubConn is not a valid + // type, Done may not be called. May be nil if the balancer does not wish + // to be notified when the RPC completes. + Done func(DoneInfo) +} + +type transientFailureError struct { + error +} + +func (e *transientFailureError) IsTransientFailure() bool { return true } + +// TransientFailureError wraps err in an error implementing +// IsTransientFailure() bool, returning true. +func TransientFailureError(err error) error { + return &transientFailureError{error: err} +} + +// V2Picker is used by gRPC to pick a SubConn to send an RPC. +// Balancer is expected to generate a new picker from its snapshot every time its +// internal state has changed. +// +// The pickers used by gRPC can be updated by ClientConn.UpdateBalancerState(). +type V2Picker interface { + // Pick returns the connection to use for this RPC and related information. + // + // Pick should not block. If the balancer needs to do I/O or any blocking + // or time-consuming work to service this call, it should return + // ErrNoSubConnAvailable, and the Pick call will be repeated by gRPC when + // the Picker is updated (using ClientConn.UpdateState). + // + // If an error is returned: + // + // - If the error is ErrNoSubConnAvailable, gRPC will block until a new + // Picker is provided by the balancer (using ClientConn.UpdateState). + // + // - If the error implements IsTransientFailure() bool, returning true, + // wait for ready RPCs will wait, but non-wait for ready RPCs will be + // terminated with this error's Error() string and status code + // Unavailable. + // + // - Any other errors terminate all RPCs with the code and message + // provided. If the error is not a status error, it will be converted by + // gRPC to a status error with code Unknown. + Pick(info PickInfo) (PickResult, error) } // Balancer takes input from gRPC, manages SubConns, and collects and aggregates @@ -292,8 +378,11 @@ type Balancer interface { // SubConnState describes the state of a SubConn. type SubConnState struct { + // ConnectivityState is the connectivity state of the SubConn. ConnectivityState connectivity.State - // TODO: add last connection error + // ConnectionError is set if the ConnectivityState is TransientFailure, + // describing the reason the SubConn failed. Otherwise, it is nil. + ConnectionError error } // ClientConnState describes the state of a ClientConn relevant to the @@ -305,14 +394,23 @@ type ClientConnState struct { BalancerConfig serviceconfig.LoadBalancingConfig } +// ErrBadResolverState may be returned by UpdateClientConnState to indicate a +// problem with the provided name resolver data. +var ErrBadResolverState = errors.New("bad resolver state") + // V2Balancer is defined for documentation purposes. If a Balancer also // implements V2Balancer, its UpdateClientConnState method will be called // instead of HandleResolvedAddrs and its UpdateSubConnState will be called // instead of HandleSubConnStateChange. type V2Balancer interface { // UpdateClientConnState is called by gRPC when the state of the ClientConn - // changes. - UpdateClientConnState(ClientConnState) + // changes. If the error returned is ErrBadResolverState, the ClientConn + // will begin calling ResolveNow on the active name resolver with + // exponential backoff until a subsequent call to UpdateClientConnState + // returns a nil error. Any other errors are currently ignored. + UpdateClientConnState(ClientConnState) error + // ResolverError is called by gRPC when the name resolver reports an error. + ResolverError(error) // UpdateSubConnState is called by gRPC when the state of a SubConn // changes. UpdateSubConnState(SubConn, SubConnState) @@ -326,9 +424,8 @@ type V2Balancer interface { // // It's not thread safe. type ConnectivityStateEvaluator struct { - numReady uint64 // Number of addrConns in ready state. - numConnecting uint64 // Number of addrConns in connecting state. - numTransientFailure uint64 // Number of addrConns in transientFailure. + numReady uint64 // Number of addrConns in ready state. + numConnecting uint64 // Number of addrConns in connecting state. } // RecordTransition records state change happening in subConn and based on that @@ -348,8 +445,6 @@ func (cse *ConnectivityStateEvaluator) RecordTransition(oldState, newState conne cse.numReady += updateVal case connectivity.Connecting: cse.numConnecting += updateVal - case connectivity.TransientFailure: - cse.numTransientFailure += updateVal } } diff --git a/vendor/google.golang.org/grpc/balancer/base/balancer.go b/vendor/google.golang.org/grpc/balancer/base/balancer.go index 1af88f0a3f1..d952f09f345 100644 --- a/vendor/google.golang.org/grpc/balancer/base/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/base/balancer.go @@ -20,6 +20,7 @@ package base import ( "context" + "errors" "google.golang.org/grpc/balancer" "google.golang.org/grpc/connectivity" @@ -28,34 +29,44 @@ import ( ) type baseBuilder struct { - name string - pickerBuilder PickerBuilder - config Config + name string + pickerBuilder PickerBuilder + v2PickerBuilder V2PickerBuilder + config Config } func (bb *baseBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) balancer.Balancer { - return &baseBalancer{ - cc: cc, - pickerBuilder: bb.pickerBuilder, + bal := &baseBalancer{ + cc: cc, + pickerBuilder: bb.pickerBuilder, + v2PickerBuilder: bb.v2PickerBuilder, subConns: make(map[resolver.Address]balancer.SubConn), scStates: make(map[balancer.SubConn]connectivity.State), csEvltr: &balancer.ConnectivityStateEvaluator{}, - // Initialize picker to a picker that always return - // ErrNoSubConnAvailable, because when state of a SubConn changes, we - // may call UpdateBalancerState with this picker. - picker: NewErrPicker(balancer.ErrNoSubConnAvailable), - config: bb.config, + config: bb.config, } + // Initialize picker to a picker that always returns + // ErrNoSubConnAvailable, because when state of a SubConn changes, we + // may call UpdateState with this picker. + if bb.pickerBuilder != nil { + bal.picker = NewErrPicker(balancer.ErrNoSubConnAvailable) + } else { + bal.v2Picker = NewErrPickerV2(balancer.ErrNoSubConnAvailable) + } + return bal } func (bb *baseBuilder) Name() string { return bb.name } +var _ balancer.V2Balancer = (*baseBalancer)(nil) // Assert that we implement V2Balancer + type baseBalancer struct { - cc balancer.ClientConn - pickerBuilder PickerBuilder + cc balancer.ClientConn + pickerBuilder PickerBuilder + v2PickerBuilder V2PickerBuilder csEvltr *balancer.ConnectivityStateEvaluator state connectivity.State @@ -63,6 +74,7 @@ type baseBalancer struct { subConns map[resolver.Address]balancer.SubConn scStates map[balancer.SubConn]connectivity.State picker balancer.Picker + v2Picker balancer.V2Picker config Config } @@ -70,7 +82,18 @@ func (b *baseBalancer) HandleResolvedAddrs(addrs []resolver.Address, err error) panic("not implemented") } -func (b *baseBalancer) UpdateClientConnState(s balancer.ClientConnState) { +func (b *baseBalancer) ResolverError(err error) { + switch b.state { + case connectivity.TransientFailure, connectivity.Idle, connectivity.Connecting: + if b.picker != nil { + b.picker = NewErrPicker(err) + } else { + b.v2Picker = NewErrPickerV2(err) + } + } +} + +func (b *baseBalancer) UpdateClientConnState(s balancer.ClientConnState) error { // TODO: handle s.ResolverState.Err (log if not nil) once implemented. // TODO: handle s.ResolverState.ServiceConfig? if grpclog.V(2) { @@ -101,26 +124,51 @@ func (b *baseBalancer) UpdateClientConnState(s balancer.ClientConnState) { // The entry will be deleted in HandleSubConnStateChange. } } + return nil } // regeneratePicker takes a snapshot of the balancer, and generates a picker // from it. The picker is // - errPicker with ErrTransientFailure if the balancer is in TransientFailure, // - built by the pickerBuilder with all READY SubConns otherwise. -func (b *baseBalancer) regeneratePicker() { +func (b *baseBalancer) regeneratePicker(err error) { if b.state == connectivity.TransientFailure { - b.picker = NewErrPicker(balancer.ErrTransientFailure) + if b.pickerBuilder != nil { + b.picker = NewErrPicker(balancer.ErrTransientFailure) + } else { + if err != nil { + b.v2Picker = NewErrPickerV2(balancer.TransientFailureError(err)) + } else { + // This means the last subchannel transition was not to + // TransientFailure (otherwise err must be set), but the + // aggregate state of the balancer is TransientFailure, meaning + // there are no other addresses. + b.v2Picker = NewErrPickerV2(balancer.TransientFailureError(errors.New("resolver returned no addresses"))) + } + } return } - readySCs := make(map[resolver.Address]balancer.SubConn) + if b.pickerBuilder != nil { + readySCs := make(map[resolver.Address]balancer.SubConn) - // Filter out all ready SCs from full subConn map. - for addr, sc := range b.subConns { - if st, ok := b.scStates[sc]; ok && st == connectivity.Ready { - readySCs[addr] = sc + // Filter out all ready SCs from full subConn map. + for addr, sc := range b.subConns { + if st, ok := b.scStates[sc]; ok && st == connectivity.Ready { + readySCs[addr] = sc + } } + b.picker = b.pickerBuilder.Build(readySCs) + } else { + readySCs := make(map[balancer.SubConn]SubConnInfo) + + // Filter out all ready SCs from full subConn map. + for addr, sc := range b.subConns { + if st, ok := b.scStates[sc]; ok && st == connectivity.Ready { + readySCs[sc] = SubConnInfo{Address: addr} + } + } + b.v2Picker = b.v2PickerBuilder.Build(PickerBuildInfo{ReadySCs: readySCs}) } - b.picker = b.pickerBuilder.Build(readySCs) } func (b *baseBalancer) HandleSubConnStateChange(sc balancer.SubConn, s connectivity.State) { @@ -159,10 +207,14 @@ func (b *baseBalancer) UpdateSubConnState(sc balancer.SubConn, state balancer.Su // - the aggregated state of balancer became non-TransientFailure from TransientFailure if (s == connectivity.Ready) != (oldS == connectivity.Ready) || (b.state == connectivity.TransientFailure) != (oldAggrState == connectivity.TransientFailure) { - b.regeneratePicker() + b.regeneratePicker(state.ConnectionError) } - b.cc.UpdateBalancerState(b.state, b.picker) + if b.picker != nil { + b.cc.UpdateBalancerState(b.state, b.picker) + } else { + b.cc.UpdateState(balancer.State{ConnectivityState: b.state, Picker: b.v2Picker}) + } } // Close is a nop because base balancer doesn't have internal state to clean up, @@ -179,6 +231,19 @@ type errPicker struct { err error // Pick() always returns this err. } -func (p *errPicker) Pick(ctx context.Context, opts balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error) { +func (p *errPicker) Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error) { return nil, nil, p.err } + +// NewErrPickerV2 returns a V2Picker that always returns err on Pick(). +func NewErrPickerV2(err error) balancer.V2Picker { + return &errPickerV2{err: err} +} + +type errPickerV2 struct { + err error // Pick() always returns this err. +} + +func (p *errPickerV2) Pick(info balancer.PickInfo) (balancer.PickResult, error) { + return balancer.PickResult{}, p.err +} diff --git a/vendor/google.golang.org/grpc/balancer/base/base.go b/vendor/google.golang.org/grpc/balancer/base/base.go index 34b1f2994a7..4192918b9e2 100644 --- a/vendor/google.golang.org/grpc/balancer/base/base.go +++ b/vendor/google.golang.org/grpc/balancer/base/base.go @@ -42,6 +42,26 @@ type PickerBuilder interface { Build(readySCs map[resolver.Address]balancer.SubConn) balancer.Picker } +// V2PickerBuilder creates balancer.V2Picker. +type V2PickerBuilder interface { + // Build returns a picker that will be used by gRPC to pick a SubConn. + Build(info PickerBuildInfo) balancer.V2Picker +} + +// PickerBuildInfo contains information needed by the picker builder to +// construct a picker. +type PickerBuildInfo struct { + // ReadySCs is a map from all ready SubConns to the Addresses used to + // create them. + ReadySCs map[balancer.SubConn]SubConnInfo +} + +// SubConnInfo contains information about a SubConn created by the base +// balancer. +type SubConnInfo struct { + Address resolver.Address // the address used to create this SubConn +} + // NewBalancerBuilder returns a balancer builder. The balancers // built by this builder will use the picker builder to build pickers. func NewBalancerBuilder(name string, pb PickerBuilder) balancer.Builder { @@ -62,3 +82,12 @@ func NewBalancerBuilderWithConfig(name string, pb PickerBuilder, config Config) config: config, } } + +// NewBalancerBuilderV2 returns a base balancer builder configured by the provided config. +func NewBalancerBuilderV2(name string, pb V2PickerBuilder, config Config) balancer.Builder { + return &baseBuilder{ + name: name, + v2PickerBuilder: pb, + config: config, + } +} diff --git a/vendor/google.golang.org/grpc/balancer/grpclb/grpc_lb_v1/load_balancer.pb.go b/vendor/google.golang.org/grpc/balancer/grpclb/grpc_lb_v1/load_balancer.pb.go index 78b1c537a86..1723e4a3877 100644 --- a/vendor/google.golang.org/grpc/balancer/grpclb/grpc_lb_v1/load_balancer.pb.go +++ b/vendor/google.golang.org/grpc/balancer/grpclb/grpc_lb_v1/load_balancer.pb.go @@ -1,17 +1,18 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: grpc/lb/v1/load_balancer.proto -package grpc_lb_v1 // import "google.golang.org/grpc/balancer/grpclb/grpc_lb_v1" - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import duration "github.com/golang/protobuf/ptypes/duration" -import timestamp "github.com/golang/protobuf/ptypes/timestamp" +package grpc_lb_v1 import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + duration "github.com/golang/protobuf/ptypes/duration" + timestamp "github.com/golang/protobuf/ptypes/timestamp" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -23,7 +24,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type LoadBalanceRequest struct { // Types that are valid to be assigned to LoadBalanceRequestType: @@ -39,16 +40,17 @@ func (m *LoadBalanceRequest) Reset() { *m = LoadBalanceRequest{} } func (m *LoadBalanceRequest) String() string { return proto.CompactTextString(m) } func (*LoadBalanceRequest) ProtoMessage() {} func (*LoadBalanceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_load_balancer_12026aec3f0251ba, []int{0} + return fileDescriptor_7cd3f6d792743fdf, []int{0} } + func (m *LoadBalanceRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_LoadBalanceRequest.Unmarshal(m, b) } func (m *LoadBalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_LoadBalanceRequest.Marshal(b, m, deterministic) } -func (dst *LoadBalanceRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_LoadBalanceRequest.Merge(dst, src) +func (m *LoadBalanceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_LoadBalanceRequest.Merge(m, src) } func (m *LoadBalanceRequest) XXX_Size() int { return xxx_messageInfo_LoadBalanceRequest.Size(m) @@ -96,80 +98,14 @@ func (m *LoadBalanceRequest) GetClientStats() *ClientStats { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*LoadBalanceRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _LoadBalanceRequest_OneofMarshaler, _LoadBalanceRequest_OneofUnmarshaler, _LoadBalanceRequest_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*LoadBalanceRequest) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*LoadBalanceRequest_InitialRequest)(nil), (*LoadBalanceRequest_ClientStats)(nil), } } -func _LoadBalanceRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*LoadBalanceRequest) - // load_balance_request_type - switch x := m.LoadBalanceRequestType.(type) { - case *LoadBalanceRequest_InitialRequest: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.InitialRequest); err != nil { - return err - } - case *LoadBalanceRequest_ClientStats: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ClientStats); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("LoadBalanceRequest.LoadBalanceRequestType has unexpected type %T", x) - } - return nil -} - -func _LoadBalanceRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*LoadBalanceRequest) - switch tag { - case 1: // load_balance_request_type.initial_request - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(InitialLoadBalanceRequest) - err := b.DecodeMessage(msg) - m.LoadBalanceRequestType = &LoadBalanceRequest_InitialRequest{msg} - return true, err - case 2: // load_balance_request_type.client_stats - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ClientStats) - err := b.DecodeMessage(msg) - m.LoadBalanceRequestType = &LoadBalanceRequest_ClientStats{msg} - return true, err - default: - return false, nil - } -} - -func _LoadBalanceRequest_OneofSizer(msg proto.Message) (n int) { - m := msg.(*LoadBalanceRequest) - // load_balance_request_type - switch x := m.LoadBalanceRequestType.(type) { - case *LoadBalanceRequest_InitialRequest: - s := proto.Size(x.InitialRequest) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *LoadBalanceRequest_ClientStats: - s := proto.Size(x.ClientStats) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type InitialLoadBalanceRequest struct { // The name of the load balanced service (e.g., service.googleapis.com). Its // length should be less than 256 bytes. @@ -185,16 +121,17 @@ func (m *InitialLoadBalanceRequest) Reset() { *m = InitialLoadBalanceReq func (m *InitialLoadBalanceRequest) String() string { return proto.CompactTextString(m) } func (*InitialLoadBalanceRequest) ProtoMessage() {} func (*InitialLoadBalanceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_load_balancer_12026aec3f0251ba, []int{1} + return fileDescriptor_7cd3f6d792743fdf, []int{1} } + func (m *InitialLoadBalanceRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InitialLoadBalanceRequest.Unmarshal(m, b) } func (m *InitialLoadBalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_InitialLoadBalanceRequest.Marshal(b, m, deterministic) } -func (dst *InitialLoadBalanceRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_InitialLoadBalanceRequest.Merge(dst, src) +func (m *InitialLoadBalanceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_InitialLoadBalanceRequest.Merge(m, src) } func (m *InitialLoadBalanceRequest) XXX_Size() int { return xxx_messageInfo_InitialLoadBalanceRequest.Size(m) @@ -227,16 +164,17 @@ func (m *ClientStatsPerToken) Reset() { *m = ClientStatsPerToken{} } func (m *ClientStatsPerToken) String() string { return proto.CompactTextString(m) } func (*ClientStatsPerToken) ProtoMessage() {} func (*ClientStatsPerToken) Descriptor() ([]byte, []int) { - return fileDescriptor_load_balancer_12026aec3f0251ba, []int{2} + return fileDescriptor_7cd3f6d792743fdf, []int{2} } + func (m *ClientStatsPerToken) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ClientStatsPerToken.Unmarshal(m, b) } func (m *ClientStatsPerToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ClientStatsPerToken.Marshal(b, m, deterministic) } -func (dst *ClientStatsPerToken) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClientStatsPerToken.Merge(dst, src) +func (m *ClientStatsPerToken) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClientStatsPerToken.Merge(m, src) } func (m *ClientStatsPerToken) XXX_Size() int { return xxx_messageInfo_ClientStatsPerToken.Size(m) @@ -286,16 +224,17 @@ func (m *ClientStats) Reset() { *m = ClientStats{} } func (m *ClientStats) String() string { return proto.CompactTextString(m) } func (*ClientStats) ProtoMessage() {} func (*ClientStats) Descriptor() ([]byte, []int) { - return fileDescriptor_load_balancer_12026aec3f0251ba, []int{3} + return fileDescriptor_7cd3f6d792743fdf, []int{3} } + func (m *ClientStats) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ClientStats.Unmarshal(m, b) } func (m *ClientStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ClientStats.Marshal(b, m, deterministic) } -func (dst *ClientStats) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClientStats.Merge(dst, src) +func (m *ClientStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClientStats.Merge(m, src) } func (m *ClientStats) XXX_Size() int { return xxx_messageInfo_ClientStats.Size(m) @@ -362,16 +301,17 @@ func (m *LoadBalanceResponse) Reset() { *m = LoadBalanceResponse{} } func (m *LoadBalanceResponse) String() string { return proto.CompactTextString(m) } func (*LoadBalanceResponse) ProtoMessage() {} func (*LoadBalanceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_load_balancer_12026aec3f0251ba, []int{4} + return fileDescriptor_7cd3f6d792743fdf, []int{4} } + func (m *LoadBalanceResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_LoadBalanceResponse.Unmarshal(m, b) } func (m *LoadBalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_LoadBalanceResponse.Marshal(b, m, deterministic) } -func (dst *LoadBalanceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_LoadBalanceResponse.Merge(dst, src) +func (m *LoadBalanceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_LoadBalanceResponse.Merge(m, src) } func (m *LoadBalanceResponse) XXX_Size() int { return xxx_messageInfo_LoadBalanceResponse.Size(m) @@ -419,80 +359,14 @@ func (m *LoadBalanceResponse) GetServerList() *ServerList { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*LoadBalanceResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _LoadBalanceResponse_OneofMarshaler, _LoadBalanceResponse_OneofUnmarshaler, _LoadBalanceResponse_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*LoadBalanceResponse) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*LoadBalanceResponse_InitialResponse)(nil), (*LoadBalanceResponse_ServerList)(nil), } } -func _LoadBalanceResponse_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*LoadBalanceResponse) - // load_balance_response_type - switch x := m.LoadBalanceResponseType.(type) { - case *LoadBalanceResponse_InitialResponse: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.InitialResponse); err != nil { - return err - } - case *LoadBalanceResponse_ServerList: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ServerList); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("LoadBalanceResponse.LoadBalanceResponseType has unexpected type %T", x) - } - return nil -} - -func _LoadBalanceResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*LoadBalanceResponse) - switch tag { - case 1: // load_balance_response_type.initial_response - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(InitialLoadBalanceResponse) - err := b.DecodeMessage(msg) - m.LoadBalanceResponseType = &LoadBalanceResponse_InitialResponse{msg} - return true, err - case 2: // load_balance_response_type.server_list - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ServerList) - err := b.DecodeMessage(msg) - m.LoadBalanceResponseType = &LoadBalanceResponse_ServerList{msg} - return true, err - default: - return false, nil - } -} - -func _LoadBalanceResponse_OneofSizer(msg proto.Message) (n int) { - m := msg.(*LoadBalanceResponse) - // load_balance_response_type - switch x := m.LoadBalanceResponseType.(type) { - case *LoadBalanceResponse_InitialResponse: - s := proto.Size(x.InitialResponse) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *LoadBalanceResponse_ServerList: - s := proto.Size(x.ServerList) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type InitialLoadBalanceResponse struct { // This is an application layer redirect that indicates the client should use // the specified server for load balancing. When this field is non-empty in @@ -513,16 +387,17 @@ func (m *InitialLoadBalanceResponse) Reset() { *m = InitialLoadBalanceRe func (m *InitialLoadBalanceResponse) String() string { return proto.CompactTextString(m) } func (*InitialLoadBalanceResponse) ProtoMessage() {} func (*InitialLoadBalanceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_load_balancer_12026aec3f0251ba, []int{5} + return fileDescriptor_7cd3f6d792743fdf, []int{5} } + func (m *InitialLoadBalanceResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InitialLoadBalanceResponse.Unmarshal(m, b) } func (m *InitialLoadBalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_InitialLoadBalanceResponse.Marshal(b, m, deterministic) } -func (dst *InitialLoadBalanceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_InitialLoadBalanceResponse.Merge(dst, src) +func (m *InitialLoadBalanceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_InitialLoadBalanceResponse.Merge(m, src) } func (m *InitialLoadBalanceResponse) XXX_Size() int { return xxx_messageInfo_InitialLoadBalanceResponse.Size(m) @@ -562,16 +437,17 @@ func (m *ServerList) Reset() { *m = ServerList{} } func (m *ServerList) String() string { return proto.CompactTextString(m) } func (*ServerList) ProtoMessage() {} func (*ServerList) Descriptor() ([]byte, []int) { - return fileDescriptor_load_balancer_12026aec3f0251ba, []int{6} + return fileDescriptor_7cd3f6d792743fdf, []int{6} } + func (m *ServerList) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ServerList.Unmarshal(m, b) } func (m *ServerList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ServerList.Marshal(b, m, deterministic) } -func (dst *ServerList) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServerList.Merge(dst, src) +func (m *ServerList) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerList.Merge(m, src) } func (m *ServerList) XXX_Size() int { return xxx_messageInfo_ServerList.Size(m) @@ -618,16 +494,17 @@ func (m *Server) Reset() { *m = Server{} } func (m *Server) String() string { return proto.CompactTextString(m) } func (*Server) ProtoMessage() {} func (*Server) Descriptor() ([]byte, []int) { - return fileDescriptor_load_balancer_12026aec3f0251ba, []int{7} + return fileDescriptor_7cd3f6d792743fdf, []int{7} } + func (m *Server) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Server.Unmarshal(m, b) } func (m *Server) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Server.Marshal(b, m, deterministic) } -func (dst *Server) XXX_Merge(src proto.Message) { - xxx_messageInfo_Server.Merge(dst, src) +func (m *Server) XXX_Merge(src proto.Message) { + xxx_messageInfo_Server.Merge(m, src) } func (m *Server) XXX_Size() int { return xxx_messageInfo_Server.Size(m) @@ -677,6 +554,59 @@ func init() { proto.RegisterType((*Server)(nil), "grpc.lb.v1.Server") } +func init() { proto.RegisterFile("grpc/lb/v1/load_balancer.proto", fileDescriptor_7cd3f6d792743fdf) } + +var fileDescriptor_7cd3f6d792743fdf = []byte{ + // 752 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xdd, 0x6e, 0x23, 0x35, + 0x14, 0xee, 0x90, 0x69, 0x36, 0x39, 0x29, 0x34, 0xeb, 0x85, 0x65, 0x92, 0xdd, 0x6d, 0x4b, 0x24, + 0x56, 0x11, 0x2a, 0x13, 0x52, 0xb8, 0x00, 0x89, 0x0b, 0x48, 0xab, 0x2a, 0x2d, 0xbd, 0x88, 0x9c, + 0x4a, 0x45, 0x95, 0x90, 0x99, 0xc9, 0xb8, 0xa9, 0x55, 0xc7, 0x1e, 0x3c, 0x4e, 0x2a, 0xae, 0x79, + 0x1f, 0xc4, 0x2b, 0x20, 0x5e, 0x0c, 0x8d, 0xed, 0x49, 0xa6, 0x49, 0xa3, 0xbd, 0xca, 0xf8, 0x9c, + 0xcf, 0xdf, 0xf9, 0xfd, 0x1c, 0x38, 0x98, 0xaa, 0x74, 0xd2, 0xe3, 0x71, 0x6f, 0xd1, 0xef, 0x71, + 0x19, 0x25, 0x24, 0x8e, 0x78, 0x24, 0x26, 0x54, 0x85, 0xa9, 0x92, 0x5a, 0x22, 0xc8, 0xfd, 0x21, + 0x8f, 0xc3, 0x45, 0xbf, 0x7d, 0x30, 0x95, 0x72, 0xca, 0x69, 0xcf, 0x78, 0xe2, 0xf9, 0x5d, 0x2f, + 0x99, 0xab, 0x48, 0x33, 0x29, 0x2c, 0xb6, 0x7d, 0xb8, 0xee, 0xd7, 0x6c, 0x46, 0x33, 0x1d, 0xcd, + 0x52, 0x0b, 0xe8, 0xfc, 0xeb, 0x01, 0xba, 0x92, 0x51, 0x32, 0x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, 0xc1, 0xcb, 0x72, 0xc8, 0x51, + 0xde, 0xf6, 0x91, 0x77, 0xdb, 0x77, 0x63, 0x98, 0x4a, 0x1e, 0x89, 0x69, 0x28, 0xd5, 0xb4, 0x67, + 0xfe, 0x51, 0x8a, 0x99, 0x9b, 0x13, 0x8f, 0xcd, 0x0f, 0xe1, 0x31, 0x59, 0xf4, 0xe3, 0xaa, 0x19, + 0xd9, 0xb7, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0x81, 0x14, 0xee, 0xd1, 0x7b, 0x06, 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -738,6 +668,14 @@ type LoadBalancerServer interface { BalanceLoad(LoadBalancer_BalanceLoadServer) error } +// UnimplementedLoadBalancerServer can be embedded to have forward compatible implementations. +type UnimplementedLoadBalancerServer struct { +} + +func (*UnimplementedLoadBalancerServer) BalanceLoad(srv LoadBalancer_BalanceLoadServer) error { + return status.Errorf(codes.Unimplemented, "method BalanceLoad not implemented") +} + func RegisterLoadBalancerServer(s *grpc.Server, srv LoadBalancerServer) { s.RegisterService(&_LoadBalancer_serviceDesc, srv) } @@ -782,58 +720,3 @@ var _LoadBalancer_serviceDesc = grpc.ServiceDesc{ }, Metadata: "grpc/lb/v1/load_balancer.proto", } - -func init() { - proto.RegisterFile("grpc/lb/v1/load_balancer.proto", fileDescriptor_load_balancer_12026aec3f0251ba) -} - -var fileDescriptor_load_balancer_12026aec3f0251ba = []byte{ - // 752 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xdd, 0x6e, 0x23, 0x35, - 0x14, 0xee, 0x90, 0x69, 0x36, 0x39, 0x29, 0x34, 0xeb, 0x85, 0x65, 0x92, 0xdd, 0x6d, 0x4b, 0x24, - 0x56, 0x11, 0x2a, 0x13, 0x52, 0xb8, 0x00, 0x89, 0x0b, 0x48, 0xab, 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 0x02, 0x58, 0x95, - 0x8a, 0x8e, 0xe1, 0x85, 0x2d, 0x35, 0x0b, 0x3c, 0x33, 0x59, 0xb4, 0xd9, 0x13, 0x5c, 0x40, 0x2e, - 0xfd, 0x5a, 0xa5, 0xe9, 0x77, 0xfe, 0xf2, 0xa0, 0x6a, 0x3d, 0xe8, 0x1d, 0x00, 0x4b, 0x49, 0x94, - 0x24, 0x8a, 0x66, 0x99, 0x29, 0x69, 0x0f, 0xd7, 0x59, 0xfa, 0xb3, 0x35, 0xe4, 0x6f, 0x41, 0x1e, - 0xdb, 0xe4, 0xbb, 0x8b, 0xcd, 0xf7, 0x16, 0xd1, 0x57, 0xb6, 0x88, 0x1e, 0x81, 0x6f, 0xd6, 0xce, - 0x3f, 0xf2, 0xba, 0x35, 0x6c, 0xbe, 0xed, 0xfa, 0x9c, 0xc4, 0xb0, 0x57, 0x6a, 0xb8, 0x42, 0x18, - 0x1a, 0xee, 0x3b, 0x37, 0xa3, 0x83, 0x72, 0x1d, 0x9b, 0xcf, 0x54, 0xfb, 0x70, 0xab, 0xdf, 0x4e, - 0xae, 0xeb, 0x7d, 0xe3, 0x0d, 0x6e, 0xe0, 0x63, 0x26, 0x4b, 0xc0, 0xc1, 0xcb, 0x72, 0xc8, 0x51, - 0xde, 0xf6, 0x91, 0x77, 0xdb, 0x77, 0x63, 0x98, 0x4a, 0x1e, 0x89, 0x69, 0x28, 0xd5, 0xb4, 0x67, - 0xfe, 0x51, 0x8a, 0x99, 0x9b, 0x13, 0x8f, 0xcd, 0x0f, 0xe1, 0x31, 0x59, 0xf4, 0xe3, 0xaa, 0x19, - 0xd9, 0xb7, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0x81, 0x14, 0xee, 0xd1, 0x7b, 0x06, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/balancer/grpclb/grpclb.go b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb.go index d881a9211b3..1e34786834b 100644 --- a/vendor/google.golang.org/grpc/balancer/grpclb/grpclb.go +++ b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb.go @@ -40,28 +40,17 @@ import ( "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal" "google.golang.org/grpc/internal/backoff" + "google.golang.org/grpc/internal/resolver/dns" "google.golang.org/grpc/resolver" ) const ( - lbTokeyKey = "lb-token" + lbTokenKey = "lb-token" defaultFallbackTimeout = 10 * time.Second grpclbName = "grpclb" ) -var ( - // defaultBackoffConfig configures the backoff strategy that's used when the - // init handshake in the RPC is unsuccessful. It's not for the clientconn - // reconnect backoff. - // - // It has the same value as the default grpc.DefaultBackoffConfig. - // - // TODO: make backoff configurable. - defaultBackoffConfig = backoff.Exponential{ - MaxDelay: 120 * time.Second, - } - errServerTerminatedConnection = errors.New("grpclb: failed to recv server list: server terminated connection") -) +var errServerTerminatedConnection = errors.New("grpclb: failed to recv server list: server terminated connection") func convertDuration(d *durationpb.Duration) time.Duration { if d == nil { @@ -109,6 +98,7 @@ func (x *balanceLoadClientStream) Recv() (*lbpb.LoadBalanceResponse, error) { func init() { balancer.Register(newLBBuilder()) + dns.EnableSRVLookups = true } // newLBBuilder creates a builder for grpclb. @@ -155,7 +145,7 @@ func (b *lbBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) bal scStates: make(map[balancer.SubConn]connectivity.State), picker: &errPicker{err: balancer.ErrNoSubConnAvailable}, clientStats: newRPCStats(), - backoff: defaultBackoffConfig, // TODO: make backoff configurable. + backoff: backoff.DefaultExponential, // TODO: make backoff configurable. } var err error @@ -173,6 +163,8 @@ func (b *lbBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) bal return lb } +var _ balancer.V2Balancer = (*lbBalancer)(nil) // Assert that we implement V2Balancer + type lbBalancer struct { cc *lbCacheClientConn target string @@ -197,7 +189,7 @@ type lbBalancer struct { // send to remote LB ClientConn through this resolver. manualResolver *lbManualResolver // The ClientConn to talk to the remote balancer. - ccRemoteLB *grpc.ClientConn + ccRemoteLB *remoteBalancerCCWrapper // backoff for calling remote balancer. backoff backoff.Strategy @@ -222,7 +214,7 @@ type lbBalancer struct { state connectivity.State subConns map[resolver.Address]balancer.SubConn // Used to new/remove SubConn. scStates map[balancer.SubConn]connectivity.State // Used to filter READY SubConns. - picker balancer.Picker + picker balancer.V2Picker // Support fallback to resolved backend addresses if there's no response // from remote balancer within fallbackTimeout. remoteBalancerConnected bool @@ -377,7 +369,7 @@ func (lb *lbBalancer) updateStateAndPicker(forceRegeneratePicker bool, resetDrop lb.regeneratePicker(resetDrop) } - lb.cc.UpdateBalancerState(lb.state, lb.picker) + lb.cc.UpdateState(balancer.State{ConnectivityState: lb.state, Picker: lb.picker}) } // fallbackToBackendsAfter blocks for fallbackTimeout and falls back to use @@ -422,7 +414,12 @@ func (lb *lbBalancer) handleServiceConfig(gc *grpclbServiceConfig) { lb.refreshSubConns(lb.backendAddrs, lb.inFallback, newUsePickFirst) } -func (lb *lbBalancer) UpdateClientConnState(ccs balancer.ClientConnState) { +func (lb *lbBalancer) ResolverError(error) { + // Ignore resolver errors. GRPCLB is not selected unless the resolver + // works at least once. +} + +func (lb *lbBalancer) UpdateClientConnState(ccs balancer.ClientConnState) error { if grpclog.V(2) { grpclog.Infof("lbBalancer: UpdateClientConnState: %+v", ccs) } @@ -430,8 +427,10 @@ func (lb *lbBalancer) UpdateClientConnState(ccs balancer.ClientConnState) { lb.handleServiceConfig(gc) addrs := ccs.ResolverState.Addresses - if len(addrs) <= 0 { - return + if len(addrs) == 0 { + // There should be at least one address, either grpclb server or + // fallback. Empty address is not valid. + return balancer.ErrBadResolverState } var remoteBalancerAddrs, backendAddrs []resolver.Address @@ -444,31 +443,37 @@ func (lb *lbBalancer) UpdateClientConnState(ccs balancer.ClientConnState) { } } - if lb.ccRemoteLB == nil { - if len(remoteBalancerAddrs) <= 0 { - grpclog.Errorf("grpclb: no remote balancer address is available, should never happen") - return + if len(remoteBalancerAddrs) == 0 { + if lb.ccRemoteLB != nil { + lb.ccRemoteLB.close() + lb.ccRemoteLB = nil } + } else if lb.ccRemoteLB == nil { // First time receiving resolved addresses, create a cc to remote // balancers. - lb.dialRemoteLB(remoteBalancerAddrs[0].ServerName) + lb.newRemoteBalancerCCWrapper() // Start the fallback goroutine. go lb.fallbackToBackendsAfter(lb.fallbackTimeout) } - // cc to remote balancers uses lb.manualResolver. Send the updated remote - // balancer addresses to it through manualResolver. - lb.manualResolver.UpdateState(resolver.State{Addresses: remoteBalancerAddrs}) + if lb.ccRemoteLB != nil { + // cc to remote balancers uses lb.manualResolver. Send the updated remote + // balancer addresses to it through manualResolver. + lb.manualResolver.UpdateState(resolver.State{Addresses: remoteBalancerAddrs}) + } lb.mu.Lock() lb.resolvedBackendAddrs = backendAddrs - if lb.inFallback { - // This means we received a new list of resolved backends, and we are - // still in fallback mode. Need to update the list of backends we are - // using to the new list of backends. + if len(remoteBalancerAddrs) == 0 || lb.inFallback { + // If there's no remote balancer address in ClientConn update, grpclb + // enters fallback mode immediately. + // + // If a new update is received while grpclb is in fallback, update the + // list of backends being used to the new fallback backends. lb.refreshSubConns(lb.resolvedBackendAddrs, true, lb.usePickFirst) } lb.mu.Unlock() + return nil } func (lb *lbBalancer) Close() { @@ -479,7 +484,7 @@ func (lb *lbBalancer) Close() { } close(lb.doneCh) if lb.ccRemoteLB != nil { - lb.ccRemoteLB.Close() + lb.ccRemoteLB.close() } lb.cc.close() } diff --git a/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_picker.go b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_picker.go index 6f023bc5eed..22213cc0bea 100644 --- a/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_picker.go +++ b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_picker.go @@ -19,7 +19,6 @@ package grpclb import ( - "context" "sync" "sync/atomic" @@ -50,6 +49,14 @@ func newRPCStats() *rpcStats { } } +func isZeroStats(stats *lbpb.ClientStats) bool { + return len(stats.CallsFinishedWithDrop) == 0 && + stats.NumCallsStarted == 0 && + stats.NumCallsFinished == 0 && + stats.NumCallsFinishedWithClientFailedToSend == 0 && + stats.NumCallsFinishedKnownReceived == 0 +} + // toClientStats converts rpcStats to lbpb.ClientStats, and clears rpcStats. func (s *rpcStats) toClientStats() *lbpb.ClientStats { stats := &lbpb.ClientStats{ @@ -96,8 +103,8 @@ type errPicker struct { err error } -func (p *errPicker) Pick(ctx context.Context, opts balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error) { - return nil, nil, p.err +func (p *errPicker) Pick(balancer.PickInfo) (balancer.PickResult, error) { + return balancer.PickResult{}, p.err } // rrPicker does roundrobin on subConns. It's typically used when there's no @@ -118,12 +125,12 @@ func newRRPicker(readySCs []balancer.SubConn) *rrPicker { } } -func (p *rrPicker) Pick(ctx context.Context, opts balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error) { +func (p *rrPicker) Pick(balancer.PickInfo) (balancer.PickResult, error) { p.mu.Lock() defer p.mu.Unlock() sc := p.subConns[p.subConnsNext] p.subConnsNext = (p.subConnsNext + 1) % len(p.subConns) - return sc, nil, nil + return balancer.PickResult{SubConn: sc}, nil } // lbPicker does two layers of picks: @@ -154,7 +161,7 @@ func newLBPicker(serverList []*lbpb.Server, readySCs []balancer.SubConn, stats * } } -func (p *lbPicker) Pick(ctx context.Context, opts balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error) { +func (p *lbPicker) Pick(balancer.PickInfo) (balancer.PickResult, error) { p.mu.Lock() defer p.mu.Unlock() @@ -165,12 +172,12 @@ func (p *lbPicker) Pick(ctx context.Context, opts balancer.PickOptions) (balance // If it's a drop, return an error and fail the RPC. if s.Drop { p.stats.drop(s.LoadBalanceToken) - return nil, nil, status.Errorf(codes.Unavailable, "request dropped by grpclb") + return balancer.PickResult{}, status.Errorf(codes.Unavailable, "request dropped by grpclb") } // If not a drop but there's no ready subConns. if len(p.subConns) <= 0 { - return nil, nil, balancer.ErrNoSubConnAvailable + return balancer.PickResult{}, balancer.ErrNoSubConnAvailable } // Return the next ready subConn in the list, also collect rpc stats. @@ -183,7 +190,7 @@ func (p *lbPicker) Pick(ctx context.Context, opts balancer.PickOptions) (balance p.stats.knownReceived() } } - return sc, done, nil + return balancer.PickResult{SubConn: sc, Done: done}, nil } func (p *lbPicker) updateReadySCs(readySCs []balancer.SubConn) { diff --git a/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_remote_balancer.go b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_remote_balancer.go index 1d1e8848874..ecaa1e78784 100644 --- a/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_remote_balancer.go +++ b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_remote_balancer.go @@ -23,16 +23,19 @@ import ( "fmt" "io" "net" - "reflect" + "sync" "time" + "github.com/golang/protobuf/proto" timestamppb "github.com/golang/protobuf/ptypes/timestamp" + "github.com/google/go-cmp/cmp" "google.golang.org/grpc" "google.golang.org/grpc/balancer" lbpb "google.golang.org/grpc/balancer/grpclb/grpc_lb_v1" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal" + "google.golang.org/grpc/internal/backoff" "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" @@ -53,7 +56,7 @@ func (lb *lbBalancer) processServerList(l *lbpb.ServerList) { lb.serverListReceived = true // If the new server list == old server list, do nothing. - if reflect.DeepEqual(lb.fullServerList, l.Servers) { + if cmp.Equal(lb.fullServerList, l.Servers, cmp.Comparer(proto.Equal)) { if grpclog.V(2) { grpclog.Infof("lbBalancer: new serverlist same as the previous one, ignoring") } @@ -67,7 +70,7 @@ func (lb *lbBalancer) processServerList(l *lbpb.ServerList) { continue } - md := metadata.Pairs(lbTokeyKey, s.LoadBalanceToken) + md := metadata.Pairs(lbTokenKey, s.LoadBalanceToken) ip := net.IP(s.IpAddress) ipStr := ip.String() if ip.To4() == nil { @@ -106,6 +109,12 @@ func (lb *lbBalancer) refreshSubConns(backendAddrs []resolver.Address, fallback fallbackModeChanged := lb.inFallback != fallback lb.inFallback = fallback + if fallbackModeChanged && lb.inFallback { + // Clear previous received list when entering fallback, so if the server + // comes back and sends the same list again, the new addresses will be + // used. + lb.fullServerList = nil + } balancingPolicyChanged := lb.usePickFirst != pickFirst oldUsePickFirst := lb.usePickFirst @@ -195,7 +204,71 @@ func (lb *lbBalancer) refreshSubConns(backendAddrs []resolver.Address, fallback lb.updateStateAndPicker(true, true) } -func (lb *lbBalancer) readServerList(s *balanceLoadClientStream) error { +type remoteBalancerCCWrapper struct { + cc *grpc.ClientConn + lb *lbBalancer + backoff backoff.Strategy + done chan struct{} + + // waitgroup to wait for all goroutines to exit. + wg sync.WaitGroup +} + +func (lb *lbBalancer) newRemoteBalancerCCWrapper() { + var dopts []grpc.DialOption + if creds := lb.opt.DialCreds; creds != nil { + dopts = append(dopts, grpc.WithTransportCredentials(creds)) + } else if bundle := lb.grpclbClientConnCreds; bundle != nil { + dopts = append(dopts, grpc.WithCredentialsBundle(bundle)) + } else { + dopts = append(dopts, grpc.WithInsecure()) + } + if lb.opt.Dialer != nil { + dopts = append(dopts, grpc.WithContextDialer(lb.opt.Dialer)) + } + // Explicitly set pickfirst as the balancer. + dopts = append(dopts, grpc.WithDefaultServiceConfig(`{"loadBalancingPolicy":"pick_first"}`)) + wrb := internal.WithResolverBuilder.(func(resolver.Builder) grpc.DialOption) + dopts = append(dopts, wrb(lb.manualResolver)) + if channelz.IsOn() { + dopts = append(dopts, grpc.WithChannelzParentID(lb.opt.ChannelzParentID)) + } + + // Enable Keepalive for grpclb client. + dopts = append(dopts, grpc.WithKeepaliveParams(keepalive.ClientParameters{ + Time: 20 * time.Second, + Timeout: 10 * time.Second, + PermitWithoutStream: true, + })) + + // The dial target is not important. + // + // The grpclb server addresses will set field ServerName, and creds will + // receive ServerName as authority. + cc, err := grpc.DialContext(context.Background(), "grpclb.subClientConn", dopts...) + if err != nil { + grpclog.Fatalf("failed to dial: %v", err) + } + ccw := &remoteBalancerCCWrapper{ + cc: cc, + lb: lb, + backoff: lb.backoff, + done: make(chan struct{}), + } + lb.ccRemoteLB = ccw + ccw.wg.Add(1) + go ccw.watchRemoteBalancer() +} + +// close closed the ClientConn to remote balancer, and waits until all +// goroutines to finish. +func (ccw *remoteBalancerCCWrapper) close() { + close(ccw.done) + ccw.cc.Close() + ccw.wg.Wait() +} + +func (ccw *remoteBalancerCCWrapper) readServerList(s *balanceLoadClientStream) error { for { reply, err := s.Recv() if err != nil { @@ -205,21 +278,28 @@ func (lb *lbBalancer) readServerList(s *balanceLoadClientStream) error { return fmt.Errorf("grpclb: failed to recv server list: %v", err) } if serverList := reply.GetServerList(); serverList != nil { - lb.processServerList(serverList) + ccw.lb.processServerList(serverList) } } } -func (lb *lbBalancer) sendLoadReport(s *balanceLoadClientStream, interval time.Duration) { +func (ccw *remoteBalancerCCWrapper) sendLoadReport(s *balanceLoadClientStream, interval time.Duration) { ticker := time.NewTicker(interval) defer ticker.Stop() + lastZero := false for { select { case <-ticker.C: case <-s.Context().Done(): return } - stats := lb.clientStats.toClientStats() + stats := ccw.lb.clientStats.toClientStats() + zero := isZeroStats(stats) + if zero && lastZero { + // Quash redundant empty load reports. + continue + } + lastZero = zero t := time.Now() stats.Timestamp = ×tamppb.Timestamp{ Seconds: t.Unix(), @@ -235,23 +315,23 @@ func (lb *lbBalancer) sendLoadReport(s *balanceLoadClientStream, interval time.D } } -func (lb *lbBalancer) callRemoteBalancer() (backoff bool, _ error) { - lbClient := &loadBalancerClient{cc: lb.ccRemoteLB} +func (ccw *remoteBalancerCCWrapper) callRemoteBalancer() (backoff bool, _ error) { + lbClient := &loadBalancerClient{cc: ccw.cc} ctx, cancel := context.WithCancel(context.Background()) defer cancel() stream, err := lbClient.BalanceLoad(ctx, grpc.WaitForReady(true)) if err != nil { return true, fmt.Errorf("grpclb: failed to perform RPC to the remote balancer %v", err) } - lb.mu.Lock() - lb.remoteBalancerConnected = true - lb.mu.Unlock() + ccw.lb.mu.Lock() + ccw.lb.remoteBalancerConnected = true + ccw.lb.mu.Unlock() // grpclb handshake on the stream. initReq := &lbpb.LoadBalanceRequest{ LoadBalanceRequestType: &lbpb.LoadBalanceRequest_InitialRequest{ InitialRequest: &lbpb.InitialLoadBalanceRequest{ - Name: lb.target, + Name: ccw.lb.target, }, }, } @@ -270,21 +350,24 @@ func (lb *lbBalancer) callRemoteBalancer() (backoff bool, _ error) { return true, fmt.Errorf("grpclb: Delegation is not supported") } + ccw.wg.Add(1) go func() { + defer ccw.wg.Done() if d := convertDuration(initResp.ClientStatsReportInterval); d > 0 { - lb.sendLoadReport(stream, d) + ccw.sendLoadReport(stream, d) } }() // No backoff if init req/resp handshake was successful. - return false, lb.readServerList(stream) + return false, ccw.readServerList(stream) } -func (lb *lbBalancer) watchRemoteBalancer() { +func (ccw *remoteBalancerCCWrapper) watchRemoteBalancer() { + defer ccw.wg.Done() var retryCount int for { - doBackoff, err := lb.callRemoteBalancer() + doBackoff, err := ccw.callRemoteBalancer() select { - case <-lb.doneCh: + case <-ccw.done: return default: if err != nil { @@ -296,76 +379,31 @@ func (lb *lbBalancer) watchRemoteBalancer() { } } // Trigger a re-resolve when the stream errors. - lb.cc.cc.ResolveNow(resolver.ResolveNowOption{}) + ccw.lb.cc.cc.ResolveNow(resolver.ResolveNowOptions{}) - lb.mu.Lock() - lb.remoteBalancerConnected = false - lb.fullServerList = nil + ccw.lb.mu.Lock() + ccw.lb.remoteBalancerConnected = false + ccw.lb.fullServerList = nil // Enter fallback when connection to remote balancer is lost, and the // aggregated state is not Ready. - if !lb.inFallback && lb.state != connectivity.Ready { + if !ccw.lb.inFallback && ccw.lb.state != connectivity.Ready { // Entering fallback. - lb.refreshSubConns(lb.resolvedBackendAddrs, true, lb.usePickFirst) + ccw.lb.refreshSubConns(ccw.lb.resolvedBackendAddrs, true, ccw.lb.usePickFirst) } - lb.mu.Unlock() + ccw.lb.mu.Unlock() if !doBackoff { retryCount = 0 continue } - timer := time.NewTimer(lb.backoff.Backoff(retryCount)) + timer := time.NewTimer(ccw.backoff.Backoff(retryCount)) // Copy backoff select { case <-timer.C: - case <-lb.doneCh: + case <-ccw.done: timer.Stop() return } retryCount++ } } - -func (lb *lbBalancer) dialRemoteLB(remoteLBName string) { - var dopts []grpc.DialOption - if creds := lb.opt.DialCreds; creds != nil { - if err := creds.OverrideServerName(remoteLBName); err == nil { - dopts = append(dopts, grpc.WithTransportCredentials(creds)) - } else { - grpclog.Warningf("grpclb: failed to override the server name in the credentials: %v, using Insecure", err) - dopts = append(dopts, grpc.WithInsecure()) - } - } else if bundle := lb.grpclbClientConnCreds; bundle != nil { - dopts = append(dopts, grpc.WithCredentialsBundle(bundle)) - } else { - dopts = append(dopts, grpc.WithInsecure()) - } - if lb.opt.Dialer != nil { - dopts = append(dopts, grpc.WithContextDialer(lb.opt.Dialer)) - } - // Explicitly set pickfirst as the balancer. - dopts = append(dopts, grpc.WithBalancerName(grpc.PickFirstBalancerName)) - wrb := internal.WithResolverBuilder.(func(resolver.Builder) grpc.DialOption) - dopts = append(dopts, wrb(lb.manualResolver)) - if channelz.IsOn() { - dopts = append(dopts, grpc.WithChannelzParentID(lb.opt.ChannelzParentID)) - } - - // Enable Keepalive for grpclb client. - dopts = append(dopts, grpc.WithKeepaliveParams(keepalive.ClientParameters{ - Time: 20 * time.Second, - Timeout: 10 * time.Second, - PermitWithoutStream: true, - })) - - // DialContext using manualResolver.Scheme, which is a random scheme - // generated when init grpclb. The target scheme here is not important. - // - // The grpc dial target will be used by the creds (ALTS) as the authority, - // so it has to be set to remoteLBName that comes from resolver. - cc, err := grpc.DialContext(context.Background(), remoteLBName, dopts...) - if err != nil { - grpclog.Fatalf("failed to dial: %v", err) - } - lb.ccRemoteLB = cc - go lb.watchRemoteBalancer() -} diff --git a/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_test.go b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_test.go index 278ca91a09c..128daa9fe5b 100644 --- a/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_test.go +++ b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_test.go @@ -44,14 +44,13 @@ import ( "google.golang.org/grpc/peer" "google.golang.org/grpc/resolver" "google.golang.org/grpc/resolver/manual" - "google.golang.org/grpc/serviceconfig" "google.golang.org/grpc/status" testpb "google.golang.org/grpc/test/grpc_testing" ) var ( - lbServerName = "bar.com" - beServerName = "foo.com" + lbServerName = "lb.server.com" + beServerName = "backends.com" lbToken = "iamatoken" // Resolver replaces localhost with fakeName in Next(). @@ -61,9 +60,8 @@ var ( ) type serverNameCheckCreds struct { - mu sync.Mutex - sn string - expected string + mu sync.Mutex + sn string } func (c *serverNameCheckCreds) ServerHandshake(rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) { @@ -73,10 +71,10 @@ func (c *serverNameCheckCreds) ServerHandshake(rawConn net.Conn) (net.Conn, cred } return rawConn, nil, nil } -func (c *serverNameCheckCreds) ClientHandshake(ctx context.Context, addr string, rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) { +func (c *serverNameCheckCreds) ClientHandshake(ctx context.Context, authority string, rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) { c.mu.Lock() defer c.mu.Unlock() - b := make([]byte, len(c.expected)) + b := make([]byte, len(authority)) errCh := make(chan error, 1) go func() { _, err := rawConn.Read(b) @@ -85,34 +83,25 @@ func (c *serverNameCheckCreds) ClientHandshake(ctx context.Context, addr string, select { case err := <-errCh: if err != nil { - fmt.Printf("Failed to read the server name from the server %v", err) + fmt.Printf("test-creds: failed to read expected authority name from the server: %v\n", err) return nil, nil, err } case <-ctx.Done(): return nil, nil, ctx.Err() } - if c.expected != string(b) { - fmt.Printf("Read the server name %s want %s", string(b), c.expected) + if authority != string(b) { + fmt.Printf("test-creds: got authority from ClientConn %q, expected by server %q\n", authority, string(b)) return nil, nil, errors.New("received unexpected server name") } return rawConn, nil, nil } func (c *serverNameCheckCreds) Info() credentials.ProtocolInfo { - c.mu.Lock() - defer c.mu.Unlock() return credentials.ProtocolInfo{} } func (c *serverNameCheckCreds) Clone() credentials.TransportCredentials { - c.mu.Lock() - defer c.mu.Unlock() - return &serverNameCheckCreds{ - expected: c.expected, - } + return &serverNameCheckCreds{} } func (c *serverNameCheckCreds) OverrideServerName(s string) error { - c.mu.Lock() - defer c.mu.Unlock() - c.expected = s return nil } @@ -177,18 +166,31 @@ func (s *rpcStats) equal(o *rpcStats) bool { return mapsEqual(s.numCallsDropped, o.numCallsDropped) } +func (s *rpcStats) String() string { + s.mu.Lock() + defer s.mu.Unlock() + return fmt.Sprintf("Started: %v, Finished: %v, FinishedWithClientFailedToSend: %v, FinishedKnownReceived: %v, Dropped: %v", + atomic.LoadInt64(&s.numCallsStarted), + atomic.LoadInt64(&s.numCallsFinished), + atomic.LoadInt64(&s.numCallsFinishedWithClientFailedToSend), + atomic.LoadInt64(&s.numCallsFinishedKnownReceived), + s.numCallsDropped) +} + type remoteBalancer struct { sls chan *lbpb.ServerList statsDura time.Duration done chan struct{} stats *rpcStats + statsChan chan *lbpb.ClientStats } -func newRemoteBalancer(intervals []time.Duration) *remoteBalancer { +func newRemoteBalancer(intervals []time.Duration, statsChan chan *lbpb.ClientStats) *remoteBalancer { return &remoteBalancer{ - sls: make(chan *lbpb.ServerList, 1), - done: make(chan struct{}), - stats: newRPCStats(), + sls: make(chan *lbpb.ServerList, 1), + done: make(chan struct{}), + stats: newRPCStats(), + statsChan: statsChan, } } @@ -229,6 +231,9 @@ func (b *remoteBalancer) BalanceLoad(stream lbgrpc.LoadBalancer_BalanceLoadServe return } b.stats.merge(req.GetClientStats()) + if b.statsChan != nil && req.GetClientStats() != nil { + b.statsChan <- req.GetClientStats() + } } }() for { @@ -249,7 +254,7 @@ func (b *remoteBalancer) BalanceLoad(stream lbgrpc.LoadBalancer_BalanceLoadServe } type testServer struct { - testpb.TestServiceServer + testpb.UnimplementedTestServiceServer addr string fallback bool @@ -306,7 +311,7 @@ type testServers struct { beListeners []net.Listener } -func newLoadBalancer(numberOfBackends int) (tss *testServers, cleanup func(), err error) { +func newLoadBalancer(numberOfBackends int, statsChan chan *lbpb.ClientStats) (tss *testServers, cleanup func(), err error) { var ( beListeners []net.Listener ls *remoteBalancer @@ -339,7 +344,7 @@ func newLoadBalancer(numberOfBackends int) (tss *testServers, cleanup func(), er sn: lbServerName, } lb = grpc.NewServer(grpc.Creds(lbCreds)) - ls = newRemoteBalancer(nil) + ls = newRemoteBalancer(nil, statsChan) lbgrpc.RegisterLoadBalancerServer(lb, ls) go func() { lb.Serve(lbLis) @@ -372,7 +377,7 @@ func TestGRPCLB(t *testing.T) { r, cleanup := manual.GenerateAndRegisterManualResolver() defer cleanup() - tss, cleanup, err := newLoadBalancer(1) + tss, cleanup, err := newLoadBalancer(1, nil) if err != nil { t.Fatalf("failed to create new load balancer: %v", err) } @@ -389,9 +394,7 @@ func TestGRPCLB(t *testing.T) { Servers: bes, } tss.ls.sls <- sl - creds := serverNameCheckCreds{ - expected: beServerName, - } + creds := serverNameCheckCreds{} ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() cc, err := grpc.DialContext(ctx, r.Scheme()+":///"+beServerName, @@ -420,7 +423,7 @@ func TestGRPCLBWeighted(t *testing.T) { r, cleanup := manual.GenerateAndRegisterManualResolver() defer cleanup() - tss, cleanup, err := newLoadBalancer(2) + tss, cleanup, err := newLoadBalancer(2, nil) if err != nil { t.Fatalf("failed to create new load balancer: %v", err) } @@ -440,9 +443,7 @@ func TestGRPCLBWeighted(t *testing.T) { portsToIndex[tss.bePorts[i]] = i } - creds := serverNameCheckCreds{ - expected: beServerName, - } + creds := serverNameCheckCreds{} ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() cc, err := grpc.DialContext(ctx, r.Scheme()+":///"+beServerName, @@ -490,7 +491,7 @@ func TestDropRequest(t *testing.T) { r, cleanup := manual.GenerateAndRegisterManualResolver() defer cleanup() - tss, cleanup, err := newLoadBalancer(2) + tss, cleanup, err := newLoadBalancer(2, nil) if err != nil { t.Fatalf("failed to create new load balancer: %v", err) } @@ -510,9 +511,7 @@ func TestDropRequest(t *testing.T) { Drop: true, }}, } - creds := serverNameCheckCreds{ - expected: beServerName, - } + creds := serverNameCheckCreds{} ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() cc, err := grpc.DialContext(ctx, r.Scheme()+":///"+beServerName, @@ -650,7 +649,7 @@ func TestBalancerDisconnects(t *testing.T) { lbs []*grpc.Server ) for i := 0; i < 2; i++ { - tss, cleanup, err := newLoadBalancer(1) + tss, cleanup, err := newLoadBalancer(1, nil) if err != nil { t.Fatalf("failed to create new load balancer: %v", err) } @@ -672,9 +671,7 @@ func TestBalancerDisconnects(t *testing.T) { lbs = append(lbs, tss.lb) } - creds := serverNameCheckCreds{ - expected: beServerName, - } + creds := serverNameCheckCreds{} ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() cc, err := grpc.DialContext(ctx, r.Scheme()+":///"+beServerName, @@ -727,7 +724,7 @@ func TestFallback(t *testing.T) { r, cleanup := manual.GenerateAndRegisterManualResolver() defer cleanup() - tss, cleanup, err := newLoadBalancer(1) + tss, cleanup, err := newLoadBalancer(1, nil) if err != nil { t.Fatalf("failed to create new load balancer: %v", err) } @@ -753,9 +750,7 @@ func TestFallback(t *testing.T) { Servers: bes, } tss.ls.sls <- sl - creds := serverNameCheckCreds{ - expected: beServerName, - } + creds := serverNameCheckCreds{} ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() cc, err := grpc.DialContext(ctx, r.Scheme()+":///"+beServerName, @@ -771,9 +766,8 @@ func TestFallback(t *testing.T) { Type: resolver.GRPCLB, ServerName: lbServerName, }, { - Addr: beLis.Addr().String(), - Type: resolver.Backend, - ServerName: beServerName, + Addr: beLis.Addr().String(), + Type: resolver.Backend, }}}) var p peer.Peer @@ -789,9 +783,8 @@ func TestFallback(t *testing.T) { Type: resolver.GRPCLB, ServerName: lbServerName, }, { - Addr: beLis.Addr().String(), - Type: resolver.Backend, - ServerName: beServerName, + Addr: beLis.Addr().String(), + Type: resolver.Backend, }}}) var backendUsed bool @@ -852,19 +845,135 @@ func TestFallback(t *testing.T) { } } -func TestGRPCLBPickFirst(t *testing.T) { - const pfc = `{"loadBalancingConfig":[{"grpclb":{"childPolicy":[{"pick_first":{}}]}}]}` - svcCfg, err := serviceconfig.Parse(pfc) +func TestFallBackWithNoServerAddress(t *testing.T) { + defer leakcheck.Check(t) + + resolveNowCh := make(chan struct{}, 1) + r, cleanup := manual.GenerateAndRegisterManualResolver() + r.ResolveNowCallback = func(resolver.ResolveNowOptions) { + select { + case <-resolveNowCh: + default: + } + resolveNowCh <- struct{}{} + } + defer cleanup() + + tss, cleanup, err := newLoadBalancer(1, nil) if err != nil { - t.Fatalf("Error parsing config %q: %v", pfc, err) + t.Fatalf("failed to create new load balancer: %v", err) } + defer cleanup() + + // Start a standalone backend. + beLis, err := net.Listen("tcp", "localhost:0") + if err != nil { + t.Fatalf("Failed to listen %v", err) + } + defer beLis.Close() + standaloneBEs := startBackends(beServerName, true, beLis) + defer stopBackends(standaloneBEs) + + be := &lbpb.Server{ + IpAddress: tss.beIPs[0], + Port: int32(tss.bePorts[0]), + LoadBalanceToken: lbToken, + } + var bes []*lbpb.Server + bes = append(bes, be) + sl := &lbpb.ServerList{ + Servers: bes, + } + creds := serverNameCheckCreds{} + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + cc, err := grpc.DialContext(ctx, r.Scheme()+":///"+beServerName, + grpc.WithTransportCredentials(&creds), grpc.WithContextDialer(fakeNameDialer)) + if err != nil { + t.Fatalf("Failed to dial to the backend %v", err) + } + defer cc.Close() + testC := testpb.NewTestServiceClient(cc) + + // Select grpclb with service config. + const pfc = `{"loadBalancingConfig":[{"grpclb":{"childPolicy":[{"round_robin":{}}]}}]}` + scpr := r.CC.ParseServiceConfig(pfc) + if scpr.Err != nil { + t.Fatalf("Error parsing config %q: %v", pfc, scpr.Err) + } + + for i := 0; i < 2; i++ { + // Send an update with only backend address. grpclb should enter fallback + // and use the fallback backend. + r.UpdateState(resolver.State{ + Addresses: []resolver.Address{{ + Addr: beLis.Addr().String(), + Type: resolver.Backend, + }}, + ServiceConfig: scpr, + }) + select { + case <-resolveNowCh: + t.Errorf("unexpected resolveNow when grpclb gets no balancer address 1111, %d", i) + case <-time.After(time.Second): + } + + var p peer.Peer + rpcCtx, rpcCancel := context.WithTimeout(context.Background(), time.Second) + defer rpcCancel() + if _, err := testC.EmptyCall(rpcCtx, &testpb.Empty{}, grpc.WaitForReady(true), grpc.Peer(&p)); err != nil { + t.Fatalf("_.EmptyCall(_, _) = _, %v, want _, ", err) + } + if p.Addr.String() != beLis.Addr().String() { + t.Fatalf("got peer: %v, want peer: %v", p.Addr, beLis.Addr()) + } + + select { + case <-resolveNowCh: + t.Errorf("unexpected resolveNow when grpclb gets no balancer address 2222, %d", i) + case <-time.After(time.Second): + } + + tss.ls.sls <- sl + // Send an update with balancer address. The backends behind grpclb should + // be used. + r.UpdateState(resolver.State{ + Addresses: []resolver.Address{{ + Addr: tss.lbAddr, + Type: resolver.GRPCLB, + ServerName: lbServerName, + }, { + Addr: beLis.Addr().String(), + Type: resolver.Backend, + }}, + ServiceConfig: scpr, + }) + + var backendUsed bool + for i := 0; i < 1000; i++ { + if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}, grpc.WaitForReady(true), grpc.Peer(&p)); err != nil { + t.Fatalf("%v.EmptyCall(_, _) = _, %v, want _, ", testC, err) + } + if p.Addr.(*net.TCPAddr).Port == tss.bePorts[0] { + backendUsed = true + break + } + time.Sleep(time.Millisecond) + } + if !backendUsed { + t.Fatalf("No RPC sent to backend behind remote balancer after 1 second") + } + } +} + +func TestGRPCLBPickFirst(t *testing.T) { defer leakcheck.Check(t) r, cleanup := manual.GenerateAndRegisterManualResolver() defer cleanup() - tss, cleanup, err := newLoadBalancer(3) + tss, cleanup, err := newLoadBalancer(3, nil) if err != nil { t.Fatalf("failed to create new load balancer: %v", err) } @@ -888,9 +997,7 @@ func TestGRPCLBPickFirst(t *testing.T) { portsToIndex[tss.bePorts[i]] = i } - creds := serverNameCheckCreds{ - expected: beServerName, - } + creds := serverNameCheckCreds{} ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() cc, err := grpc.DialContext(ctx, r.Scheme()+":///"+beServerName, @@ -908,6 +1015,11 @@ func TestGRPCLBPickFirst(t *testing.T) { tss.ls.sls <- &lbpb.ServerList{Servers: beServers[0:3]} // Start with sub policy pick_first. + const pfc = `{"loadBalancingConfig":[{"grpclb":{"childPolicy":[{"pick_first":{}}]}}]}` + scpr := r.CC.ParseServiceConfig(pfc) + if scpr.Err != nil { + t.Fatalf("Error parsing config %q: %v", pfc, scpr.Err) + } r.UpdateState(resolver.State{ Addresses: []resolver.Address{{ @@ -915,7 +1027,7 @@ func TestGRPCLBPickFirst(t *testing.T) { Type: resolver.GRPCLB, ServerName: lbServerName, }}, - ServiceConfig: svcCfg, + ServiceConfig: scpr, }) result = "" @@ -954,9 +1066,9 @@ func TestGRPCLBPickFirst(t *testing.T) { } // Switch sub policy to roundrobin. - grpclbServiceConfigEmpty, err := serviceconfig.Parse(`{}`) - if err != nil { - t.Fatalf("Error parsing config %q: %v", grpclbServiceConfigEmpty, err) + grpclbServiceConfigEmpty := r.CC.ParseServiceConfig(`{}`) + if grpclbServiceConfigEmpty.Err != nil { + t.Fatalf("Error parsing config %q: %v", `{}`, grpclbServiceConfigEmpty.Err) } r.UpdateState(resolver.State{ @@ -1012,13 +1124,11 @@ func checkStats(stats, expected *rpcStats) error { return nil } -func runAndGetStats(t *testing.T, drop bool, runRPCs func(*grpc.ClientConn)) *rpcStats { - defer leakcheck.Check(t) - +func runAndCheckStats(t *testing.T, drop bool, statsChan chan *lbpb.ClientStats, runRPCs func(*grpc.ClientConn), statsWant *rpcStats) error { r, cleanup := manual.GenerateAndRegisterManualResolver() defer cleanup() - tss, cleanup, err := newLoadBalancer(1) + tss, cleanup, err := newLoadBalancer(1, statsChan) if err != nil { t.Fatalf("failed to create new load balancer: %v", err) } @@ -1036,7 +1146,7 @@ func runAndGetStats(t *testing.T, drop bool, runRPCs func(*grpc.ClientConn)) *rp } tss.ls.sls <- &lbpb.ServerList{Servers: servers} tss.ls.statsDura = 100 * time.Millisecond - creds := serverNameCheckCreds{expected: beServerName} + creds := serverNameCheckCreds{} ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() @@ -1056,9 +1166,14 @@ func runAndGetStats(t *testing.T, drop bool, runRPCs func(*grpc.ClientConn)) *rp }}}) runRPCs(cc) - time.Sleep(1 * time.Second) - stats := tss.ls.stats - return stats + end := time.Now().Add(time.Second) + for time.Now().Before(end) { + if err := checkStats(tss.ls.stats, statsWant); err == nil { + time.Sleep(200 * time.Millisecond) // sleep for two intervals to make sure no new stats are reported. + break + } + } + return checkStats(tss.ls.stats, statsWant) } const ( @@ -1068,7 +1183,7 @@ const ( func TestGRPCLBStatsUnarySuccess(t *testing.T) { defer leakcheck.Check(t) - stats := runAndGetStats(t, false, func(cc *grpc.ClientConn) { + if err := runAndCheckStats(t, false, nil, func(cc *grpc.ClientConn) { testC := testpb.NewTestServiceClient(cc) // The first non-failfast RPC succeeds, all connections are up. if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}, grpc.WaitForReady(true)); err != nil { @@ -1077,9 +1192,7 @@ func TestGRPCLBStatsUnarySuccess(t *testing.T) { for i := 0; i < countRPC-1; i++ { testC.EmptyCall(context.Background(), &testpb.Empty{}) } - }) - - if err := checkStats(stats, &rpcStats{ + }, &rpcStats{ numCallsStarted: int64(countRPC), numCallsFinished: int64(countRPC), numCallsFinishedKnownReceived: int64(countRPC), @@ -1090,7 +1203,7 @@ func TestGRPCLBStatsUnarySuccess(t *testing.T) { func TestGRPCLBStatsUnaryDrop(t *testing.T) { defer leakcheck.Check(t) - stats := runAndGetStats(t, true, func(cc *grpc.ClientConn) { + if err := runAndCheckStats(t, true, nil, func(cc *grpc.ClientConn) { testC := testpb.NewTestServiceClient(cc) // The first non-failfast RPC succeeds, all connections are up. if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}, grpc.WaitForReady(true)); err != nil { @@ -1099,9 +1212,7 @@ func TestGRPCLBStatsUnaryDrop(t *testing.T) { for i := 0; i < countRPC-1; i++ { testC.EmptyCall(context.Background(), &testpb.Empty{}) } - }) - - if err := checkStats(stats, &rpcStats{ + }, &rpcStats{ numCallsStarted: int64(countRPC), numCallsFinished: int64(countRPC), numCallsFinishedKnownReceived: int64(countRPC) / 2, @@ -1113,7 +1224,7 @@ func TestGRPCLBStatsUnaryDrop(t *testing.T) { func TestGRPCLBStatsUnaryFailedToSend(t *testing.T) { defer leakcheck.Check(t) - stats := runAndGetStats(t, false, func(cc *grpc.ClientConn) { + if err := runAndCheckStats(t, false, nil, func(cc *grpc.ClientConn) { testC := testpb.NewTestServiceClient(cc) // The first non-failfast RPC succeeds, all connections are up. if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}, grpc.WaitForReady(true)); err != nil { @@ -1122,9 +1233,7 @@ func TestGRPCLBStatsUnaryFailedToSend(t *testing.T) { for i := 0; i < countRPC-1; i++ { cc.Invoke(context.Background(), failtosendURI, &testpb.Empty{}, nil) } - }) - - if err := checkStats(stats, &rpcStats{ + }, &rpcStats{ numCallsStarted: int64(countRPC)*2 - 1, numCallsFinished: int64(countRPC)*2 - 1, numCallsFinishedWithClientFailedToSend: int64(countRPC-1) * 2, @@ -1136,7 +1245,7 @@ func TestGRPCLBStatsUnaryFailedToSend(t *testing.T) { func TestGRPCLBStatsStreamingSuccess(t *testing.T) { defer leakcheck.Check(t) - stats := runAndGetStats(t, false, func(cc *grpc.ClientConn) { + if err := runAndCheckStats(t, false, nil, func(cc *grpc.ClientConn) { testC := testpb.NewTestServiceClient(cc) // The first non-failfast RPC succeeds, all connections are up. stream, err := testC.FullDuplexCall(context.Background(), grpc.WaitForReady(true)) @@ -1159,9 +1268,7 @@ func TestGRPCLBStatsStreamingSuccess(t *testing.T) { } } } - }) - - if err := checkStats(stats, &rpcStats{ + }, &rpcStats{ numCallsStarted: int64(countRPC), numCallsFinished: int64(countRPC), numCallsFinishedKnownReceived: int64(countRPC), @@ -1172,7 +1279,7 @@ func TestGRPCLBStatsStreamingSuccess(t *testing.T) { func TestGRPCLBStatsStreamingDrop(t *testing.T) { defer leakcheck.Check(t) - stats := runAndGetStats(t, true, func(cc *grpc.ClientConn) { + if err := runAndCheckStats(t, true, nil, func(cc *grpc.ClientConn) { testC := testpb.NewTestServiceClient(cc) // The first non-failfast RPC succeeds, all connections are up. stream, err := testC.FullDuplexCall(context.Background(), grpc.WaitForReady(true)) @@ -1195,9 +1302,7 @@ func TestGRPCLBStatsStreamingDrop(t *testing.T) { } } } - }) - - if err := checkStats(stats, &rpcStats{ + }, &rpcStats{ numCallsStarted: int64(countRPC), numCallsFinished: int64(countRPC), numCallsFinishedKnownReceived: int64(countRPC) / 2, @@ -1209,7 +1314,7 @@ func TestGRPCLBStatsStreamingDrop(t *testing.T) { func TestGRPCLBStatsStreamingFailedToSend(t *testing.T) { defer leakcheck.Check(t) - stats := runAndGetStats(t, false, func(cc *grpc.ClientConn) { + if err := runAndCheckStats(t, false, nil, func(cc *grpc.ClientConn) { testC := testpb.NewTestServiceClient(cc) // The first non-failfast RPC succeeds, all connections are up. stream, err := testC.FullDuplexCall(context.Background(), grpc.WaitForReady(true)) @@ -1224,9 +1329,7 @@ func TestGRPCLBStatsStreamingFailedToSend(t *testing.T) { for i := 0; i < countRPC-1; i++ { cc.NewStream(context.Background(), &grpc.StreamDesc{}, failtosendURI) } - }) - - if err := checkStats(stats, &rpcStats{ + }, &rpcStats{ numCallsStarted: int64(countRPC)*2 - 1, numCallsFinished: int64(countRPC)*2 - 1, numCallsFinishedWithClientFailedToSend: int64(countRPC-1) * 2, @@ -1235,3 +1338,40 @@ func TestGRPCLBStatsStreamingFailedToSend(t *testing.T) { t.Fatal(err) } } + +func TestGRPCLBStatsQuashEmpty(t *testing.T) { + defer leakcheck.Check(t) + ch := make(chan *lbpb.ClientStats) + defer close(ch) + if err := runAndCheckStats(t, false, ch, func(cc *grpc.ClientConn) { + // Perform no RPCs; wait for load reports to start, which should be + // zero, then expect no other load report within 5x the update + // interval. + select { + case st := <-ch: + if !isZeroStats(st) { + t.Errorf("got stats %v; want all zero", st) + } + case <-time.After(5 * time.Second): + t.Errorf("did not get initial stats report after 5 seconds") + return + } + + select { + case st := <-ch: + t.Errorf("got unexpected stats report: %v", st) + case <-time.After(500 * time.Millisecond): + // Success. + } + go func() { + for range ch { // Drain statsChan until it is closed. + } + }() + }, &rpcStats{ + numCallsStarted: 0, + numCallsFinished: 0, + numCallsFinishedKnownReceived: 0, + }); err != nil { + t.Fatal(err) + } +} diff --git a/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_util.go b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_util.go index 2663c37e3f8..636725e5416 100644 --- a/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_util.go +++ b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_util.go @@ -24,7 +24,6 @@ import ( "time" "google.golang.org/grpc/balancer" - "google.golang.org/grpc/connectivity" "google.golang.org/grpc/resolver" ) @@ -67,7 +66,7 @@ type lbManualResolver struct { ccb balancer.ClientConn } -func (r *lbManualResolver) Build(_ resolver.Target, cc resolver.ClientConn, _ resolver.BuildOption) (resolver.Resolver, error) { +func (r *lbManualResolver) Build(_ resolver.Target, cc resolver.ClientConn, _ resolver.BuildOptions) (resolver.Resolver, error) { r.ccr = cc return r, nil } @@ -77,7 +76,7 @@ func (r *lbManualResolver) Scheme() string { } // ResolveNow calls resolveNow on the parent ClientConn. -func (r *lbManualResolver) ResolveNow(o resolver.ResolveNowOption) { +func (r *lbManualResolver) ResolveNow(o resolver.ResolveNowOptions) { r.ccb.ResolveNow(o) } @@ -173,13 +172,13 @@ func (ccc *lbCacheClientConn) RemoveSubConn(sc balancer.SubConn) { timer := time.AfterFunc(ccc.timeout, func() { ccc.mu.Lock() + defer ccc.mu.Unlock() if entry.abortDeleting { return } ccc.cc.RemoveSubConn(sc) delete(ccc.subConnToAddr, sc) delete(ccc.subConnCache, addr) - ccc.mu.Unlock() }) entry.cancel = func() { if !timer.Stop() { @@ -195,8 +194,8 @@ func (ccc *lbCacheClientConn) RemoveSubConn(sc balancer.SubConn) { } } -func (ccc *lbCacheClientConn) UpdateBalancerState(s connectivity.State, p balancer.Picker) { - ccc.cc.UpdateBalancerState(s, p) +func (ccc *lbCacheClientConn) UpdateState(s balancer.State) { + ccc.cc.UpdateState(s) } func (ccc *lbCacheClientConn) close() { diff --git a/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_util_test.go b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_util_test.go index 39d422a7050..0037b3d9d7e 100644 --- a/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_util_test.go +++ b/vendor/google.golang.org/grpc/balancer/grpclb/grpclb_util_test.go @@ -217,3 +217,46 @@ func TestLBCacheClientConnReuse(t *testing.T) { t.Fatal(err) } } + +// Test that if the timer to remove a SubConn fires at the same time NewSubConn +// cancels the timer, it doesn't cause deadlock. +func TestLBCache_RemoveTimer_New_Race(t *testing.T) { + mcc := newMockClientConn() + if err := checkMockCC(mcc, 0); err != nil { + t.Fatal(err) + } + + ccc := newLBCacheClientConn(mcc) + ccc.timeout = time.Nanosecond + if err := checkCacheCC(ccc, 0, 0); err != nil { + t.Fatal(err) + } + + sc, _ := ccc.NewSubConn([]resolver.Address{{Addr: "address1"}}, balancer.NewSubConnOptions{}) + // One subconn in MockCC. + if err := checkMockCC(mcc, 1); err != nil { + t.Fatal(err) + } + // No subconn being deleted, and one in CacheCC. + if err := checkCacheCC(ccc, 0, 1); err != nil { + t.Fatal(err) + } + + done := make(chan struct{}) + + go func() { + for i := 0; i < 1000; i++ { + // Remove starts a timer with 1 ns timeout, the NewSubConn will race + // with with the timer. + ccc.RemoveSubConn(sc) + sc, _ = ccc.NewSubConn([]resolver.Address{{Addr: "address1"}}, balancer.NewSubConnOptions{}) + } + close(done) + }() + + select { + case <-time.After(time.Second): + t.Fatalf("Test didn't finish within 1 second. Deadlock") + case <-done: + } +} diff --git a/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go b/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go index 29f7a4ddd68..d4d645501c1 100644 --- a/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go +++ b/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go @@ -22,14 +22,12 @@ package roundrobin import ( - "context" "sync" "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/base" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal/grpcrand" - "google.golang.org/grpc/resolver" ) // Name is the name of round_robin balancer. @@ -37,7 +35,7 @@ const Name = "round_robin" // newBuilder creates a new roundrobin balancer builder. func newBuilder() balancer.Builder { - return base.NewBalancerBuilderWithConfig(Name, &rrPickerBuilder{}, base.Config{HealthCheck: true}) + return base.NewBalancerBuilderV2(Name, &rrPickerBuilder{}, base.Config{HealthCheck: true}) } func init() { @@ -46,13 +44,13 @@ func init() { type rrPickerBuilder struct{} -func (*rrPickerBuilder) Build(readySCs map[resolver.Address]balancer.SubConn) balancer.Picker { - grpclog.Infof("roundrobinPicker: newPicker called with readySCs: %v", readySCs) - if len(readySCs) == 0 { - return base.NewErrPicker(balancer.ErrNoSubConnAvailable) +func (*rrPickerBuilder) Build(info base.PickerBuildInfo) balancer.V2Picker { + grpclog.Infof("roundrobinPicker: newPicker called with info: %v", info) + if len(info.ReadySCs) == 0 { + return base.NewErrPickerV2(balancer.ErrNoSubConnAvailable) } var scs []balancer.SubConn - for _, sc := range readySCs { + for sc := range info.ReadySCs { scs = append(scs, sc) } return &rrPicker{ @@ -74,10 +72,10 @@ type rrPicker struct { next int } -func (p *rrPicker) Pick(ctx context.Context, opts balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error) { +func (p *rrPicker) Pick(balancer.PickInfo) (balancer.PickResult, error) { p.mu.Lock() sc := p.subConns[p.next] p.next = (p.next + 1) % len(p.subConns) p.mu.Unlock() - return sc, nil, nil + return balancer.PickResult{SubConn: sc}, nil } diff --git a/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin_test.go b/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin_test.go index 2cc900c5737..4f13bdd7897 100644 --- a/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin_test.go +++ b/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin_test.go @@ -39,7 +39,7 @@ import ( ) type testServer struct { - testpb.TestServiceServer + testpb.UnimplementedTestServiceServer } func (s *testServer) EmptyCall(ctx context.Context, in *testpb.Empty) (*testpb.Empty, error) { diff --git a/vendor/google.golang.org/grpc/balancer_conn_wrappers.go b/vendor/google.golang.org/grpc/balancer_conn_wrappers.go index 8df4095ca95..824f28e740a 100644 --- a/vendor/google.golang.org/grpc/balancer_conn_wrappers.go +++ b/vendor/google.golang.org/grpc/balancer_conn_wrappers.go @@ -25,6 +25,8 @@ import ( "google.golang.org/grpc/balancer" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal/buffer" + "google.golang.org/grpc/internal/grpcsync" "google.golang.org/grpc/resolver" ) @@ -32,64 +34,17 @@ import ( type scStateUpdate struct { sc balancer.SubConn state connectivity.State -} - -// scStateUpdateBuffer is an unbounded channel for scStateChangeTuple. -// TODO make a general purpose buffer that uses interface{}. -type scStateUpdateBuffer struct { - c chan *scStateUpdate - mu sync.Mutex - backlog []*scStateUpdate -} - -func newSCStateUpdateBuffer() *scStateUpdateBuffer { - return &scStateUpdateBuffer{ - c: make(chan *scStateUpdate, 1), - } -} - -func (b *scStateUpdateBuffer) put(t *scStateUpdate) { - b.mu.Lock() - defer b.mu.Unlock() - if len(b.backlog) == 0 { - select { - case b.c <- t: - return - default: - } - } - b.backlog = append(b.backlog, t) -} - -func (b *scStateUpdateBuffer) load() { - b.mu.Lock() - defer b.mu.Unlock() - if len(b.backlog) > 0 { - select { - case b.c <- b.backlog[0]: - b.backlog[0] = nil - b.backlog = b.backlog[1:] - default: - } - } -} - -// get returns the channel that the scStateUpdate will be sent to. -// -// Upon receiving, the caller should call load to send another -// scStateChangeTuple onto the channel if there is any. -func (b *scStateUpdateBuffer) get() <-chan *scStateUpdate { - return b.c + err error } // ccBalancerWrapper is a wrapper on top of cc for balancers. // It implements balancer.ClientConn interface. type ccBalancerWrapper struct { - cc *ClientConn - balancer balancer.Balancer - stateChangeQueue *scStateUpdateBuffer - ccUpdateCh chan *balancer.ClientConnState - done chan struct{} + cc *ClientConn + balancerMu sync.Mutex // synchronizes calls to the balancer + balancer balancer.Balancer + scBuffer *buffer.Unbounded + done *grpcsync.Event mu sync.Mutex subConns map[*acBalancerWrapper]struct{} @@ -97,11 +52,10 @@ type ccBalancerWrapper struct { func newCCBalancerWrapper(cc *ClientConn, b balancer.Builder, bopts balancer.BuildOptions) *ccBalancerWrapper { ccb := &ccBalancerWrapper{ - cc: cc, - stateChangeQueue: newSCStateUpdateBuffer(), - ccUpdateCh: make(chan *balancer.ClientConnState, 1), - done: make(chan struct{}), - subConns: make(map[*acBalancerWrapper]struct{}), + cc: cc, + scBuffer: buffer.NewUnbounded(), + done: grpcsync.NewEvent(), + subConns: make(map[*acBalancerWrapper]struct{}), } go ccb.watcher() ccb.balancer = b.Build(ccb, bopts) @@ -113,36 +67,23 @@ func newCCBalancerWrapper(cc *ClientConn, b balancer.Builder, bopts balancer.Bui func (ccb *ccBalancerWrapper) watcher() { for { select { - case t := <-ccb.stateChangeQueue.get(): - ccb.stateChangeQueue.load() - select { - case <-ccb.done: - ccb.balancer.Close() - return - default: + case t := <-ccb.scBuffer.Get(): + ccb.scBuffer.Load() + if ccb.done.HasFired() { + break } + ccb.balancerMu.Lock() + su := t.(*scStateUpdate) if ub, ok := ccb.balancer.(balancer.V2Balancer); ok { - ub.UpdateSubConnState(t.sc, balancer.SubConnState{ConnectivityState: t.state}) + ub.UpdateSubConnState(su.sc, balancer.SubConnState{ConnectivityState: su.state, ConnectionError: su.err}) } else { - ccb.balancer.HandleSubConnStateChange(t.sc, t.state) + ccb.balancer.HandleSubConnStateChange(su.sc, su.state) } - case s := <-ccb.ccUpdateCh: - select { - case <-ccb.done: - ccb.balancer.Close() - return - default: - } - if ub, ok := ccb.balancer.(balancer.V2Balancer); ok { - ub.UpdateClientConnState(*s) - } else { - ccb.balancer.HandleResolvedAddrs(s.ResolverState.Addresses, nil) - } - case <-ccb.done: + ccb.balancerMu.Unlock() + case <-ccb.done.Done(): } - select { - case <-ccb.done: + if ccb.done.HasFired() { ccb.balancer.Close() ccb.mu.Lock() scs := ccb.subConns @@ -151,19 +92,17 @@ func (ccb *ccBalancerWrapper) watcher() { for acbw := range scs { ccb.cc.removeAddrConn(acbw.getAddrConn(), errConnDrain) } - ccb.UpdateBalancerState(connectivity.Connecting, nil) + ccb.UpdateState(balancer.State{ConnectivityState: connectivity.Connecting, Picker: nil}) return - default: } - ccb.cc.firstResolveEvent.Fire() } } func (ccb *ccBalancerWrapper) close() { - close(ccb.done) + ccb.done.Fire() } -func (ccb *ccBalancerWrapper) handleSubConnStateChange(sc balancer.SubConn, s connectivity.State) { +func (ccb *ccBalancerWrapper) handleSubConnStateChange(sc balancer.SubConn, s connectivity.State, err error) { // When updating addresses for a SubConn, if the address in use is not in // the new addresses, the old ac will be tearDown() and a new ac will be // created. tearDown() generates a state change with Shutdown state, we @@ -174,30 +113,29 @@ func (ccb *ccBalancerWrapper) handleSubConnStateChange(sc balancer.SubConn, s co if sc == nil { return } - ccb.stateChangeQueue.put(&scStateUpdate{ + ccb.scBuffer.Put(&scStateUpdate{ sc: sc, state: s, + err: err, }) } -func (ccb *ccBalancerWrapper) updateClientConnState(ccs *balancer.ClientConnState) { - if ccb.cc.curBalancerName != grpclbName { - // Filter any grpclb addresses since we don't have the grpclb balancer. - s := &ccs.ResolverState - for i := 0; i < len(s.Addresses); { - if s.Addresses[i].Type == resolver.GRPCLB { - copy(s.Addresses[i:], s.Addresses[i+1:]) - s.Addresses = s.Addresses[:len(s.Addresses)-1] - continue - } - i++ - } +func (ccb *ccBalancerWrapper) updateClientConnState(ccs *balancer.ClientConnState) error { + ccb.balancerMu.Lock() + defer ccb.balancerMu.Unlock() + if ub, ok := ccb.balancer.(balancer.V2Balancer); ok { + return ub.UpdateClientConnState(*ccs) } - select { - case <-ccb.ccUpdateCh: - default: + ccb.balancer.HandleResolvedAddrs(ccs.ResolverState.Addresses, nil) + return nil +} + +func (ccb *ccBalancerWrapper) resolverError(err error) { + if ub, ok := ccb.balancer.(balancer.V2Balancer); ok { + ccb.balancerMu.Lock() + ub.ResolverError(err) + ccb.balancerMu.Unlock() } - ccb.ccUpdateCh <- ccs } func (ccb *ccBalancerWrapper) NewSubConn(addrs []resolver.Address, opts balancer.NewSubConnOptions) (balancer.SubConn, error) { @@ -250,7 +188,22 @@ func (ccb *ccBalancerWrapper) UpdateBalancerState(s connectivity.State, p balanc ccb.cc.csMgr.updateState(s) } -func (ccb *ccBalancerWrapper) ResolveNow(o resolver.ResolveNowOption) { +func (ccb *ccBalancerWrapper) UpdateState(s balancer.State) { + ccb.mu.Lock() + defer ccb.mu.Unlock() + if ccb.subConns == nil { + return + } + // Update picker before updating state. Even though the ordering here does + // not matter, it can lead to multiple calls of Pick in the common start-up + // case where we wait for ready and then perform an RPC. If the picker is + // updated later, we could call the "connecting" picker when the state is + // updated, and then call the "ready" picker after the picker gets updated. + ccb.cc.blockingpicker.updatePickerV2(s.Picker) + ccb.cc.csMgr.updateState(s.ConnectivityState) +} + +func (ccb *ccBalancerWrapper) ResolveNow(o resolver.ResolveNowOptions) { ccb.cc.resolveNow(o) } diff --git a/vendor/google.golang.org/grpc/balancer_conn_wrappers_test.go b/vendor/google.golang.org/grpc/balancer_conn_wrappers_test.go new file mode 100644 index 00000000000..a29a7dd8fad --- /dev/null +++ b/vendor/google.golang.org/grpc/balancer_conn_wrappers_test.go @@ -0,0 +1,90 @@ +/* + * + * 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. + * + */ + +package grpc + +import ( + "fmt" + "testing" + + "google.golang.org/grpc/balancer" + "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/resolver" + "google.golang.org/grpc/resolver/manual" +) + +var _ balancer.V2Balancer = &funcBalancer{} + +type funcBalancer struct { + updateClientConnState func(s balancer.ClientConnState) error +} + +func (*funcBalancer) HandleSubConnStateChange(balancer.SubConn, connectivity.State) { + panic("unimplemented") // v1 API +} +func (*funcBalancer) HandleResolvedAddrs([]resolver.Address, error) { + panic("unimplemented") // v1 API +} +func (b *funcBalancer) UpdateClientConnState(s balancer.ClientConnState) error { + return b.updateClientConnState(s) +} +func (*funcBalancer) ResolverError(error) {} +func (*funcBalancer) UpdateSubConnState(balancer.SubConn, balancer.SubConnState) { + panic("unimplemented") // we never have sub-conns +} +func (*funcBalancer) Close() {} + +type funcBalancerBuilder struct { + name string + instance *funcBalancer +} + +func (b *funcBalancerBuilder) Build(balancer.ClientConn, balancer.BuildOptions) balancer.Balancer { + return b.instance +} +func (b *funcBalancerBuilder) Name() string { return b.name } + +// TestBalancerErrorResolverPolling injects balancer errors and verifies +// ResolveNow is called on the resolver with the appropriate backoff strategy +// being consulted between ResolveNow calls. +func (s) TestBalancerErrorResolverPolling(t *testing.T) { + // The test balancer will return ErrBadResolverState iff the + // ClientConnState contains no addresses. + fb := &funcBalancer{ + updateClientConnState: func(s balancer.ClientConnState) error { + if len(s.ResolverState.Addresses) == 0 { + return balancer.ErrBadResolverState + } + return nil + }, + } + const balName = "BalancerErrorResolverPolling" + balancer.Register(&funcBalancerBuilder{name: balName, instance: fb}) + + testResolverErrorPolling(t, + func(r *manual.Resolver) { + // No addresses so the balancer will fail. + r.CC.UpdateState(resolver.State{}) + }, func(r *manual.Resolver) { + // UpdateState will block if ResolveNow is being called (which blocks on + // rn), so call it in a goroutine. Include some address so the balancer + // will be happy. + go r.CC.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: "x"}}}) + }, + WithDefaultServiceConfig(fmt.Sprintf(`{ "loadBalancingConfig": [{"%v": {}}] }`, balName))) +} diff --git a/vendor/google.golang.org/grpc/balancer_switching_test.go b/vendor/google.golang.org/grpc/balancer_switching_test.go index 638139ab4c2..1ccbaba6cdc 100644 --- a/vendor/google.golang.org/grpc/balancer_switching_test.go +++ b/vendor/google.golang.org/grpc/balancer_switching_test.go @@ -28,7 +28,6 @@ import ( "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/roundrobin" "google.golang.org/grpc/connectivity" - _ "google.golang.org/grpc/grpclog/glogger" "google.golang.org/grpc/internal" "google.golang.org/grpc/resolver" "google.golang.org/grpc/resolver/manual" @@ -149,12 +148,12 @@ func (s) TestSwitchBalancer(t *testing.T) { t.Fatalf("check pickfirst returned non-nil error: %v", err) } // Switch to roundrobin. - cc.updateResolverState(resolver.State{ServiceConfig: parseCfg(`{"loadBalancingPolicy": "round_robin"}`), Addresses: addrs}) + cc.updateResolverState(resolver.State{ServiceConfig: parseCfg(r, `{"loadBalancingPolicy": "round_robin"}`), Addresses: addrs}, nil) if err := checkRoundRobin(cc, servers); err != nil { t.Fatalf("check roundrobin returned non-nil error: %v", err) } // Switch to pickfirst. - cc.updateResolverState(resolver.State{ServiceConfig: parseCfg(`{"loadBalancingPolicy": "pick_first"}`), Addresses: addrs}) + cc.updateResolverState(resolver.State{ServiceConfig: parseCfg(r, `{"loadBalancingPolicy": "pick_first"}`), Addresses: addrs}, nil) if err := checkPickFirst(cc, servers); err != nil { t.Fatalf("check pickfirst returned non-nil error: %v", err) } @@ -181,7 +180,7 @@ func (s) TestBalancerDialOption(t *testing.T) { t.Fatalf("check roundrobin returned non-nil error: %v", err) } // Switch to pickfirst. - cc.updateResolverState(resolver.State{ServiceConfig: parseCfg(`{"loadBalancingPolicy": "pick_first"}`), Addresses: addrs}) + cc.updateResolverState(resolver.State{ServiceConfig: parseCfg(r, `{"loadBalancingPolicy": "pick_first"}`), Addresses: addrs}, nil) // Balancer is still roundrobin. if err := checkRoundRobin(cc, servers); err != nil { t.Fatalf("check roundrobin returned non-nil error: %v", err) @@ -337,7 +336,7 @@ func (s) TestSwitchBalancerGRPCLBRoundRobin(t *testing.T) { } defer cc.Close() - sc := parseCfg(`{"loadBalancingPolicy": "round_robin"}`) + sc := parseCfg(r, `{"loadBalancingPolicy": "round_robin"}`) r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: "backend"}}, ServiceConfig: sc}) var isRoundRobin bool @@ -433,7 +432,7 @@ func (s) TestSwitchBalancerGRPCLBServiceConfig(t *testing.T) { t.Fatalf("after 5 second, cc.balancer is of type %v, not grpclb", cc.curBalancerName) } - sc := parseCfg(`{"loadBalancingPolicy": "round_robin"}`) + sc := parseCfg(r, `{"loadBalancingPolicy": "round_robin"}`) r.UpdateState(resolver.State{Addresses: addrs, ServiceConfig: sc}) var isRoundRobin bool for i := 0; i < 200; i++ { @@ -510,16 +509,16 @@ func (s) TestSwitchBalancerGRPCLBWithGRPCLBNotRegistered(t *testing.T) { t.Fatalf("check pickfirst returned non-nil error: %v", err) } // Switch to roundrobin, and check against server[1] and server[2]. - cc.updateResolverState(resolver.State{ServiceConfig: parseCfg(`{"loadBalancingPolicy": "round_robin"}`), Addresses: addrs}) + cc.updateResolverState(resolver.State{ServiceConfig: parseCfg(r, `{"loadBalancingPolicy": "round_robin"}`), Addresses: addrs}, nil) if err := checkRoundRobin(cc, servers[1:]); err != nil { t.Fatalf("check roundrobin returned non-nil error: %v", err) } } -func parseCfg(s string) serviceconfig.Config { - c, err := serviceconfig.Parse(s) - if err != nil { - panic(fmt.Sprintf("Error parsing config %q: %v", s, err)) +func parseCfg(r *manual.Resolver, s string) *serviceconfig.ParseResult { + scpr := r.CC.ParseServiceConfig(s) + if scpr.Err != nil { + panic(fmt.Sprintf("Error parsing config %q: %v", s, scpr.Err)) } - return c + return scpr } diff --git a/vendor/google.golang.org/grpc/balancer_test.go b/vendor/google.golang.org/grpc/balancer_test.go index a494d6e8766..524fd43a6f5 100644 --- a/vendor/google.golang.org/grpc/balancer_test.go +++ b/vendor/google.golang.org/grpc/balancer_test.go @@ -28,14 +28,8 @@ import ( "time" "google.golang.org/grpc/codes" - _ "google.golang.org/grpc/grpclog/glogger" "google.golang.org/grpc/naming" "google.golang.org/grpc/status" - - // V1 balancer tests use passthrough resolver instead of dns. - // TODO(bar) remove this when removing v1 balaner entirely. - - _ "google.golang.org/grpc/resolver/passthrough" ) func pickFirstBalancerV1(r naming.Resolver) Balancer { diff --git a/vendor/google.golang.org/grpc/balancer_v1_wrapper.go b/vendor/google.golang.org/grpc/balancer_v1_wrapper.go index 66e9a44ac4d..db04b08b842 100644 --- a/vendor/google.golang.org/grpc/balancer_v1_wrapper.go +++ b/vendor/google.golang.org/grpc/balancer_v1_wrapper.go @@ -19,7 +19,6 @@ package grpc import ( - "context" "sync" "google.golang.org/grpc/balancer" @@ -49,7 +48,7 @@ func (bwb *balancerWrapperBuilder) Build(cc balancer.ClientConn, opts balancer.B csEvltr: &balancer.ConnectivityStateEvaluator{}, state: connectivity.Idle, } - cc.UpdateBalancerState(connectivity.Idle, bw) + cc.UpdateState(balancer.State{ConnectivityState: connectivity.Idle, Picker: bw}) go bw.lbWatcher() return bw } @@ -243,7 +242,7 @@ func (bw *balancerWrapper) HandleSubConnStateChange(sc balancer.SubConn, s conne if bw.state != sa { bw.state = sa } - bw.cc.UpdateBalancerState(bw.state, bw) + bw.cc.UpdateState(balancer.State{ConnectivityState: bw.state, Picker: bw}) if s == connectivity.Shutdown { // Remove state for this sc. delete(bw.connSt, sc) @@ -275,17 +274,17 @@ func (bw *balancerWrapper) Close() { // The picker is the balancerWrapper itself. // It either blocks or returns error, consistent with v1 balancer Get(). -func (bw *balancerWrapper) Pick(ctx context.Context, opts balancer.PickOptions) (sc balancer.SubConn, done func(balancer.DoneInfo), err error) { +func (bw *balancerWrapper) Pick(info balancer.PickInfo) (result balancer.PickResult, err error) { failfast := true // Default failfast is true. - if ss, ok := rpcInfoFromContext(ctx); ok { + if ss, ok := rpcInfoFromContext(info.Ctx); ok { failfast = ss.failfast } - a, p, err := bw.balancer.Get(ctx, BalancerGetOptions{BlockingWait: !failfast}) + a, p, err := bw.balancer.Get(info.Ctx, BalancerGetOptions{BlockingWait: !failfast}) if err != nil { - return nil, nil, err + return balancer.PickResult{}, toRPCErr(err) } if p != nil { - done = func(balancer.DoneInfo) { p() } + result.Done = func(balancer.DoneInfo) { p() } defer func() { if err != nil { p() @@ -297,38 +296,39 @@ func (bw *balancerWrapper) Pick(ctx context.Context, opts balancer.PickOptions) defer bw.mu.Unlock() if bw.pickfirst { // Get the first sc in conns. - for _, sc := range bw.conns { - return sc, done, nil + for _, result.SubConn = range bw.conns { + return result, nil } - return nil, nil, balancer.ErrNoSubConnAvailable + return balancer.PickResult{}, balancer.ErrNoSubConnAvailable } - sc, ok1 := bw.conns[resolver.Address{ + var ok1 bool + result.SubConn, ok1 = bw.conns[resolver.Address{ Addr: a.Addr, Type: resolver.Backend, ServerName: "", Metadata: a.Metadata, }] - s, ok2 := bw.connSt[sc] + s, ok2 := bw.connSt[result.SubConn] if !ok1 || !ok2 { // This can only happen due to a race where Get() returned an address // that was subsequently removed by Notify. In this case we should // retry always. - return nil, nil, balancer.ErrNoSubConnAvailable + return balancer.PickResult{}, balancer.ErrNoSubConnAvailable } switch s.s { case connectivity.Ready, connectivity.Idle: - return sc, done, nil + return result, nil case connectivity.Shutdown, connectivity.TransientFailure: // If the returned sc has been shut down or is in transient failure, // return error, and this RPC will fail or wait for another picker (if // non-failfast). - return nil, nil, balancer.ErrTransientFailure + return balancer.PickResult{}, balancer.ErrTransientFailure default: // For other states (connecting or unknown), the v1 balancer would // traditionally wait until ready and then issue the RPC. Returning // ErrNoSubConnAvailable will be a slight improvement in that it will // allow the balancer to choose another address in case others are // connected. - return nil, nil, balancer.ErrNoSubConnAvailable + return balancer.PickResult{}, balancer.ErrNoSubConnAvailable } } diff --git a/vendor/google.golang.org/grpc/benchmark/benchmain/main.go b/vendor/google.golang.org/grpc/benchmark/benchmain/main.go index 4dddb291b05..b238c74036d 100644 --- a/vendor/google.golang.org/grpc/benchmark/benchmain/main.go +++ b/vendor/google.golang.org/grpc/benchmark/benchmain/main.go @@ -143,8 +143,11 @@ var ( networkModeWAN: latency.WAN, networkLongHaul: latency.Longhaul, } - keepaliveTime = 10 * time.Second // this is the minimum allowed + keepaliveTime = 10 * time.Second keepaliveTimeout = 1 * time.Second + // This is 0.8*keepaliveTime to prevent connection issues because of server + // keepalive enforcement. + keepaliveMinTime = 8 * time.Second ) // runModes indicates the workloads to run. This is initialized with a call to @@ -275,6 +278,16 @@ func makeClient(bf stats.Features) (testpb.BenchmarkServiceClient, func()) { ) } if bf.EnableKeepalive { + sopts = append(sopts, + grpc.KeepaliveParams(keepalive.ServerParameters{ + Time: keepaliveTime, + Timeout: keepaliveTimeout, + }), + grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{ + MinTime: keepaliveMinTime, + PermitWithoutStream: true, + }), + ) opts = append(opts, grpc.WithKeepaliveParams(keepalive.ClientParameters{ Time: keepaliveTime, diff --git a/vendor/google.golang.org/grpc/benchmark/benchresult/main.go b/vendor/google.golang.org/grpc/benchmark/benchresult/main.go index ec27a830640..587a0f6bda3 100644 --- a/vendor/google.golang.org/grpc/benchmark/benchresult/main.go +++ b/vendor/google.golang.org/grpc/benchmark/benchresult/main.go @@ -68,6 +68,10 @@ func timeChange(title string, val1, val2 time.Duration) string { val2.String(), float64(val2-val1)*100/float64(val1)) } +func strDiff(title, val1, val2 string) string { + return fmt.Sprintf("%20s %12s %12s\n", title, val1, val2) +} + func compareTwoMap(m1, m2 map[string]stats.BenchResults) { for k2, v2 := range m2 { if v1, ok := m1[k2]; ok { @@ -76,14 +80,16 @@ func compareTwoMap(m1, m2 map[string]stats.BenchResults) { changes += intChange("TotalOps", v1.Data.TotalOps, v2.Data.TotalOps) changes += intChange("SendOps", v1.Data.SendOps, v2.Data.SendOps) changes += intChange("RecvOps", v1.Data.RecvOps, v2.Data.RecvOps) - changes += intChange("Bytes/op", v1.Data.AllocedBytes, v2.Data.AllocedBytes) - changes += intChange("Allocs/op", v1.Data.Allocs, v2.Data.Allocs) + changes += floatChange("Bytes/op", v1.Data.AllocedBytes, v2.Data.AllocedBytes) + changes += floatChange("Allocs/op", v1.Data.Allocs, v2.Data.Allocs) changes += floatChange("ReqT/op", v1.Data.ReqT, v2.Data.ReqT) changes += floatChange("RespT/op", v1.Data.RespT, v2.Data.RespT) changes += timeChange("50th-Lat", v1.Data.Fiftieth, v2.Data.Fiftieth) changes += timeChange("90th-Lat", v1.Data.Ninetieth, v2.Data.Ninetieth) changes += timeChange("99th-Lat", v1.Data.NinetyNinth, v2.Data.NinetyNinth) changes += timeChange("Avg-Lat", v1.Data.Average, v2.Data.Average) + changes += strDiff("GoVersion", v1.GoVersion, v2.GoVersion) + changes += strDiff("GrpcVersion", v1.GrpcVersion, v2.GrpcVersion) fmt.Printf("%s\n", changes) } } @@ -93,9 +99,16 @@ func compareBenchmark(file1, file2 string) { compareTwoMap(createMap(file1), createMap(file2)) } -func printline(benchName, total, send, recv, allocB, allocN, reqT, respT, ltc50, ltc90, l99, lAvg interface{}) { - fmt.Printf("%-80v%12v%12v%12v%12v%12v%18v%18v%12v%12v%12v%12v\n", - benchName, total, send, recv, allocB, allocN, reqT, respT, ltc50, ltc90, l99, lAvg) +func printHeader() { + fmt.Printf("%-80s%12s%12s%12s%18s%18s%18s%18s%12s%12s%12s%12s\n", + "Name", "TotalOps", "SendOps", "RecvOps", "Bytes/op (B)", "Allocs/op (#)", + "RequestT", "ResponseT", "L-50", "L-90", "L-99", "L-Avg") +} + +func printline(benchName string, d stats.RunData) { + fmt.Printf("%-80s%12d%12d%12d%18.2f%18.2f%18.2f%18.2f%12v%12v%12v%12v\n", + benchName, d.TotalOps, d.SendOps, d.RecvOps, d.AllocedBytes, d.Allocs, + d.ReqT, d.RespT, d.Fiftieth, d.Ninetieth, d.NinetyNinth, d.Average) } func formatBenchmark(fileName string) { @@ -122,12 +135,9 @@ func formatBenchmark(fileName string) { wantFeatures[i] = !wantFeatures[i] } - printline("Name", "TotalOps", "SendOps", "RecvOps", "Alloc (B)", "Alloc (#)", - "RequestT", "ResponseT", "L-50", "L-90", "L-99", "L-Avg") + printHeader() for _, r := range results { - d := r.Data - printline(r.RunMode+r.Features.PrintableName(wantFeatures), d.TotalOps, d.SendOps, d.RecvOps, - d.AllocedBytes, d.Allocs, d.ReqT, d.RespT, d.Fiftieth, d.Ninetieth, d.NinetyNinth, d.Average) + printline(r.RunMode+r.Features.PrintableName(wantFeatures), r.Data) } } diff --git a/vendor/google.golang.org/grpc/benchmark/grpc_testing/control.pb.go b/vendor/google.golang.org/grpc/benchmark/grpc_testing/control.pb.go index 3d125b31fb3..c4af112a07b 100644 --- a/vendor/google.golang.org/grpc/benchmark/grpc_testing/control.pb.go +++ b/vendor/google.golang.org/grpc/benchmark/grpc_testing/control.pb.go @@ -3,9 +3,11 @@ package grpc_testing -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -16,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type ClientType int32 @@ -29,6 +31,7 @@ var ClientType_name = map[int32]string{ 0: "SYNC_CLIENT", 1: "ASYNC_CLIENT", } + var ClientType_value = map[string]int32{ "SYNC_CLIENT": 0, "ASYNC_CLIENT": 1, @@ -37,8 +40,9 @@ var ClientType_value = map[string]int32{ func (x ClientType) String() string { return proto.EnumName(ClientType_name, int32(x)) } + func (ClientType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{0} + return fileDescriptor_0c5120591600887d, []int{0} } type ServerType int32 @@ -54,6 +58,7 @@ var ServerType_name = map[int32]string{ 1: "ASYNC_SERVER", 2: "ASYNC_GENERIC_SERVER", } + var ServerType_value = map[string]int32{ "SYNC_SERVER": 0, "ASYNC_SERVER": 1, @@ -63,8 +68,9 @@ var ServerType_value = map[string]int32{ func (x ServerType) String() string { return proto.EnumName(ServerType_name, int32(x)) } + func (ServerType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{1} + return fileDescriptor_0c5120591600887d, []int{1} } type RpcType int32 @@ -78,6 +84,7 @@ var RpcType_name = map[int32]string{ 0: "UNARY", 1: "STREAMING", } + var RpcType_value = map[string]int32{ "UNARY": 0, "STREAMING": 1, @@ -86,8 +93,9 @@ var RpcType_value = map[string]int32{ func (x RpcType) String() string { return proto.EnumName(RpcType_name, int32(x)) } + func (RpcType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{2} + return fileDescriptor_0c5120591600887d, []int{2} } // Parameters of poisson process distribution, which is a good representation @@ -104,16 +112,17 @@ func (m *PoissonParams) Reset() { *m = PoissonParams{} } func (m *PoissonParams) String() string { return proto.CompactTextString(m) } func (*PoissonParams) ProtoMessage() {} func (*PoissonParams) Descriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{0} + return fileDescriptor_0c5120591600887d, []int{0} } + func (m *PoissonParams) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PoissonParams.Unmarshal(m, b) } func (m *PoissonParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_PoissonParams.Marshal(b, m, deterministic) } -func (dst *PoissonParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_PoissonParams.Merge(dst, src) +func (m *PoissonParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_PoissonParams.Merge(m, src) } func (m *PoissonParams) XXX_Size() int { return xxx_messageInfo_PoissonParams.Size(m) @@ -143,16 +152,17 @@ func (m *UniformParams) Reset() { *m = UniformParams{} } func (m *UniformParams) String() string { return proto.CompactTextString(m) } func (*UniformParams) ProtoMessage() {} func (*UniformParams) Descriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{1} + return fileDescriptor_0c5120591600887d, []int{1} } + func (m *UniformParams) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UniformParams.Unmarshal(m, b) } func (m *UniformParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_UniformParams.Marshal(b, m, deterministic) } -func (dst *UniformParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_UniformParams.Merge(dst, src) +func (m *UniformParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_UniformParams.Merge(m, src) } func (m *UniformParams) XXX_Size() int { return xxx_messageInfo_UniformParams.Size(m) @@ -188,16 +198,17 @@ func (m *DeterministicParams) Reset() { *m = DeterministicParams{} } func (m *DeterministicParams) String() string { return proto.CompactTextString(m) } func (*DeterministicParams) ProtoMessage() {} func (*DeterministicParams) Descriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{2} + return fileDescriptor_0c5120591600887d, []int{2} } + func (m *DeterministicParams) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeterministicParams.Unmarshal(m, b) } func (m *DeterministicParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_DeterministicParams.Marshal(b, m, deterministic) } -func (dst *DeterministicParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeterministicParams.Merge(dst, src) +func (m *DeterministicParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeterministicParams.Merge(m, src) } func (m *DeterministicParams) XXX_Size() int { return xxx_messageInfo_DeterministicParams.Size(m) @@ -227,16 +238,17 @@ func (m *ParetoParams) Reset() { *m = ParetoParams{} } func (m *ParetoParams) String() string { return proto.CompactTextString(m) } func (*ParetoParams) ProtoMessage() {} func (*ParetoParams) Descriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{3} + return fileDescriptor_0c5120591600887d, []int{3} } + func (m *ParetoParams) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ParetoParams.Unmarshal(m, b) } func (m *ParetoParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ParetoParams.Marshal(b, m, deterministic) } -func (dst *ParetoParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_ParetoParams.Merge(dst, src) +func (m *ParetoParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_ParetoParams.Merge(m, src) } func (m *ParetoParams) XXX_Size() int { return xxx_messageInfo_ParetoParams.Size(m) @@ -273,16 +285,17 @@ func (m *ClosedLoopParams) Reset() { *m = ClosedLoopParams{} } func (m *ClosedLoopParams) String() string { return proto.CompactTextString(m) } func (*ClosedLoopParams) ProtoMessage() {} func (*ClosedLoopParams) Descriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{4} + return fileDescriptor_0c5120591600887d, []int{4} } + func (m *ClosedLoopParams) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ClosedLoopParams.Unmarshal(m, b) } func (m *ClosedLoopParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ClosedLoopParams.Marshal(b, m, deterministic) } -func (dst *ClosedLoopParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClosedLoopParams.Merge(dst, src) +func (m *ClosedLoopParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClosedLoopParams.Merge(m, src) } func (m *ClosedLoopParams) XXX_Size() int { return xxx_messageInfo_ClosedLoopParams.Size(m) @@ -310,16 +323,17 @@ func (m *LoadParams) Reset() { *m = LoadParams{} } func (m *LoadParams) String() string { return proto.CompactTextString(m) } func (*LoadParams) ProtoMessage() {} func (*LoadParams) Descriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{5} + return fileDescriptor_0c5120591600887d, []int{5} } + func (m *LoadParams) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_LoadParams.Unmarshal(m, b) } func (m *LoadParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_LoadParams.Marshal(b, m, deterministic) } -func (dst *LoadParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_LoadParams.Merge(dst, src) +func (m *LoadParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_LoadParams.Merge(m, src) } func (m *LoadParams) XXX_Size() int { return xxx_messageInfo_LoadParams.Size(m) @@ -406,9 +420,9 @@ func (m *LoadParams) GetPareto() *ParetoParams { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*LoadParams) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _LoadParams_OneofMarshaler, _LoadParams_OneofUnmarshaler, _LoadParams_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*LoadParams) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*LoadParams_ClosedLoop)(nil), (*LoadParams_Poisson)(nil), (*LoadParams_Uniform)(nil), @@ -417,126 +431,6 @@ func (*LoadParams) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) er } } -func _LoadParams_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*LoadParams) - // load - switch x := m.Load.(type) { - case *LoadParams_ClosedLoop: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ClosedLoop); err != nil { - return err - } - case *LoadParams_Poisson: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Poisson); err != nil { - return err - } - case *LoadParams_Uniform: - b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Uniform); err != nil { - return err - } - case *LoadParams_Determ: - b.EncodeVarint(4<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Determ); err != nil { - return err - } - case *LoadParams_Pareto: - b.EncodeVarint(5<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Pareto); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("LoadParams.Load has unexpected type %T", x) - } - return nil -} - -func _LoadParams_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*LoadParams) - switch tag { - case 1: // load.closed_loop - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ClosedLoopParams) - err := b.DecodeMessage(msg) - m.Load = &LoadParams_ClosedLoop{msg} - return true, err - case 2: // load.poisson - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(PoissonParams) - err := b.DecodeMessage(msg) - m.Load = &LoadParams_Poisson{msg} - return true, err - case 3: // load.uniform - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(UniformParams) - err := b.DecodeMessage(msg) - m.Load = &LoadParams_Uniform{msg} - return true, err - case 4: // load.determ - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(DeterministicParams) - err := b.DecodeMessage(msg) - m.Load = &LoadParams_Determ{msg} - return true, err - case 5: // load.pareto - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ParetoParams) - err := b.DecodeMessage(msg) - m.Load = &LoadParams_Pareto{msg} - return true, err - default: - return false, nil - } -} - -func _LoadParams_OneofSizer(msg proto.Message) (n int) { - m := msg.(*LoadParams) - // load - switch x := m.Load.(type) { - case *LoadParams_ClosedLoop: - s := proto.Size(x.ClosedLoop) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *LoadParams_Poisson: - s := proto.Size(x.Poisson) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *LoadParams_Uniform: - s := proto.Size(x.Uniform) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *LoadParams_Determ: - s := proto.Size(x.Determ) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *LoadParams_Pareto: - s := proto.Size(x.Pareto) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - // presence of SecurityParams implies use of TLS type SecurityParams struct { UseTestCa bool `protobuf:"varint,1,opt,name=use_test_ca,json=useTestCa,proto3" json:"use_test_ca,omitempty"` @@ -550,16 +444,17 @@ func (m *SecurityParams) Reset() { *m = SecurityParams{} } func (m *SecurityParams) String() string { return proto.CompactTextString(m) } func (*SecurityParams) ProtoMessage() {} func (*SecurityParams) Descriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{6} + return fileDescriptor_0c5120591600887d, []int{6} } + func (m *SecurityParams) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SecurityParams.Unmarshal(m, b) } func (m *SecurityParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SecurityParams.Marshal(b, m, deterministic) } -func (dst *SecurityParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_SecurityParams.Merge(dst, src) +func (m *SecurityParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_SecurityParams.Merge(m, src) } func (m *SecurityParams) XXX_Size() int { return xxx_messageInfo_SecurityParams.Size(m) @@ -614,16 +509,17 @@ func (m *ClientConfig) Reset() { *m = ClientConfig{} } func (m *ClientConfig) String() string { return proto.CompactTextString(m) } func (*ClientConfig) ProtoMessage() {} func (*ClientConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{7} + return fileDescriptor_0c5120591600887d, []int{7} } + func (m *ClientConfig) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ClientConfig.Unmarshal(m, b) } func (m *ClientConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ClientConfig.Marshal(b, m, deterministic) } -func (dst *ClientConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClientConfig.Merge(dst, src) +func (m *ClientConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClientConfig.Merge(m, src) } func (m *ClientConfig) XXX_Size() int { return xxx_messageInfo_ClientConfig.Size(m) @@ -729,16 +625,17 @@ func (m *ClientStatus) Reset() { *m = ClientStatus{} } func (m *ClientStatus) String() string { return proto.CompactTextString(m) } func (*ClientStatus) ProtoMessage() {} func (*ClientStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{8} + return fileDescriptor_0c5120591600887d, []int{8} } + func (m *ClientStatus) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ClientStatus.Unmarshal(m, b) } func (m *ClientStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ClientStatus.Marshal(b, m, deterministic) } -func (dst *ClientStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClientStatus.Merge(dst, src) +func (m *ClientStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClientStatus.Merge(m, src) } func (m *ClientStatus) XXX_Size() int { return xxx_messageInfo_ClientStatus.Size(m) @@ -769,16 +666,17 @@ func (m *Mark) Reset() { *m = Mark{} } func (m *Mark) String() string { return proto.CompactTextString(m) } func (*Mark) ProtoMessage() {} func (*Mark) Descriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{9} + return fileDescriptor_0c5120591600887d, []int{9} } + func (m *Mark) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Mark.Unmarshal(m, b) } func (m *Mark) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Mark.Marshal(b, m, deterministic) } -func (dst *Mark) XXX_Merge(src proto.Message) { - xxx_messageInfo_Mark.Merge(dst, src) +func (m *Mark) XXX_Merge(src proto.Message) { + xxx_messageInfo_Mark.Merge(m, src) } func (m *Mark) XXX_Size() int { return xxx_messageInfo_Mark.Size(m) @@ -810,16 +708,17 @@ func (m *ClientArgs) Reset() { *m = ClientArgs{} } func (m *ClientArgs) String() string { return proto.CompactTextString(m) } func (*ClientArgs) ProtoMessage() {} func (*ClientArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{10} + return fileDescriptor_0c5120591600887d, []int{10} } + func (m *ClientArgs) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ClientArgs.Unmarshal(m, b) } func (m *ClientArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ClientArgs.Marshal(b, m, deterministic) } -func (dst *ClientArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClientArgs.Merge(dst, src) +func (m *ClientArgs) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClientArgs.Merge(m, src) } func (m *ClientArgs) XXX_Size() int { return xxx_messageInfo_ClientArgs.Size(m) @@ -867,80 +766,14 @@ func (m *ClientArgs) GetMark() *Mark { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*ClientArgs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _ClientArgs_OneofMarshaler, _ClientArgs_OneofUnmarshaler, _ClientArgs_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ClientArgs) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*ClientArgs_Setup)(nil), (*ClientArgs_Mark)(nil), } } -func _ClientArgs_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*ClientArgs) - // argtype - switch x := m.Argtype.(type) { - case *ClientArgs_Setup: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Setup); err != nil { - return err - } - case *ClientArgs_Mark: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Mark); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("ClientArgs.Argtype has unexpected type %T", x) - } - return nil -} - -func _ClientArgs_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*ClientArgs) - switch tag { - case 1: // argtype.setup - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ClientConfig) - err := b.DecodeMessage(msg) - m.Argtype = &ClientArgs_Setup{msg} - return true, err - case 2: // argtype.mark - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Mark) - err := b.DecodeMessage(msg) - m.Argtype = &ClientArgs_Mark{msg} - return true, err - default: - return false, nil - } -} - -func _ClientArgs_OneofSizer(msg proto.Message) (n int) { - m := msg.(*ClientArgs) - // argtype - switch x := m.Argtype.(type) { - case *ClientArgs_Setup: - s := proto.Size(x.Setup) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *ClientArgs_Mark: - s := proto.Size(x.Mark) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type ServerConfig struct { ServerType ServerType `protobuf:"varint,1,opt,name=server_type,json=serverType,proto3,enum=grpc.testing.ServerType" json:"server_type,omitempty"` SecurityParams *SecurityParams `protobuf:"bytes,2,opt,name=security_params,json=securityParams,proto3" json:"security_params,omitempty"` @@ -963,16 +796,17 @@ func (m *ServerConfig) Reset() { *m = ServerConfig{} } func (m *ServerConfig) String() string { return proto.CompactTextString(m) } func (*ServerConfig) ProtoMessage() {} func (*ServerConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{11} + return fileDescriptor_0c5120591600887d, []int{11} } + func (m *ServerConfig) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ServerConfig.Unmarshal(m, b) } func (m *ServerConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ServerConfig.Marshal(b, m, deterministic) } -func (dst *ServerConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServerConfig.Merge(dst, src) +func (m *ServerConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerConfig.Merge(m, src) } func (m *ServerConfig) XXX_Size() int { return xxx_messageInfo_ServerConfig.Size(m) @@ -1046,16 +880,17 @@ func (m *ServerArgs) Reset() { *m = ServerArgs{} } func (m *ServerArgs) String() string { return proto.CompactTextString(m) } func (*ServerArgs) ProtoMessage() {} func (*ServerArgs) Descriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{12} + return fileDescriptor_0c5120591600887d, []int{12} } + func (m *ServerArgs) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ServerArgs.Unmarshal(m, b) } func (m *ServerArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ServerArgs.Marshal(b, m, deterministic) } -func (dst *ServerArgs) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServerArgs.Merge(dst, src) +func (m *ServerArgs) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerArgs.Merge(m, src) } func (m *ServerArgs) XXX_Size() int { return xxx_messageInfo_ServerArgs.Size(m) @@ -1103,80 +938,14 @@ func (m *ServerArgs) GetMark() *Mark { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*ServerArgs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _ServerArgs_OneofMarshaler, _ServerArgs_OneofUnmarshaler, _ServerArgs_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ServerArgs) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*ServerArgs_Setup)(nil), (*ServerArgs_Mark)(nil), } } -func _ServerArgs_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*ServerArgs) - // argtype - switch x := m.Argtype.(type) { - case *ServerArgs_Setup: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Setup); err != nil { - return err - } - case *ServerArgs_Mark: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Mark); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("ServerArgs.Argtype has unexpected type %T", x) - } - return nil -} - -func _ServerArgs_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*ServerArgs) - switch tag { - case 1: // argtype.setup - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ServerConfig) - err := b.DecodeMessage(msg) - m.Argtype = &ServerArgs_Setup{msg} - return true, err - case 2: // argtype.mark - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Mark) - err := b.DecodeMessage(msg) - m.Argtype = &ServerArgs_Mark{msg} - return true, err - default: - return false, nil - } -} - -func _ServerArgs_OneofSizer(msg proto.Message) (n int) { - m := msg.(*ServerArgs) - // argtype - switch x := m.Argtype.(type) { - case *ServerArgs_Setup: - s := proto.Size(x.Setup) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *ServerArgs_Mark: - s := proto.Size(x.Mark) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type ServerStatus struct { Stats *ServerStats `protobuf:"bytes,1,opt,name=stats,proto3" json:"stats,omitempty"` // the port bound by the server @@ -1192,16 +961,17 @@ func (m *ServerStatus) Reset() { *m = ServerStatus{} } func (m *ServerStatus) String() string { return proto.CompactTextString(m) } func (*ServerStatus) ProtoMessage() {} func (*ServerStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{13} + return fileDescriptor_0c5120591600887d, []int{13} } + func (m *ServerStatus) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ServerStatus.Unmarshal(m, b) } func (m *ServerStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ServerStatus.Marshal(b, m, deterministic) } -func (dst *ServerStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServerStatus.Merge(dst, src) +func (m *ServerStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerStatus.Merge(m, src) } func (m *ServerStatus) XXX_Size() int { return xxx_messageInfo_ServerStatus.Size(m) @@ -1243,16 +1013,17 @@ func (m *CoreRequest) Reset() { *m = CoreRequest{} } func (m *CoreRequest) String() string { return proto.CompactTextString(m) } func (*CoreRequest) ProtoMessage() {} func (*CoreRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{14} + return fileDescriptor_0c5120591600887d, []int{14} } + func (m *CoreRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CoreRequest.Unmarshal(m, b) } func (m *CoreRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_CoreRequest.Marshal(b, m, deterministic) } -func (dst *CoreRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CoreRequest.Merge(dst, src) +func (m *CoreRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CoreRequest.Merge(m, src) } func (m *CoreRequest) XXX_Size() int { return xxx_messageInfo_CoreRequest.Size(m) @@ -1275,16 +1046,17 @@ func (m *CoreResponse) Reset() { *m = CoreResponse{} } func (m *CoreResponse) String() string { return proto.CompactTextString(m) } func (*CoreResponse) ProtoMessage() {} func (*CoreResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{15} + return fileDescriptor_0c5120591600887d, []int{15} } + func (m *CoreResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CoreResponse.Unmarshal(m, b) } func (m *CoreResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_CoreResponse.Marshal(b, m, deterministic) } -func (dst *CoreResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CoreResponse.Merge(dst, src) +func (m *CoreResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CoreResponse.Merge(m, src) } func (m *CoreResponse) XXX_Size() int { return xxx_messageInfo_CoreResponse.Size(m) @@ -1312,16 +1084,17 @@ func (m *Void) Reset() { *m = Void{} } func (m *Void) String() string { return proto.CompactTextString(m) } func (*Void) ProtoMessage() {} func (*Void) Descriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{16} + return fileDescriptor_0c5120591600887d, []int{16} } + func (m *Void) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Void.Unmarshal(m, b) } func (m *Void) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Void.Marshal(b, m, deterministic) } -func (dst *Void) XXX_Merge(src proto.Message) { - xxx_messageInfo_Void.Merge(dst, src) +func (m *Void) XXX_Merge(src proto.Message) { + xxx_messageInfo_Void.Merge(m, src) } func (m *Void) XXX_Size() int { return xxx_messageInfo_Void.Size(m) @@ -1359,16 +1132,17 @@ func (m *Scenario) Reset() { *m = Scenario{} } func (m *Scenario) String() string { return proto.CompactTextString(m) } func (*Scenario) ProtoMessage() {} func (*Scenario) Descriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{17} + return fileDescriptor_0c5120591600887d, []int{17} } + func (m *Scenario) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Scenario.Unmarshal(m, b) } func (m *Scenario) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Scenario.Marshal(b, m, deterministic) } -func (dst *Scenario) XXX_Merge(src proto.Message) { - xxx_messageInfo_Scenario.Merge(dst, src) +func (m *Scenario) XXX_Merge(src proto.Message) { + xxx_messageInfo_Scenario.Merge(m, src) } func (m *Scenario) XXX_Size() int { return xxx_messageInfo_Scenario.Size(m) @@ -1447,16 +1221,17 @@ func (m *Scenarios) Reset() { *m = Scenarios{} } func (m *Scenarios) String() string { return proto.CompactTextString(m) } func (*Scenarios) ProtoMessage() {} func (*Scenarios) Descriptor() ([]byte, []int) { - return fileDescriptor_control_63d6a60a9ad7e299, []int{18} + return fileDescriptor_0c5120591600887d, []int{18} } + func (m *Scenarios) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Scenarios.Unmarshal(m, b) } func (m *Scenarios) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Scenarios.Marshal(b, m, deterministic) } -func (dst *Scenarios) XXX_Merge(src proto.Message) { - xxx_messageInfo_Scenarios.Merge(dst, src) +func (m *Scenarios) XXX_Merge(src proto.Message) { + xxx_messageInfo_Scenarios.Merge(m, src) } func (m *Scenarios) XXX_Size() int { return xxx_messageInfo_Scenarios.Size(m) @@ -1475,6 +1250,9 @@ func (m *Scenarios) GetScenarios() []*Scenario { } func init() { + proto.RegisterEnum("grpc.testing.ClientType", ClientType_name, ClientType_value) + proto.RegisterEnum("grpc.testing.ServerType", ServerType_name, ServerType_value) + proto.RegisterEnum("grpc.testing.RpcType", RpcType_name, RpcType_value) proto.RegisterType((*PoissonParams)(nil), "grpc.testing.PoissonParams") proto.RegisterType((*UniformParams)(nil), "grpc.testing.UniformParams") proto.RegisterType((*DeterministicParams)(nil), "grpc.testing.DeterministicParams") @@ -1494,14 +1272,11 @@ func init() { proto.RegisterType((*Void)(nil), "grpc.testing.Void") proto.RegisterType((*Scenario)(nil), "grpc.testing.Scenario") proto.RegisterType((*Scenarios)(nil), "grpc.testing.Scenarios") - proto.RegisterEnum("grpc.testing.ClientType", ClientType_name, ClientType_value) - proto.RegisterEnum("grpc.testing.ServerType", ServerType_name, ServerType_value) - proto.RegisterEnum("grpc.testing.RpcType", RpcType_name, RpcType_value) } -func init() { proto.RegisterFile("control.proto", fileDescriptor_control_63d6a60a9ad7e299) } +func init() { proto.RegisterFile("control.proto", fileDescriptor_0c5120591600887d) } -var fileDescriptor_control_63d6a60a9ad7e299 = []byte{ +var fileDescriptor_0c5120591600887d = []byte{ // 1179 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x6f, 0x6f, 0xdb, 0xb6, 0x13, 0xb6, 0x1d, 0xdb, 0xb1, 0x4e, 0xb6, 0xe3, 0x1f, 0x7f, 0xe9, 0xa0, 0xa6, 0x69, 0x97, 0x6a, diff --git a/vendor/google.golang.org/grpc/benchmark/grpc_testing/messages.pb.go b/vendor/google.golang.org/grpc/benchmark/grpc_testing/messages.pb.go index 9354eeaa03f..e2c694507b0 100644 --- a/vendor/google.golang.org/grpc/benchmark/grpc_testing/messages.pb.go +++ b/vendor/google.golang.org/grpc/benchmark/grpc_testing/messages.pb.go @@ -3,9 +3,11 @@ package grpc_testing -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -16,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // The type of payload that should be returned. type PayloadType int32 @@ -35,6 +37,7 @@ var PayloadType_name = map[int32]string{ 1: "UNCOMPRESSABLE", 2: "RANDOM", } + var PayloadType_value = map[string]int32{ "COMPRESSABLE": 0, "UNCOMPRESSABLE": 1, @@ -44,8 +47,9 @@ var PayloadType_value = map[string]int32{ func (x PayloadType) String() string { return proto.EnumName(PayloadType_name, int32(x)) } + func (PayloadType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_messages_5c70222ad96bf232, []int{0} + return fileDescriptor_4dc296cbfe5ffcd5, []int{0} } // Compression algorithms @@ -63,6 +67,7 @@ var CompressionType_name = map[int32]string{ 1: "GZIP", 2: "DEFLATE", } + var CompressionType_value = map[string]int32{ "NONE": 0, "GZIP": 1, @@ -72,8 +77,9 @@ var CompressionType_value = map[string]int32{ func (x CompressionType) String() string { return proto.EnumName(CompressionType_name, int32(x)) } + func (CompressionType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_messages_5c70222ad96bf232, []int{1} + return fileDescriptor_4dc296cbfe5ffcd5, []int{1} } // A block of data, to simply increase gRPC message size. @@ -91,16 +97,17 @@ func (m *Payload) Reset() { *m = Payload{} } func (m *Payload) String() string { return proto.CompactTextString(m) } func (*Payload) ProtoMessage() {} func (*Payload) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_5c70222ad96bf232, []int{0} + return fileDescriptor_4dc296cbfe5ffcd5, []int{0} } + func (m *Payload) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Payload.Unmarshal(m, b) } func (m *Payload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Payload.Marshal(b, m, deterministic) } -func (dst *Payload) XXX_Merge(src proto.Message) { - xxx_messageInfo_Payload.Merge(dst, src) +func (m *Payload) XXX_Merge(src proto.Message) { + xxx_messageInfo_Payload.Merge(m, src) } func (m *Payload) XXX_Size() int { return xxx_messageInfo_Payload.Size(m) @@ -139,16 +146,17 @@ func (m *EchoStatus) Reset() { *m = EchoStatus{} } func (m *EchoStatus) String() string { return proto.CompactTextString(m) } func (*EchoStatus) ProtoMessage() {} func (*EchoStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_5c70222ad96bf232, []int{1} + return fileDescriptor_4dc296cbfe5ffcd5, []int{1} } + func (m *EchoStatus) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EchoStatus.Unmarshal(m, b) } func (m *EchoStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_EchoStatus.Marshal(b, m, deterministic) } -func (dst *EchoStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_EchoStatus.Merge(dst, src) +func (m *EchoStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_EchoStatus.Merge(m, src) } func (m *EchoStatus) XXX_Size() int { return xxx_messageInfo_EchoStatus.Size(m) @@ -200,16 +208,17 @@ func (m *SimpleRequest) Reset() { *m = SimpleRequest{} } func (m *SimpleRequest) String() string { return proto.CompactTextString(m) } func (*SimpleRequest) ProtoMessage() {} func (*SimpleRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_5c70222ad96bf232, []int{2} + return fileDescriptor_4dc296cbfe5ffcd5, []int{2} } + func (m *SimpleRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SimpleRequest.Unmarshal(m, b) } func (m *SimpleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SimpleRequest.Marshal(b, m, deterministic) } -func (dst *SimpleRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SimpleRequest.Merge(dst, src) +func (m *SimpleRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleRequest.Merge(m, src) } func (m *SimpleRequest) XXX_Size() int { return xxx_messageInfo_SimpleRequest.Size(m) @@ -287,16 +296,17 @@ func (m *SimpleResponse) Reset() { *m = SimpleResponse{} } func (m *SimpleResponse) String() string { return proto.CompactTextString(m) } func (*SimpleResponse) ProtoMessage() {} func (*SimpleResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_5c70222ad96bf232, []int{3} + return fileDescriptor_4dc296cbfe5ffcd5, []int{3} } + func (m *SimpleResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SimpleResponse.Unmarshal(m, b) } func (m *SimpleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SimpleResponse.Marshal(b, m, deterministic) } -func (dst *SimpleResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SimpleResponse.Merge(dst, src) +func (m *SimpleResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleResponse.Merge(m, src) } func (m *SimpleResponse) XXX_Size() int { return xxx_messageInfo_SimpleResponse.Size(m) @@ -341,16 +351,17 @@ func (m *StreamingInputCallRequest) Reset() { *m = StreamingInputCallReq func (m *StreamingInputCallRequest) String() string { return proto.CompactTextString(m) } func (*StreamingInputCallRequest) ProtoMessage() {} func (*StreamingInputCallRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_5c70222ad96bf232, []int{4} + return fileDescriptor_4dc296cbfe5ffcd5, []int{4} } + func (m *StreamingInputCallRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StreamingInputCallRequest.Unmarshal(m, b) } func (m *StreamingInputCallRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_StreamingInputCallRequest.Marshal(b, m, deterministic) } -func (dst *StreamingInputCallRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamingInputCallRequest.Merge(dst, src) +func (m *StreamingInputCallRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingInputCallRequest.Merge(m, src) } func (m *StreamingInputCallRequest) XXX_Size() int { return xxx_messageInfo_StreamingInputCallRequest.Size(m) @@ -381,16 +392,17 @@ func (m *StreamingInputCallResponse) Reset() { *m = StreamingInputCallRe func (m *StreamingInputCallResponse) String() string { return proto.CompactTextString(m) } func (*StreamingInputCallResponse) ProtoMessage() {} func (*StreamingInputCallResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_5c70222ad96bf232, []int{5} + return fileDescriptor_4dc296cbfe5ffcd5, []int{5} } + func (m *StreamingInputCallResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StreamingInputCallResponse.Unmarshal(m, b) } func (m *StreamingInputCallResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_StreamingInputCallResponse.Marshal(b, m, deterministic) } -func (dst *StreamingInputCallResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamingInputCallResponse.Merge(dst, src) +func (m *StreamingInputCallResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingInputCallResponse.Merge(m, src) } func (m *StreamingInputCallResponse) XXX_Size() int { return xxx_messageInfo_StreamingInputCallResponse.Size(m) @@ -425,16 +437,17 @@ func (m *ResponseParameters) Reset() { *m = ResponseParameters{} } func (m *ResponseParameters) String() string { return proto.CompactTextString(m) } func (*ResponseParameters) ProtoMessage() {} func (*ResponseParameters) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_5c70222ad96bf232, []int{6} + return fileDescriptor_4dc296cbfe5ffcd5, []int{6} } + func (m *ResponseParameters) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResponseParameters.Unmarshal(m, b) } func (m *ResponseParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ResponseParameters.Marshal(b, m, deterministic) } -func (dst *ResponseParameters) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseParameters.Merge(dst, src) +func (m *ResponseParameters) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseParameters.Merge(m, src) } func (m *ResponseParameters) XXX_Size() int { return xxx_messageInfo_ResponseParameters.Size(m) @@ -483,16 +496,17 @@ func (m *StreamingOutputCallRequest) Reset() { *m = StreamingOutputCallR func (m *StreamingOutputCallRequest) String() string { return proto.CompactTextString(m) } func (*StreamingOutputCallRequest) ProtoMessage() {} func (*StreamingOutputCallRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_5c70222ad96bf232, []int{7} + return fileDescriptor_4dc296cbfe5ffcd5, []int{7} } + func (m *StreamingOutputCallRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StreamingOutputCallRequest.Unmarshal(m, b) } func (m *StreamingOutputCallRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_StreamingOutputCallRequest.Marshal(b, m, deterministic) } -func (dst *StreamingOutputCallRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamingOutputCallRequest.Merge(dst, src) +func (m *StreamingOutputCallRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingOutputCallRequest.Merge(m, src) } func (m *StreamingOutputCallRequest) XXX_Size() int { return xxx_messageInfo_StreamingOutputCallRequest.Size(m) @@ -551,16 +565,17 @@ func (m *StreamingOutputCallResponse) Reset() { *m = StreamingOutputCall func (m *StreamingOutputCallResponse) String() string { return proto.CompactTextString(m) } func (*StreamingOutputCallResponse) ProtoMessage() {} func (*StreamingOutputCallResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_5c70222ad96bf232, []int{8} + return fileDescriptor_4dc296cbfe5ffcd5, []int{8} } + func (m *StreamingOutputCallResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StreamingOutputCallResponse.Unmarshal(m, b) } func (m *StreamingOutputCallResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_StreamingOutputCallResponse.Marshal(b, m, deterministic) } -func (dst *StreamingOutputCallResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamingOutputCallResponse.Merge(dst, src) +func (m *StreamingOutputCallResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingOutputCallResponse.Merge(m, src) } func (m *StreamingOutputCallResponse) XXX_Size() int { return xxx_messageInfo_StreamingOutputCallResponse.Size(m) @@ -591,16 +606,17 @@ func (m *ReconnectParams) Reset() { *m = ReconnectParams{} } func (m *ReconnectParams) String() string { return proto.CompactTextString(m) } func (*ReconnectParams) ProtoMessage() {} func (*ReconnectParams) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_5c70222ad96bf232, []int{9} + return fileDescriptor_4dc296cbfe5ffcd5, []int{9} } + func (m *ReconnectParams) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ReconnectParams.Unmarshal(m, b) } func (m *ReconnectParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ReconnectParams.Marshal(b, m, deterministic) } -func (dst *ReconnectParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReconnectParams.Merge(dst, src) +func (m *ReconnectParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_ReconnectParams.Merge(m, src) } func (m *ReconnectParams) XXX_Size() int { return xxx_messageInfo_ReconnectParams.Size(m) @@ -633,16 +649,17 @@ func (m *ReconnectInfo) Reset() { *m = ReconnectInfo{} } func (m *ReconnectInfo) String() string { return proto.CompactTextString(m) } func (*ReconnectInfo) ProtoMessage() {} func (*ReconnectInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_5c70222ad96bf232, []int{10} + return fileDescriptor_4dc296cbfe5ffcd5, []int{10} } + func (m *ReconnectInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ReconnectInfo.Unmarshal(m, b) } func (m *ReconnectInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ReconnectInfo.Marshal(b, m, deterministic) } -func (dst *ReconnectInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReconnectInfo.Merge(dst, src) +func (m *ReconnectInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_ReconnectInfo.Merge(m, src) } func (m *ReconnectInfo) XXX_Size() int { return xxx_messageInfo_ReconnectInfo.Size(m) @@ -668,6 +685,8 @@ func (m *ReconnectInfo) GetBackoffMs() []int32 { } func init() { + proto.RegisterEnum("grpc.testing.PayloadType", PayloadType_name, PayloadType_value) + proto.RegisterEnum("grpc.testing.CompressionType", CompressionType_name, CompressionType_value) proto.RegisterType((*Payload)(nil), "grpc.testing.Payload") proto.RegisterType((*EchoStatus)(nil), "grpc.testing.EchoStatus") proto.RegisterType((*SimpleRequest)(nil), "grpc.testing.SimpleRequest") @@ -679,13 +698,11 @@ func init() { proto.RegisterType((*StreamingOutputCallResponse)(nil), "grpc.testing.StreamingOutputCallResponse") proto.RegisterType((*ReconnectParams)(nil), "grpc.testing.ReconnectParams") proto.RegisterType((*ReconnectInfo)(nil), "grpc.testing.ReconnectInfo") - proto.RegisterEnum("grpc.testing.PayloadType", PayloadType_name, PayloadType_value) - proto.RegisterEnum("grpc.testing.CompressionType", CompressionType_name, CompressionType_value) } -func init() { proto.RegisterFile("messages.proto", fileDescriptor_messages_5c70222ad96bf232) } +func init() { proto.RegisterFile("messages.proto", fileDescriptor_4dc296cbfe5ffcd5) } -var fileDescriptor_messages_5c70222ad96bf232 = []byte{ +var fileDescriptor_4dc296cbfe5ffcd5 = []byte{ // 652 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x4d, 0x6f, 0xd3, 0x40, 0x10, 0xc5, 0xf9, 0xee, 0x24, 0x4d, 0xa3, 0x85, 0x82, 0x5b, 0x54, 0x11, 0x99, 0x4b, 0x54, 0x89, diff --git a/vendor/google.golang.org/grpc/benchmark/grpc_testing/payloads.pb.go b/vendor/google.golang.org/grpc/benchmark/grpc_testing/payloads.pb.go index f7f9cf8eb46..5e58aacea16 100644 --- a/vendor/google.golang.org/grpc/benchmark/grpc_testing/payloads.pb.go +++ b/vendor/google.golang.org/grpc/benchmark/grpc_testing/payloads.pb.go @@ -3,9 +3,11 @@ package grpc_testing -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -16,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type ByteBufferParams struct { ReqSize int32 `protobuf:"varint,1,opt,name=req_size,json=reqSize,proto3" json:"req_size,omitempty"` @@ -30,16 +32,17 @@ func (m *ByteBufferParams) Reset() { *m = ByteBufferParams{} } func (m *ByteBufferParams) String() string { return proto.CompactTextString(m) } func (*ByteBufferParams) ProtoMessage() {} func (*ByteBufferParams) Descriptor() ([]byte, []int) { - return fileDescriptor_payloads_3abc71de35f06c83, []int{0} + return fileDescriptor_3a075f58f70088c8, []int{0} } + func (m *ByteBufferParams) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ByteBufferParams.Unmarshal(m, b) } func (m *ByteBufferParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ByteBufferParams.Marshal(b, m, deterministic) } -func (dst *ByteBufferParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_ByteBufferParams.Merge(dst, src) +func (m *ByteBufferParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_ByteBufferParams.Merge(m, src) } func (m *ByteBufferParams) XXX_Size() int { return xxx_messageInfo_ByteBufferParams.Size(m) @@ -76,16 +79,17 @@ func (m *SimpleProtoParams) Reset() { *m = SimpleProtoParams{} } func (m *SimpleProtoParams) String() string { return proto.CompactTextString(m) } func (*SimpleProtoParams) ProtoMessage() {} func (*SimpleProtoParams) Descriptor() ([]byte, []int) { - return fileDescriptor_payloads_3abc71de35f06c83, []int{1} + return fileDescriptor_3a075f58f70088c8, []int{1} } + func (m *SimpleProtoParams) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SimpleProtoParams.Unmarshal(m, b) } func (m *SimpleProtoParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SimpleProtoParams.Marshal(b, m, deterministic) } -func (dst *SimpleProtoParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_SimpleProtoParams.Merge(dst, src) +func (m *SimpleProtoParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleProtoParams.Merge(m, src) } func (m *SimpleProtoParams) XXX_Size() int { return xxx_messageInfo_SimpleProtoParams.Size(m) @@ -120,16 +124,17 @@ func (m *ComplexProtoParams) Reset() { *m = ComplexProtoParams{} } func (m *ComplexProtoParams) String() string { return proto.CompactTextString(m) } func (*ComplexProtoParams) ProtoMessage() {} func (*ComplexProtoParams) Descriptor() ([]byte, []int) { - return fileDescriptor_payloads_3abc71de35f06c83, []int{2} + return fileDescriptor_3a075f58f70088c8, []int{2} } + func (m *ComplexProtoParams) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ComplexProtoParams.Unmarshal(m, b) } func (m *ComplexProtoParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ComplexProtoParams.Marshal(b, m, deterministic) } -func (dst *ComplexProtoParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_ComplexProtoParams.Merge(dst, src) +func (m *ComplexProtoParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_ComplexProtoParams.Merge(m, src) } func (m *ComplexProtoParams) XXX_Size() int { return xxx_messageInfo_ComplexProtoParams.Size(m) @@ -155,16 +160,17 @@ func (m *PayloadConfig) Reset() { *m = PayloadConfig{} } func (m *PayloadConfig) String() string { return proto.CompactTextString(m) } func (*PayloadConfig) ProtoMessage() {} func (*PayloadConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_payloads_3abc71de35f06c83, []int{3} + return fileDescriptor_3a075f58f70088c8, []int{3} } + func (m *PayloadConfig) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PayloadConfig.Unmarshal(m, b) } func (m *PayloadConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_PayloadConfig.Marshal(b, m, deterministic) } -func (dst *PayloadConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_PayloadConfig.Merge(dst, src) +func (m *PayloadConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_PayloadConfig.Merge(m, src) } func (m *PayloadConfig) XXX_Size() int { return xxx_messageInfo_PayloadConfig.Size(m) @@ -225,99 +231,15 @@ func (m *PayloadConfig) GetComplexParams() *ComplexProtoParams { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*PayloadConfig) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _PayloadConfig_OneofMarshaler, _PayloadConfig_OneofUnmarshaler, _PayloadConfig_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*PayloadConfig) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*PayloadConfig_BytebufParams)(nil), (*PayloadConfig_SimpleParams)(nil), (*PayloadConfig_ComplexParams)(nil), } } -func _PayloadConfig_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*PayloadConfig) - // payload - switch x := m.Payload.(type) { - case *PayloadConfig_BytebufParams: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.BytebufParams); err != nil { - return err - } - case *PayloadConfig_SimpleParams: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SimpleParams); err != nil { - return err - } - case *PayloadConfig_ComplexParams: - b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ComplexParams); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("PayloadConfig.Payload has unexpected type %T", x) - } - return nil -} - -func _PayloadConfig_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*PayloadConfig) - switch tag { - case 1: // payload.bytebuf_params - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ByteBufferParams) - err := b.DecodeMessage(msg) - m.Payload = &PayloadConfig_BytebufParams{msg} - return true, err - case 2: // payload.simple_params - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SimpleProtoParams) - err := b.DecodeMessage(msg) - m.Payload = &PayloadConfig_SimpleParams{msg} - return true, err - case 3: // payload.complex_params - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ComplexProtoParams) - err := b.DecodeMessage(msg) - m.Payload = &PayloadConfig_ComplexParams{msg} - return true, err - default: - return false, nil - } -} - -func _PayloadConfig_OneofSizer(msg proto.Message) (n int) { - m := msg.(*PayloadConfig) - // payload - switch x := m.Payload.(type) { - case *PayloadConfig_BytebufParams: - s := proto.Size(x.BytebufParams) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *PayloadConfig_SimpleParams: - s := proto.Size(x.SimpleParams) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *PayloadConfig_ComplexParams: - s := proto.Size(x.ComplexParams) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - func init() { proto.RegisterType((*ByteBufferParams)(nil), "grpc.testing.ByteBufferParams") proto.RegisterType((*SimpleProtoParams)(nil), "grpc.testing.SimpleProtoParams") @@ -325,9 +247,9 @@ func init() { proto.RegisterType((*PayloadConfig)(nil), "grpc.testing.PayloadConfig") } -func init() { proto.RegisterFile("payloads.proto", fileDescriptor_payloads_3abc71de35f06c83) } +func init() { proto.RegisterFile("payloads.proto", fileDescriptor_3a075f58f70088c8) } -var fileDescriptor_payloads_3abc71de35f06c83 = []byte{ +var fileDescriptor_3a075f58f70088c8 = []byte{ // 254 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2b, 0x48, 0xac, 0xcc, 0xc9, 0x4f, 0x4c, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x49, 0x2f, 0x2a, 0x48, diff --git a/vendor/google.golang.org/grpc/benchmark/grpc_testing/services.pb.go b/vendor/google.golang.org/grpc/benchmark/grpc_testing/services.pb.go index 30f8fb65a0e..d2f7d6debc8 100644 --- a/vendor/google.golang.org/grpc/benchmark/grpc_testing/services.pb.go +++ b/vendor/google.golang.org/grpc/benchmark/grpc_testing/services.pb.go @@ -3,13 +3,14 @@ package grpc_testing -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -21,7 +22,30 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +func init() { proto.RegisterFile("services.proto", fileDescriptor_8e16ccb8c5307b32) } + +var fileDescriptor_8e16ccb8c5307b32 = []byte{ + // 271 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0xc1, 0x4a, 0xc3, 0x40, + 0x10, 0x86, 0x69, 0x0f, 0x42, 0x16, 0x53, 0x64, 0x4f, 0xba, 0xfa, 0x00, 0x9e, 0x82, 0x54, 0x5f, + 0xc0, 0x06, 0x3d, 0x0a, 0x36, 0x54, 0x0f, 0x9e, 0xd6, 0x74, 0x88, 0x4b, 0x93, 0x99, 0x38, 0x33, + 0x11, 0x7c, 0x02, 0x1f, 0xc1, 0xd7, 0x15, 0xb3, 0x56, 0x6a, 0xc8, 0xcd, 0x1e, 0xe7, 0xff, 0x86, + 0x8f, 0xfd, 0x77, 0xd7, 0xcc, 0x04, 0xf8, 0x2d, 0x94, 0x20, 0x59, 0xcb, 0xa4, 0x64, 0x0f, 0x2b, + 0x6e, 0xcb, 0x4c, 0x41, 0x34, 0x60, 0xe5, 0x66, 0x0d, 0x88, 0xf8, 0x6a, 0x4b, 0x5d, 0x5a, 0x12, + 0x2a, 0x53, 0x1d, 0xc7, 0xf9, 0xc7, 0xd4, 0x1c, 0x2d, 0x00, 0xcb, 0x97, 0xc6, 0xf3, 0xa6, 0x88, + 0x22, 0x7b, 0x6b, 0x92, 0x15, 0x7a, 0x7e, 0xcf, 0x7d, 0x5d, 0xdb, 0xd3, 0x6c, 0xd7, 0x97, 0x15, + 0xa1, 0x69, 0x6b, 0x58, 0xc2, 0x6b, 0x07, 0xa2, 0xee, 0x6c, 0x1c, 0x4a, 0x4b, 0x28, 0x60, 0xef, + 0x4c, 0x5a, 0x28, 0x83, 0x6f, 0x02, 0x56, 0xff, 0x74, 0x9d, 0x4f, 0x2e, 0x26, 0xf6, 0xc9, 0xb8, + 0x15, 0x96, 0x84, 0xa2, 0xec, 0x03, 0xc2, 0x7a, 0x9f, 0xf2, 0xf9, 0xe7, 0xd4, 0xa4, 0x8f, 0xc4, + 0x1b, 0xe0, 0xed, 0x35, 0xdc, 0x98, 0x64, 0xd9, 0xe1, 0xf7, 0x04, 0x6c, 0x8f, 0x07, 0x82, 0x3e, + 0xbd, 0xe6, 0x4a, 0x9c, 0x1b, 0x23, 0x85, 0x7a, 0xed, 0xa4, 0x3f, 0x75, 0xd4, 0xe4, 0x75, 0x00, + 0xd4, 0xa1, 0x26, 0xa6, 0x63, 0x9a, 0x48, 0x76, 0x34, 0x0b, 0x93, 0xe4, 0xc4, 0x90, 0x53, 0x87, + 0x6a, 0x4f, 0x06, 0xcb, 0xc4, 0xbf, 0x4d, 0xdd, 0x18, 0xfa, 0x79, 0x90, 0x2b, 0x63, 0xee, 0xbb, + 0xa0, 0xb1, 0xa6, 0xb5, 0x7f, 0x37, 0x1f, 0x28, 0xac, 0xdd, 0x48, 0xf6, 0x7c, 0xd0, 0x7f, 0x95, + 0xcb, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9a, 0xb4, 0x19, 0x36, 0x69, 0x02, 0x00, 0x00, +} // Reference imports to suppress errors if they are not otherwise used. var _ context.Context @@ -138,6 +162,20 @@ type BenchmarkServiceServer interface { UnconstrainedStreamingCall(BenchmarkService_UnconstrainedStreamingCallServer) error } +// UnimplementedBenchmarkServiceServer can be embedded to have forward compatible implementations. +type UnimplementedBenchmarkServiceServer struct { +} + +func (*UnimplementedBenchmarkServiceServer) UnaryCall(ctx context.Context, req *SimpleRequest) (*SimpleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnaryCall not implemented") +} +func (*UnimplementedBenchmarkServiceServer) StreamingCall(srv BenchmarkService_StreamingCallServer) error { + return status.Errorf(codes.Unimplemented, "method StreamingCall not implemented") +} +func (*UnimplementedBenchmarkServiceServer) UnconstrainedStreamingCall(srv BenchmarkService_UnconstrainedStreamingCallServer) error { + return status.Errorf(codes.Unimplemented, "method UnconstrainedStreamingCall not implemented") +} + func RegisterBenchmarkServiceServer(s *grpc.Server, srv BenchmarkServiceServer) { s.RegisterService(&_BenchmarkService_serviceDesc, srv) } @@ -372,6 +410,23 @@ type WorkerServiceServer interface { QuitWorker(context.Context, *Void) (*Void, error) } +// UnimplementedWorkerServiceServer can be embedded to have forward compatible implementations. +type UnimplementedWorkerServiceServer struct { +} + +func (*UnimplementedWorkerServiceServer) RunServer(srv WorkerService_RunServerServer) error { + return status.Errorf(codes.Unimplemented, "method RunServer not implemented") +} +func (*UnimplementedWorkerServiceServer) RunClient(srv WorkerService_RunClientServer) error { + return status.Errorf(codes.Unimplemented, "method RunClient not implemented") +} +func (*UnimplementedWorkerServiceServer) CoreCount(ctx context.Context, req *CoreRequest) (*CoreResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CoreCount not implemented") +} +func (*UnimplementedWorkerServiceServer) QuitWorker(ctx context.Context, req *Void) (*Void, error) { + return nil, status.Errorf(codes.Unimplemented, "method QuitWorker not implemented") +} + func RegisterWorkerServiceServer(s *grpc.Server, srv WorkerServiceServer) { s.RegisterService(&_WorkerService_serviceDesc, srv) } @@ -493,26 +548,3 @@ var _WorkerService_serviceDesc = grpc.ServiceDesc{ }, Metadata: "services.proto", } - -func init() { proto.RegisterFile("services.proto", fileDescriptor_services_e4655369b5d7f4d0) } - -var fileDescriptor_services_e4655369b5d7f4d0 = []byte{ - // 271 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0xc1, 0x4a, 0xc3, 0x40, - 0x10, 0x86, 0x69, 0x0f, 0x42, 0x16, 0x53, 0x64, 0x4f, 0xba, 0xfa, 0x00, 0x9e, 0x82, 0x54, 0x5f, - 0xc0, 0x06, 0x3d, 0x0a, 0x36, 0x54, 0x0f, 0x9e, 0xd6, 0x74, 0x88, 0x4b, 0x93, 0x99, 0x38, 0x33, - 0x11, 0x7c, 0x02, 0x1f, 0xc1, 0xd7, 0x15, 0xb3, 0x56, 0x6a, 0xc8, 0xcd, 0x1e, 0xe7, 0xff, 0x86, - 0x8f, 0xfd, 0x77, 0xd7, 0xcc, 0x04, 0xf8, 0x2d, 0x94, 0x20, 0x59, 0xcb, 0xa4, 0x64, 0x0f, 0x2b, - 0x6e, 0xcb, 0x4c, 0x41, 0x34, 0x60, 0xe5, 0x66, 0x0d, 0x88, 0xf8, 0x6a, 0x4b, 0x5d, 0x5a, 0x12, - 0x2a, 0x53, 0x1d, 0xc7, 0xf9, 0xc7, 0xd4, 0x1c, 0x2d, 0x00, 0xcb, 0x97, 0xc6, 0xf3, 0xa6, 0x88, - 0x22, 0x7b, 0x6b, 0x92, 0x15, 0x7a, 0x7e, 0xcf, 0x7d, 0x5d, 0xdb, 0xd3, 0x6c, 0xd7, 0x97, 0x15, - 0xa1, 0x69, 0x6b, 0x58, 0xc2, 0x6b, 0x07, 0xa2, 0xee, 0x6c, 0x1c, 0x4a, 0x4b, 0x28, 0x60, 0xef, - 0x4c, 0x5a, 0x28, 0x83, 0x6f, 0x02, 0x56, 0xff, 0x74, 0x9d, 0x4f, 0x2e, 0x26, 0xf6, 0xc9, 0xb8, - 0x15, 0x96, 0x84, 0xa2, 0xec, 0x03, 0xc2, 0x7a, 0x9f, 0xf2, 0xf9, 0xe7, 0xd4, 0xa4, 0x8f, 0xc4, - 0x1b, 0xe0, 0xed, 0x35, 0xdc, 0x98, 0x64, 0xd9, 0xe1, 0xf7, 0x04, 0x6c, 0x8f, 0x07, 0x82, 0x3e, - 0xbd, 0xe6, 0x4a, 0x9c, 0x1b, 0x23, 0x85, 0x7a, 0xed, 0xa4, 0x3f, 0x75, 0xd4, 0xe4, 0x75, 0x00, - 0xd4, 0xa1, 0x26, 0xa6, 0x63, 0x9a, 0x48, 0x76, 0x34, 0x0b, 0x93, 0xe4, 0xc4, 0x90, 0x53, 0x87, - 0x6a, 0x4f, 0x06, 0xcb, 0xc4, 0xbf, 0x4d, 0xdd, 0x18, 0xfa, 0x79, 0x90, 0x2b, 0x63, 0xee, 0xbb, - 0xa0, 0xb1, 0xa6, 0xb5, 0x7f, 0x37, 0x1f, 0x28, 0xac, 0xdd, 0x48, 0xf6, 0x7c, 0xd0, 0x7f, 0x95, - 0xcb, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9a, 0xb4, 0x19, 0x36, 0x69, 0x02, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/benchmark/grpc_testing/stats.pb.go b/vendor/google.golang.org/grpc/benchmark/grpc_testing/stats.pb.go index abc2aea7604..2e6bcc70655 100644 --- a/vendor/google.golang.org/grpc/benchmark/grpc_testing/stats.pb.go +++ b/vendor/google.golang.org/grpc/benchmark/grpc_testing/stats.pb.go @@ -3,9 +3,11 @@ package grpc_testing -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -16,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type ServerStats struct { // wall clock time change in seconds since last reset @@ -35,16 +37,17 @@ func (m *ServerStats) Reset() { *m = ServerStats{} } func (m *ServerStats) String() string { return proto.CompactTextString(m) } func (*ServerStats) ProtoMessage() {} func (*ServerStats) Descriptor() ([]byte, []int) { - return fileDescriptor_stats_8ba831c0cb3c3440, []int{0} + return fileDescriptor_b4756a0aec8b9d44, []int{0} } + func (m *ServerStats) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ServerStats.Unmarshal(m, b) } func (m *ServerStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ServerStats.Marshal(b, m, deterministic) } -func (dst *ServerStats) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServerStats.Merge(dst, src) +func (m *ServerStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerStats.Merge(m, src) } func (m *ServerStats) XXX_Size() int { return xxx_messageInfo_ServerStats.Size(m) @@ -89,16 +92,17 @@ func (m *HistogramParams) Reset() { *m = HistogramParams{} } func (m *HistogramParams) String() string { return proto.CompactTextString(m) } func (*HistogramParams) ProtoMessage() {} func (*HistogramParams) Descriptor() ([]byte, []int) { - return fileDescriptor_stats_8ba831c0cb3c3440, []int{1} + return fileDescriptor_b4756a0aec8b9d44, []int{1} } + func (m *HistogramParams) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_HistogramParams.Unmarshal(m, b) } func (m *HistogramParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_HistogramParams.Marshal(b, m, deterministic) } -func (dst *HistogramParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_HistogramParams.Merge(dst, src) +func (m *HistogramParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_HistogramParams.Merge(m, src) } func (m *HistogramParams) XXX_Size() int { return xxx_messageInfo_HistogramParams.Size(m) @@ -140,16 +144,17 @@ func (m *HistogramData) Reset() { *m = HistogramData{} } func (m *HistogramData) String() string { return proto.CompactTextString(m) } func (*HistogramData) ProtoMessage() {} func (*HistogramData) Descriptor() ([]byte, []int) { - return fileDescriptor_stats_8ba831c0cb3c3440, []int{2} + return fileDescriptor_b4756a0aec8b9d44, []int{2} } + func (m *HistogramData) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_HistogramData.Unmarshal(m, b) } func (m *HistogramData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_HistogramData.Marshal(b, m, deterministic) } -func (dst *HistogramData) XXX_Merge(src proto.Message) { - xxx_messageInfo_HistogramData.Merge(dst, src) +func (m *HistogramData) XXX_Merge(src proto.Message) { + xxx_messageInfo_HistogramData.Merge(m, src) } func (m *HistogramData) XXX_Size() int { return xxx_messageInfo_HistogramData.Size(m) @@ -218,16 +223,17 @@ func (m *ClientStats) Reset() { *m = ClientStats{} } func (m *ClientStats) String() string { return proto.CompactTextString(m) } func (*ClientStats) ProtoMessage() {} func (*ClientStats) Descriptor() ([]byte, []int) { - return fileDescriptor_stats_8ba831c0cb3c3440, []int{3} + return fileDescriptor_b4756a0aec8b9d44, []int{3} } + func (m *ClientStats) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ClientStats.Unmarshal(m, b) } func (m *ClientStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ClientStats.Marshal(b, m, deterministic) } -func (dst *ClientStats) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClientStats.Merge(dst, src) +func (m *ClientStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClientStats.Merge(m, src) } func (m *ClientStats) XXX_Size() int { return xxx_messageInfo_ClientStats.Size(m) @@ -273,9 +279,9 @@ func init() { proto.RegisterType((*ClientStats)(nil), "grpc.testing.ClientStats") } -func init() { proto.RegisterFile("stats.proto", fileDescriptor_stats_8ba831c0cb3c3440) } +func init() { proto.RegisterFile("stats.proto", fileDescriptor_b4756a0aec8b9d44) } -var fileDescriptor_stats_8ba831c0cb3c3440 = []byte{ +var fileDescriptor_b4756a0aec8b9d44 = []byte{ // 341 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xc1, 0x4a, 0xeb, 0x40, 0x14, 0x86, 0x49, 0xd3, 0xf6, 0xb6, 0x27, 0xed, 0xbd, 0x97, 0x41, 0x24, 0x52, 0xd0, 0x1a, 0x5c, diff --git a/vendor/google.golang.org/grpc/benchmark/primitives/context_test.go b/vendor/google.golang.org/grpc/benchmark/primitives/context_test.go index 1d92192f343..c94acd74597 100644 --- a/vendor/google.golang.org/grpc/benchmark/primitives/context_test.go +++ b/vendor/google.golang.org/grpc/benchmark/primitives/context_test.go @@ -117,3 +117,34 @@ func BenchmarkTimerContextChannelGotErr(b *testing.B) { } } } + +type ctxKey struct{} + +func newContextWithLocalKey(parent context.Context) context.Context { + return context.WithValue(parent, ctxKey{}, nil) +} + +var ck = ctxKey{} + +func newContextWithGlobalKey(parent context.Context) context.Context { + return context.WithValue(parent, ck, nil) +} + +func BenchmarkContextWithValue(b *testing.B) { + benches := []struct { + name string + f func(context.Context) context.Context + }{ + {"newContextWithLocalKey", newContextWithLocalKey}, + {"newContextWithGlobalKey", newContextWithGlobalKey}, + } + + pCtx := context.Background() + for _, bench := range benches { + b.Run(bench.name, func(b *testing.B) { + for j := 0; j < b.N; j++ { + bench.f(pCtx) + } + }) + } +} diff --git a/vendor/google.golang.org/grpc/benchmark/stats/stats.go b/vendor/google.golang.org/grpc/benchmark/stats/stats.go index 70972cb845c..a1a21c51558 100644 --- a/vendor/google.golang.org/grpc/benchmark/stats/stats.go +++ b/vendor/google.golang.org/grpc/benchmark/stats/stats.go @@ -29,6 +29,8 @@ import ( "strconv" "sync" "time" + + "google.golang.org/grpc" ) // FeatureIndex is an enum for features that usually differ across individual @@ -174,6 +176,10 @@ func (f Features) partialString(b *bytes.Buffer, wantFeatures []bool, sep, delim // benchmark execution, and could later be read for pretty-printing or // comparison with other benchmark results. type BenchResults struct { + // GoVersion is the version of the compiler the benchmark was compiled with. + GoVersion string + // GrpcVersion is the gRPC version being benchmarked. + GrpcVersion string // RunMode is the workload mode for this benchmark run. This could be unary, // stream or unconstrained. RunMode string @@ -200,9 +206,9 @@ type RunData struct { // run. Only makes sense for unconstrained workloads. RecvOps uint64 // AllocedBytes is the average memory allocation in bytes per operation. - AllocedBytes uint64 + AllocedBytes float64 // Allocs is the average number of memory allocations per operation. - Allocs uint64 + Allocs float64 // ReqT is the average request throughput associated with this run. ReqT float64 // RespT is the average response throughput associated with this run. @@ -262,7 +268,13 @@ func (s *Stats) StartRun(mode string, f Features, sf []bool) { defer s.mu.Unlock() runtime.ReadMemStats(&s.startMS) - s.results = append(s.results, BenchResults{RunMode: mode, Features: f, SharedFeatures: sf}) + s.results = append(s.results, BenchResults{ + GoVersion: runtime.Version(), + GrpcVersion: grpc.Version, + RunMode: mode, + Features: f, + SharedFeatures: sf, + }) } // EndRun is to be invoked to indicate the end of the ongoing benchmark run. It @@ -275,8 +287,8 @@ func (s *Stats) EndRun(count uint64) { r := &s.results[len(s.results)-1] r.Data = RunData{ TotalOps: count, - AllocedBytes: s.stopMS.TotalAlloc - s.startMS.TotalAlloc, - Allocs: s.stopMS.Mallocs - s.startMS.Mallocs, + AllocedBytes: float64(s.stopMS.TotalAlloc-s.startMS.TotalAlloc) / float64(count), + Allocs: float64(s.stopMS.Mallocs-s.startMS.Mallocs) / float64(count), ReqT: float64(count) * float64(r.Features.ReqSizeBytes) * 8 / r.Features.BenchTime.Seconds(), RespT: float64(count) * float64(r.Features.RespSizeBytes) * 8 / r.Features.BenchTime.Seconds(), } @@ -296,8 +308,8 @@ func (s *Stats) EndUnconstrainedRun(req uint64, resp uint64) { r.Data = RunData{ SendOps: req, RecvOps: resp, - AllocedBytes: (s.stopMS.TotalAlloc - s.startMS.TotalAlloc) / ((req + resp) / 2), - Allocs: (s.stopMS.Mallocs - s.startMS.Mallocs) / ((req + resp) / 2), + AllocedBytes: float64(s.stopMS.TotalAlloc-s.startMS.TotalAlloc) / float64((req+resp)/2), + Allocs: float64(s.stopMS.Mallocs-s.startMS.Mallocs) / float64((req+resp)/2), ReqT: float64(req) * float64(r.Features.ReqSizeBytes) * 8 / r.Features.BenchTime.Seconds(), RespT: float64(resp) * float64(r.Features.RespSizeBytes) * 8 / r.Features.BenchTime.Seconds(), } @@ -365,6 +377,10 @@ func (s *Stats) computeLatencies(result *BenchResults) { // dump returns a printable version. func (s *Stats) dump(result *BenchResults) { var b bytes.Buffer + + // Go and gRPC version information. + b.WriteString(fmt.Sprintf("%s/grpc%s\n", result.GoVersion, result.GrpcVersion)) + // This prints the run mode and all features of the bench on a line. b.WriteString(fmt.Sprintf("%s-%s:\n", result.RunMode, result.Features.String())) diff --git a/vendor/google.golang.org/grpc/channelz/grpc_channelz_v1/channelz.pb.go b/vendor/google.golang.org/grpc/channelz/grpc_channelz_v1/channelz.pb.go index 0269cab1ca3..f5cbb3a51b4 100644 --- a/vendor/google.golang.org/grpc/channelz/grpc_channelz_v1/channelz.pb.go +++ b/vendor/google.golang.org/grpc/channelz/grpc_channelz_v1/channelz.pb.go @@ -1,19 +1,20 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: grpc/channelz/v1/channelz.proto -package grpc_channelz_v1 // import "google.golang.org/grpc/channelz/grpc_channelz_v1" - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import any "github.com/golang/protobuf/ptypes/any" -import duration "github.com/golang/protobuf/ptypes/duration" -import timestamp "github.com/golang/protobuf/ptypes/timestamp" -import wrappers "github.com/golang/protobuf/ptypes/wrappers" +package grpc_channelz_v1 import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + any "github.com/golang/protobuf/ptypes/any" + duration "github.com/golang/protobuf/ptypes/duration" + timestamp "github.com/golang/protobuf/ptypes/timestamp" + wrappers "github.com/golang/protobuf/ptypes/wrappers" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -25,7 +26,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type ChannelConnectivityState_State int32 @@ -46,6 +47,7 @@ var ChannelConnectivityState_State_name = map[int32]string{ 4: "TRANSIENT_FAILURE", 5: "SHUTDOWN", } + var ChannelConnectivityState_State_value = map[string]int32{ "UNKNOWN": 0, "IDLE": 1, @@ -58,8 +60,9 @@ var ChannelConnectivityState_State_value = map[string]int32{ func (x ChannelConnectivityState_State) String() string { return proto.EnumName(ChannelConnectivityState_State_name, int32(x)) } + func (ChannelConnectivityState_State) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{2, 0} + return fileDescriptor_6ee37dfd35a8ab00, []int{2, 0} } // The supported severity levels of trace events. @@ -78,6 +81,7 @@ var ChannelTraceEvent_Severity_name = map[int32]string{ 2: "CT_WARNING", 3: "CT_ERROR", } + var ChannelTraceEvent_Severity_value = map[string]int32{ "CT_UNKNOWN": 0, "CT_INFO": 1, @@ -88,8 +92,9 @@ var ChannelTraceEvent_Severity_value = map[string]int32{ func (x ChannelTraceEvent_Severity) String() string { return proto.EnumName(ChannelTraceEvent_Severity_name, int32(x)) } + func (ChannelTraceEvent_Severity) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{4, 0} + return fileDescriptor_6ee37dfd35a8ab00, []int{4, 0} } // Channel is a logical grouping of channels, subchannels, and sockets. @@ -118,16 +123,17 @@ func (m *Channel) Reset() { *m = Channel{} } func (m *Channel) String() string { return proto.CompactTextString(m) } func (*Channel) ProtoMessage() {} func (*Channel) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{0} + return fileDescriptor_6ee37dfd35a8ab00, []int{0} } + func (m *Channel) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Channel.Unmarshal(m, b) } func (m *Channel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Channel.Marshal(b, m, deterministic) } -func (dst *Channel) XXX_Merge(src proto.Message) { - xxx_messageInfo_Channel.Merge(dst, src) +func (m *Channel) XXX_Merge(src proto.Message) { + xxx_messageInfo_Channel.Merge(m, src) } func (m *Channel) XXX_Size() int { return xxx_messageInfo_Channel.Size(m) @@ -200,16 +206,17 @@ func (m *Subchannel) Reset() { *m = Subchannel{} } func (m *Subchannel) String() string { return proto.CompactTextString(m) } func (*Subchannel) ProtoMessage() {} func (*Subchannel) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{1} + return fileDescriptor_6ee37dfd35a8ab00, []int{1} } + func (m *Subchannel) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Subchannel.Unmarshal(m, b) } func (m *Subchannel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Subchannel.Marshal(b, m, deterministic) } -func (dst *Subchannel) XXX_Merge(src proto.Message) { - xxx_messageInfo_Subchannel.Merge(dst, src) +func (m *Subchannel) XXX_Merge(src proto.Message) { + xxx_messageInfo_Subchannel.Merge(m, src) } func (m *Subchannel) XXX_Size() int { return xxx_messageInfo_Subchannel.Size(m) @@ -268,16 +275,17 @@ func (m *ChannelConnectivityState) Reset() { *m = ChannelConnectivitySta func (m *ChannelConnectivityState) String() string { return proto.CompactTextString(m) } func (*ChannelConnectivityState) ProtoMessage() {} func (*ChannelConnectivityState) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{2} + return fileDescriptor_6ee37dfd35a8ab00, []int{2} } + func (m *ChannelConnectivityState) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChannelConnectivityState.Unmarshal(m, b) } func (m *ChannelConnectivityState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ChannelConnectivityState.Marshal(b, m, deterministic) } -func (dst *ChannelConnectivityState) XXX_Merge(src proto.Message) { - xxx_messageInfo_ChannelConnectivityState.Merge(dst, src) +func (m *ChannelConnectivityState) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChannelConnectivityState.Merge(m, src) } func (m *ChannelConnectivityState) XXX_Size() int { return xxx_messageInfo_ChannelConnectivityState.Size(m) @@ -321,16 +329,17 @@ func (m *ChannelData) Reset() { *m = ChannelData{} } func (m *ChannelData) String() string { return proto.CompactTextString(m) } func (*ChannelData) ProtoMessage() {} func (*ChannelData) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{3} + return fileDescriptor_6ee37dfd35a8ab00, []int{3} } + func (m *ChannelData) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChannelData.Unmarshal(m, b) } func (m *ChannelData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ChannelData.Marshal(b, m, deterministic) } -func (dst *ChannelData) XXX_Merge(src proto.Message) { - xxx_messageInfo_ChannelData.Merge(dst, src) +func (m *ChannelData) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChannelData.Merge(m, src) } func (m *ChannelData) XXX_Size() int { return xxx_messageInfo_ChannelData.Size(m) @@ -417,16 +426,17 @@ func (m *ChannelTraceEvent) Reset() { *m = ChannelTraceEvent{} } func (m *ChannelTraceEvent) String() string { return proto.CompactTextString(m) } func (*ChannelTraceEvent) ProtoMessage() {} func (*ChannelTraceEvent) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{4} + return fileDescriptor_6ee37dfd35a8ab00, []int{4} } + func (m *ChannelTraceEvent) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChannelTraceEvent.Unmarshal(m, b) } func (m *ChannelTraceEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ChannelTraceEvent.Marshal(b, m, deterministic) } -func (dst *ChannelTraceEvent) XXX_Merge(src proto.Message) { - xxx_messageInfo_ChannelTraceEvent.Merge(dst, src) +func (m *ChannelTraceEvent) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChannelTraceEvent.Merge(m, src) } func (m *ChannelTraceEvent) XXX_Size() int { return xxx_messageInfo_ChannelTraceEvent.Size(m) @@ -495,80 +505,14 @@ func (m *ChannelTraceEvent) GetSubchannelRef() *SubchannelRef { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*ChannelTraceEvent) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _ChannelTraceEvent_OneofMarshaler, _ChannelTraceEvent_OneofUnmarshaler, _ChannelTraceEvent_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ChannelTraceEvent) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*ChannelTraceEvent_ChannelRef)(nil), (*ChannelTraceEvent_SubchannelRef)(nil), } } -func _ChannelTraceEvent_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*ChannelTraceEvent) - // child_ref - switch x := m.ChildRef.(type) { - case *ChannelTraceEvent_ChannelRef: - b.EncodeVarint(4<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ChannelRef); err != nil { - return err - } - case *ChannelTraceEvent_SubchannelRef: - b.EncodeVarint(5<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SubchannelRef); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("ChannelTraceEvent.ChildRef has unexpected type %T", x) - } - return nil -} - -func _ChannelTraceEvent_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*ChannelTraceEvent) - switch tag { - case 4: // child_ref.channel_ref - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ChannelRef) - err := b.DecodeMessage(msg) - m.ChildRef = &ChannelTraceEvent_ChannelRef{msg} - return true, err - case 5: // child_ref.subchannel_ref - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SubchannelRef) - err := b.DecodeMessage(msg) - m.ChildRef = &ChannelTraceEvent_SubchannelRef{msg} - return true, err - default: - return false, nil - } -} - -func _ChannelTraceEvent_OneofSizer(msg proto.Message) (n int) { - m := msg.(*ChannelTraceEvent) - // child_ref - switch x := m.ChildRef.(type) { - case *ChannelTraceEvent_ChannelRef: - s := proto.Size(x.ChannelRef) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *ChannelTraceEvent_SubchannelRef: - s := proto.Size(x.SubchannelRef) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - // ChannelTrace represents the recent events that have occurred on the channel. type ChannelTrace struct { // Number of events ever logged in this tracing object. This can differ from @@ -588,16 +532,17 @@ func (m *ChannelTrace) Reset() { *m = ChannelTrace{} } func (m *ChannelTrace) String() string { return proto.CompactTextString(m) } func (*ChannelTrace) ProtoMessage() {} func (*ChannelTrace) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{5} + return fileDescriptor_6ee37dfd35a8ab00, []int{5} } + func (m *ChannelTrace) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChannelTrace.Unmarshal(m, b) } func (m *ChannelTrace) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ChannelTrace.Marshal(b, m, deterministic) } -func (dst *ChannelTrace) XXX_Merge(src proto.Message) { - xxx_messageInfo_ChannelTrace.Merge(dst, src) +func (m *ChannelTrace) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChannelTrace.Merge(m, src) } func (m *ChannelTrace) XXX_Size() int { return xxx_messageInfo_ChannelTrace.Size(m) @@ -644,16 +589,17 @@ func (m *ChannelRef) Reset() { *m = ChannelRef{} } func (m *ChannelRef) String() string { return proto.CompactTextString(m) } func (*ChannelRef) ProtoMessage() {} func (*ChannelRef) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{6} + return fileDescriptor_6ee37dfd35a8ab00, []int{6} } + func (m *ChannelRef) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChannelRef.Unmarshal(m, b) } func (m *ChannelRef) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ChannelRef.Marshal(b, m, deterministic) } -func (dst *ChannelRef) XXX_Merge(src proto.Message) { - xxx_messageInfo_ChannelRef.Merge(dst, src) +func (m *ChannelRef) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChannelRef.Merge(m, src) } func (m *ChannelRef) XXX_Size() int { return xxx_messageInfo_ChannelRef.Size(m) @@ -693,16 +639,17 @@ func (m *SubchannelRef) Reset() { *m = SubchannelRef{} } func (m *SubchannelRef) String() string { return proto.CompactTextString(m) } func (*SubchannelRef) ProtoMessage() {} func (*SubchannelRef) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{7} + return fileDescriptor_6ee37dfd35a8ab00, []int{7} } + func (m *SubchannelRef) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SubchannelRef.Unmarshal(m, b) } func (m *SubchannelRef) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SubchannelRef.Marshal(b, m, deterministic) } -func (dst *SubchannelRef) XXX_Merge(src proto.Message) { - xxx_messageInfo_SubchannelRef.Merge(dst, src) +func (m *SubchannelRef) XXX_Merge(src proto.Message) { + xxx_messageInfo_SubchannelRef.Merge(m, src) } func (m *SubchannelRef) XXX_Size() int { return xxx_messageInfo_SubchannelRef.Size(m) @@ -742,16 +689,17 @@ func (m *SocketRef) Reset() { *m = SocketRef{} } func (m *SocketRef) String() string { return proto.CompactTextString(m) } func (*SocketRef) ProtoMessage() {} func (*SocketRef) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{8} + return fileDescriptor_6ee37dfd35a8ab00, []int{8} } + func (m *SocketRef) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SocketRef.Unmarshal(m, b) } func (m *SocketRef) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SocketRef.Marshal(b, m, deterministic) } -func (dst *SocketRef) XXX_Merge(src proto.Message) { - xxx_messageInfo_SocketRef.Merge(dst, src) +func (m *SocketRef) XXX_Merge(src proto.Message) { + xxx_messageInfo_SocketRef.Merge(m, src) } func (m *SocketRef) XXX_Size() int { return xxx_messageInfo_SocketRef.Size(m) @@ -791,16 +739,17 @@ func (m *ServerRef) Reset() { *m = ServerRef{} } func (m *ServerRef) String() string { return proto.CompactTextString(m) } func (*ServerRef) ProtoMessage() {} func (*ServerRef) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{9} + return fileDescriptor_6ee37dfd35a8ab00, []int{9} } + func (m *ServerRef) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ServerRef.Unmarshal(m, b) } func (m *ServerRef) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ServerRef.Marshal(b, m, deterministic) } -func (dst *ServerRef) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServerRef.Merge(dst, src) +func (m *ServerRef) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerRef.Merge(m, src) } func (m *ServerRef) XXX_Size() int { return xxx_messageInfo_ServerRef.Size(m) @@ -844,16 +793,17 @@ func (m *Server) Reset() { *m = Server{} } func (m *Server) String() string { return proto.CompactTextString(m) } func (*Server) ProtoMessage() {} func (*Server) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{10} + return fileDescriptor_6ee37dfd35a8ab00, []int{10} } + func (m *Server) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Server.Unmarshal(m, b) } func (m *Server) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Server.Marshal(b, m, deterministic) } -func (dst *Server) XXX_Merge(src proto.Message) { - xxx_messageInfo_Server.Merge(dst, src) +func (m *Server) XXX_Merge(src proto.Message) { + xxx_messageInfo_Server.Merge(m, src) } func (m *Server) XXX_Size() int { return xxx_messageInfo_Server.Size(m) @@ -906,16 +856,17 @@ func (m *ServerData) Reset() { *m = ServerData{} } func (m *ServerData) String() string { return proto.CompactTextString(m) } func (*ServerData) ProtoMessage() {} func (*ServerData) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{11} + return fileDescriptor_6ee37dfd35a8ab00, []int{11} } + func (m *ServerData) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ServerData.Unmarshal(m, b) } func (m *ServerData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ServerData.Marshal(b, m, deterministic) } -func (dst *ServerData) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServerData.Merge(dst, src) +func (m *ServerData) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerData.Merge(m, src) } func (m *ServerData) XXX_Size() int { return xxx_messageInfo_ServerData.Size(m) @@ -986,16 +937,17 @@ func (m *Socket) Reset() { *m = Socket{} } func (m *Socket) String() string { return proto.CompactTextString(m) } func (*Socket) ProtoMessage() {} func (*Socket) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{12} + return fileDescriptor_6ee37dfd35a8ab00, []int{12} } + func (m *Socket) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Socket.Unmarshal(m, b) } func (m *Socket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Socket.Marshal(b, m, deterministic) } -func (dst *Socket) XXX_Merge(src proto.Message) { - xxx_messageInfo_Socket.Merge(dst, src) +func (m *Socket) XXX_Merge(src proto.Message) { + xxx_messageInfo_Socket.Merge(m, src) } func (m *Socket) XXX_Size() int { return xxx_messageInfo_Socket.Size(m) @@ -1099,16 +1051,17 @@ func (m *SocketData) Reset() { *m = SocketData{} } func (m *SocketData) String() string { return proto.CompactTextString(m) } func (*SocketData) ProtoMessage() {} func (*SocketData) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{13} + return fileDescriptor_6ee37dfd35a8ab00, []int{13} } + func (m *SocketData) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SocketData.Unmarshal(m, b) } func (m *SocketData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SocketData.Marshal(b, m, deterministic) } -func (dst *SocketData) XXX_Merge(src proto.Message) { - xxx_messageInfo_SocketData.Merge(dst, src) +func (m *SocketData) XXX_Merge(src proto.Message) { + xxx_messageInfo_SocketData.Merge(m, src) } func (m *SocketData) XXX_Size() int { return xxx_messageInfo_SocketData.Size(m) @@ -1226,16 +1179,17 @@ func (m *Address) Reset() { *m = Address{} } func (m *Address) String() string { return proto.CompactTextString(m) } func (*Address) ProtoMessage() {} func (*Address) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{14} + return fileDescriptor_6ee37dfd35a8ab00, []int{14} } + func (m *Address) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Address.Unmarshal(m, b) } func (m *Address) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Address.Marshal(b, m, deterministic) } -func (dst *Address) XXX_Merge(src proto.Message) { - xxx_messageInfo_Address.Merge(dst, src) +func (m *Address) XXX_Merge(src proto.Message) { + xxx_messageInfo_Address.Merge(m, src) } func (m *Address) XXX_Size() int { return xxx_messageInfo_Address.Size(m) @@ -1296,99 +1250,15 @@ func (m *Address) GetOtherAddress() *Address_OtherAddress { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Address) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Address_OneofMarshaler, _Address_OneofUnmarshaler, _Address_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Address) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*Address_TcpipAddress)(nil), (*Address_UdsAddress_)(nil), (*Address_OtherAddress_)(nil), } } -func _Address_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Address) - // address - switch x := m.Address.(type) { - case *Address_TcpipAddress: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.TcpipAddress); err != nil { - return err - } - case *Address_UdsAddress_: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.UdsAddress); err != nil { - return err - } - case *Address_OtherAddress_: - b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.OtherAddress); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("Address.Address has unexpected type %T", x) - } - return nil -} - -func _Address_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Address) - switch tag { - case 1: // address.tcpip_address - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Address_TcpIpAddress) - err := b.DecodeMessage(msg) - m.Address = &Address_TcpipAddress{msg} - return true, err - case 2: // address.uds_address - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Address_UdsAddress) - err := b.DecodeMessage(msg) - m.Address = &Address_UdsAddress_{msg} - return true, err - case 3: // address.other_address - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Address_OtherAddress) - err := b.DecodeMessage(msg) - m.Address = &Address_OtherAddress_{msg} - return true, err - default: - return false, nil - } -} - -func _Address_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Address) - // address - switch x := m.Address.(type) { - case *Address_TcpipAddress: - s := proto.Size(x.TcpipAddress) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Address_UdsAddress_: - s := proto.Size(x.UdsAddress) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Address_OtherAddress_: - s := proto.Size(x.OtherAddress) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type Address_TcpIpAddress struct { // Either the IPv4 or IPv6 address in bytes. Will be either 4 bytes or 16 // bytes in length. @@ -1404,16 +1274,17 @@ func (m *Address_TcpIpAddress) Reset() { *m = Address_TcpIpAddress{} } func (m *Address_TcpIpAddress) String() string { return proto.CompactTextString(m) } func (*Address_TcpIpAddress) ProtoMessage() {} func (*Address_TcpIpAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{14, 0} + return fileDescriptor_6ee37dfd35a8ab00, []int{14, 0} } + func (m *Address_TcpIpAddress) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Address_TcpIpAddress.Unmarshal(m, b) } func (m *Address_TcpIpAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Address_TcpIpAddress.Marshal(b, m, deterministic) } -func (dst *Address_TcpIpAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_Address_TcpIpAddress.Merge(dst, src) +func (m *Address_TcpIpAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_Address_TcpIpAddress.Merge(m, src) } func (m *Address_TcpIpAddress) XXX_Size() int { return xxx_messageInfo_Address_TcpIpAddress.Size(m) @@ -1450,16 +1321,17 @@ func (m *Address_UdsAddress) Reset() { *m = Address_UdsAddress{} } func (m *Address_UdsAddress) String() string { return proto.CompactTextString(m) } func (*Address_UdsAddress) ProtoMessage() {} func (*Address_UdsAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{14, 1} + return fileDescriptor_6ee37dfd35a8ab00, []int{14, 1} } + func (m *Address_UdsAddress) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Address_UdsAddress.Unmarshal(m, b) } func (m *Address_UdsAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Address_UdsAddress.Marshal(b, m, deterministic) } -func (dst *Address_UdsAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_Address_UdsAddress.Merge(dst, src) +func (m *Address_UdsAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_Address_UdsAddress.Merge(m, src) } func (m *Address_UdsAddress) XXX_Size() int { return xxx_messageInfo_Address_UdsAddress.Size(m) @@ -1492,16 +1364,17 @@ func (m *Address_OtherAddress) Reset() { *m = Address_OtherAddress{} } func (m *Address_OtherAddress) String() string { return proto.CompactTextString(m) } func (*Address_OtherAddress) ProtoMessage() {} func (*Address_OtherAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{14, 2} + return fileDescriptor_6ee37dfd35a8ab00, []int{14, 2} } + func (m *Address_OtherAddress) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Address_OtherAddress.Unmarshal(m, b) } func (m *Address_OtherAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Address_OtherAddress.Marshal(b, m, deterministic) } -func (dst *Address_OtherAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_Address_OtherAddress.Merge(dst, src) +func (m *Address_OtherAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_Address_OtherAddress.Merge(m, src) } func (m *Address_OtherAddress) XXX_Size() int { return xxx_messageInfo_Address_OtherAddress.Size(m) @@ -1541,16 +1414,17 @@ func (m *Security) Reset() { *m = Security{} } func (m *Security) String() string { return proto.CompactTextString(m) } func (*Security) ProtoMessage() {} func (*Security) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{15} + return fileDescriptor_6ee37dfd35a8ab00, []int{15} } + func (m *Security) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Security.Unmarshal(m, b) } func (m *Security) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Security.Marshal(b, m, deterministic) } -func (dst *Security) XXX_Merge(src proto.Message) { - xxx_messageInfo_Security.Merge(dst, src) +func (m *Security) XXX_Merge(src proto.Message) { + xxx_messageInfo_Security.Merge(m, src) } func (m *Security) XXX_Size() int { return xxx_messageInfo_Security.Size(m) @@ -1598,80 +1472,14 @@ func (m *Security) GetOther() *Security_OtherSecurity { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Security) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Security_OneofMarshaler, _Security_OneofUnmarshaler, _Security_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Security) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*Security_Tls_)(nil), (*Security_Other)(nil), } } -func _Security_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Security) - // model - switch x := m.Model.(type) { - case *Security_Tls_: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Tls); err != nil { - return err - } - case *Security_Other: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Other); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("Security.Model has unexpected type %T", x) - } - return nil -} - -func _Security_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Security) - switch tag { - case 1: // model.tls - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Security_Tls) - err := b.DecodeMessage(msg) - m.Model = &Security_Tls_{msg} - return true, err - case 2: // model.other - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Security_OtherSecurity) - err := b.DecodeMessage(msg) - m.Model = &Security_Other{msg} - return true, err - default: - return false, nil - } -} - -func _Security_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Security) - // model - switch x := m.Model.(type) { - case *Security_Tls_: - s := proto.Size(x.Tls) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Security_Other: - s := proto.Size(x.Other) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type Security_Tls struct { // Types that are valid to be assigned to CipherSuite: // *Security_Tls_StandardName @@ -1690,16 +1498,17 @@ func (m *Security_Tls) Reset() { *m = Security_Tls{} } func (m *Security_Tls) String() string { return proto.CompactTextString(m) } func (*Security_Tls) ProtoMessage() {} func (*Security_Tls) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{15, 0} + return fileDescriptor_6ee37dfd35a8ab00, []int{15, 0} } + func (m *Security_Tls) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Security_Tls.Unmarshal(m, b) } func (m *Security_Tls) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Security_Tls.Marshal(b, m, deterministic) } -func (dst *Security_Tls) XXX_Merge(src proto.Message) { - xxx_messageInfo_Security_Tls.Merge(dst, src) +func (m *Security_Tls) XXX_Merge(src proto.Message) { + xxx_messageInfo_Security_Tls.Merge(m, src) } func (m *Security_Tls) XXX_Size() int { return xxx_messageInfo_Security_Tls.Size(m) @@ -1761,72 +1570,14 @@ func (m *Security_Tls) GetRemoteCertificate() []byte { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Security_Tls) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Security_Tls_OneofMarshaler, _Security_Tls_OneofUnmarshaler, _Security_Tls_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Security_Tls) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*Security_Tls_StandardName)(nil), (*Security_Tls_OtherName)(nil), } } -func _Security_Tls_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Security_Tls) - // cipher_suite - switch x := m.CipherSuite.(type) { - case *Security_Tls_StandardName: - b.EncodeVarint(1<<3 | proto.WireBytes) - b.EncodeStringBytes(x.StandardName) - case *Security_Tls_OtherName: - b.EncodeVarint(2<<3 | proto.WireBytes) - b.EncodeStringBytes(x.OtherName) - case nil: - default: - return fmt.Errorf("Security_Tls.CipherSuite has unexpected type %T", x) - } - return nil -} - -func _Security_Tls_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Security_Tls) - switch tag { - case 1: // cipher_suite.standard_name - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.CipherSuite = &Security_Tls_StandardName{x} - return true, err - case 2: // cipher_suite.other_name - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.CipherSuite = &Security_Tls_OtherName{x} - return true, err - default: - return false, nil - } -} - -func _Security_Tls_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Security_Tls) - // cipher_suite - switch x := m.CipherSuite.(type) { - case *Security_Tls_StandardName: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.StandardName))) - n += len(x.StandardName) - case *Security_Tls_OtherName: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.OtherName))) - n += len(x.OtherName) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type Security_OtherSecurity struct { // The human readable version of the value. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` @@ -1841,16 +1592,17 @@ func (m *Security_OtherSecurity) Reset() { *m = Security_OtherSecurity{} func (m *Security_OtherSecurity) String() string { return proto.CompactTextString(m) } func (*Security_OtherSecurity) ProtoMessage() {} func (*Security_OtherSecurity) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{15, 1} + return fileDescriptor_6ee37dfd35a8ab00, []int{15, 1} } + func (m *Security_OtherSecurity) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Security_OtherSecurity.Unmarshal(m, b) } func (m *Security_OtherSecurity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Security_OtherSecurity.Marshal(b, m, deterministic) } -func (dst *Security_OtherSecurity) XXX_Merge(src proto.Message) { - xxx_messageInfo_Security_OtherSecurity.Merge(dst, src) +func (m *Security_OtherSecurity) XXX_Merge(src proto.Message) { + xxx_messageInfo_Security_OtherSecurity.Merge(m, src) } func (m *Security_OtherSecurity) XXX_Size() int { return xxx_messageInfo_Security_OtherSecurity.Size(m) @@ -1896,16 +1648,17 @@ func (m *SocketOption) Reset() { *m = SocketOption{} } func (m *SocketOption) String() string { return proto.CompactTextString(m) } func (*SocketOption) ProtoMessage() {} func (*SocketOption) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{16} + return fileDescriptor_6ee37dfd35a8ab00, []int{16} } + func (m *SocketOption) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SocketOption.Unmarshal(m, b) } func (m *SocketOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SocketOption.Marshal(b, m, deterministic) } -func (dst *SocketOption) XXX_Merge(src proto.Message) { - xxx_messageInfo_SocketOption.Merge(dst, src) +func (m *SocketOption) XXX_Merge(src proto.Message) { + xxx_messageInfo_SocketOption.Merge(m, src) } func (m *SocketOption) XXX_Size() int { return xxx_messageInfo_SocketOption.Size(m) @@ -1950,16 +1703,17 @@ func (m *SocketOptionTimeout) Reset() { *m = SocketOptionTimeout{} } func (m *SocketOptionTimeout) String() string { return proto.CompactTextString(m) } func (*SocketOptionTimeout) ProtoMessage() {} func (*SocketOptionTimeout) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{17} + return fileDescriptor_6ee37dfd35a8ab00, []int{17} } + func (m *SocketOptionTimeout) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SocketOptionTimeout.Unmarshal(m, b) } func (m *SocketOptionTimeout) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SocketOptionTimeout.Marshal(b, m, deterministic) } -func (dst *SocketOptionTimeout) XXX_Merge(src proto.Message) { - xxx_messageInfo_SocketOptionTimeout.Merge(dst, src) +func (m *SocketOptionTimeout) XXX_Merge(src proto.Message) { + xxx_messageInfo_SocketOptionTimeout.Merge(m, src) } func (m *SocketOptionTimeout) XXX_Size() int { return xxx_messageInfo_SocketOptionTimeout.Size(m) @@ -1993,16 +1747,17 @@ func (m *SocketOptionLinger) Reset() { *m = SocketOptionLinger{} } func (m *SocketOptionLinger) String() string { return proto.CompactTextString(m) } func (*SocketOptionLinger) ProtoMessage() {} func (*SocketOptionLinger) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{18} + return fileDescriptor_6ee37dfd35a8ab00, []int{18} } + func (m *SocketOptionLinger) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SocketOptionLinger.Unmarshal(m, b) } func (m *SocketOptionLinger) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SocketOptionLinger.Marshal(b, m, deterministic) } -func (dst *SocketOptionLinger) XXX_Merge(src proto.Message) { - xxx_messageInfo_SocketOptionLinger.Merge(dst, src) +func (m *SocketOptionLinger) XXX_Merge(src proto.Message) { + xxx_messageInfo_SocketOptionLinger.Merge(m, src) } func (m *SocketOptionLinger) XXX_Size() int { return xxx_messageInfo_SocketOptionLinger.Size(m) @@ -2068,16 +1823,17 @@ func (m *SocketOptionTcpInfo) Reset() { *m = SocketOptionTcpInfo{} } func (m *SocketOptionTcpInfo) String() string { return proto.CompactTextString(m) } func (*SocketOptionTcpInfo) ProtoMessage() {} func (*SocketOptionTcpInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{19} + return fileDescriptor_6ee37dfd35a8ab00, []int{19} } + func (m *SocketOptionTcpInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SocketOptionTcpInfo.Unmarshal(m, b) } func (m *SocketOptionTcpInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SocketOptionTcpInfo.Marshal(b, m, deterministic) } -func (dst *SocketOptionTcpInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_SocketOptionTcpInfo.Merge(dst, src) +func (m *SocketOptionTcpInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_SocketOptionTcpInfo.Merge(m, src) } func (m *SocketOptionTcpInfo) XXX_Size() int { return xxx_messageInfo_SocketOptionTcpInfo.Size(m) @@ -2311,16 +2067,17 @@ func (m *GetTopChannelsRequest) Reset() { *m = GetTopChannelsRequest{} } func (m *GetTopChannelsRequest) String() string { return proto.CompactTextString(m) } func (*GetTopChannelsRequest) ProtoMessage() {} func (*GetTopChannelsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{20} + return fileDescriptor_6ee37dfd35a8ab00, []int{20} } + func (m *GetTopChannelsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetTopChannelsRequest.Unmarshal(m, b) } func (m *GetTopChannelsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GetTopChannelsRequest.Marshal(b, m, deterministic) } -func (dst *GetTopChannelsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetTopChannelsRequest.Merge(dst, src) +func (m *GetTopChannelsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetTopChannelsRequest.Merge(m, src) } func (m *GetTopChannelsRequest) XXX_Size() int { return xxx_messageInfo_GetTopChannelsRequest.Size(m) @@ -2363,16 +2120,17 @@ func (m *GetTopChannelsResponse) Reset() { *m = GetTopChannelsResponse{} func (m *GetTopChannelsResponse) String() string { return proto.CompactTextString(m) } func (*GetTopChannelsResponse) ProtoMessage() {} func (*GetTopChannelsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{21} + return fileDescriptor_6ee37dfd35a8ab00, []int{21} } + func (m *GetTopChannelsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetTopChannelsResponse.Unmarshal(m, b) } func (m *GetTopChannelsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GetTopChannelsResponse.Marshal(b, m, deterministic) } -func (dst *GetTopChannelsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetTopChannelsResponse.Merge(dst, src) +func (m *GetTopChannelsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetTopChannelsResponse.Merge(m, src) } func (m *GetTopChannelsResponse) XXX_Size() int { return xxx_messageInfo_GetTopChannelsResponse.Size(m) @@ -2417,16 +2175,17 @@ func (m *GetServersRequest) Reset() { *m = GetServersRequest{} } func (m *GetServersRequest) String() string { return proto.CompactTextString(m) } func (*GetServersRequest) ProtoMessage() {} func (*GetServersRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{22} + return fileDescriptor_6ee37dfd35a8ab00, []int{22} } + func (m *GetServersRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetServersRequest.Unmarshal(m, b) } func (m *GetServersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GetServersRequest.Marshal(b, m, deterministic) } -func (dst *GetServersRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetServersRequest.Merge(dst, src) +func (m *GetServersRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetServersRequest.Merge(m, src) } func (m *GetServersRequest) XXX_Size() int { return xxx_messageInfo_GetServersRequest.Size(m) @@ -2469,16 +2228,17 @@ func (m *GetServersResponse) Reset() { *m = GetServersResponse{} } func (m *GetServersResponse) String() string { return proto.CompactTextString(m) } func (*GetServersResponse) ProtoMessage() {} func (*GetServersResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{23} + return fileDescriptor_6ee37dfd35a8ab00, []int{23} } + func (m *GetServersResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetServersResponse.Unmarshal(m, b) } func (m *GetServersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GetServersResponse.Marshal(b, m, deterministic) } -func (dst *GetServersResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetServersResponse.Merge(dst, src) +func (m *GetServersResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetServersResponse.Merge(m, src) } func (m *GetServersResponse) XXX_Size() int { return xxx_messageInfo_GetServersResponse.Size(m) @@ -2515,16 +2275,17 @@ func (m *GetServerRequest) Reset() { *m = GetServerRequest{} } func (m *GetServerRequest) String() string { return proto.CompactTextString(m) } func (*GetServerRequest) ProtoMessage() {} func (*GetServerRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{24} + return fileDescriptor_6ee37dfd35a8ab00, []int{24} } + func (m *GetServerRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetServerRequest.Unmarshal(m, b) } func (m *GetServerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GetServerRequest.Marshal(b, m, deterministic) } -func (dst *GetServerRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetServerRequest.Merge(dst, src) +func (m *GetServerRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetServerRequest.Merge(m, src) } func (m *GetServerRequest) XXX_Size() int { return xxx_messageInfo_GetServerRequest.Size(m) @@ -2555,16 +2316,17 @@ func (m *GetServerResponse) Reset() { *m = GetServerResponse{} } func (m *GetServerResponse) String() string { return proto.CompactTextString(m) } func (*GetServerResponse) ProtoMessage() {} func (*GetServerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{25} + return fileDescriptor_6ee37dfd35a8ab00, []int{25} } + func (m *GetServerResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetServerResponse.Unmarshal(m, b) } func (m *GetServerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GetServerResponse.Marshal(b, m, deterministic) } -func (dst *GetServerResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetServerResponse.Merge(dst, src) +func (m *GetServerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetServerResponse.Merge(m, src) } func (m *GetServerResponse) XXX_Size() int { return xxx_messageInfo_GetServerResponse.Size(m) @@ -2603,16 +2365,17 @@ func (m *GetServerSocketsRequest) Reset() { *m = GetServerSocketsRequest func (m *GetServerSocketsRequest) String() string { return proto.CompactTextString(m) } func (*GetServerSocketsRequest) ProtoMessage() {} func (*GetServerSocketsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{26} + return fileDescriptor_6ee37dfd35a8ab00, []int{26} } + func (m *GetServerSocketsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetServerSocketsRequest.Unmarshal(m, b) } func (m *GetServerSocketsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GetServerSocketsRequest.Marshal(b, m, deterministic) } -func (dst *GetServerSocketsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetServerSocketsRequest.Merge(dst, src) +func (m *GetServerSocketsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetServerSocketsRequest.Merge(m, src) } func (m *GetServerSocketsRequest) XXX_Size() int { return xxx_messageInfo_GetServerSocketsRequest.Size(m) @@ -2662,16 +2425,17 @@ func (m *GetServerSocketsResponse) Reset() { *m = GetServerSocketsRespon func (m *GetServerSocketsResponse) String() string { return proto.CompactTextString(m) } func (*GetServerSocketsResponse) ProtoMessage() {} func (*GetServerSocketsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{27} + return fileDescriptor_6ee37dfd35a8ab00, []int{27} } + func (m *GetServerSocketsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetServerSocketsResponse.Unmarshal(m, b) } func (m *GetServerSocketsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GetServerSocketsResponse.Marshal(b, m, deterministic) } -func (dst *GetServerSocketsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetServerSocketsResponse.Merge(dst, src) +func (m *GetServerSocketsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetServerSocketsResponse.Merge(m, src) } func (m *GetServerSocketsResponse) XXX_Size() int { return xxx_messageInfo_GetServerSocketsResponse.Size(m) @@ -2708,16 +2472,17 @@ func (m *GetChannelRequest) Reset() { *m = GetChannelRequest{} } func (m *GetChannelRequest) String() string { return proto.CompactTextString(m) } func (*GetChannelRequest) ProtoMessage() {} func (*GetChannelRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{28} + return fileDescriptor_6ee37dfd35a8ab00, []int{28} } + func (m *GetChannelRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetChannelRequest.Unmarshal(m, b) } func (m *GetChannelRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GetChannelRequest.Marshal(b, m, deterministic) } -func (dst *GetChannelRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetChannelRequest.Merge(dst, src) +func (m *GetChannelRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetChannelRequest.Merge(m, src) } func (m *GetChannelRequest) XXX_Size() int { return xxx_messageInfo_GetChannelRequest.Size(m) @@ -2748,16 +2513,17 @@ func (m *GetChannelResponse) Reset() { *m = GetChannelResponse{} } func (m *GetChannelResponse) String() string { return proto.CompactTextString(m) } func (*GetChannelResponse) ProtoMessage() {} func (*GetChannelResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{29} + return fileDescriptor_6ee37dfd35a8ab00, []int{29} } + func (m *GetChannelResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetChannelResponse.Unmarshal(m, b) } func (m *GetChannelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GetChannelResponse.Marshal(b, m, deterministic) } -func (dst *GetChannelResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetChannelResponse.Merge(dst, src) +func (m *GetChannelResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetChannelResponse.Merge(m, src) } func (m *GetChannelResponse) XXX_Size() int { return xxx_messageInfo_GetChannelResponse.Size(m) @@ -2787,16 +2553,17 @@ func (m *GetSubchannelRequest) Reset() { *m = GetSubchannelRequest{} } func (m *GetSubchannelRequest) String() string { return proto.CompactTextString(m) } func (*GetSubchannelRequest) ProtoMessage() {} func (*GetSubchannelRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{30} + return fileDescriptor_6ee37dfd35a8ab00, []int{30} } + func (m *GetSubchannelRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSubchannelRequest.Unmarshal(m, b) } func (m *GetSubchannelRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GetSubchannelRequest.Marshal(b, m, deterministic) } -func (dst *GetSubchannelRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetSubchannelRequest.Merge(dst, src) +func (m *GetSubchannelRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSubchannelRequest.Merge(m, src) } func (m *GetSubchannelRequest) XXX_Size() int { return xxx_messageInfo_GetSubchannelRequest.Size(m) @@ -2827,16 +2594,17 @@ func (m *GetSubchannelResponse) Reset() { *m = GetSubchannelResponse{} } func (m *GetSubchannelResponse) String() string { return proto.CompactTextString(m) } func (*GetSubchannelResponse) ProtoMessage() {} func (*GetSubchannelResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{31} + return fileDescriptor_6ee37dfd35a8ab00, []int{31} } + func (m *GetSubchannelResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSubchannelResponse.Unmarshal(m, b) } func (m *GetSubchannelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GetSubchannelResponse.Marshal(b, m, deterministic) } -func (dst *GetSubchannelResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetSubchannelResponse.Merge(dst, src) +func (m *GetSubchannelResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSubchannelResponse.Merge(m, src) } func (m *GetSubchannelResponse) XXX_Size() int { return xxx_messageInfo_GetSubchannelResponse.Size(m) @@ -2870,16 +2638,17 @@ func (m *GetSocketRequest) Reset() { *m = GetSocketRequest{} } func (m *GetSocketRequest) String() string { return proto.CompactTextString(m) } func (*GetSocketRequest) ProtoMessage() {} func (*GetSocketRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{32} + return fileDescriptor_6ee37dfd35a8ab00, []int{32} } + func (m *GetSocketRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSocketRequest.Unmarshal(m, b) } func (m *GetSocketRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GetSocketRequest.Marshal(b, m, deterministic) } -func (dst *GetSocketRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetSocketRequest.Merge(dst, src) +func (m *GetSocketRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSocketRequest.Merge(m, src) } func (m *GetSocketRequest) XXX_Size() int { return xxx_messageInfo_GetSocketRequest.Size(m) @@ -2917,16 +2686,17 @@ func (m *GetSocketResponse) Reset() { *m = GetSocketResponse{} } func (m *GetSocketResponse) String() string { return proto.CompactTextString(m) } func (*GetSocketResponse) ProtoMessage() {} func (*GetSocketResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_channelz_eaeecd17d5e19ad2, []int{33} + return fileDescriptor_6ee37dfd35a8ab00, []int{33} } + func (m *GetSocketResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSocketResponse.Unmarshal(m, b) } func (m *GetSocketResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GetSocketResponse.Marshal(b, m, deterministic) } -func (dst *GetSocketResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetSocketResponse.Merge(dst, src) +func (m *GetSocketResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSocketResponse.Merge(m, src) } func (m *GetSocketResponse) XXX_Size() int { return xxx_messageInfo_GetSocketResponse.Size(m) @@ -2945,6 +2715,8 @@ func (m *GetSocketResponse) GetSocket() *Socket { } func init() { + proto.RegisterEnum("grpc.channelz.v1.ChannelConnectivityState_State", ChannelConnectivityState_State_name, ChannelConnectivityState_State_value) + proto.RegisterEnum("grpc.channelz.v1.ChannelTraceEvent_Severity", ChannelTraceEvent_Severity_name, ChannelTraceEvent_Severity_value) proto.RegisterType((*Channel)(nil), "grpc.channelz.v1.Channel") proto.RegisterType((*Subchannel)(nil), "grpc.channelz.v1.Subchannel") proto.RegisterType((*ChannelConnectivityState)(nil), "grpc.channelz.v1.ChannelConnectivityState") @@ -2984,8 +2756,174 @@ func init() { proto.RegisterType((*GetSubchannelResponse)(nil), "grpc.channelz.v1.GetSubchannelResponse") proto.RegisterType((*GetSocketRequest)(nil), "grpc.channelz.v1.GetSocketRequest") proto.RegisterType((*GetSocketResponse)(nil), "grpc.channelz.v1.GetSocketResponse") - proto.RegisterEnum("grpc.channelz.v1.ChannelConnectivityState_State", ChannelConnectivityState_State_name, ChannelConnectivityState_State_value) - proto.RegisterEnum("grpc.channelz.v1.ChannelTraceEvent_Severity", ChannelTraceEvent_Severity_name, ChannelTraceEvent_Severity_value) +} + +func init() { proto.RegisterFile("grpc/channelz/v1/channelz.proto", fileDescriptor_6ee37dfd35a8ab00) } + +var fileDescriptor_6ee37dfd35a8ab00 = []byte{ + // 2584 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x59, 0x4b, 0x6f, 0xdb, 0xd8, + 0xf5, 0xb7, 0xde, 0xd4, 0xd1, 0x23, 0xf2, 0x4d, 0x26, 0x43, 0x2b, 0x99, 0xb1, 0xff, 0xf4, 0x4c, + 0xc6, 0x93, 0xfc, 0x23, 0xc7, 0x9e, 0x34, 0x28, 0x3a, 0x2d, 0x3a, 0xb6, 0x62, 0xc7, 0x72, 0x1d, + 0x39, 0xa0, 0xe4, 0x49, 0xa6, 0x28, 0xca, 0xa1, 0xc9, 0x6b, 0x99, 0x35, 0x45, 0xaa, 0xbc, 0x57, + 0xf2, 0x24, 0x9b, 0x2e, 0xba, 0xef, 0xb2, 0x28, 0xfa, 0x01, 0xba, 0xe9, 0xa2, 0x40, 0x81, 0x02, + 0xed, 0xb6, 0xdf, 0xa6, 0xdf, 0xa2, 0xb8, 0x0f, 0x3e, 0xf4, 0xb2, 0x14, 0x64, 0xd9, 0x8d, 0x21, + 0x1e, 0xfe, 0xce, 0xef, 0x9c, 0x7b, 0x5e, 0xf7, 0xf2, 0x1a, 0xd6, 0x7b, 0xc1, 0xc0, 0xda, 0xb6, + 0x2e, 0x4d, 0xcf, 0xc3, 0xee, 0xbb, 0xed, 0xd1, 0x4e, 0xf4, 0xbb, 0x31, 0x08, 0x7c, 0xea, 0xa3, + 0x1a, 0x03, 0x34, 0x22, 0xe1, 0x68, 0xa7, 0xbe, 0xd6, 0xf3, 0xfd, 0x9e, 0x8b, 0xb7, 0xf9, 0xfb, + 0xf3, 0xe1, 0xc5, 0xb6, 0xe9, 0xbd, 0x15, 0xe0, 0xfa, 0xa7, 0x93, 0xaf, 0xec, 0x61, 0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1, 0xe8, 0x2b, 0x28, 0x48, 0x7a, 0x35, 0xc5, 0x8f, 0x58, 0x6b, 0xf3, + 0xaf, 0xb3, 0x42, 0x24, 0xaa, 0x41, 0x06, 0x7b, 0xe2, 0xf3, 0x44, 0xd1, 0xd9, 0x4f, 0xed, 0x57, + 0xb0, 0xfa, 0x02, 0x53, 0xf1, 0xc9, 0x1c, 0x2d, 0xe0, 0x01, 0xfb, 0xf8, 0x61, 0x0b, 0x88, 0xaf, + 0x13, 0x52, 0xe1, 0x77, 0x8a, 0x19, 0x48, 0xf4, 0x32, 0xee, 0xbf, 0x01, 0x94, 0x64, 0x97, 0xae, + 0x3f, 0x81, 0xbc, 0x20, 0x96, 0x9e, 0xab, 0x73, 0xaf, 0x12, 0x24, 0x6e, 0x86, 0xdf, 0xdb, 0x50, + 0x8b, 0x98, 0x43, 0xb7, 0xc7, 0xee, 0x3f, 0x52, 0xe3, 0xf7, 0x1f, 0xda, 0x41, 0x62, 0xa1, 0x33, + 0x3d, 0x49, 0x2d, 0xe3, 0x89, 0xf6, 0x3b, 0xf8, 0x38, 0xa2, 0x11, 0x3b, 0x06, 0x59, 0xc6, 0x7c, + 0x22, 0xa4, 0xd1, 0x1d, 0x50, 0x3a, 0x19, 0xd2, 0xf0, 0x22, 0x68, 0x22, 0xa4, 0x99, 0xa9, 0x90, + 0x5e, 0x82, 0x3a, 0xed, 0x80, 0x5c, 0xce, 0xf8, 0xff, 0x03, 0x52, 0xef, 0xf3, 0xff, 0x80, 0x19, + 0x21, 0xde, 0xe5, 0x11, 0x8b, 0xee, 0xe4, 0xc4, 0x22, 0x6f, 0xbe, 0x97, 0xd3, 0x5a, 0x3c, 0xe1, + 0x91, 0xce, 0xac, 0x5a, 0x4d, 0x2d, 0x57, 0xab, 0xda, 0xd7, 0x70, 0x87, 0x2d, 0x34, 0x71, 0x5b, + 0x27, 0x3c, 0x98, 0xba, 0xb1, 0x4b, 0x4d, 0xdf, 0xd8, 0x69, 0x67, 0xbc, 0x37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, 0x16, 0xec, 0x2b, 0x76, 0x24, 0x7f, 0x95, 0xfa, 0xe5, 0x13, 0x79, 0x44, + 0xef, 0xf9, 0xae, 0xe9, 0xf5, 0x1a, 0x7e, 0xd0, 0xdb, 0x1e, 0xff, 0xb7, 0x3d, 0x7b, 0x0a, 0x77, + 0xd3, 0x77, 0xc6, 0x68, 0xe7, 0x3c, 0xcf, 0x4f, 0xf3, 0x5f, 0xfd, 0x37, 0x00, 0x00, 0xff, 0xff, + 0x54, 0xae, 0x0b, 0x93, 0xdf, 0x1f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3107,6 +3045,32 @@ type ChannelzServer interface { GetSocket(context.Context, *GetSocketRequest) (*GetSocketResponse, error) } +// UnimplementedChannelzServer can be embedded to have forward compatible implementations. +type UnimplementedChannelzServer struct { +} + +func (*UnimplementedChannelzServer) GetTopChannels(ctx context.Context, req *GetTopChannelsRequest) (*GetTopChannelsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetTopChannels not implemented") +} +func (*UnimplementedChannelzServer) GetServers(ctx context.Context, req *GetServersRequest) (*GetServersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetServers not implemented") +} +func (*UnimplementedChannelzServer) GetServer(ctx context.Context, req *GetServerRequest) (*GetServerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetServer not implemented") +} +func (*UnimplementedChannelzServer) GetServerSockets(ctx context.Context, req *GetServerSocketsRequest) (*GetServerSocketsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetServerSockets not implemented") +} +func (*UnimplementedChannelzServer) GetChannel(ctx context.Context, req *GetChannelRequest) (*GetChannelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetChannel not implemented") +} +func (*UnimplementedChannelzServer) GetSubchannel(ctx context.Context, req *GetSubchannelRequest) (*GetSubchannelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSubchannel not implemented") +} +func (*UnimplementedChannelzServer) GetSocket(ctx context.Context, req *GetSocketRequest) (*GetSocketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSocket not implemented") +} + func RegisterChannelzServer(s *grpc.Server, srv ChannelzServer) { s.RegisterService(&_Channelz_serviceDesc, srv) } @@ -3273,173 +3237,3 @@ var _Channelz_serviceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, Metadata: "grpc/channelz/v1/channelz.proto", } - -func init() { - proto.RegisterFile("grpc/channelz/v1/channelz.proto", fileDescriptor_channelz_eaeecd17d5e19ad2) -} - -var fileDescriptor_channelz_eaeecd17d5e19ad2 = []byte{ - // 2584 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x59, 0x4b, 0x6f, 0xdb, 0xd8, - 0xf5, 0xb7, 0xde, 0xd4, 0xd1, 0x23, 0xf2, 0x4d, 0x26, 0x43, 0x2b, 0x99, 0xb1, 0xff, 0xf4, 0x4c, - 0xc6, 0x93, 0xfc, 0x23, 0xc7, 0x9e, 0x34, 0x28, 0x3a, 0x2d, 0x3a, 0xb6, 0x62, 0xc7, 0x72, 0x1d, - 0x39, 0xa0, 0xe4, 0x49, 0xa6, 0x28, 0xca, 0xa1, 0xc9, 0x6b, 0x99, 0x35, 0x45, 0xaa, 0xbc, 0x57, - 0xf2, 0x24, 0x9b, 0x2e, 0xba, 0xef, 0xb2, 0x28, 0xfa, 0x01, 0xba, 0xe9, 0xa2, 0x40, 0x81, 0x02, - 0xed, 0xb6, 0xdf, 0xa6, 0xdf, 0xa2, 0xb8, 0x0f, 0x3e, 0xf4, 0xb2, 0x14, 0x64, 0xd9, 0x8d, 0x21, - 0x1e, 0xfe, 0xce, 0xef, 0x9c, 0x7b, 0x5e, 0xf7, 0xf2, 0x1a, 0xd6, 0x7b, 0xc1, 0xc0, 0xda, 0xb6, - 0x2e, 0x4d, 0xcf, 0xc3, 0xee, 0xbb, 0xed, 0xd1, 0x4e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 0x71, 0x99, 0x2e, 0x2c, 0x81, 0xd0, 0x23, 0x2c, 0x5a, - 0x87, 0x92, 0x60, 0x30, 0x12, 0x5d, 0x00, 0x42, 0xd4, 0x36, 0xfb, 0x58, 0xfb, 0x7d, 0x01, 0x20, - 0x5e, 0x11, 0x4b, 0x2f, 0xa1, 0x01, 0x36, 0xfb, 0x71, 0x15, 0x88, 0x21, 0x54, 0x95, 0xe2, 0xb0, - 0x0e, 0x1e, 0xc1, 0x6a, 0x04, 0x8c, 0x2a, 0x41, 0x14, 0x4c, 0x2d, 0x84, 0x46, 0xb5, 0xf0, 0x39, - 0x84, 0xea, 0x61, 0x35, 0x88, 0x9a, 0xa9, 0x48, 0xa9, 0xac, 0x87, 0x4d, 0xa8, 0xf4, 0x31, 0x21, - 0x66, 0x0f, 0x13, 0x83, 0x60, 0x8f, 0x86, 0xc7, 0x86, 0x50, 0xd8, 0x61, 0x3b, 0xef, 0x23, 0x58, - 0x8d, 0x40, 0x01, 0xb6, 0xb0, 0x33, 0x8a, 0x0e, 0x0e, 0xb5, 0xf0, 0x85, 0x2e, 0xe5, 0x68, 0x0b, - 0x6a, 0x57, 0x18, 0x0f, 0x0c, 0xd3, 0x75, 0x46, 0x21, 0xa9, 0x38, 0x3e, 0x54, 0x99, 0x7c, 0x8f, - 0x8b, 0x39, 0xed, 0x25, 0x6c, 0xf2, 0x5a, 0xe4, 0x19, 0x32, 0x84, 0x5f, 0x06, 0x1f, 0xf5, 0xef, - 0x79, 0x92, 0x58, 0x67, 0x34, 0x27, 0x8c, 0xa5, 0xc3, 0x49, 0x9a, 0x82, 0x23, 0xde, 0x2d, 0x7e, - 0x03, 0x9f, 0x71, 0x4b, 0x32, 0x2f, 0x73, 0x4d, 0x29, 0x0b, 0x4d, 0x6d, 0x30, 0x1e, 0x9d, 0xd3, - 0xcc, 0xb1, 0x15, 0x76, 0x98, 0x0c, 0x0c, 0x0f, 0x40, 0xc2, 0x44, 0x71, 0xb9, 0x0e, 0x7b, 0x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9b, 0xc1, 0x98, - 0xba, 0xc1, 0xa8, 0x72, 0x79, 0x33, 0xba, 0x58, 0x58, 0x87, 0x52, 0xdf, 0xfc, 0xc1, 0x08, 0x30, - 0x19, 0xba, 0x94, 0xc8, 0xcf, 0x06, 0xe8, 0x9b, 0x3f, 0xe8, 0x42, 0xa2, 0x19, 0x70, 0x77, 0xd2, - 0x06, 0x19, 0xf8, 0x1e, 0xc1, 0xe8, 0x2b, 0x28, 0x48, 0x7a, 0x35, 0xc5, 0x8f, 0x58, 0x6b, 0xf3, - 0xaf, 0xb3, 0x42, 0x24, 0xaa, 0x41, 0x06, 0x7b, 0xe2, 0xf3, 0x44, 0xd1, 0xd9, 0x4f, 0xed, 0x57, - 0xb0, 0xfa, 0x02, 0x53, 0xf1, 0xc9, 0x1c, 0x2d, 0xe0, 0x01, 0xfb, 0xf8, 0x61, 0x0b, 0x88, 0xaf, - 0x13, 0x52, 0xe1, 0x77, 0x8a, 0x19, 0x48, 0xf4, 0x32, 0xee, 0xbf, 0x01, 0x94, 0x64, 0x97, 0xae, - 0x3f, 0x81, 0xbc, 0x20, 0x96, 0x9e, 0xab, 0x73, 0xaf, 0x12, 0x24, 0x6e, 0x86, 0xdf, 0xdb, 0x50, - 0x8b, 0x98, 0x43, 0xb7, 0xc7, 0xee, 0x3f, 0x52, 0xe3, 0xf7, 0x1f, 0xda, 0x41, 0x62, 0xa1, 0x33, - 0x3d, 0x49, 0x2d, 0xe3, 0x89, 0xf6, 0x3b, 0xf8, 0x38, 0xa2, 0x11, 0x3b, 0x06, 0x59, 0xc6, 0x7c, - 0x22, 0xa4, 0xd1, 0x1d, 0x50, 0x3a, 0x19, 0xd2, 0xf0, 0x22, 0x68, 0x22, 0xa4, 0x99, 0xa9, 0x90, - 0x5e, 0x82, 0x3a, 0xed, 0x80, 0x5c, 0xce, 0xf8, 0xff, 0x03, 0x52, 0xef, 0xf3, 0xff, 0x80, 0x19, - 0x21, 0xde, 0xe5, 0x11, 0x8b, 0xee, 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, 0x50, 0x19, 0xab, - 0x66, 0xf4, 0x60, 0xb6, 0x57, 0x93, 0xbd, 0x52, 0xff, 0x62, 0x21, 0x6e, 0x3c, 0xf6, 0xe2, 0xa2, - 0x70, 0x4e, 0xec, 0x93, 0x55, 0x3f, 0x2f, 0xf6, 0x63, 0xe5, 0xbc, 0xff, 0x06, 0x6e, 0x3b, 0xfe, - 0x14, 0x70, 0xbf, 0x12, 0x16, 0xec, 0x2b, 0x76, 0x24, 0x7f, 0x95, 0xfa, 0xe5, 0x13, 0x79, 0x44, - 0xef, 0xf9, 0xae, 0xe9, 0xf5, 0x1a, 0x7e, 0xd0, 0xdb, 0x1e, 0xff, 0xb7, 0x3d, 0x7b, 0x0a, 0x77, - 0xd3, 0x77, 0xc6, 0x68, 0xe7, 0x3c, 0xcf, 0x4f, 0xf3, 0x5f, 0xfd, 0x37, 0x00, 0x00, 0xff, 0xff, - 0x54, 0xae, 0x0b, 0x93, 0xdf, 0x1f, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/clientconn.go b/vendor/google.golang.org/grpc/clientconn.go index a7643df7d29..14ce9c76aa3 100644 --- a/vendor/google.golang.org/grpc/clientconn.go +++ b/vendor/google.golang.org/grpc/clientconn.go @@ -31,7 +31,7 @@ import ( "time" "google.golang.org/grpc/balancer" - _ "google.golang.org/grpc/balancer/roundrobin" // To register roundrobin. + "google.golang.org/grpc/balancer/base" "google.golang.org/grpc/codes" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/credentials" @@ -42,10 +42,12 @@ import ( "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/resolver" - _ "google.golang.org/grpc/resolver/dns" // To register dns resolver. - _ "google.golang.org/grpc/resolver/passthrough" // To register passthrough resolver. "google.golang.org/grpc/serviceconfig" "google.golang.org/grpc/status" + + _ "google.golang.org/grpc/balancer/roundrobin" // To register roundrobin. + _ "google.golang.org/grpc/internal/resolver/dns" // To register dns resolver. + _ "google.golang.org/grpc/internal/resolver/passthrough" // To register passthrough resolver. ) const ( @@ -186,11 +188,11 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * } if cc.dopts.defaultServiceConfigRawJSON != nil { - sc, err := parseServiceConfig(*cc.dopts.defaultServiceConfigRawJSON) - if err != nil { - return nil, fmt.Errorf("%s: %v", invalidDefaultServiceConfigErrPrefix, err) + scpr := parseServiceConfig(*cc.dopts.defaultServiceConfigRawJSON) + if scpr.Err != nil { + return nil, fmt.Errorf("%s: %v", invalidDefaultServiceConfigErrPrefix, scpr.Err) } - cc.dopts.defaultServiceConfig = sc + cc.dopts.defaultServiceConfig, _ = scpr.Config.(*ServiceConfig) } cc.mkp = cc.dopts.copts.KeepaliveParams @@ -235,9 +237,7 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * } } if cc.dopts.bs == nil { - cc.dopts.bs = backoff.Exponential{ - MaxDelay: DefaultBackoffConfig.MaxDelay, - } + cc.dopts.bs = backoff.DefaultExponential } if cc.dopts.resolverBuilder == nil { // Only try to parse target when resolver builder is not already set. @@ -443,7 +443,18 @@ func (csm *connectivityStateManager) getNotifyChan() <-chan struct{} { return csm.notifyChan } -// ClientConn represents a client connection to an RPC server. +// ClientConn represents a virtual connection to a conceptual endpoint, to +// perform RPCs. +// +// A ClientConn is free to have zero or more actual connections to the endpoint +// based on configuration, load, etc. It is also free to determine which actual +// endpoints to use and may change it every RPC, permitting client-side load +// balancing. +// +// A ClientConn encapsulates a range of functionality including name +// resolution, TCP connection establishment (with retries and backoff) and TLS +// handshakes. It also handles errors on established connections by +// re-resolving the name and reconnecting. type ClientConn struct { ctx context.Context cancel context.CancelFunc @@ -532,58 +543,104 @@ func (cc *ClientConn) waitForResolvedAddrs(ctx context.Context) error { } } -func (cc *ClientConn) updateResolverState(s resolver.State) error { +var emptyServiceConfig *ServiceConfig + +func init() { + cfg := parseServiceConfig("{}") + if cfg.Err != nil { + panic(fmt.Sprintf("impossible error parsing empty service config: %v", cfg.Err)) + } + emptyServiceConfig = cfg.Config.(*ServiceConfig) +} + +func (cc *ClientConn) maybeApplyDefaultServiceConfig(addrs []resolver.Address) { + if cc.sc != nil { + cc.applyServiceConfigAndBalancer(cc.sc, addrs) + return + } + if cc.dopts.defaultServiceConfig != nil { + cc.applyServiceConfigAndBalancer(cc.dopts.defaultServiceConfig, addrs) + } else { + cc.applyServiceConfigAndBalancer(emptyServiceConfig, addrs) + } +} + +func (cc *ClientConn) updateResolverState(s resolver.State, err error) error { + defer cc.firstResolveEvent.Fire() cc.mu.Lock() - defer cc.mu.Unlock() // Check if the ClientConn is already closed. Some fields (e.g. // balancerWrapper) are set to nil when closing the ClientConn, and could // cause nil pointer panic if we don't have this check. if cc.conns == nil { + cc.mu.Unlock() return nil } - if cc.dopts.disableServiceConfig || s.ServiceConfig == nil { - if cc.dopts.defaultServiceConfig != nil && cc.sc == nil { - cc.applyServiceConfig(cc.dopts.defaultServiceConfig) + if err != nil { + // May need to apply the initial service config in case the resolver + // doesn't support service configs, or doesn't provide a service config + // with the new addresses. + cc.maybeApplyDefaultServiceConfig(nil) + + if cc.balancerWrapper != nil { + cc.balancerWrapper.resolverError(err) } - } else if sc, ok := s.ServiceConfig.(*ServiceConfig); ok { - cc.applyServiceConfig(sc) + + // No addresses are valid with err set; return early. + cc.mu.Unlock() + return balancer.ErrBadResolverState } - var balCfg serviceconfig.LoadBalancingConfig - if cc.dopts.balancerBuilder == nil { - // Only look at balancer types and switch balancer if balancer dial - // option is not set. - var newBalancerName string - if cc.sc != nil && cc.sc.lbConfig != nil { - newBalancerName = cc.sc.lbConfig.name - balCfg = cc.sc.lbConfig.cfg + var ret error + if cc.dopts.disableServiceConfig || s.ServiceConfig == nil { + cc.maybeApplyDefaultServiceConfig(s.Addresses) + // TODO: do we need to apply a failing LB policy if there is no + // default, per the error handling design? + } else { + if sc, ok := s.ServiceConfig.Config.(*ServiceConfig); s.ServiceConfig.Err == nil && ok { + cc.applyServiceConfigAndBalancer(sc, s.Addresses) } else { - var isGRPCLB bool - for _, a := range s.Addresses { - if a.Type == resolver.GRPCLB { - isGRPCLB = true - break + ret = balancer.ErrBadResolverState + if cc.balancerWrapper == nil { + var err error + if s.ServiceConfig.Err != nil { + err = status.Errorf(codes.Unavailable, "error parsing service config: %v", s.ServiceConfig.Err) + } else { + err = status.Errorf(codes.Unavailable, "illegal service config type: %T", s.ServiceConfig.Config) } - } - if isGRPCLB { - newBalancerName = grpclbName - } else if cc.sc != nil && cc.sc.LB != nil { - newBalancerName = *cc.sc.LB - } else { - newBalancerName = PickFirstBalancerName + cc.blockingpicker.updatePicker(base.NewErrPicker(err)) + cc.csMgr.updateState(connectivity.TransientFailure) + cc.mu.Unlock() + return ret } } - cc.switchBalancer(newBalancerName) - } else if cc.balancerWrapper == nil { - // Balancer dial option was set, and this is the first time handling - // resolved addresses. Build a balancer with dopts.balancerBuilder. - cc.curBalancerName = cc.dopts.balancerBuilder.Name() - cc.balancerWrapper = newCCBalancerWrapper(cc, cc.dopts.balancerBuilder, cc.balancerBuildOpts) } - cc.balancerWrapper.updateClientConnState(&balancer.ClientConnState{ResolverState: s, BalancerConfig: balCfg}) - return nil + var balCfg serviceconfig.LoadBalancingConfig + if cc.dopts.balancerBuilder == nil && cc.sc != nil && cc.sc.lbConfig != nil { + balCfg = cc.sc.lbConfig.cfg + } + + cbn := cc.curBalancerName + bw := cc.balancerWrapper + cc.mu.Unlock() + if cbn != grpclbName { + // Filter any grpclb addresses since we don't have the grpclb balancer. + for i := 0; i < len(s.Addresses); { + if s.Addresses[i].Type == resolver.GRPCLB { + copy(s.Addresses[i:], s.Addresses[i+1:]) + s.Addresses = s.Addresses[:len(s.Addresses)-1] + continue + } + i++ + } + } + uccsErr := bw.updateClientConnState(&balancer.ClientConnState{ResolverState: s, BalancerConfig: balCfg}) + if ret == nil { + ret = uccsErr // prefer ErrBadResolver state since any other error is + // currently meaningless to the caller. + } + return ret } // switchBalancer starts the switching from current balancer to the balancer @@ -631,7 +688,7 @@ func (cc *ClientConn) switchBalancer(name string) { cc.balancerWrapper = newCCBalancerWrapper(cc, builder, cc.balancerBuildOpts) } -func (cc *ClientConn) handleSubConnStateChange(sc balancer.SubConn, s connectivity.State) { +func (cc *ClientConn) handleSubConnStateChange(sc balancer.SubConn, s connectivity.State, err error) { cc.mu.Lock() if cc.conns == nil { cc.mu.Unlock() @@ -639,7 +696,7 @@ func (cc *ClientConn) handleSubConnStateChange(sc balancer.SubConn, s connectivi } // TODO(bar switching) send updates to all balancer wrappers when balancer // gracefully switching is supported. - cc.balancerWrapper.handleSubConnStateChange(sc, s) + cc.balancerWrapper.handleSubConnStateChange(sc, s, err) cc.mu.Unlock() } @@ -736,7 +793,7 @@ func (ac *addrConn) connect() error { } // Update connectivity state within the lock to prevent subsequent or // concurrent calls from resetting the transport more than once. - ac.updateConnectivityState(connectivity.Connecting) + ac.updateConnectivityState(connectivity.Connecting, nil) ac.mu.Unlock() // Start a goroutine connecting to the server asynchronously. @@ -822,7 +879,8 @@ func (cc *ClientConn) healthCheckConfig() *healthCheckConfig { } func (cc *ClientConn) getTransport(ctx context.Context, failfast bool, method string) (transport.ClientTransport, func(balancer.DoneInfo), error) { - t, done, err := cc.blockingpicker.pick(ctx, failfast, balancer.PickOptions{ + t, done, err := cc.blockingpicker.pick(ctx, failfast, balancer.PickInfo{ + Ctx: ctx, FullMethodName: method, }) if err != nil { @@ -831,10 +889,10 @@ func (cc *ClientConn) getTransport(ctx context.Context, failfast bool, method st return t, done, nil } -func (cc *ClientConn) applyServiceConfig(sc *ServiceConfig) error { +func (cc *ClientConn) applyServiceConfigAndBalancer(sc *ServiceConfig, addrs []resolver.Address) { if sc == nil { // should never reach here. - return fmt.Errorf("got nil pointer for service config") + return } cc.sc = sc @@ -850,10 +908,38 @@ func (cc *ClientConn) applyServiceConfig(sc *ServiceConfig) error { cc.retryThrottler.Store((*retryThrottler)(nil)) } - return nil + if cc.dopts.balancerBuilder == nil { + // Only look at balancer types and switch balancer if balancer dial + // option is not set. + var newBalancerName string + if cc.sc != nil && cc.sc.lbConfig != nil { + newBalancerName = cc.sc.lbConfig.name + } else { + var isGRPCLB bool + for _, a := range addrs { + if a.Type == resolver.GRPCLB { + isGRPCLB = true + break + } + } + if isGRPCLB { + newBalancerName = grpclbName + } else if cc.sc != nil && cc.sc.LB != nil { + newBalancerName = *cc.sc.LB + } else { + newBalancerName = PickFirstBalancerName + } + } + cc.switchBalancer(newBalancerName) + } else if cc.balancerWrapper == nil { + // Balancer dial option was set, and this is the first time handling + // resolved addresses. Build a balancer with dopts.balancerBuilder. + cc.curBalancerName = cc.dopts.balancerBuilder.Name() + cc.balancerWrapper = newCCBalancerWrapper(cc, cc.dopts.balancerBuilder, cc.balancerBuildOpts) + } } -func (cc *ClientConn) resolveNow(o resolver.ResolveNowOption) { +func (cc *ClientConn) resolveNow(o resolver.ResolveNowOptions) { cc.mu.RLock() r := cc.resolverWrapper cc.mu.RUnlock() @@ -875,8 +961,9 @@ func (cc *ClientConn) resolveNow(o resolver.ResolveNowOption) { // This API is EXPERIMENTAL. func (cc *ClientConn) ResetConnectBackoff() { cc.mu.Lock() - defer cc.mu.Unlock() - for ac := range cc.conns { + conns := cc.conns + cc.mu.Unlock() + for ac := range conns { ac.resetConnectBackoff() } } @@ -962,7 +1049,7 @@ type addrConn struct { } // Note: this requires a lock on ac.mu. -func (ac *addrConn) updateConnectivityState(s connectivity.State) { +func (ac *addrConn) updateConnectivityState(s connectivity.State, lastErr error) { if ac.state == s { return } @@ -975,7 +1062,7 @@ func (ac *addrConn) updateConnectivityState(s connectivity.State) { Severity: channelz.CtINFO, }) } - ac.cc.handleSubConnStateChange(ac.acbw, s) + ac.cc.handleSubConnStateChange(ac.acbw, s, lastErr) } // adjustParams updates parameters used to create transports upon @@ -995,7 +1082,7 @@ func (ac *addrConn) adjustParams(r transport.GoAwayReason) { func (ac *addrConn) resetTransport() { for i := 0; ; i++ { if i > 0 { - ac.cc.resolveNow(resolver.ResolveNowOption{}) + ac.cc.resolveNow(resolver.ResolveNowOptions{}) } ac.mu.Lock() @@ -1024,7 +1111,7 @@ func (ac *addrConn) resetTransport() { // https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md#proposed-backoff-algorithm connectDeadline := time.Now().Add(dialDuration) - ac.updateConnectivityState(connectivity.Connecting) + ac.updateConnectivityState(connectivity.Connecting, nil) ac.transport = nil ac.mu.Unlock() @@ -1037,7 +1124,7 @@ func (ac *addrConn) resetTransport() { ac.mu.Unlock() return } - ac.updateConnectivityState(connectivity.TransientFailure) + ac.updateConnectivityState(connectivity.TransientFailure, err) // Backoff. b := ac.resetBackoff @@ -1093,6 +1180,7 @@ func (ac *addrConn) resetTransport() { // first successful one. It returns the transport, the address and a Event in // the successful case. The Event fires when the returned transport disconnects. func (ac *addrConn) tryAllAddrs(addrs []resolver.Address, connectDeadline time.Time) (transport.ClientTransport, resolver.Address, *grpcsync.Event, error) { + var firstConnErr error for _, addr := range addrs { ac.mu.Lock() if ac.state == connectivity.Shutdown { @@ -1121,11 +1209,14 @@ func (ac *addrConn) tryAllAddrs(addrs []resolver.Address, connectDeadline time.T if err == nil { return newTr, addr, reconnect, nil } + if firstConnErr == nil { + firstConnErr = err + } ac.cc.blockingpicker.updateConnectionError(err) } // Couldn't connect to any address. - return nil, resolver.Address{}, nil, fmt.Errorf("couldn't connect to any address") + return nil, resolver.Address{}, nil, firstConnErr } // createTransport creates a connection to addr. It returns the transport and a @@ -1136,10 +1227,16 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne onCloseCalled := make(chan struct{}) reconnect := grpcsync.NewEvent() + authority := ac.cc.authority + // addr.ServerName takes precedent over ClientConn authority, if present. + if addr.ServerName != "" { + authority = addr.ServerName + } + target := transport.TargetInfo{ Addr: addr.Addr, Metadata: addr.Metadata, - Authority: ac.cc.authority, + Authority: authority, } once := sync.Once{} @@ -1152,7 +1249,7 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne // state to Connecting. // // TODO: this should be Idle when grpc-go properly supports it. - ac.updateConnectivityState(connectivity.Connecting) + ac.updateConnectivityState(connectivity.Connecting, nil) } }) ac.mu.Unlock() @@ -1167,7 +1264,7 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne // state to Connecting. // // TODO: this should be Idle when grpc-go properly supports it. - ac.updateConnectivityState(connectivity.Connecting) + ac.updateConnectivityState(connectivity.Connecting, nil) } }) ac.mu.Unlock() @@ -1193,7 +1290,7 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne } select { - case <-time.After(connectDeadline.Sub(time.Now())): + case <-time.After(time.Until(connectDeadline)): // We didn't get the preface in time. newTr.Close() grpclog.Warningf("grpc: addrConn.createTransport failed to connect to %v: didn't receive server preface in time. Reconnecting...", addr) @@ -1224,7 +1321,7 @@ func (ac *addrConn) startHealthCheck(ctx context.Context) { var healthcheckManagingState bool defer func() { if !healthcheckManagingState { - ac.updateConnectivityState(connectivity.Ready) + ac.updateConnectivityState(connectivity.Ready, nil) } }() @@ -1260,13 +1357,13 @@ func (ac *addrConn) startHealthCheck(ctx context.Context) { ac.mu.Unlock() return newNonRetryClientStream(ctx, &StreamDesc{ServerStreams: true}, method, currentTr, ac) } - setConnectivityState := func(s connectivity.State) { + setConnectivityState := func(s connectivity.State, lastErr error) { ac.mu.Lock() defer ac.mu.Unlock() if ac.transport != currentTr { return } - ac.updateConnectivityState(s) + ac.updateConnectivityState(s, lastErr) } // Start the health checking stream. go func() { @@ -1331,8 +1428,8 @@ func (ac *addrConn) tearDown(err error) { curTr := ac.transport ac.transport = nil // We have to set the state to Shutdown before anything else to prevent races - // between setting the state and logic that waits on context cancelation / etc. - ac.updateConnectivityState(connectivity.Shutdown) + // between setting the state and logic that waits on context cancellation / etc. + ac.updateConnectivityState(connectivity.Shutdown, nil) ac.cancel() ac.curAddr = resolver.Address{} if err == errConnDrain && curTr != nil { @@ -1355,7 +1452,7 @@ func (ac *addrConn) tearDown(err error) { }, }) // TraceEvent needs to be called before RemoveEntry, as TraceEvent may add trace reference to - // the entity beng deleted, and thus prevent it from being deleted right away. + // the entity being deleted, and thus prevent it from being deleted right away. channelz.RemoveEntry(ac.channelzID) } ac.mu.Unlock() diff --git a/vendor/google.golang.org/grpc/clientconn_test.go b/vendor/google.golang.org/grpc/clientconn_test.go index 13727ee8a3a..02d15abbc4f 100644 --- a/vendor/google.golang.org/grpc/clientconn_test.go +++ b/vendor/google.golang.org/grpc/clientconn_test.go @@ -30,15 +30,15 @@ import ( "time" "golang.org/x/net/http2" + "google.golang.org/grpc/backoff" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/credentials" - "google.golang.org/grpc/internal/backoff" + internalbackoff "google.golang.org/grpc/internal/backoff" "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/naming" "google.golang.org/grpc/resolver" "google.golang.org/grpc/resolver/manual" - _ "google.golang.org/grpc/resolver/passthrough" "google.golang.org/grpc/testdata" ) @@ -655,22 +655,39 @@ func (s) TestCredentialsMisuse(t *testing.T) { } func (s) TestWithBackoffConfigDefault(t *testing.T) { - testBackoffConfigSet(t, &DefaultBackoffConfig) + testBackoffConfigSet(t, internalbackoff.DefaultExponential) } func (s) TestWithBackoffConfig(t *testing.T) { b := BackoffConfig{MaxDelay: DefaultBackoffConfig.MaxDelay / 2} - expected := b - testBackoffConfigSet(t, &expected, WithBackoffConfig(b)) + bc := backoff.DefaultConfig + bc.MaxDelay = b.MaxDelay + wantBackoff := internalbackoff.Exponential{Config: bc} + testBackoffConfigSet(t, wantBackoff, WithBackoffConfig(b)) } func (s) TestWithBackoffMaxDelay(t *testing.T) { md := DefaultBackoffConfig.MaxDelay / 2 - expected := BackoffConfig{MaxDelay: md} - testBackoffConfigSet(t, &expected, WithBackoffMaxDelay(md)) + bc := backoff.DefaultConfig + bc.MaxDelay = md + wantBackoff := internalbackoff.Exponential{Config: bc} + testBackoffConfigSet(t, wantBackoff, WithBackoffMaxDelay(md)) } -func testBackoffConfigSet(t *testing.T, expected *BackoffConfig, opts ...DialOption) { +func (s) TestWithConnectParams(t *testing.T) { + bd := 2 * time.Second + mltpr := 2.0 + jitter := 0.0 + bc := backoff.Config{BaseDelay: bd, Multiplier: mltpr, Jitter: jitter} + + crt := ConnectParams{Backoff: bc} + // MaxDelay is not set in the ConnectParams. So it should not be set on + // internalbackoff.Exponential as well. + wantBackoff := internalbackoff.Exponential{Config: bc} + testBackoffConfigSet(t, wantBackoff, WithConnectParams(crt)) +} + +func testBackoffConfigSet(t *testing.T, wantBackoff internalbackoff.Exponential, opts ...DialOption) { opts = append(opts, WithInsecure()) conn, err := Dial("passthrough:///foo:80", opts...) if err != nil { @@ -682,16 +699,27 @@ func testBackoffConfigSet(t *testing.T, expected *BackoffConfig, opts ...DialOpt t.Fatalf("backoff config not set") } - actual, ok := conn.dopts.bs.(backoff.Exponential) + gotBackoff, ok := conn.dopts.bs.(internalbackoff.Exponential) if !ok { t.Fatalf("unexpected type of backoff config: %#v", conn.dopts.bs) } - expectedValue := backoff.Exponential{ - MaxDelay: expected.MaxDelay, + if gotBackoff != wantBackoff { + t.Fatalf("unexpected backoff config on connection: %v, want %v", gotBackoff, wantBackoff) } - if actual != expectedValue { - t.Fatalf("unexpected backoff config on connection: %v, want %v", actual, expected) +} + +func (s) TestConnectParamsWithMinConnectTimeout(t *testing.T) { + // Default value specified for minConnectTimeout in the spec is 20 seconds. + mct := 1 * time.Minute + conn, err := Dial("passthrough:///foo:80", WithInsecure(), WithConnectParams(ConnectParams{MinConnectTimeout: mct})) + if err != nil { + t.Fatalf("unexpected error dialing connection: %v", err) + } + defer conn.Close() + + if got := conn.dopts.minConnectTimeout(); got != mct { + t.Errorf("unexpect minConnectTimeout on the connection: %v, want %v", got, mct) } } @@ -751,7 +779,7 @@ func (s) TestResolverServiceConfigBeforeAddressNotPanic(t *testing.T) { // SwitchBalancer before NewAddress. There was no balancer created, this // makes sure we don't call close on nil balancerWrapper. - r.UpdateState(resolver.State{ServiceConfig: parseCfg(`{"loadBalancingPolicy": "round_robin"}`)}) // This should not panic. + r.UpdateState(resolver.State{ServiceConfig: parseCfg(r, `{"loadBalancingPolicy": "round_robin"}`)}) // This should not panic. time.Sleep(time.Second) // Sleep to make sure the service config is handled by ClientConn. } @@ -767,7 +795,7 @@ func (s) TestResolverServiceConfigWhileClosingNotPanic(t *testing.T) { } // Send a new service config while closing the ClientConn. go cc.Close() - go r.UpdateState(resolver.State{ServiceConfig: parseCfg(`{"loadBalancingPolicy": "round_robin"}`)}) // This should not panic. + go r.UpdateState(resolver.State{ServiceConfig: parseCfg(r, `{"loadBalancingPolicy": "round_robin"}`)}) // This should not panic. } } @@ -860,7 +888,7 @@ func (s) TestDisableServiceConfigOption(t *testing.T) { t.Fatalf("Dial(%s, _) = _, %v, want _, ", addr, err) } defer cc.Close() - r.UpdateState(resolver.State{ServiceConfig: parseCfg(`{ + r.UpdateState(resolver.State{ServiceConfig: parseCfg(r, `{ "methodConfig": [ { "name": [ @@ -1152,29 +1180,29 @@ func testInvalidDefaultServiceConfig(t *testing.T) { } } -func testDefaultServiceConfigWhenResolverServiceConfigDisabled(t *testing.T, r resolver.Resolver, addr string, js string) { +func testDefaultServiceConfigWhenResolverServiceConfigDisabled(t *testing.T, r *manual.Resolver, addr string, js string) { cc, err := Dial(addr, WithInsecure(), WithDisableServiceConfig(), WithDefaultServiceConfig(js)) if err != nil { t.Fatalf("Dial(%s, _) = _, %v, want _, ", addr, err) } defer cc.Close() // Resolver service config gets ignored since resolver service config is disabled. - r.(*manual.Resolver).UpdateState(resolver.State{ + r.UpdateState(resolver.State{ Addresses: []resolver.Address{{Addr: addr}}, - ServiceConfig: parseCfg("{}"), + ServiceConfig: parseCfg(r, "{}"), }) if !verifyWaitForReadyEqualsTrue(cc) { t.Fatal("default service config failed to be applied after 1s") } } -func testDefaultServiceConfigWhenResolverDoesNotReturnServiceConfig(t *testing.T, r resolver.Resolver, addr string, js string) { +func testDefaultServiceConfigWhenResolverDoesNotReturnServiceConfig(t *testing.T, r *manual.Resolver, addr string, js string) { cc, err := Dial(addr, WithInsecure(), WithDefaultServiceConfig(js)) if err != nil { t.Fatalf("Dial(%s, _) = _, %v, want _, ", addr, err) } defer cc.Close() - r.(*manual.Resolver).UpdateState(resolver.State{ + r.UpdateState(resolver.State{ Addresses: []resolver.Address{{Addr: addr}}, }) if !verifyWaitForReadyEqualsTrue(cc) { @@ -1182,15 +1210,14 @@ func testDefaultServiceConfigWhenResolverDoesNotReturnServiceConfig(t *testing.T } } -func testDefaultServiceConfigWhenResolverReturnInvalidServiceConfig(t *testing.T, r resolver.Resolver, addr string, js string) { +func testDefaultServiceConfigWhenResolverReturnInvalidServiceConfig(t *testing.T, r *manual.Resolver, addr string, js string) { cc, err := Dial(addr, WithInsecure(), WithDefaultServiceConfig(js)) if err != nil { t.Fatalf("Dial(%s, _) = _, %v, want _, ", addr, err) } defer cc.Close() - r.(*manual.Resolver).UpdateState(resolver.State{ - Addresses: []resolver.Address{{Addr: addr}}, - ServiceConfig: nil, + r.UpdateState(resolver.State{ + Addresses: []resolver.Address{{Addr: addr}}, }) if !verifyWaitForReadyEqualsTrue(cc) { t.Fatal("default service config failed to be applied after 1s") diff --git a/vendor/google.golang.org/grpc/credentials/alts/internal/handshaker/handshaker.go b/vendor/google.golang.org/grpc/credentials/alts/internal/handshaker/handshaker.go index 49c22c1e897..8bc7ceee0af 100644 --- a/vendor/google.golang.org/grpc/credentials/alts/internal/handshaker/handshaker.go +++ b/vendor/google.golang.org/grpc/credentials/alts/internal/handshaker/handshaker.go @@ -64,6 +64,9 @@ var ( concurrentHandshakes = int64(0) // errDropped occurs when maxPendingHandshakes is reached. errDropped = errors.New("maximum number of concurrent ALTS handshakes is reached") + // errOutOfBound occurs when the handshake service returns a consumed + // bytes value larger than the buffer that was passed to it originally. + errOutOfBound = errors.New("handshaker service consumed bytes value is out-of-bound") ) func init() { @@ -74,8 +77,10 @@ func init() { } } -func acquire(n int64) bool { +func acquire() bool { mu.Lock() + // If we need n to be configurable, we can pass it as an argument. + n := int64(1) success := maxPendingHandshakes-concurrentHandshakes >= n if success { concurrentHandshakes += n @@ -84,8 +89,10 @@ func acquire(n int64) bool { return success } -func release(n int64) { +func release() { mu.Lock() + // If we need n to be configurable, we can pass it as an argument. + n := int64(1) concurrentHandshakes -= n if concurrentHandshakes < 0 { mu.Unlock() @@ -182,10 +189,10 @@ func NewServerHandshaker(ctx context.Context, conn *grpc.ClientConn, c net.Conn, // ClientHandshake starts and completes a client ALTS handshaking for GCP. Once // done, ClientHandshake returns a secure connection. func (h *altsHandshaker) ClientHandshake(ctx context.Context) (net.Conn, credentials.AuthInfo, error) { - if !acquire(1) { + if !acquire() { return nil, nil, errDropped } - defer release(1) + defer release() if h.side != core.ClientSide { return nil, nil, errors.New("only handshakers created using NewClientHandshaker can perform a client handshaker") @@ -225,10 +232,10 @@ func (h *altsHandshaker) ClientHandshake(ctx context.Context) (net.Conn, credent // ServerHandshake starts and completes a server ALTS handshaking for GCP. Once // done, ServerHandshake returns a secure connection. func (h *altsHandshaker) ServerHandshake(ctx context.Context) (net.Conn, credentials.AuthInfo, error) { - if !acquire(1) { + if !acquire() { return nil, nil, errDropped } - defer release(1) + defer release() if h.side != core.ServerSide { return nil, nil, errors.New("only handshakers created using NewServerHandshaker can perform a server handshaker") @@ -280,6 +287,9 @@ func (h *altsHandshaker) doHandshake(req *altspb.HandshakerReq) (net.Conn, *alts var extra []byte if req.GetServerStart() != nil { + if resp.GetBytesConsumed() > uint32(len(req.GetServerStart().GetInBytes())) { + return nil, nil, errOutOfBound + } extra = req.GetServerStart().GetInBytes()[resp.GetBytesConsumed():] } result, extra, err := h.processUntilDone(resp, extra) @@ -339,6 +349,7 @@ func (h *altsHandshaker) processUntilDone(resp *altspb.HandshakerResp, extra []b // Append extra bytes from the previous interaction with the // handshaker service with the current buffer read from conn. p := append(extra, buf[:n]...) + // From here on, p and extra point to the same slice. resp, err = h.accessHandshakerService(&altspb.HandshakerReq{ ReqOneof: &altspb.HandshakerReq_Next{ Next: &altspb.NextHandshakeMessageReq{ @@ -350,11 +361,10 @@ func (h *altsHandshaker) processUntilDone(resp *altspb.HandshakerResp, extra []b return nil, nil, err } // Set extra based on handshaker service response. - if n == 0 { - extra = nil - } else { - extra = buf[resp.GetBytesConsumed():n] + if resp.GetBytesConsumed() > uint32(len(p)) { + return nil, nil, errOutOfBound } + extra = p[resp.GetBytesConsumed():] } } diff --git a/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/altscontext.pb.go b/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/altscontext.pb.go index d1793073ded..38c4832dfd4 100644 --- a/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/altscontext.pb.go +++ b/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/altscontext.pb.go @@ -1,11 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: grpc/gcp/altscontext.proto -package grpc_gcp // import "google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp" +package grpc_gcp -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -16,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type AltsContext struct { // The application protocol negotiated for this connection. @@ -42,16 +44,17 @@ func (m *AltsContext) Reset() { *m = AltsContext{} } func (m *AltsContext) String() string { return proto.CompactTextString(m) } func (*AltsContext) ProtoMessage() {} func (*AltsContext) Descriptor() ([]byte, []int) { - return fileDescriptor_altscontext_f6b7868f9a30497f, []int{0} + return fileDescriptor_6647a41e53a575a3, []int{0} } + func (m *AltsContext) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AltsContext.Unmarshal(m, b) } func (m *AltsContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_AltsContext.Marshal(b, m, deterministic) } -func (dst *AltsContext) XXX_Merge(src proto.Message) { - xxx_messageInfo_AltsContext.Merge(dst, src) +func (m *AltsContext) XXX_Merge(src proto.Message) { + xxx_messageInfo_AltsContext.Merge(m, src) } func (m *AltsContext) XXX_Size() int { return xxx_messageInfo_AltsContext.Size(m) @@ -116,11 +119,9 @@ func init() { proto.RegisterMapType((map[string]string)(nil), "grpc.gcp.AltsContext.PeerAttributesEntry") } -func init() { - proto.RegisterFile("grpc/gcp/altscontext.proto", fileDescriptor_altscontext_f6b7868f9a30497f) -} +func init() { proto.RegisterFile("grpc/gcp/altscontext.proto", fileDescriptor_6647a41e53a575a3) } -var fileDescriptor_altscontext_f6b7868f9a30497f = []byte{ +var fileDescriptor_6647a41e53a575a3 = []byte{ // 411 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0x4d, 0x6f, 0x13, 0x31, 0x10, 0x86, 0xb5, 0x0d, 0x2d, 0xe0, 0x88, 0xb4, 0xb8, 0xa9, 0x58, 0x45, 0x42, 0x8a, 0xb8, 0xb0, diff --git a/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/handshaker.pb.go b/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/handshaker.pb.go index 0c37ba2abeb..4d1fc4c4d8d 100644 --- a/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/handshaker.pb.go +++ b/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/handshaker.pb.go @@ -1,15 +1,16 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: grpc/gcp/handshaker.proto -package grpc_gcp // import "google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp" - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +package grpc_gcp import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -21,7 +22,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type HandshakeProtocol int32 @@ -39,6 +40,7 @@ var HandshakeProtocol_name = map[int32]string{ 1: "TLS", 2: "ALTS", } + var HandshakeProtocol_value = map[string]int32{ "HANDSHAKE_PROTOCOL_UNSPECIFIED": 0, "TLS": 1, @@ -48,8 +50,9 @@ var HandshakeProtocol_value = map[string]int32{ func (x HandshakeProtocol) String() string { return proto.EnumName(HandshakeProtocol_name, int32(x)) } + func (HandshakeProtocol) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_handshaker_1dfe659b12ea825e, []int{0} + return fileDescriptor_54c074f40c7c7e99, []int{0} } type NetworkProtocol int32 @@ -65,6 +68,7 @@ var NetworkProtocol_name = map[int32]string{ 1: "TCP", 2: "UDP", } + var NetworkProtocol_value = map[string]int32{ "NETWORK_PROTOCOL_UNSPECIFIED": 0, "TCP": 1, @@ -74,8 +78,9 @@ var NetworkProtocol_value = map[string]int32{ func (x NetworkProtocol) String() string { return proto.EnumName(NetworkProtocol_name, int32(x)) } + func (NetworkProtocol) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_handshaker_1dfe659b12ea825e, []int{1} + return fileDescriptor_54c074f40c7c7e99, []int{1} } type Endpoint struct { @@ -95,16 +100,17 @@ func (m *Endpoint) Reset() { *m = Endpoint{} } func (m *Endpoint) String() string { return proto.CompactTextString(m) } func (*Endpoint) ProtoMessage() {} func (*Endpoint) Descriptor() ([]byte, []int) { - return fileDescriptor_handshaker_1dfe659b12ea825e, []int{0} + return fileDescriptor_54c074f40c7c7e99, []int{0} } + func (m *Endpoint) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Endpoint.Unmarshal(m, b) } func (m *Endpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Endpoint.Marshal(b, m, deterministic) } -func (dst *Endpoint) XXX_Merge(src proto.Message) { - xxx_messageInfo_Endpoint.Merge(dst, src) +func (m *Endpoint) XXX_Merge(src proto.Message) { + xxx_messageInfo_Endpoint.Merge(m, src) } func (m *Endpoint) XXX_Size() int { return xxx_messageInfo_Endpoint.Size(m) @@ -152,16 +158,17 @@ func (m *Identity) Reset() { *m = Identity{} } func (m *Identity) String() string { return proto.CompactTextString(m) } func (*Identity) ProtoMessage() {} func (*Identity) Descriptor() ([]byte, []int) { - return fileDescriptor_handshaker_1dfe659b12ea825e, []int{1} + return fileDescriptor_54c074f40c7c7e99, []int{1} } + func (m *Identity) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Identity.Unmarshal(m, b) } func (m *Identity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Identity.Marshal(b, m, deterministic) } -func (dst *Identity) XXX_Merge(src proto.Message) { - xxx_messageInfo_Identity.Merge(dst, src) +func (m *Identity) XXX_Merge(src proto.Message) { + xxx_messageInfo_Identity.Merge(m, src) } func (m *Identity) XXX_Size() int { return xxx_messageInfo_Identity.Size(m) @@ -216,72 +223,14 @@ func (m *Identity) GetAttributes() map[string]string { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Identity) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Identity_OneofMarshaler, _Identity_OneofUnmarshaler, _Identity_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Identity) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*Identity_ServiceAccount)(nil), (*Identity_Hostname)(nil), } } -func _Identity_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Identity) - // identity_oneof - switch x := m.IdentityOneof.(type) { - case *Identity_ServiceAccount: - b.EncodeVarint(1<<3 | proto.WireBytes) - b.EncodeStringBytes(x.ServiceAccount) - case *Identity_Hostname: - b.EncodeVarint(2<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Hostname) - case nil: - default: - return fmt.Errorf("Identity.IdentityOneof has unexpected type %T", x) - } - return nil -} - -func _Identity_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Identity) - switch tag { - case 1: // identity_oneof.service_account - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.IdentityOneof = &Identity_ServiceAccount{x} - return true, err - case 2: // identity_oneof.hostname - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.IdentityOneof = &Identity_Hostname{x} - return true, err - default: - return false, nil - } -} - -func _Identity_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Identity) - // identity_oneof - switch x := m.IdentityOneof.(type) { - case *Identity_ServiceAccount: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.ServiceAccount))) - n += len(x.ServiceAccount) - case *Identity_Hostname: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Hostname))) - n += len(x.Hostname) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type StartClientHandshakeReq struct { // Handshake security protocol requested by the client. HandshakeSecurityProtocol HandshakeProtocol `protobuf:"varint,1,opt,name=handshake_security_protocol,json=handshakeSecurityProtocol,proto3,enum=grpc.gcp.HandshakeProtocol" json:"handshake_security_protocol,omitempty"` @@ -309,26 +258,29 @@ type StartClientHandshakeReq struct { // the target name. TargetName string `protobuf:"bytes,8,opt,name=target_name,json=targetName,proto3" json:"target_name,omitempty"` // (Optional) RPC protocol versions supported by the client. - RpcVersions *RpcProtocolVersions `protobuf:"bytes,9,opt,name=rpc_versions,json=rpcVersions,proto3" json:"rpc_versions,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + RpcVersions *RpcProtocolVersions `protobuf:"bytes,9,opt,name=rpc_versions,json=rpcVersions,proto3" json:"rpc_versions,omitempty"` + // (Optional) Maximum frame size supported by the client. + MaxFrameSize uint32 `protobuf:"varint,10,opt,name=max_frame_size,json=maxFrameSize,proto3" json:"max_frame_size,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *StartClientHandshakeReq) Reset() { *m = StartClientHandshakeReq{} } func (m *StartClientHandshakeReq) String() string { return proto.CompactTextString(m) } func (*StartClientHandshakeReq) ProtoMessage() {} func (*StartClientHandshakeReq) Descriptor() ([]byte, []int) { - return fileDescriptor_handshaker_1dfe659b12ea825e, []int{2} + return fileDescriptor_54c074f40c7c7e99, []int{2} } + func (m *StartClientHandshakeReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StartClientHandshakeReq.Unmarshal(m, b) } func (m *StartClientHandshakeReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_StartClientHandshakeReq.Marshal(b, m, deterministic) } -func (dst *StartClientHandshakeReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_StartClientHandshakeReq.Merge(dst, src) +func (m *StartClientHandshakeReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_StartClientHandshakeReq.Merge(m, src) } func (m *StartClientHandshakeReq) XXX_Size() int { return xxx_messageInfo_StartClientHandshakeReq.Size(m) @@ -402,6 +354,13 @@ func (m *StartClientHandshakeReq) GetRpcVersions() *RpcProtocolVersions { return nil } +func (m *StartClientHandshakeReq) GetMaxFrameSize() uint32 { + if m != nil { + return m.MaxFrameSize + } + return 0 +} + type ServerHandshakeParameters struct { // The record protocols supported by the server, e.g., // "ALTSRP_GCM_AES128". @@ -418,16 +377,17 @@ func (m *ServerHandshakeParameters) Reset() { *m = ServerHandshakeParame func (m *ServerHandshakeParameters) String() string { return proto.CompactTextString(m) } func (*ServerHandshakeParameters) ProtoMessage() {} func (*ServerHandshakeParameters) Descriptor() ([]byte, []int) { - return fileDescriptor_handshaker_1dfe659b12ea825e, []int{3} + return fileDescriptor_54c074f40c7c7e99, []int{3} } + func (m *ServerHandshakeParameters) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ServerHandshakeParameters.Unmarshal(m, b) } func (m *ServerHandshakeParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ServerHandshakeParameters.Marshal(b, m, deterministic) } -func (dst *ServerHandshakeParameters) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServerHandshakeParameters.Merge(dst, src) +func (m *ServerHandshakeParameters) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerHandshakeParameters.Merge(m, src) } func (m *ServerHandshakeParameters) XXX_Size() int { return xxx_messageInfo_ServerHandshakeParameters.Size(m) @@ -472,26 +432,29 @@ type StartServerHandshakeReq struct { // port number, and network protocol. RemoteEndpoint *Endpoint `protobuf:"bytes,5,opt,name=remote_endpoint,json=remoteEndpoint,proto3" json:"remote_endpoint,omitempty"` // (Optional) RPC protocol versions supported by the server. - RpcVersions *RpcProtocolVersions `protobuf:"bytes,6,opt,name=rpc_versions,json=rpcVersions,proto3" json:"rpc_versions,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + RpcVersions *RpcProtocolVersions `protobuf:"bytes,6,opt,name=rpc_versions,json=rpcVersions,proto3" json:"rpc_versions,omitempty"` + // (Optional) Maximum frame size supported by the server. + MaxFrameSize uint32 `protobuf:"varint,7,opt,name=max_frame_size,json=maxFrameSize,proto3" json:"max_frame_size,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *StartServerHandshakeReq) Reset() { *m = StartServerHandshakeReq{} } func (m *StartServerHandshakeReq) String() string { return proto.CompactTextString(m) } func (*StartServerHandshakeReq) ProtoMessage() {} func (*StartServerHandshakeReq) Descriptor() ([]byte, []int) { - return fileDescriptor_handshaker_1dfe659b12ea825e, []int{4} + return fileDescriptor_54c074f40c7c7e99, []int{4} } + func (m *StartServerHandshakeReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StartServerHandshakeReq.Unmarshal(m, b) } func (m *StartServerHandshakeReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_StartServerHandshakeReq.Marshal(b, m, deterministic) } -func (dst *StartServerHandshakeReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_StartServerHandshakeReq.Merge(dst, src) +func (m *StartServerHandshakeReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_StartServerHandshakeReq.Merge(m, src) } func (m *StartServerHandshakeReq) XXX_Size() int { return xxx_messageInfo_StartServerHandshakeReq.Size(m) @@ -544,6 +507,13 @@ func (m *StartServerHandshakeReq) GetRpcVersions() *RpcProtocolVersions { return nil } +func (m *StartServerHandshakeReq) GetMaxFrameSize() uint32 { + if m != nil { + return m.MaxFrameSize + } + return 0 +} + type NextHandshakeMessageReq struct { // Bytes in out_frames returned from the peer's HandshakerResp. It is possible // that the peer's out_frames are split into multiple NextHandshakerMessageReq @@ -558,16 +528,17 @@ func (m *NextHandshakeMessageReq) Reset() { *m = NextHandshakeMessageReq func (m *NextHandshakeMessageReq) String() string { return proto.CompactTextString(m) } func (*NextHandshakeMessageReq) ProtoMessage() {} func (*NextHandshakeMessageReq) Descriptor() ([]byte, []int) { - return fileDescriptor_handshaker_1dfe659b12ea825e, []int{5} + return fileDescriptor_54c074f40c7c7e99, []int{5} } + func (m *NextHandshakeMessageReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NextHandshakeMessageReq.Unmarshal(m, b) } func (m *NextHandshakeMessageReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_NextHandshakeMessageReq.Marshal(b, m, deterministic) } -func (dst *NextHandshakeMessageReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_NextHandshakeMessageReq.Merge(dst, src) +func (m *NextHandshakeMessageReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_NextHandshakeMessageReq.Merge(m, src) } func (m *NextHandshakeMessageReq) XXX_Size() int { return xxx_messageInfo_NextHandshakeMessageReq.Size(m) @@ -600,16 +571,17 @@ func (m *HandshakerReq) Reset() { *m = HandshakerReq{} } func (m *HandshakerReq) String() string { return proto.CompactTextString(m) } func (*HandshakerReq) ProtoMessage() {} func (*HandshakerReq) Descriptor() ([]byte, []int) { - return fileDescriptor_handshaker_1dfe659b12ea825e, []int{6} + return fileDescriptor_54c074f40c7c7e99, []int{6} } + func (m *HandshakerReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_HandshakerReq.Unmarshal(m, b) } func (m *HandshakerReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_HandshakerReq.Marshal(b, m, deterministic) } -func (dst *HandshakerReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_HandshakerReq.Merge(dst, src) +func (m *HandshakerReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_HandshakerReq.Merge(m, src) } func (m *HandshakerReq) XXX_Size() int { return xxx_messageInfo_HandshakerReq.Size(m) @@ -670,99 +642,15 @@ func (m *HandshakerReq) GetNext() *NextHandshakeMessageReq { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*HandshakerReq) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _HandshakerReq_OneofMarshaler, _HandshakerReq_OneofUnmarshaler, _HandshakerReq_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*HandshakerReq) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*HandshakerReq_ClientStart)(nil), (*HandshakerReq_ServerStart)(nil), (*HandshakerReq_Next)(nil), } } -func _HandshakerReq_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*HandshakerReq) - // req_oneof - switch x := m.ReqOneof.(type) { - case *HandshakerReq_ClientStart: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ClientStart); err != nil { - return err - } - case *HandshakerReq_ServerStart: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ServerStart); err != nil { - return err - } - case *HandshakerReq_Next: - b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Next); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("HandshakerReq.ReqOneof has unexpected type %T", x) - } - return nil -} - -func _HandshakerReq_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*HandshakerReq) - switch tag { - case 1: // req_oneof.client_start - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(StartClientHandshakeReq) - err := b.DecodeMessage(msg) - m.ReqOneof = &HandshakerReq_ClientStart{msg} - return true, err - case 2: // req_oneof.server_start - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(StartServerHandshakeReq) - err := b.DecodeMessage(msg) - m.ReqOneof = &HandshakerReq_ServerStart{msg} - return true, err - case 3: // req_oneof.next - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(NextHandshakeMessageReq) - err := b.DecodeMessage(msg) - m.ReqOneof = &HandshakerReq_Next{msg} - return true, err - default: - return false, nil - } -} - -func _HandshakerReq_OneofSizer(msg proto.Message) (n int) { - m := msg.(*HandshakerReq) - // req_oneof - switch x := m.ReqOneof.(type) { - case *HandshakerReq_ClientStart: - s := proto.Size(x.ClientStart) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *HandshakerReq_ServerStart: - s := proto.Size(x.ServerStart) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *HandshakerReq_Next: - s := proto.Size(x.Next) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type HandshakerResult struct { // The application protocol negotiated for this connection. ApplicationProtocol string `protobuf:"bytes,1,opt,name=application_protocol,json=applicationProtocol,proto3" json:"application_protocol,omitempty"` @@ -781,26 +669,29 @@ type HandshakerResult struct { // post-handshake messages in the future. KeepChannelOpen bool `protobuf:"varint,6,opt,name=keep_channel_open,json=keepChannelOpen,proto3" json:"keep_channel_open,omitempty"` // The RPC protocol versions supported by the peer. - PeerRpcVersions *RpcProtocolVersions `protobuf:"bytes,7,opt,name=peer_rpc_versions,json=peerRpcVersions,proto3" json:"peer_rpc_versions,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + PeerRpcVersions *RpcProtocolVersions `protobuf:"bytes,7,opt,name=peer_rpc_versions,json=peerRpcVersions,proto3" json:"peer_rpc_versions,omitempty"` + // The maximum frame size of the peer. + MaxFrameSize uint32 `protobuf:"varint,8,opt,name=max_frame_size,json=maxFrameSize,proto3" json:"max_frame_size,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *HandshakerResult) Reset() { *m = HandshakerResult{} } func (m *HandshakerResult) String() string { return proto.CompactTextString(m) } func (*HandshakerResult) ProtoMessage() {} func (*HandshakerResult) Descriptor() ([]byte, []int) { - return fileDescriptor_handshaker_1dfe659b12ea825e, []int{7} + return fileDescriptor_54c074f40c7c7e99, []int{7} } + func (m *HandshakerResult) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_HandshakerResult.Unmarshal(m, b) } func (m *HandshakerResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_HandshakerResult.Marshal(b, m, deterministic) } -func (dst *HandshakerResult) XXX_Merge(src proto.Message) { - xxx_messageInfo_HandshakerResult.Merge(dst, src) +func (m *HandshakerResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_HandshakerResult.Merge(m, src) } func (m *HandshakerResult) XXX_Size() int { return xxx_messageInfo_HandshakerResult.Size(m) @@ -860,6 +751,13 @@ func (m *HandshakerResult) GetPeerRpcVersions() *RpcProtocolVersions { return nil } +func (m *HandshakerResult) GetMaxFrameSize() uint32 { + if m != nil { + return m.MaxFrameSize + } + return 0 +} + type HandshakerStatus struct { // The status code. This could be the gRPC status code. Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` @@ -874,16 +772,17 @@ func (m *HandshakerStatus) Reset() { *m = HandshakerStatus{} } func (m *HandshakerStatus) String() string { return proto.CompactTextString(m) } func (*HandshakerStatus) ProtoMessage() {} func (*HandshakerStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_handshaker_1dfe659b12ea825e, []int{8} + return fileDescriptor_54c074f40c7c7e99, []int{8} } + func (m *HandshakerStatus) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_HandshakerStatus.Unmarshal(m, b) } func (m *HandshakerStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_HandshakerStatus.Marshal(b, m, deterministic) } -func (dst *HandshakerStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_HandshakerStatus.Merge(dst, src) +func (m *HandshakerStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_HandshakerStatus.Merge(m, src) } func (m *HandshakerStatus) XXX_Size() int { return xxx_messageInfo_HandshakerStatus.Size(m) @@ -933,16 +832,17 @@ func (m *HandshakerResp) Reset() { *m = HandshakerResp{} } func (m *HandshakerResp) String() string { return proto.CompactTextString(m) } func (*HandshakerResp) ProtoMessage() {} func (*HandshakerResp) Descriptor() ([]byte, []int) { - return fileDescriptor_handshaker_1dfe659b12ea825e, []int{9} + return fileDescriptor_54c074f40c7c7e99, []int{9} } + func (m *HandshakerResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_HandshakerResp.Unmarshal(m, b) } func (m *HandshakerResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_HandshakerResp.Marshal(b, m, deterministic) } -func (dst *HandshakerResp) XXX_Merge(src proto.Message) { - xxx_messageInfo_HandshakerResp.Merge(dst, src) +func (m *HandshakerResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_HandshakerResp.Merge(m, src) } func (m *HandshakerResp) XXX_Size() int { return xxx_messageInfo_HandshakerResp.Size(m) @@ -982,6 +882,8 @@ func (m *HandshakerResp) GetStatus() *HandshakerStatus { } func init() { + proto.RegisterEnum("grpc.gcp.HandshakeProtocol", HandshakeProtocol_name, HandshakeProtocol_value) + proto.RegisterEnum("grpc.gcp.NetworkProtocol", NetworkProtocol_name, NetworkProtocol_value) proto.RegisterType((*Endpoint)(nil), "grpc.gcp.Endpoint") proto.RegisterType((*Identity)(nil), "grpc.gcp.Identity") proto.RegisterMapType((map[string]string)(nil), "grpc.gcp.Identity.AttributesEntry") @@ -994,8 +896,88 @@ func init() { proto.RegisterType((*HandshakerResult)(nil), "grpc.gcp.HandshakerResult") proto.RegisterType((*HandshakerStatus)(nil), "grpc.gcp.HandshakerStatus") proto.RegisterType((*HandshakerResp)(nil), "grpc.gcp.HandshakerResp") - proto.RegisterEnum("grpc.gcp.HandshakeProtocol", HandshakeProtocol_name, HandshakeProtocol_value) - proto.RegisterEnum("grpc.gcp.NetworkProtocol", NetworkProtocol_name, NetworkProtocol_value) +} + +func init() { proto.RegisterFile("grpc/gcp/handshaker.proto", fileDescriptor_54c074f40c7c7e99) } + +var fileDescriptor_54c074f40c7c7e99 = []byte{ + // 1203 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0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 0x11, 0x9d, + 0x42, 0xe1, 0x84, 0x45, 0x66, 0x74, 0x2b, 0x3d, 0x1d, 0x6f, 0x8f, 0xf5, 0x0d, 0x79, 0x72, 0x6b, + 0x5b, 0x75, 0xed, 0x4b, 0xad, 0x33, 0x85, 0x9b, 0x36, 0xf3, 0x31, 0xd8, 0x91, 0xa2, 0x61, 0x53, + 0x49, 0x38, 0xc5, 0x4e, 0xa7, 0x1c, 0xc3, 0x55, 0xf4, 0x43, 0xed, 0xe7, 0xa7, 0x13, 0xc6, 0x26, + 0x0e, 0x69, 0x4c, 0x98, 0x83, 0xe9, 0xa4, 0xc1, 0xf8, 0xa4, 0xa9, 0x1e, 0xdf, 0x16, 0x27, 0x4a, + 0xde, 0xd8, 0x11, 0x4d, 0xcf, 0x49, 0x33, 0x74, 0xd2, 0x54, 0xbd, 0xa9, 0x40, 0xe6, 0xc4, 0x72, + 0x5f, 0xef, 0xa8, 0xf5, 0x83, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xc1, 0xf9, 0x9d, 0xf2, 0xd9, + 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1069,6 +1051,14 @@ type HandshakerServiceServer interface { DoHandshake(HandshakerService_DoHandshakeServer) error } +// UnimplementedHandshakerServiceServer can be embedded to have forward compatible implementations. +type UnimplementedHandshakerServiceServer struct { +} + +func (*UnimplementedHandshakerServiceServer) DoHandshake(srv HandshakerService_DoHandshakeServer) error { + return status.Errorf(codes.Unimplemented, "method DoHandshake not implemented") +} + func RegisterHandshakerServiceServer(s *grpc.Server, srv HandshakerServiceServer) { s.RegisterService(&_HandshakerService_serviceDesc, srv) } @@ -1113,84 +1103,3 @@ var _HandshakerService_serviceDesc = grpc.ServiceDesc{ }, Metadata: "grpc/gcp/handshaker.proto", } - -func init() { - proto.RegisterFile("grpc/gcp/handshaker.proto", fileDescriptor_handshaker_1dfe659b12ea825e) -} - -var fileDescriptor_handshaker_1dfe659b12ea825e = []byte{ - // 1168 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xdf, 0x6e, 0x1a, 0xc7, - 0x17, 0xf6, 0x02, 0xb6, 0xf1, 0xc1, 0xfc, 0xf1, 0xc4, 0x51, 0xd6, 0x4e, 0xf2, 0xfb, 0x51, 0xaa, - 0xaa, 0x24, 0x17, 0xd0, 0x92, 0x56, 0x69, 0x52, 0x45, 0x09, 0x60, 0x2c, 0xdc, 0xa4, 0x18, 0x2d, - 0x4e, 0x2b, 0x35, 0x17, 0xab, 0xc9, 0x32, 0xc1, 0x2b, 0x96, 0x99, 0xf5, 0xcc, 0xe0, 0x86, 0x07, - 0xe8, 0xe3, 0xf4, 0x15, 0xfa, 0x36, 0x95, 0xfa, 0x00, 0xbd, 0x6f, 0xb5, 0xb3, 0xb3, 0x7f, 0xc0, - 0x10, 0x25, 0xea, 0xdd, 0xee, 0x99, 0xef, 0x3b, 0x7b, 0xe6, 0x3b, 0xdf, 0x9c, 0x1d, 0x38, 0x9a, - 0x70, 0xdf, 0x69, 0x4e, 0x1c, 0xbf, 0x79, 0x89, 0xe9, 0x58, 0x5c, 0xe2, 0x29, 0xe1, 0x0d, 0x9f, - 0x33, 0xc9, 0x50, 0x3e, 0x58, 0x6a, 0x4c, 0x1c, 0xff, 0xb8, 0x1e, 0x83, 0x24, 0xc7, 0x54, 0xf8, - 0x8c, 0x4b, 0x5b, 0x10, 0x67, 0xce, 0x5d, 0xb9, 0xb0, 0x1d, 0x36, 0x9b, 0x31, 0x1a, 0x72, 0x6a, - 0x12, 0xf2, 0x3d, 0x3a, 0xf6, 0x99, 0x4b, 0x25, 0xba, 0x0f, 0xe0, 0xfa, 0x36, 0x1e, 0x8f, 0x39, - 0x11, 0xc2, 0x34, 0xaa, 0x46, 0x7d, 0xcf, 0xda, 0x73, 0xfd, 0x76, 0x18, 0x40, 0x08, 0x72, 0x41, - 0x22, 0x33, 0x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 0xaf, 0x8c, 0xce, 0x14, 0x6e, 0xbb, 0x2c, 0xc4, 0x60, 0x4f, 0x8a, 0x86, 0x4b, 0x25, 0xe1, 0x14, - 0x7b, 0x9d, 0x72, 0x02, 0x57, 0xd5, 0x0f, 0x8d, 0x5f, 0x9e, 0x4f, 0x18, 0x9b, 0x78, 0xa4, 0x31, - 0x61, 0x1e, 0xa6, 0x93, 0x06, 0xe3, 0x93, 0xa6, 0xba, 0x0a, 0x3b, 0x9c, 0x28, 0xe3, 0x62, 0x4f, - 0x34, 0x83, 0x24, 0xcd, 0x28, 0x49, 0x53, 0x9d, 0x3a, 0x05, 0xb2, 0x27, 0x8e, 0xff, 0x76, 0x47, - 0xbd, 0x3f, 0xfa, 0x37, 0x00, 0x00, 0xff, 0xff, 0x6e, 0x37, 0x34, 0x9b, 0x67, 0x0b, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/transport_security_common.pb.go b/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/transport_security_common.pb.go index 27510d4de91..992805165db 100644 --- a/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/transport_security_common.pb.go +++ b/vendor/google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp/transport_security_common.pb.go @@ -1,11 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: grpc/gcp/transport_security_common.proto -package grpc_gcp // import "google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp" +package grpc_gcp -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -16,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // The security level of the created channel. The list is sorted in increasing // level of security. This order must always be maintained. @@ -33,6 +35,7 @@ var SecurityLevel_name = map[int32]string{ 1: "INTEGRITY_ONLY", 2: "INTEGRITY_AND_PRIVACY", } + var SecurityLevel_value = map[string]int32{ "SECURITY_NONE": 0, "INTEGRITY_ONLY": 1, @@ -42,8 +45,9 @@ var SecurityLevel_value = map[string]int32{ func (x SecurityLevel) String() string { return proto.EnumName(SecurityLevel_name, int32(x)) } + func (SecurityLevel) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_transport_security_common_71945991f2c3b4a6, []int{0} + return fileDescriptor_b97e31e3cc23582a, []int{0} } // Max and min supported RPC protocol versions. @@ -61,16 +65,17 @@ func (m *RpcProtocolVersions) Reset() { *m = RpcProtocolVersions{} } func (m *RpcProtocolVersions) String() string { return proto.CompactTextString(m) } func (*RpcProtocolVersions) ProtoMessage() {} func (*RpcProtocolVersions) Descriptor() ([]byte, []int) { - return fileDescriptor_transport_security_common_71945991f2c3b4a6, []int{0} + return fileDescriptor_b97e31e3cc23582a, []int{0} } + func (m *RpcProtocolVersions) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RpcProtocolVersions.Unmarshal(m, b) } func (m *RpcProtocolVersions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_RpcProtocolVersions.Marshal(b, m, deterministic) } -func (dst *RpcProtocolVersions) XXX_Merge(src proto.Message) { - xxx_messageInfo_RpcProtocolVersions.Merge(dst, src) +func (m *RpcProtocolVersions) XXX_Merge(src proto.Message) { + xxx_messageInfo_RpcProtocolVersions.Merge(m, src) } func (m *RpcProtocolVersions) XXX_Size() int { return xxx_messageInfo_RpcProtocolVersions.Size(m) @@ -108,16 +113,17 @@ func (m *RpcProtocolVersions_Version) Reset() { *m = RpcProtocolVersions func (m *RpcProtocolVersions_Version) String() string { return proto.CompactTextString(m) } func (*RpcProtocolVersions_Version) ProtoMessage() {} func (*RpcProtocolVersions_Version) Descriptor() ([]byte, []int) { - return fileDescriptor_transport_security_common_71945991f2c3b4a6, []int{0, 0} + return fileDescriptor_b97e31e3cc23582a, []int{0, 0} } + func (m *RpcProtocolVersions_Version) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RpcProtocolVersions_Version.Unmarshal(m, b) } func (m *RpcProtocolVersions_Version) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_RpcProtocolVersions_Version.Marshal(b, m, deterministic) } -func (dst *RpcProtocolVersions_Version) XXX_Merge(src proto.Message) { - xxx_messageInfo_RpcProtocolVersions_Version.Merge(dst, src) +func (m *RpcProtocolVersions_Version) XXX_Merge(src proto.Message) { + xxx_messageInfo_RpcProtocolVersions_Version.Merge(m, src) } func (m *RpcProtocolVersions_Version) XXX_Size() int { return xxx_messageInfo_RpcProtocolVersions_Version.Size(m) @@ -143,16 +149,16 @@ func (m *RpcProtocolVersions_Version) GetMinor() uint32 { } func init() { + proto.RegisterEnum("grpc.gcp.SecurityLevel", SecurityLevel_name, SecurityLevel_value) proto.RegisterType((*RpcProtocolVersions)(nil), "grpc.gcp.RpcProtocolVersions") proto.RegisterType((*RpcProtocolVersions_Version)(nil), "grpc.gcp.RpcProtocolVersions.Version") - proto.RegisterEnum("grpc.gcp.SecurityLevel", SecurityLevel_name, SecurityLevel_value) } func init() { - proto.RegisterFile("grpc/gcp/transport_security_common.proto", fileDescriptor_transport_security_common_71945991f2c3b4a6) + proto.RegisterFile("grpc/gcp/transport_security_common.proto", fileDescriptor_b97e31e3cc23582a) } -var fileDescriptor_transport_security_common_71945991f2c3b4a6 = []byte{ +var fileDescriptor_b97e31e3cc23582a = []byte{ // 323 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x91, 0x41, 0x4b, 0x3b, 0x31, 0x10, 0xc5, 0xff, 0x5b, 0xf8, 0xab, 0x44, 0x56, 0xeb, 0x6a, 0x41, 0xc5, 0x83, 0x08, 0x42, 0xf1, diff --git a/vendor/google.golang.org/grpc/credentials/alts/utils.go b/vendor/google.golang.org/grpc/credentials/alts/utils.go index 4ed27c605b6..f13aeef1c47 100644 --- a/vendor/google.golang.org/grpc/credentials/alts/utils.go +++ b/vendor/google.golang.org/grpc/credentials/alts/utils.go @@ -83,6 +83,9 @@ var ( // running on GCP. func isRunningOnGCP() bool { manufacturer, err := readManufacturer() + if os.IsNotExist(err) { + return false + } if err != nil { log.Fatalf("failure to read manufacturer information: %v", err) } diff --git a/vendor/google.golang.org/grpc/credentials/alts/utils_test.go b/vendor/google.golang.org/grpc/credentials/alts/utils_test.go index 3c7e43db14a..8935c5fbec8 100644 --- a/vendor/google.golang.org/grpc/credentials/alts/utils_test.go +++ b/vendor/google.golang.org/grpc/credentials/alts/utils_test.go @@ -21,6 +21,7 @@ package alts import ( "context" "io" + "os" "strings" "testing" @@ -28,6 +29,34 @@ import ( "google.golang.org/grpc/peer" ) +func setupManufacturerReader(testOS string, reader func() (io.Reader, error)) func() { + tmpOS := runningOS + tmpReader := manufacturerReader + + // Set test OS and reader function. + runningOS = testOS + manufacturerReader = reader + return func() { + runningOS = tmpOS + manufacturerReader = tmpReader + } + +} + +func setup(testOS string, testReader io.Reader) func() { + reader := func() (io.Reader, error) { + return testReader, nil + } + return setupManufacturerReader(testOS, reader) +} + +func setupError(testOS string, err error) func() { + reader := func() (io.Reader, error) { + return nil, err + } + return setupManufacturerReader(testOS, reader) +} + func TestIsRunningOnGCP(t *testing.T) { for _, tc := range []struct { description string @@ -53,20 +82,12 @@ func TestIsRunningOnGCP(t *testing.T) { } } -func setup(testOS string, testReader io.Reader) func() { - tmpOS := runningOS - tmpReader := manufacturerReader - - // Set test OS and reader function. - runningOS = testOS - manufacturerReader = func() (io.Reader, error) { - return testReader, nil - } - - return func() { - runningOS = tmpOS - manufacturerReader = tmpReader +func TestIsRunningOnGCPNoProductNameFile(t *testing.T) { + reverseFunc := setupError("linux", os.ErrNotExist) + if isRunningOnGCP() { + t.Errorf("ErrNotExist: isRunningOnGCP()=true, want false") } + reverseFunc() } func TestAuthInfoFromContext(t *testing.T) { diff --git a/vendor/google.golang.org/grpc/credentials/credentials.go b/vendor/google.golang.org/grpc/credentials/credentials.go index 8ea3d4a1dc2..667cf6b3360 100644 --- a/vendor/google.golang.org/grpc/credentials/credentials.go +++ b/vendor/google.golang.org/grpc/credentials/credentials.go @@ -24,16 +24,11 @@ package credentials // import "google.golang.org/grpc/credentials" import ( "context" - "crypto/tls" - "crypto/x509" "errors" - "fmt" - "io/ioutil" "net" - "strings" "github.com/golang/protobuf/proto" - "google.golang.org/grpc/credentials/internal" + "google.golang.org/grpc/internal" ) // PerRPCCredentials defines the common interface for the credentials which need to @@ -45,7 +40,8 @@ type PerRPCCredentials interface { // context. If a status code is returned, it will be used as the status // for the RPC. uri is the URI of the entry point for the request. // When supported by the underlying implementation, ctx can be used for - // timeout and cancellation. + // timeout and cancellation. Additionally, RequestInfo data will be + // available via ctx to this call. // TODO(zhaoq): Define the set of the qualified keys instead of leaving // it as an arbitrary string. GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) @@ -125,145 +121,35 @@ type Bundle interface { NewWithMode(mode string) (Bundle, error) } -// TLSInfo contains the auth information for a TLS authenticated connection. -// It implements the AuthInfo interface. -type TLSInfo struct { - State tls.ConnectionState -} - -// AuthType returns the type of TLSInfo as a string. -func (t TLSInfo) AuthType() string { - return "tls" -} - -// GetSecurityValue returns security info requested by channelz. -func (t TLSInfo) GetSecurityValue() ChannelzSecurityValue { - v := &TLSChannelzSecurityValue{ - StandardName: cipherSuiteLookup[t.State.CipherSuite], - } - // Currently there's no way to get LocalCertificate info from tls package. - if len(t.State.PeerCertificates) > 0 { - v.RemoteCertificate = t.State.PeerCertificates[0].Raw - } - return v -} - -// tlsCreds is the credentials required for authenticating a connection using TLS. -type tlsCreds struct { - // TLS configuration - config *tls.Config -} - -func (c tlsCreds) Info() ProtocolInfo { - return ProtocolInfo{ - SecurityProtocol: "tls", - SecurityVersion: "1.2", - ServerName: c.config.ServerName, - } -} - -func (c *tlsCreds) ClientHandshake(ctx context.Context, authority string, rawConn net.Conn) (_ net.Conn, _ AuthInfo, err error) { - // use local cfg to avoid clobbering ServerName if using multiple endpoints - cfg := cloneTLSConfig(c.config) - if cfg.ServerName == "" { - colonPos := strings.LastIndex(authority, ":") - if colonPos == -1 { - colonPos = len(authority) - } - cfg.ServerName = authority[:colonPos] - } - conn := tls.Client(rawConn, cfg) - errChannel := make(chan error, 1) - go func() { - errChannel <- conn.Handshake() - }() - select { - case err := <-errChannel: - if err != nil { - return nil, nil, err - } - case <-ctx.Done(): - return nil, nil, ctx.Err() - } - return internal.WrapSyscallConn(rawConn, conn), TLSInfo{conn.ConnectionState()}, nil -} - -func (c *tlsCreds) ServerHandshake(rawConn net.Conn) (net.Conn, AuthInfo, error) { - conn := tls.Server(rawConn, c.config) - if err := conn.Handshake(); err != nil { - return nil, nil, err - } - return internal.WrapSyscallConn(rawConn, conn), TLSInfo{conn.ConnectionState()}, nil -} - -func (c *tlsCreds) Clone() TransportCredentials { - return NewTLS(c.config) -} - -func (c *tlsCreds) OverrideServerName(serverNameOverride string) error { - c.config.ServerName = serverNameOverride - return nil -} - -const alpnProtoStrH2 = "h2" - -func appendH2ToNextProtos(ps []string) []string { - for _, p := range ps { - if p == alpnProtoStrH2 { - return ps - } - } - ret := make([]string, 0, len(ps)+1) - ret = append(ret, ps...) - return append(ret, alpnProtoStrH2) -} - -// NewTLS uses c to construct a TransportCredentials based on TLS. -func NewTLS(c *tls.Config) TransportCredentials { - tc := &tlsCreds{cloneTLSConfig(c)} - tc.config.NextProtos = appendH2ToNextProtos(tc.config.NextProtos) - return tc -} - -// NewClientTLSFromCert constructs TLS credentials from the input certificate for client. -// serverNameOverride is for testing only. If set to a non empty string, -// it will override the virtual host name of authority (e.g. :authority header field) in requests. -func NewClientTLSFromCert(cp *x509.CertPool, serverNameOverride string) TransportCredentials { - return NewTLS(&tls.Config{ServerName: serverNameOverride, RootCAs: cp}) +// RequestInfo contains request data attached to the context passed to GetRequestMetadata calls. +// +// This API is experimental. +type RequestInfo struct { + // The method passed to Invoke or NewStream for this RPC. (For proto methods, this has the format "/some.Service/Method") + Method string } -// NewClientTLSFromFile constructs TLS credentials from the input certificate file for client. -// serverNameOverride is for testing only. If set to a non empty string, -// it will override the virtual host name of authority (e.g. :authority header field) in requests. -func NewClientTLSFromFile(certFile, serverNameOverride string) (TransportCredentials, error) { - b, err := ioutil.ReadFile(certFile) - if err != nil { - return nil, err - } - cp := x509.NewCertPool() - if !cp.AppendCertsFromPEM(b) { - return nil, fmt.Errorf("credentials: failed to append certificates") - } - return NewTLS(&tls.Config{ServerName: serverNameOverride, RootCAs: cp}), nil -} +// requestInfoKey is a struct to be used as the key when attaching a RequestInfo to a context object. +type requestInfoKey struct{} -// NewServerTLSFromCert constructs TLS credentials from the input certificate for server. -func NewServerTLSFromCert(cert *tls.Certificate) TransportCredentials { - return NewTLS(&tls.Config{Certificates: []tls.Certificate{*cert}}) +// RequestInfoFromContext extracts the RequestInfo from the context if it exists. +// +// This API is experimental. +func RequestInfoFromContext(ctx context.Context) (ri RequestInfo, ok bool) { + ri, ok = ctx.Value(requestInfoKey{}).(RequestInfo) + return } -// NewServerTLSFromFile constructs TLS credentials from the input certificate file and key -// file for server. -func NewServerTLSFromFile(certFile, keyFile string) (TransportCredentials, error) { - cert, err := tls.LoadX509KeyPair(certFile, keyFile) - if err != nil { - return nil, err +func init() { + internal.NewRequestInfoContext = func(ctx context.Context, ri RequestInfo) context.Context { + return context.WithValue(ctx, requestInfoKey{}, ri) } - return NewTLS(&tls.Config{Certificates: []tls.Certificate{cert}}), nil } // ChannelzSecurityInfo defines the interface that security protocols should implement // in order to provide security info to channelz. +// +// This API is experimental. type ChannelzSecurityInfo interface { GetSecurityValue() ChannelzSecurityValue } @@ -271,66 +157,20 @@ type ChannelzSecurityInfo interface { // ChannelzSecurityValue defines the interface that GetSecurityValue() return value // should satisfy. This interface should only be satisfied by *TLSChannelzSecurityValue // and *OtherChannelzSecurityValue. +// +// This API is experimental. type ChannelzSecurityValue interface { isChannelzSecurityValue() } -// TLSChannelzSecurityValue defines the struct that TLS protocol should return -// from GetSecurityValue(), containing security info like cipher and certificate used. -type TLSChannelzSecurityValue struct { - ChannelzSecurityValue - StandardName string - LocalCertificate []byte - RemoteCertificate []byte -} - // OtherChannelzSecurityValue defines the struct that non-TLS protocol should return // from GetSecurityValue(), which contains protocol specific security info. Note // the Value field will be sent to users of channelz requesting channel info, and // thus sensitive info should better be avoided. +// +// This API is experimental. type OtherChannelzSecurityValue struct { ChannelzSecurityValue Name string Value proto.Message } - -var cipherSuiteLookup = map[uint16]string{ - tls.TLS_RSA_WITH_RC4_128_SHA: "TLS_RSA_WITH_RC4_128_SHA", - tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA: "TLS_RSA_WITH_3DES_EDE_CBC_SHA", - tls.TLS_RSA_WITH_AES_128_CBC_SHA: "TLS_RSA_WITH_AES_128_CBC_SHA", - tls.TLS_RSA_WITH_AES_256_CBC_SHA: "TLS_RSA_WITH_AES_256_CBC_SHA", - tls.TLS_RSA_WITH_AES_128_GCM_SHA256: "TLS_RSA_WITH_AES_128_GCM_SHA256", - tls.TLS_RSA_WITH_AES_256_GCM_SHA384: "TLS_RSA_WITH_AES_256_GCM_SHA384", - tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA: "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", - tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA: "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", - tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA: "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", - tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA: "TLS_ECDHE_RSA_WITH_RC4_128_SHA", - tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA: "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", - tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA: "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", - tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", - tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256: "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", - tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", - tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384: "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", - tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384: "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", - tls.TLS_FALLBACK_SCSV: "TLS_FALLBACK_SCSV", - tls.TLS_RSA_WITH_AES_128_CBC_SHA256: "TLS_RSA_WITH_AES_128_CBC_SHA256", - tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256: "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256", - tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256: "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", - tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305: "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305", - tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305: "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305", -} - -// cloneTLSConfig returns a shallow clone of the exported -// fields of cfg, ignoring the unexported sync.Once, which -// contains a mutex and must not be copied. -// -// If cfg is nil, a new zero tls.Config is returned. -// -// TODO: inline this function if possible. -func cloneTLSConfig(cfg *tls.Config) *tls.Config { - if cfg == nil { - return &tls.Config{} - } - - return cfg.Clone() -} diff --git a/vendor/google.golang.org/grpc/credentials/credentials_test.go b/vendor/google.golang.org/grpc/credentials/credentials_test.go index b15458636f1..00c51418278 100644 --- a/vendor/google.golang.org/grpc/credentials/credentials_test.go +++ b/vendor/google.golang.org/grpc/credentials/credentials_test.go @@ -23,6 +23,7 @@ import ( "crypto/tls" "net" "reflect" + "strings" "testing" "google.golang.org/grpc/testdata" @@ -55,18 +56,40 @@ func TestTLSClone(t *testing.T) { type serverHandshake func(net.Conn) (AuthInfo, error) func TestClientHandshakeReturnsAuthInfo(t *testing.T) { - done := make(chan AuthInfo, 1) - lis := launchServer(t, tlsServerHandshake, done) - defer lis.Close() - lisAddr := lis.Addr().String() - clientAuthInfo := clientHandle(t, gRPCClientHandshake, lisAddr) - // wait until server sends serverAuthInfo or fails. - serverAuthInfo, ok := <-done - if !ok { - t.Fatalf("Error at server-side") + tcs := []struct { + name string + address string + }{ + { + name: "localhost", + address: "localhost:0", + }, + { + name: "ipv4", + address: "127.0.0.1:0", + }, + { + name: "ipv6", + address: "[::1]:0", + }, } - if !compare(clientAuthInfo, serverAuthInfo) { - t.Fatalf("c.ClientHandshake(_, %v, _) = %v, want %v.", lisAddr, clientAuthInfo, serverAuthInfo) + + for _, tc := range tcs { + t.Run(tc.name, func(t *testing.T) { + done := make(chan AuthInfo, 1) + lis := launchServerOnListenAddress(t, tlsServerHandshake, done, tc.address) + defer lis.Close() + lisAddr := lis.Addr().String() + clientAuthInfo := clientHandle(t, gRPCClientHandshake, lisAddr) + // wait until server sends serverAuthInfo or fails. + serverAuthInfo, ok := <-done + if !ok { + t.Fatalf("Error at server-side") + } + if !compare(clientAuthInfo, serverAuthInfo) { + t.Fatalf("c.ClientHandshake(_, %v, _) = %v, want %v.", lisAddr, clientAuthInfo, serverAuthInfo) + } + }) } } @@ -121,8 +144,16 @@ func compare(a1, a2 AuthInfo) bool { } func launchServer(t *testing.T, hs serverHandshake, done chan AuthInfo) net.Listener { - lis, err := net.Listen("tcp", "localhost:0") + return launchServerOnListenAddress(t, hs, done, "localhost:0") +} + +func launchServerOnListenAddress(t *testing.T, hs serverHandshake, done chan AuthInfo, address string) net.Listener { + lis, err := net.Listen("tcp", address) if err != nil { + if strings.Contains(err.Error(), "bind: cannot assign requested address") || + strings.Contains(err.Error(), "socket: address family not supported by protocol") { + t.Skipf("no support for address %v", address) + } t.Fatalf("Failed to listen: %v", err) } go serverHandle(t, hs, done, lis) diff --git a/vendor/google.golang.org/grpc/credentials/tls13.go b/vendor/google.golang.org/grpc/credentials/go12.go similarity index 100% rename from vendor/google.golang.org/grpc/credentials/tls13.go rename to vendor/google.golang.org/grpc/credentials/go12.go diff --git a/vendor/google.golang.org/grpc/credentials/tls.go b/vendor/google.golang.org/grpc/credentials/tls.go new file mode 100644 index 00000000000..7c33613685a --- /dev/null +++ b/vendor/google.golang.org/grpc/credentials/tls.go @@ -0,0 +1,220 @@ +/* + * + * Copyright 2014 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. + * + */ + +package credentials + +import ( + "context" + "crypto/tls" + "crypto/x509" + "fmt" + "io/ioutil" + "net" + + "google.golang.org/grpc/credentials/internal" +) + +// TLSInfo contains the auth information for a TLS authenticated connection. +// It implements the AuthInfo interface. +type TLSInfo struct { + State tls.ConnectionState +} + +// AuthType returns the type of TLSInfo as a string. +func (t TLSInfo) AuthType() string { + return "tls" +} + +// GetSecurityValue returns security info requested by channelz. +func (t TLSInfo) GetSecurityValue() ChannelzSecurityValue { + v := &TLSChannelzSecurityValue{ + StandardName: cipherSuiteLookup[t.State.CipherSuite], + } + // Currently there's no way to get LocalCertificate info from tls package. + if len(t.State.PeerCertificates) > 0 { + v.RemoteCertificate = t.State.PeerCertificates[0].Raw + } + return v +} + +// tlsCreds is the credentials required for authenticating a connection using TLS. +type tlsCreds struct { + // TLS configuration + config *tls.Config +} + +func (c tlsCreds) Info() ProtocolInfo { + return ProtocolInfo{ + SecurityProtocol: "tls", + SecurityVersion: "1.2", + ServerName: c.config.ServerName, + } +} + +func (c *tlsCreds) ClientHandshake(ctx context.Context, authority string, rawConn net.Conn) (_ net.Conn, _ AuthInfo, err error) { + // use local cfg to avoid clobbering ServerName if using multiple endpoints + cfg := cloneTLSConfig(c.config) + if cfg.ServerName == "" { + serverName, _, err := net.SplitHostPort(authority) + if err != nil { + // If the authority had no host port or if the authority cannot be parsed, use it as-is. + serverName = authority + } + cfg.ServerName = serverName + } + conn := tls.Client(rawConn, cfg) + errChannel := make(chan error, 1) + go func() { + errChannel <- conn.Handshake() + }() + select { + case err := <-errChannel: + if err != nil { + return nil, nil, err + } + case <-ctx.Done(): + return nil, nil, ctx.Err() + } + return internal.WrapSyscallConn(rawConn, conn), TLSInfo{conn.ConnectionState()}, nil +} + +func (c *tlsCreds) ServerHandshake(rawConn net.Conn) (net.Conn, AuthInfo, error) { + conn := tls.Server(rawConn, c.config) + if err := conn.Handshake(); err != nil { + return nil, nil, err + } + return internal.WrapSyscallConn(rawConn, conn), TLSInfo{conn.ConnectionState()}, nil +} + +func (c *tlsCreds) Clone() TransportCredentials { + return NewTLS(c.config) +} + +func (c *tlsCreds) OverrideServerName(serverNameOverride string) error { + c.config.ServerName = serverNameOverride + return nil +} + +const alpnProtoStrH2 = "h2" + +func appendH2ToNextProtos(ps []string) []string { + for _, p := range ps { + if p == alpnProtoStrH2 { + return ps + } + } + ret := make([]string, 0, len(ps)+1) + ret = append(ret, ps...) + return append(ret, alpnProtoStrH2) +} + +// NewTLS uses c to construct a TransportCredentials based on TLS. +func NewTLS(c *tls.Config) TransportCredentials { + tc := &tlsCreds{cloneTLSConfig(c)} + tc.config.NextProtos = appendH2ToNextProtos(tc.config.NextProtos) + return tc +} + +// NewClientTLSFromCert constructs TLS credentials from the input certificate for client. +// serverNameOverride is for testing only. If set to a non empty string, +// it will override the virtual host name of authority (e.g. :authority header field) in requests. +func NewClientTLSFromCert(cp *x509.CertPool, serverNameOverride string) TransportCredentials { + return NewTLS(&tls.Config{ServerName: serverNameOverride, RootCAs: cp}) +} + +// NewClientTLSFromFile constructs TLS credentials from the input certificate file for client. +// serverNameOverride is for testing only. If set to a non empty string, +// it will override the virtual host name of authority (e.g. :authority header field) in requests. +func NewClientTLSFromFile(certFile, serverNameOverride string) (TransportCredentials, error) { + b, err := ioutil.ReadFile(certFile) + if err != nil { + return nil, err + } + cp := x509.NewCertPool() + if !cp.AppendCertsFromPEM(b) { + return nil, fmt.Errorf("credentials: failed to append certificates") + } + return NewTLS(&tls.Config{ServerName: serverNameOverride, RootCAs: cp}), nil +} + +// NewServerTLSFromCert constructs TLS credentials from the input certificate for server. +func NewServerTLSFromCert(cert *tls.Certificate) TransportCredentials { + return NewTLS(&tls.Config{Certificates: []tls.Certificate{*cert}}) +} + +// NewServerTLSFromFile constructs TLS credentials from the input certificate file and key +// file for server. +func NewServerTLSFromFile(certFile, keyFile string) (TransportCredentials, error) { + cert, err := tls.LoadX509KeyPair(certFile, keyFile) + if err != nil { + return nil, err + } + return NewTLS(&tls.Config{Certificates: []tls.Certificate{cert}}), nil +} + +// TLSChannelzSecurityValue defines the struct that TLS protocol should return +// from GetSecurityValue(), containing security info like cipher and certificate used. +// +// This API is EXPERIMENTAL. +type TLSChannelzSecurityValue struct { + ChannelzSecurityValue + StandardName string + LocalCertificate []byte + RemoteCertificate []byte +} + +var cipherSuiteLookup = map[uint16]string{ + tls.TLS_RSA_WITH_RC4_128_SHA: "TLS_RSA_WITH_RC4_128_SHA", + tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA: "TLS_RSA_WITH_3DES_EDE_CBC_SHA", + tls.TLS_RSA_WITH_AES_128_CBC_SHA: "TLS_RSA_WITH_AES_128_CBC_SHA", + tls.TLS_RSA_WITH_AES_256_CBC_SHA: "TLS_RSA_WITH_AES_256_CBC_SHA", + tls.TLS_RSA_WITH_AES_128_GCM_SHA256: "TLS_RSA_WITH_AES_128_GCM_SHA256", + tls.TLS_RSA_WITH_AES_256_GCM_SHA384: "TLS_RSA_WITH_AES_256_GCM_SHA384", + tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA: "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", + tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA: "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", + tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA: "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", + tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA: "TLS_ECDHE_RSA_WITH_RC4_128_SHA", + tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA: "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", + tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA: "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", + tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", + tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256: "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", + tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", + tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384: "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", + tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384: "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", + tls.TLS_FALLBACK_SCSV: "TLS_FALLBACK_SCSV", + tls.TLS_RSA_WITH_AES_128_CBC_SHA256: "TLS_RSA_WITH_AES_128_CBC_SHA256", + tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256: "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256", + tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256: "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", + tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305: "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305", + tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305: "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305", +} + +// cloneTLSConfig returns a shallow clone of the exported +// fields of cfg, ignoring the unexported sync.Once, which +// contains a mutex and must not be copied. +// +// If cfg is nil, a new zero tls.Config is returned. +// +// TODO: inline this function if possible. +func cloneTLSConfig(cfg *tls.Config) *tls.Config { + if cfg == nil { + return &tls.Config{} + } + + return cfg.Clone() +} diff --git a/vendor/google.golang.org/grpc/dialoptions.go b/vendor/google.golang.org/grpc/dialoptions.go index e8f34d0d6ea..9af3eef7ab3 100644 --- a/vendor/google.golang.org/grpc/dialoptions.go +++ b/vendor/google.golang.org/grpc/dialoptions.go @@ -24,11 +24,12 @@ import ( "net" "time" + "google.golang.org/grpc/backoff" "google.golang.org/grpc/balancer" "google.golang.org/grpc/credentials" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal" - "google.golang.org/grpc/internal/backoff" + internalbackoff "google.golang.org/grpc/internal/backoff" "google.golang.org/grpc/internal/envconfig" "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/keepalive" @@ -47,7 +48,7 @@ type dialOptions struct { cp Compressor dc Decompressor - bs backoff.Strategy + bs internalbackoff.Strategy block bool insecure bool timeout time.Duration @@ -68,6 +69,10 @@ type dialOptions struct { minConnectTimeout func() time.Duration defaultServiceConfig *ServiceConfig // defaultServiceConfig is parsed from defaultServiceConfigRawJSON. defaultServiceConfigRawJSON *string + // This is used by ccResolverWrapper to backoff between successive calls to + // resolver.ResolveNow(). The user will have no need to configure this, but + // we need to be able to configure this in tests. + resolveNowBackoff func(int) time.Duration } // DialOption configures how we set up the connection. @@ -246,8 +251,28 @@ func WithServiceConfig(c <-chan ServiceConfig) DialOption { }) } +// WithConnectParams configures the dialer to use the provided ConnectParams. +// +// The backoff configuration specified as part of the ConnectParams overrides +// all defaults specified in +// https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. Consider +// using the backoff.DefaultConfig as a base, in cases where you want to +// override only a subset of the backoff configuration. +// +// This API is EXPERIMENTAL. +func WithConnectParams(p ConnectParams) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.bs = internalbackoff.Exponential{Config: p.Backoff} + o.minConnectTimeout = func() time.Duration { + return p.MinConnectTimeout + } + }) +} + // WithBackoffMaxDelay configures the dialer to use the provided maximum delay // when backing off after failed connection attempts. +// +// Deprecated: use WithConnectParams instead. Will be supported throughout 1.x. func WithBackoffMaxDelay(md time.Duration) DialOption { return WithBackoffConfig(BackoffConfig{MaxDelay: md}) } @@ -255,19 +280,18 @@ func WithBackoffMaxDelay(md time.Duration) DialOption { // WithBackoffConfig configures the dialer to use the provided backoff // parameters after connection failures. // -// Use WithBackoffMaxDelay until more parameters on BackoffConfig are opened up -// for use. +// Deprecated: use WithConnectParams instead. Will be supported throughout 1.x. func WithBackoffConfig(b BackoffConfig) DialOption { - return withBackoff(backoff.Exponential{ - MaxDelay: b.MaxDelay, - }) + bc := backoff.DefaultConfig + bc.MaxDelay = b.MaxDelay + return withBackoff(internalbackoff.Exponential{Config: bc}) } // withBackoff sets the backoff strategy used for connectRetryNum after a failed // connection attempt. // // This can be exported if arbitrary backoff strategies are allowed by gRPC. -func withBackoff(bs backoff.Strategy) DialOption { +func withBackoff(bs internalbackoff.Strategy) DialOption { return newFuncDialOption(func(o *dialOptions) { o.bs = bs }) @@ -322,8 +346,8 @@ func WithCredentialsBundle(b credentials.Bundle) DialOption { // WithTimeout returns a DialOption that configures a timeout for dialing a // ClientConn initially. This is valid if and only if WithBlock() is present. // -// Deprecated: use DialContext and context.WithTimeout instead. Will be -// supported throughout 1.x. +// Deprecated: use DialContext instead of Dial and context.WithTimeout +// instead. Will be supported throughout 1.x. func WithTimeout(d time.Duration) DialOption { return newFuncDialOption(func(o *dialOptions) { o.timeout = d @@ -455,6 +479,8 @@ func WithAuthority(a string) DialOption { // WithChannelzParentID returns a DialOption that specifies the channelz ID of // current ClientConn's parent. This function is used in nested channel creation // (e.g. grpclb dial). +// +// This API is EXPERIMENTAL. func WithChannelzParentID(id int64) DialOption { return newFuncDialOption(func(o *dialOptions) { o.channelzParentID = id @@ -539,6 +565,7 @@ func defaultDialOptions() dialOptions { WriteBufferSize: defaultWriteBufSize, ReadBufferSize: defaultReadBufSize, }, + resolveNowBackoff: internalbackoff.DefaultExponential.Backoff, } } @@ -552,3 +579,13 @@ func withMinConnectDeadline(f func() time.Duration) DialOption { o.minConnectTimeout = f }) } + +// withResolveNowBackoff specifies the function that clientconn uses to backoff +// between successive calls to resolver.ResolveNow(). +// +// For testing purpose only. +func withResolveNowBackoff(f func(int) time.Duration) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.resolveNowBackoff = f + }) +} diff --git a/vendor/google.golang.org/grpc/encoding/encoding.go b/vendor/google.golang.org/grpc/encoding/encoding.go index 30a75da99d5..195e8448b64 100644 --- a/vendor/google.golang.org/grpc/encoding/encoding.go +++ b/vendor/google.golang.org/grpc/encoding/encoding.go @@ -46,6 +46,10 @@ type Compressor interface { // coding header. The result must be static; the result cannot change // between calls. Name() string + // EXPERIMENTAL: if a Compressor implements + // DecompressedSize(compressedBytes []byte) int, gRPC will call it + // to determine the size of the buffer allocated for the result of decompression. + // Return -1 to indicate unknown size. } var registeredCompressor = make(map[string]Compressor) diff --git a/vendor/google.golang.org/grpc/encoding/gzip/gzip.go b/vendor/google.golang.org/grpc/encoding/gzip/gzip.go index 09564db197f..5f2991a3b37 100644 --- a/vendor/google.golang.org/grpc/encoding/gzip/gzip.go +++ b/vendor/google.golang.org/grpc/encoding/gzip/gzip.go @@ -23,6 +23,7 @@ package gzip import ( "compress/gzip" + "encoding/binary" "fmt" "io" "io/ioutil" @@ -107,6 +108,17 @@ func (z *reader) Read(p []byte) (n int, err error) { return n, err } +// RFC1952 specifies that the last four bytes "contains the size of +// the original (uncompressed) input data modulo 2^32." +// gRPC has a max message size of 2GB so we don't need to worry about wraparound. +func (c *compressor) DecompressedSize(buf []byte) int { + last := len(buf) + if last < 4 { + return -1 + } + return int(binary.LittleEndian.Uint32(buf[last-4 : last])) +} + func (c *compressor) Name() string { return Name } diff --git a/vendor/google.golang.org/grpc/examples/examples_test.sh b/vendor/google.golang.org/grpc/examples/examples_test.sh new file mode 100755 index 00000000000..dcafe401c97 --- /dev/null +++ b/vendor/google.golang.org/grpc/examples/examples_test.sh @@ -0,0 +1,157 @@ +#!/bin/bash +# +# 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. +# + +set +e -x + +export TMPDIR=$(mktemp -d) +trap "rm -rf ${TMPDIR}" EXIT + +clean () { + for i in {1..10}; do + jobs -p | xargs -n1 pkill -P + # A simple "wait" just hangs sometimes. Running `jobs` seems to help. + sleep 1 + if jobs | read; then + return + fi + done + echo "$(tput setaf 1) clean failed to kill tests $(tput sgr 0)" + jobs + pstree + exit 1 +} + +fail () { + echo "$(tput setaf 1) $1 $(tput sgr 0)" + clean + exit 1 +} + +pass () { + echo "$(tput setaf 2) $1 $(tput sgr 0)" +} + +EXAMPLES=( + "helloworld" + "route_guide" + "features/authentication" + "features/compression" + "features/deadline" + "features/encryption/TLS" + "features/errors" + "features/interceptor" + "features/load_balancing" + "features/metadata" + "features/multiplex" + "features/name_resolving" +) + +declare -A EXPECTED_SERVER_OUTPUT=( + ["helloworld"]="Received: world" + ["route_guide"]="" + ["features/authentication"]="server starting on port 50051..." + ["features/compression"]="UnaryEcho called with message \"compress\"" + ["features/deadline"]="" + ["features/encryption/TLS"]="" + ["features/errors"]="" + ["features/interceptor"]="unary echoing message \"hello world\"" + ["features/load_balancing"]="serving on :50051" + ["features/metadata"]="message:\"this is examples/metadata\" , sending echo" + ["features/multiplex"]=":50051" + ["features/name_resolving"]="serving on localhost:50051" +) + +declare -A EXPECTED_CLIENT_OUTPUT=( + ["helloworld"]="Greeting: Hello world" + ["route_guide"]="location:" + ["features/authentication"]="UnaryEcho: hello world" + ["features/compression"]="UnaryEcho call returned \"compress\", " + ["features/deadline"]="wanted = DeadlineExceeded, got = DeadlineExceeded" + ["features/encryption/TLS"]="UnaryEcho: hello world" + ["features/errors"]="Greeting: Hello world" + ["features/interceptor"]="UnaryEcho: hello world" + ["features/load_balancing"]="calling helloworld.Greeter/SayHello with pick_first" + ["features/metadata"]="this is examples/metadata" + ["features/multiplex"]="Greeting: Hello multiplex" + ["features/name_resolving"]="calling helloworld.Greeter/SayHello to \"example:///resolver.example.grpc.io\"" +) + +for example in ${EXAMPLES[@]}; do + echo "$(tput setaf 4) testing: ${example} $(tput sgr 0)" + + # Build server + if ! go build -o /dev/null ./examples/${example}/*server/*.go; then + fail "failed to build server" + else + pass "successfully built server" + fi + + # Build client + if ! go build -o /dev/null ./examples/${example}/*client/*.go; then + fail "failed to build client" + else + pass "successfully built client" + fi + + # Start server + SERVER_LOG="$(mktemp)" + go run ./examples/$example/*server/*.go &> $SERVER_LOG & + + CLIENT_LOG="$(mktemp)" + if ! timeout 20 go run examples/${example}/*client/*.go &> $CLIENT_LOG; then + fail "client failed to communicate with server + got server log: + $(cat $SERVER_LOG) + got client log: + $(cat $CLIENT_LOG) + " + else + pass "client successfully communitcated with server" + fi + + # Check server log for expected output if expecting an + # output + if [ -n "${EXPECTED_SERVER_OUTPUT[$example]}" ]; then + if ! grep -q "${EXPECTED_SERVER_OUTPUT[$example]}" $SERVER_LOG; then + fail "server log missing output: ${EXPECTED_SERVER_OUTPUT[$example]} + got server log: + $(cat $SERVER_LOG) + got client log: + $(cat $CLIENT_LOG) + " + else + pass "server log contains expected output: ${EXPECTED_SERVER_OUTPUT[$example]}" + fi + fi + + # Check client log for expected output if expecting an + # output + if [ -n "${EXPECTED_CLIENT_OUTPUT[$example]}" ]; then + if ! grep -q "${EXPECTED_CLIENT_OUTPUT[$example]}" $CLIENT_LOG; then + fail "client log missing output: ${EXPECTED_CLIENT_OUTPUT[$example]} + got server log: + $(cat $SERVER_LOG) + got client log: + $(cat $CLIENT_LOG) + " + else + pass "client log contains expected output: ${EXPECTED_CLIENT_OUTPUT[$example]}" + fi + fi + + clean +done diff --git a/vendor/google.golang.org/grpc/examples/features/authentication/client/main.go b/vendor/google.golang.org/grpc/examples/features/authentication/client/main.go index 1097eafa525..7790e58eeac 100644 --- a/vendor/google.golang.org/grpc/examples/features/authentication/client/main.go +++ b/vendor/google.golang.org/grpc/examples/features/authentication/client/main.go @@ -66,6 +66,7 @@ func main() { grpc.WithTransportCredentials(creds), } + opts = append(opts, grpc.WithBlock()) conn, err := grpc.Dial(*addr, opts...) if err != nil { log.Fatalf("did not connect: %v", err) diff --git a/vendor/google.golang.org/grpc/examples/features/authentication/server/main.go b/vendor/google.golang.org/grpc/examples/features/authentication/server/main.go index 3ea94cda7e6..63983e1a60d 100644 --- a/vendor/google.golang.org/grpc/examples/features/authentication/server/main.go +++ b/vendor/google.golang.org/grpc/examples/features/authentication/server/main.go @@ -32,10 +32,11 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" - ecpb "google.golang.org/grpc/examples/features/proto/echo" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/grpc/testdata" + + pb "google.golang.org/grpc/examples/features/proto/echo" ) var ( @@ -62,7 +63,7 @@ func main() { grpc.Creds(credentials.NewServerTLSFromCert(&cert)), } s := grpc.NewServer(opts...) - ecpb.RegisterEchoServer(s, &ecServer{}) + pb.RegisterEchoServer(s, &ecServer{}) lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port)) if err != nil { log.Fatalf("failed to listen: %v", err) @@ -72,19 +73,12 @@ func main() { } } -type ecServer struct{} - -func (s *ecServer) UnaryEcho(ctx context.Context, req *ecpb.EchoRequest) (*ecpb.EchoResponse, error) { - return &ecpb.EchoResponse{Message: req.Message}, nil -} -func (s *ecServer) ServerStreamingEcho(*ecpb.EchoRequest, ecpb.Echo_ServerStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") +type ecServer struct { + pb.UnimplementedEchoServer } -func (s *ecServer) ClientStreamingEcho(ecpb.Echo_ClientStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") -} -func (s *ecServer) BidirectionalStreamingEcho(ecpb.Echo_BidirectionalStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") + +func (s *ecServer) UnaryEcho(ctx context.Context, req *pb.EchoRequest) (*pb.EchoResponse, error) { + return &pb.EchoResponse{Message: req.Message}, nil } // valid validates the authorization. diff --git a/vendor/google.golang.org/grpc/examples/features/cancellation/server/main.go b/vendor/google.golang.org/grpc/examples/features/cancellation/server/main.go index 2d12bb9028f..520286bf193 100644 --- a/vendor/google.golang.org/grpc/examples/features/cancellation/server/main.go +++ b/vendor/google.golang.org/grpc/examples/features/cancellation/server/main.go @@ -20,7 +20,6 @@ package main import ( - "context" "flag" "fmt" "io" @@ -28,25 +27,14 @@ import ( "net" "google.golang.org/grpc" - "google.golang.org/grpc/codes" + pb "google.golang.org/grpc/examples/features/proto/echo" - "google.golang.org/grpc/status" ) var port = flag.Int("port", 50051, "the port to serve on") -type server struct{} - -func (s *server) UnaryEcho(ctx context.Context, in *pb.EchoRequest) (*pb.EchoResponse, error) { - return nil, status.Error(codes.Unimplemented, "not implemented") -} - -func (s *server) ServerStreamingEcho(in *pb.EchoRequest, stream pb.Echo_ServerStreamingEchoServer) error { - return status.Error(codes.Unimplemented, "not implemented") -} - -func (s *server) ClientStreamingEcho(stream pb.Echo_ClientStreamingEchoServer) error { - return status.Error(codes.Unimplemented, "not implemented") +type server struct { + pb.UnimplementedEchoServer } func (s *server) BidirectionalStreamingEcho(stream pb.Echo_BidirectionalStreamingEchoServer) error { diff --git a/vendor/google.golang.org/grpc/examples/features/compression/client/main.go b/vendor/google.golang.org/grpc/examples/features/compression/client/main.go index 4375c5d7ef9..df6d825a3ee 100644 --- a/vendor/google.golang.org/grpc/examples/features/compression/client/main.go +++ b/vendor/google.golang.org/grpc/examples/features/compression/client/main.go @@ -37,7 +37,7 @@ func main() { flag.Parse() // Set up a connection to the server. - conn, err := grpc.Dial(*addr, grpc.WithInsecure()) + conn, err := grpc.Dial(*addr, grpc.WithInsecure(), grpc.WithBlock()) if err != nil { log.Fatalf("did not connect: %v", err) } diff --git a/vendor/google.golang.org/grpc/examples/features/compression/server/main.go b/vendor/google.golang.org/grpc/examples/features/compression/server/main.go index f2862c07ad7..e495cc89106 100644 --- a/vendor/google.golang.org/grpc/examples/features/compression/server/main.go +++ b/vendor/google.golang.org/grpc/examples/features/compression/server/main.go @@ -27,34 +27,22 @@ import ( "net" "google.golang.org/grpc" - "google.golang.org/grpc/codes" - pb "google.golang.org/grpc/examples/features/proto/echo" - "google.golang.org/grpc/status" - _ "google.golang.org/grpc/encoding/gzip" // Install the gzip compressor + + pb "google.golang.org/grpc/examples/features/proto/echo" ) var port = flag.Int("port", 50051, "the port to serve on") -type server struct{} +type server struct { + pb.UnimplementedEchoServer +} func (s *server) UnaryEcho(ctx context.Context, in *pb.EchoRequest) (*pb.EchoResponse, error) { fmt.Printf("UnaryEcho called with message %q\n", in.GetMessage()) return &pb.EchoResponse{Message: in.Message}, nil } -func (s *server) ServerStreamingEcho(in *pb.EchoRequest, stream pb.Echo_ServerStreamingEchoServer) error { - return status.Error(codes.Unimplemented, "not implemented") -} - -func (s *server) ClientStreamingEcho(stream pb.Echo_ClientStreamingEchoServer) error { - return status.Error(codes.Unimplemented, "not implemented") -} - -func (s *server) BidirectionalStreamingEcho(stream pb.Echo_BidirectionalStreamingEchoServer) error { - return status.Error(codes.Unimplemented, "not implemented") -} - func main() { flag.Parse() diff --git a/vendor/google.golang.org/grpc/examples/features/deadline/client/main.go b/vendor/google.golang.org/grpc/examples/features/deadline/client/main.go index 0e2626130ce..026ce96f429 100644 --- a/vendor/google.golang.org/grpc/examples/features/deadline/client/main.go +++ b/vendor/google.golang.org/grpc/examples/features/deadline/client/main.go @@ -72,7 +72,7 @@ func streamingCall(c pb.EchoClient, requestID int, message string, want codes.Co func main() { flag.Parse() - conn, err := grpc.Dial(*addr, grpc.WithInsecure()) + conn, err := grpc.Dial(*addr, grpc.WithInsecure(), grpc.WithBlock()) if err != nil { log.Fatalf("did not connect: %v", err) } diff --git a/vendor/google.golang.org/grpc/examples/features/deadline/server/main.go b/vendor/google.golang.org/grpc/examples/features/deadline/server/main.go index 63044b542b5..11cd47a6b5b 100644 --- a/vendor/google.golang.org/grpc/examples/features/deadline/server/main.go +++ b/vendor/google.golang.org/grpc/examples/features/deadline/server/main.go @@ -31,14 +31,16 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" - pb "google.golang.org/grpc/examples/features/proto/echo" "google.golang.org/grpc/status" + + pb "google.golang.org/grpc/examples/features/proto/echo" ) var port = flag.Int("port", 50052, "port number") // server is used to implement EchoServer. type server struct { + pb.UnimplementedEchoServer client pb.EchoClient cc *grpc.ClientConn } @@ -58,14 +60,6 @@ func (s *server) UnaryEcho(ctx context.Context, req *pb.EchoRequest) (*pb.EchoRe return &pb.EchoResponse{Message: req.Message}, nil } -func (s *server) ServerStreamingEcho(req *pb.EchoRequest, stream pb.Echo_ServerStreamingEchoServer) error { - return status.Error(codes.Unimplemented, "RPC unimplemented") -} - -func (s *server) ClientStreamingEcho(stream pb.Echo_ClientStreamingEchoServer) error { - return status.Error(codes.Unimplemented, "RPC unimplemented") -} - func (s *server) BidirectionalStreamingEcho(stream pb.Echo_BidirectionalStreamingEchoServer) error { for { req, err := stream.Recv() diff --git a/vendor/google.golang.org/grpc/examples/features/debugging/README.md b/vendor/google.golang.org/grpc/examples/features/debugging/README.md index 008989932ff..41618e960a3 100644 --- a/vendor/google.golang.org/grpc/examples/features/debugging/README.md +++ b/vendor/google.golang.org/grpc/examples/features/debugging/README.md @@ -11,7 +11,7 @@ To turn on the logs for debugging, run the code with the following environment v `GRPC_GO_LOG_VERBOSITY_LEVEL=99 GRPC_GO_LOG_SEVERITY_LEVEL=info`. ## Channelz -We also provides a runtime debugging tool, Channelz, to help users with live debugging. +We also provide a runtime debugging tool, Channelz, to help users with live debugging. See the channelz blog post here ([link](https://grpc.io/blog/a_short_introduction_to_channelz)) for details about how to use channelz service to debug live program. @@ -26,4 +26,4 @@ go run server/main.go ``` go run client/main.go -``` \ No newline at end of file +``` diff --git a/vendor/google.golang.org/grpc/examples/features/debugging/client/main.go b/vendor/google.golang.org/grpc/examples/features/debugging/client/main.go index 5fc774dfd8a..33b7a0a1475 100644 --- a/vendor/google.golang.org/grpc/examples/features/debugging/client/main.go +++ b/vendor/google.golang.org/grpc/examples/features/debugging/client/main.go @@ -20,17 +20,18 @@ package main import ( + "context" "log" "net" "os" "time" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/channelz/service" - pb "google.golang.org/grpc/examples/helloworld/helloworld" "google.golang.org/grpc/resolver" "google.golang.org/grpc/resolver/manual" + + pb "google.golang.org/grpc/examples/helloworld/helloworld" ) const ( diff --git a/vendor/google.golang.org/grpc/examples/features/debugging/server/main.go b/vendor/google.golang.org/grpc/examples/features/debugging/server/main.go index 8dab454d6d6..397cb0c781e 100644 --- a/vendor/google.golang.org/grpc/examples/features/debugging/server/main.go +++ b/vendor/google.golang.org/grpc/examples/features/debugging/server/main.go @@ -20,15 +20,16 @@ package main import ( + "context" "log" "net" "time" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/channelz/service" - pb "google.golang.org/grpc/examples/helloworld/helloworld" "google.golang.org/grpc/internal/grpcrand" + + pb "google.golang.org/grpc/examples/helloworld/helloworld" ) var ( @@ -36,7 +37,9 @@ var ( ) // server is used to implement helloworld.GreeterServer. -type server struct{} +type server struct { + pb.UnimplementedGreeterServer +} // SayHello implements helloworld.GreeterServer func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) { @@ -44,7 +47,9 @@ func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloRe } // slow server is used to simulate a server that has a variable delay in its response. -type slowServer struct{} +type slowServer struct { + pb.UnimplementedGreeterServer +} // SayHello implements helloworld.GreeterServer func (s *slowServer) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) { diff --git a/vendor/google.golang.org/grpc/examples/features/encryption/ALTS/client/main.go b/vendor/google.golang.org/grpc/examples/features/encryption/ALTS/client/main.go index aa090807ba3..e2654f5865f 100644 --- a/vendor/google.golang.org/grpc/examples/features/encryption/ALTS/client/main.go +++ b/vendor/google.golang.org/grpc/examples/features/encryption/ALTS/client/main.go @@ -50,7 +50,7 @@ func main() { altsTC := alts.NewClientCreds(alts.DefaultClientOptions()) // Set up a connection to the server. - conn, err := grpc.Dial(*addr, grpc.WithTransportCredentials(altsTC)) + conn, err := grpc.Dial(*addr, grpc.WithTransportCredentials(altsTC), grpc.WithBlock()) if err != nil { log.Fatalf("did not connect: %v", err) } diff --git a/vendor/google.golang.org/grpc/examples/features/encryption/ALTS/server/main.go b/vendor/google.golang.org/grpc/examples/features/encryption/ALTS/server/main.go index f4b84d72f67..87bedd810f4 100644 --- a/vendor/google.golang.org/grpc/examples/features/encryption/ALTS/server/main.go +++ b/vendor/google.golang.org/grpc/examples/features/encryption/ALTS/server/main.go @@ -27,30 +27,19 @@ import ( "net" "google.golang.org/grpc" - "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials/alts" - ecpb "google.golang.org/grpc/examples/features/proto/echo" - "google.golang.org/grpc/status" + + pb "google.golang.org/grpc/examples/features/proto/echo" ) var port = flag.Int("port", 50051, "the port to serve on") -type ecServer struct{} - -func (s *ecServer) UnaryEcho(ctx context.Context, req *ecpb.EchoRequest) (*ecpb.EchoResponse, error) { - return &ecpb.EchoResponse{Message: req.Message}, nil -} - -func (s *ecServer) ServerStreamingEcho(*ecpb.EchoRequest, ecpb.Echo_ServerStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") -} - -func (s *ecServer) ClientStreamingEcho(ecpb.Echo_ClientStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") +type ecServer struct { + pb.UnimplementedEchoServer } -func (s *ecServer) BidirectionalStreamingEcho(ecpb.Echo_BidirectionalStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") +func (s *ecServer) UnaryEcho(ctx context.Context, req *pb.EchoRequest) (*pb.EchoResponse, error) { + return &pb.EchoResponse{Message: req.Message}, nil } func main() { @@ -66,7 +55,7 @@ func main() { s := grpc.NewServer(grpc.Creds(altsTC)) // Register EchoServer on the server. - ecpb.RegisterEchoServer(s, &ecServer{}) + pb.RegisterEchoServer(s, &ecServer{}) if err := s.Serve(lis); err != nil { log.Fatalf("failed to serve: %v", err) diff --git a/vendor/google.golang.org/grpc/examples/features/encryption/TLS/client/main.go b/vendor/google.golang.org/grpc/examples/features/encryption/TLS/client/main.go index 3cac02113a7..71bd23bd84b 100644 --- a/vendor/google.golang.org/grpc/examples/features/encryption/TLS/client/main.go +++ b/vendor/google.golang.org/grpc/examples/features/encryption/TLS/client/main.go @@ -54,7 +54,7 @@ func main() { } // Set up a connection to the server. - conn, err := grpc.Dial(*addr, grpc.WithTransportCredentials(creds)) + conn, err := grpc.Dial(*addr, grpc.WithTransportCredentials(creds), grpc.WithBlock()) if err != nil { log.Fatalf("did not connect: %v", err) } diff --git a/vendor/google.golang.org/grpc/examples/features/encryption/TLS/server/main.go b/vendor/google.golang.org/grpc/examples/features/encryption/TLS/server/main.go index 538a2b87d65..10795178de7 100644 --- a/vendor/google.golang.org/grpc/examples/features/encryption/TLS/server/main.go +++ b/vendor/google.golang.org/grpc/examples/features/encryption/TLS/server/main.go @@ -27,31 +27,20 @@ import ( "net" "google.golang.org/grpc" - "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" - ecpb "google.golang.org/grpc/examples/features/proto/echo" - "google.golang.org/grpc/status" "google.golang.org/grpc/testdata" + + pb "google.golang.org/grpc/examples/features/proto/echo" ) var port = flag.Int("port", 50051, "the port to serve on") -type ecServer struct{} - -func (s *ecServer) UnaryEcho(ctx context.Context, req *ecpb.EchoRequest) (*ecpb.EchoResponse, error) { - return &ecpb.EchoResponse{Message: req.Message}, nil -} - -func (s *ecServer) ServerStreamingEcho(*ecpb.EchoRequest, ecpb.Echo_ServerStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") -} - -func (s *ecServer) ClientStreamingEcho(ecpb.Echo_ClientStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") +type ecServer struct { + pb.UnimplementedEchoServer } -func (s *ecServer) BidirectionalStreamingEcho(ecpb.Echo_BidirectionalStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") +func (s *ecServer) UnaryEcho(ctx context.Context, req *pb.EchoRequest) (*pb.EchoResponse, error) { + return &pb.EchoResponse{Message: req.Message}, nil } func main() { @@ -71,7 +60,7 @@ func main() { s := grpc.NewServer(grpc.Creds(creds)) // Register EchoServer on the server. - ecpb.RegisterEchoServer(s, &ecServer{}) + pb.RegisterEchoServer(s, &ecServer{}) if err := s.Serve(lis); err != nil { log.Fatalf("failed to serve: %v", err) diff --git a/vendor/google.golang.org/grpc/examples/features/errors/client/main.go b/vendor/google.golang.org/grpc/examples/features/errors/client/main.go index 4bacff5f3e5..b87fb48a9bb 100644 --- a/vendor/google.golang.org/grpc/examples/features/errors/client/main.go +++ b/vendor/google.golang.org/grpc/examples/features/errors/client/main.go @@ -38,7 +38,7 @@ func main() { flag.Parse() // Set up a connection to the server. - conn, err := grpc.Dial(*addr, grpc.WithInsecure()) + conn, err := grpc.Dial(*addr, grpc.WithInsecure(), grpc.WithBlock()) if err != nil { log.Fatalf("did not connect: %v", err) } diff --git a/vendor/google.golang.org/grpc/examples/features/errors/server/main.go b/vendor/google.golang.org/grpc/examples/features/errors/server/main.go index d306c4eb0cc..dc337741ad0 100644 --- a/vendor/google.golang.org/grpc/examples/features/errors/server/main.go +++ b/vendor/google.golang.org/grpc/examples/features/errors/server/main.go @@ -27,17 +27,19 @@ import ( "net" "sync" - epb "google.golang.org/genproto/googleapis/rpc/errdetails" "google.golang.org/grpc" "google.golang.org/grpc/codes" - pb "google.golang.org/grpc/examples/helloworld/helloworld" "google.golang.org/grpc/status" + + epb "google.golang.org/genproto/googleapis/rpc/errdetails" + pb "google.golang.org/grpc/examples/helloworld/helloworld" ) var port = flag.Int("port", 50052, "port number") // server is used to implement helloworld.GreeterServer. type server struct { + pb.UnimplementedGreeterServer mu sync.Mutex count map[string]int } diff --git a/vendor/google.golang.org/grpc/examples/features/interceptor/README.md b/vendor/google.golang.org/grpc/examples/features/interceptor/README.md index 32912fd82ae..1e74b2881cc 100644 --- a/vendor/google.golang.org/grpc/examples/features/interceptor/README.md +++ b/vendor/google.golang.org/grpc/examples/features/interceptor/README.md @@ -42,7 +42,7 @@ the args passed in, such as RPC context, method string, request to be sent, and CallOptions configured. With the info, users can even modify the RPC call. For instance, in the example, we examine the list of CallOptions and see if call credential has been configured. If not, configure it to use oauth2 with token -"some-secrete-token" as fallback. In our example, we intentionally omit +"some-secret-token" as fallback. In our example, we intentionally omit configuring the per RPC credential to resort to fallback. After pre-processing is done, use can invoke the RPC call by calling the diff --git a/vendor/google.golang.org/grpc/examples/features/interceptor/client/main.go b/vendor/google.golang.org/grpc/examples/features/interceptor/client/main.go index 4f5ed23fb4e..0642477c4e3 100644 --- a/vendor/google.golang.org/grpc/examples/features/interceptor/client/main.go +++ b/vendor/google.golang.org/grpc/examples/features/interceptor/client/main.go @@ -152,7 +152,7 @@ func main() { } // Set up a connection to the server. - conn, err := grpc.Dial(*addr, grpc.WithTransportCredentials(creds), grpc.WithUnaryInterceptor(unaryInterceptor), grpc.WithStreamInterceptor(streamInterceptor)) + conn, err := grpc.Dial(*addr, grpc.WithTransportCredentials(creds), grpc.WithUnaryInterceptor(unaryInterceptor), grpc.WithStreamInterceptor(streamInterceptor), grpc.WithBlock()) if err != nil { log.Fatalf("did not connect: %v", err) } diff --git a/vendor/google.golang.org/grpc/examples/features/interceptor/server/main.go b/vendor/google.golang.org/grpc/examples/features/interceptor/server/main.go index 54ae297c545..2ad04c1584c 100644 --- a/vendor/google.golang.org/grpc/examples/features/interceptor/server/main.go +++ b/vendor/google.golang.org/grpc/examples/features/interceptor/server/main.go @@ -32,10 +32,11 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" - ecpb "google.golang.org/grpc/examples/features/proto/echo" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/grpc/testdata" + + pb "google.golang.org/grpc/examples/features/proto/echo" ) var ( @@ -50,22 +51,16 @@ func logger(format string, a ...interface{}) { fmt.Printf("LOG:\t"+format+"\n", a...) } -type server struct{} - -func (s *server) UnaryEcho(ctx context.Context, in *ecpb.EchoRequest) (*ecpb.EchoResponse, error) { - fmt.Printf("unary echoing message %q\n", in.Message) - return &ecpb.EchoResponse{Message: in.Message}, nil -} - -func (s *server) ServerStreamingEcho(in *ecpb.EchoRequest, stream ecpb.Echo_ServerStreamingEchoServer) error { - return status.Error(codes.Unimplemented, "not implemented") +type server struct { + pb.UnimplementedEchoServer } -func (s *server) ClientStreamingEcho(stream ecpb.Echo_ClientStreamingEchoServer) error { - return status.Error(codes.Unimplemented, "not implemented") +func (s *server) UnaryEcho(ctx context.Context, in *pb.EchoRequest) (*pb.EchoResponse, error) { + fmt.Printf("unary echoing message %q\n", in.Message) + return &pb.EchoResponse{Message: in.Message}, nil } -func (s *server) BidirectionalStreamingEcho(stream ecpb.Echo_BidirectionalStreamingEchoServer) error { +func (s *server) BidirectionalStreamingEcho(stream pb.Echo_BidirectionalStreamingEchoServer) error { for { in, err := stream.Recv() if err != nil { @@ -76,7 +71,7 @@ func (s *server) BidirectionalStreamingEcho(stream ecpb.Echo_BidirectionalStream return err } fmt.Printf("bidi echoing message %q\n", in.Message) - stream.Send(&ecpb.EchoResponse{Message: in.Message}) + stream.Send(&pb.EchoResponse{Message: in.Message}) } } @@ -162,7 +157,7 @@ func main() { s := grpc.NewServer(grpc.Creds(creds), grpc.UnaryInterceptor(unaryInterceptor), grpc.StreamInterceptor(streamInterceptor)) // Register EchoServer on the server. - ecpb.RegisterEchoServer(s, &server{}) + pb.RegisterEchoServer(s, &server{}) if err := s.Serve(lis); err != nil { log.Fatalf("failed to serve: %v", err) diff --git a/vendor/google.golang.org/grpc/examples/features/keepalive/server/main.go b/vendor/google.golang.org/grpc/examples/features/keepalive/server/main.go index 723a6b906c9..beaa8f71088 100644 --- a/vendor/google.golang.org/grpc/examples/features/keepalive/server/main.go +++ b/vendor/google.golang.org/grpc/examples/features/keepalive/server/main.go @@ -28,10 +28,9 @@ import ( "time" "google.golang.org/grpc" - "google.golang.org/grpc/codes" - pb "google.golang.org/grpc/examples/features/proto/echo" "google.golang.org/grpc/keepalive" - "google.golang.org/grpc/status" + + pb "google.golang.org/grpc/examples/features/proto/echo" ) var port = flag.Int("port", 50052, "port number") @@ -50,24 +49,14 @@ var kasp = keepalive.ServerParameters{ } // server implements EchoServer. -type server struct{} +type server struct { + pb.UnimplementedEchoServer +} func (s *server) UnaryEcho(ctx context.Context, req *pb.EchoRequest) (*pb.EchoResponse, error) { return &pb.EchoResponse{Message: req.Message}, nil } -func (s *server) ServerStreamingEcho(req *pb.EchoRequest, stream pb.Echo_ServerStreamingEchoServer) error { - return status.Error(codes.Unimplemented, "RPC unimplemented") -} - -func (s *server) ClientStreamingEcho(stream pb.Echo_ClientStreamingEchoServer) error { - return status.Error(codes.Unimplemented, "RPC unimplemented") -} - -func (s *server) BidirectionalStreamingEcho(stream pb.Echo_BidirectionalStreamingEchoServer) error { - return status.Error(codes.Unimplemented, "RPC unimplemented") -} - func main() { flag.Parse() diff --git a/vendor/google.golang.org/grpc/examples/features/load_balancing/client/main.go b/vendor/google.golang.org/grpc/examples/features/load_balancing/client/main.go index 27a1552a32e..8cf0ba03b39 100644 --- a/vendor/google.golang.org/grpc/examples/features/load_balancing/client/main.go +++ b/vendor/google.golang.org/grpc/examples/features/load_balancing/client/main.go @@ -59,6 +59,7 @@ func main() { fmt.Sprintf("%s:///%s", exampleScheme, exampleServiceName), // grpc.WithBalancerName("pick_first"), // "pick_first" is the default, so this DialOption is not necessary. grpc.WithInsecure(), + grpc.WithBlock(), ) if err != nil { log.Fatalf("did not connect: %v", err) @@ -75,6 +76,7 @@ func main() { fmt.Sprintf("%s:///%s", exampleScheme, exampleServiceName), grpc.WithBalancerName("round_robin"), // This sets the initial balancing policy. grpc.WithInsecure(), + grpc.WithBlock(), ) if err != nil { log.Fatalf("did not connect: %v", err) @@ -90,7 +92,7 @@ func main() { type exampleResolverBuilder struct{} -func (*exampleResolverBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOption) (resolver.Resolver, error) { +func (*exampleResolverBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) { r := &exampleResolver{ target: target, cc: cc, @@ -117,8 +119,8 @@ func (r *exampleResolver) start() { } r.cc.UpdateState(resolver.State{Addresses: addrs}) } -func (*exampleResolver) ResolveNow(o resolver.ResolveNowOption) {} -func (*exampleResolver) Close() {} +func (*exampleResolver) ResolveNow(o resolver.ResolveNowOptions) {} +func (*exampleResolver) Close() {} func init() { resolver.Register(&exampleResolverBuilder{}) diff --git a/vendor/google.golang.org/grpc/examples/features/load_balancing/server/main.go b/vendor/google.golang.org/grpc/examples/features/load_balancing/server/main.go index 8a1dad51289..9d179579ed4 100644 --- a/vendor/google.golang.org/grpc/examples/features/load_balancing/server/main.go +++ b/vendor/google.golang.org/grpc/examples/features/load_balancing/server/main.go @@ -27,9 +27,8 @@ import ( "sync" "google.golang.org/grpc" - "google.golang.org/grpc/codes" - ecpb "google.golang.org/grpc/examples/features/proto/echo" - "google.golang.org/grpc/status" + + pb "google.golang.org/grpc/examples/features/proto/echo" ) var ( @@ -37,20 +36,12 @@ var ( ) type ecServer struct { + pb.UnimplementedEchoServer addr string } -func (s *ecServer) UnaryEcho(ctx context.Context, req *ecpb.EchoRequest) (*ecpb.EchoResponse, error) { - return &ecpb.EchoResponse{Message: fmt.Sprintf("%s (from %s)", req.Message, s.addr)}, nil -} -func (s *ecServer) ServerStreamingEcho(*ecpb.EchoRequest, ecpb.Echo_ServerStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") -} -func (s *ecServer) ClientStreamingEcho(ecpb.Echo_ClientStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") -} -func (s *ecServer) BidirectionalStreamingEcho(ecpb.Echo_BidirectionalStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") +func (s *ecServer) UnaryEcho(ctx context.Context, req *pb.EchoRequest) (*pb.EchoResponse, error) { + return &pb.EchoResponse{Message: fmt.Sprintf("%s (from %s)", req.Message, s.addr)}, nil } func startServer(addr string) { @@ -59,7 +50,7 @@ func startServer(addr string) { log.Fatalf("failed to listen: %v", err) } s := grpc.NewServer() - ecpb.RegisterEchoServer(s, &ecServer{addr: addr}) + pb.RegisterEchoServer(s, &ecServer{addr: addr}) log.Printf("serving on %s\n", addr) if err := s.Serve(lis); err != nil { log.Fatalf("failed to serve: %v", err) diff --git a/vendor/google.golang.org/grpc/examples/features/metadata/client/main.go b/vendor/google.golang.org/grpc/examples/features/metadata/client/main.go index 3aa3a599c2d..715fb6f5acb 100644 --- a/vendor/google.golang.org/grpc/examples/features/metadata/client/main.go +++ b/vendor/google.golang.org/grpc/examples/features/metadata/client/main.go @@ -286,7 +286,7 @@ const message = "this is examples/metadata" func main() { flag.Parse() // Set up a connection to the server. - conn, err := grpc.Dial(*addr, grpc.WithInsecure()) + conn, err := grpc.Dial(*addr, grpc.WithInsecure(), grpc.WithBlock()) if err != nil { log.Fatalf("did not connect: %v", err) } diff --git a/vendor/google.golang.org/grpc/examples/features/metadata/server/main.go b/vendor/google.golang.org/grpc/examples/features/metadata/server/main.go index a0dd3b86de7..cda3b497869 100644 --- a/vendor/google.golang.org/grpc/examples/features/metadata/server/main.go +++ b/vendor/google.golang.org/grpc/examples/features/metadata/server/main.go @@ -31,9 +31,10 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" - pb "google.golang.org/grpc/examples/features/proto/echo" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" + + pb "google.golang.org/grpc/examples/features/proto/echo" ) var port = flag.Int("port", 50051, "the port to serve on") @@ -43,7 +44,9 @@ const ( streamingCount = 10 ) -type server struct{} +type server struct { + pb.UnimplementedEchoServer +} func (s *server) UnaryEcho(ctx context.Context, in *pb.EchoRequest) (*pb.EchoResponse, error) { fmt.Printf("--- UnaryEcho ---\n") diff --git a/vendor/google.golang.org/grpc/examples/features/multiplex/client/main.go b/vendor/google.golang.org/grpc/examples/features/multiplex/client/main.go index e25bb7a838b..72d6cd56775 100644 --- a/vendor/google.golang.org/grpc/examples/features/multiplex/client/main.go +++ b/vendor/google.golang.org/grpc/examples/features/multiplex/client/main.go @@ -58,7 +58,7 @@ func callUnaryEcho(client ecpb.EchoClient, message string) { func main() { flag.Parse() // Set up a connection to the server. - conn, err := grpc.Dial(*addr, grpc.WithInsecure()) + conn, err := grpc.Dial(*addr, grpc.WithInsecure(), grpc.WithBlock()) if err != nil { log.Fatalf("did not connect: %v", err) } diff --git a/vendor/google.golang.org/grpc/examples/features/multiplex/server/main.go b/vendor/google.golang.org/grpc/examples/features/multiplex/server/main.go index 956d36fcfcf..18da09adda3 100644 --- a/vendor/google.golang.org/grpc/examples/features/multiplex/server/main.go +++ b/vendor/google.golang.org/grpc/examples/features/multiplex/server/main.go @@ -27,40 +27,31 @@ import ( "net" "google.golang.org/grpc" - "google.golang.org/grpc/codes" + ecpb "google.golang.org/grpc/examples/features/proto/echo" hwpb "google.golang.org/grpc/examples/helloworld/helloworld" - "google.golang.org/grpc/status" ) var port = flag.Int("port", 50051, "the port to serve on") // hwServer is used to implement helloworld.GreeterServer. -type hwServer struct{} +type hwServer struct { + hwpb.UnimplementedGreeterServer +} // SayHello implements helloworld.GreeterServer func (s *hwServer) SayHello(ctx context.Context, in *hwpb.HelloRequest) (*hwpb.HelloReply, error) { return &hwpb.HelloReply{Message: "Hello " + in.Name}, nil } -type ecServer struct{} +type ecServer struct { + ecpb.UnimplementedEchoServer +} func (s *ecServer) UnaryEcho(ctx context.Context, req *ecpb.EchoRequest) (*ecpb.EchoResponse, error) { return &ecpb.EchoResponse{Message: req.Message}, nil } -func (s *ecServer) ServerStreamingEcho(*ecpb.EchoRequest, ecpb.Echo_ServerStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") -} - -func (s *ecServer) ClientStreamingEcho(ecpb.Echo_ClientStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") -} - -func (s *ecServer) BidirectionalStreamingEcho(ecpb.Echo_BidirectionalStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") -} - func main() { flag.Parse() lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port)) diff --git a/vendor/google.golang.org/grpc/examples/features/name_resolving/client/main.go b/vendor/google.golang.org/grpc/examples/features/name_resolving/client/main.go index 626991b0edc..1c56dcce15d 100644 --- a/vendor/google.golang.org/grpc/examples/features/name_resolving/client/main.go +++ b/vendor/google.golang.org/grpc/examples/features/name_resolving/client/main.go @@ -58,6 +58,7 @@ func main() { passthroughConn, err := grpc.Dial( fmt.Sprintf("passthrough:///%s", backendAddr), // Dial to "passthrough:///localhost:50051" grpc.WithInsecure(), + grpc.WithBlock(), ) if err != nil { log.Fatalf("did not connect: %v", err) @@ -72,6 +73,7 @@ func main() { exampleConn, err := grpc.Dial( fmt.Sprintf("%s:///%s", exampleScheme, exampleServiceName), // Dial to "example:///resolver.example.grpc.io" grpc.WithInsecure(), + grpc.WithBlock(), ) if err != nil { log.Fatalf("did not connect: %v", err) @@ -96,7 +98,7 @@ func main() { // ResolverBuilder(https://godoc.org/google.golang.org/grpc/resolver#Builder). type exampleResolverBuilder struct{} -func (*exampleResolverBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOption) (resolver.Resolver, error) { +func (*exampleResolverBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) { r := &exampleResolver{ target: target, cc: cc, @@ -125,8 +127,8 @@ func (r *exampleResolver) start() { } r.cc.UpdateState(resolver.State{Addresses: addrs}) } -func (*exampleResolver) ResolveNow(o resolver.ResolveNowOption) {} -func (*exampleResolver) Close() {} +func (*exampleResolver) ResolveNow(o resolver.ResolveNowOptions) {} +func (*exampleResolver) Close() {} func init() { // Register the example ResolverBuilder. This is usually done in a package's diff --git a/vendor/google.golang.org/grpc/examples/features/name_resolving/server/main.go b/vendor/google.golang.org/grpc/examples/features/name_resolving/server/main.go index d3963a8281b..1977f44d0c5 100644 --- a/vendor/google.golang.org/grpc/examples/features/name_resolving/server/main.go +++ b/vendor/google.golang.org/grpc/examples/features/name_resolving/server/main.go @@ -26,28 +26,19 @@ import ( "net" "google.golang.org/grpc" - "google.golang.org/grpc/codes" - ecpb "google.golang.org/grpc/examples/features/proto/echo" - "google.golang.org/grpc/status" + + pb "google.golang.org/grpc/examples/features/proto/echo" ) const addr = "localhost:50051" type ecServer struct { + pb.UnimplementedEchoServer addr string } -func (s *ecServer) UnaryEcho(ctx context.Context, req *ecpb.EchoRequest) (*ecpb.EchoResponse, error) { - return &ecpb.EchoResponse{Message: fmt.Sprintf("%s (from %s)", req.Message, s.addr)}, nil -} -func (s *ecServer) ServerStreamingEcho(*ecpb.EchoRequest, ecpb.Echo_ServerStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") -} -func (s *ecServer) ClientStreamingEcho(ecpb.Echo_ClientStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") -} -func (s *ecServer) BidirectionalStreamingEcho(ecpb.Echo_BidirectionalStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") +func (s *ecServer) UnaryEcho(ctx context.Context, req *pb.EchoRequest) (*pb.EchoResponse, error) { + return &pb.EchoResponse{Message: fmt.Sprintf("%s (from %s)", req.Message, s.addr)}, nil } func main() { @@ -56,7 +47,7 @@ func main() { log.Fatalf("failed to listen: %v", err) } s := grpc.NewServer() - ecpb.RegisterEchoServer(s, &ecServer{addr: addr}) + pb.RegisterEchoServer(s, &ecServer{addr: addr}) log.Printf("serving on %s\n", addr) if err := s.Serve(lis); err != nil { log.Fatalf("failed to serve: %v", err) diff --git a/vendor/google.golang.org/grpc/examples/features/proto/echo/echo.pb.go b/vendor/google.golang.org/grpc/examples/features/proto/echo/echo.pb.go index 8b1f6f2dabb..4f2b7538c6e 100644 --- a/vendor/google.golang.org/grpc/examples/features/proto/echo/echo.pb.go +++ b/vendor/google.golang.org/grpc/examples/features/proto/echo/echo.pb.go @@ -1,15 +1,16 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: echo.proto -package echo // import "google.golang.org/grpc/examples/features/proto/echo" - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +package echo import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -21,7 +22,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // EchoRequest is the request for echo. type EchoRequest struct { @@ -35,16 +36,17 @@ func (m *EchoRequest) Reset() { *m = EchoRequest{} } func (m *EchoRequest) String() string { return proto.CompactTextString(m) } func (*EchoRequest) ProtoMessage() {} func (*EchoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_echo_9d6886b3223721ca, []int{0} + return fileDescriptor_08134aea513e0001, []int{0} } + func (m *EchoRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EchoRequest.Unmarshal(m, b) } func (m *EchoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_EchoRequest.Marshal(b, m, deterministic) } -func (dst *EchoRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_EchoRequest.Merge(dst, src) +func (m *EchoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_EchoRequest.Merge(m, src) } func (m *EchoRequest) XXX_Size() int { return xxx_messageInfo_EchoRequest.Size(m) @@ -74,16 +76,17 @@ func (m *EchoResponse) Reset() { *m = EchoResponse{} } func (m *EchoResponse) String() string { return proto.CompactTextString(m) } func (*EchoResponse) ProtoMessage() {} func (*EchoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_echo_9d6886b3223721ca, []int{1} + return fileDescriptor_08134aea513e0001, []int{1} } + func (m *EchoResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EchoResponse.Unmarshal(m, b) } func (m *EchoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_EchoResponse.Marshal(b, m, deterministic) } -func (dst *EchoResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_EchoResponse.Merge(dst, src) +func (m *EchoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_EchoResponse.Merge(m, src) } func (m *EchoResponse) XXX_Size() int { return xxx_messageInfo_EchoResponse.Size(m) @@ -106,6 +109,27 @@ func init() { proto.RegisterType((*EchoResponse)(nil), "grpc.examples.echo.EchoResponse") } +func init() { proto.RegisterFile("echo.proto", fileDescriptor_08134aea513e0001) } + +var fileDescriptor_08134aea513e0001 = []byte{ + // 234 bytes of a gzipped FileDescriptorProto + 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 0x1f, 0x91, 0x59, 0xb5, 0xb8, 0x7d, 0x9a, 0x3b, 0x66, + 0x17, 0xa0, 0x1d, 0x07, 0x1b, 0x9d, 0x66, 0x71, 0xa6, 0xac, 0x9a, 0xdd, 0xaa, 0x79, 0x83, 0xcd, + 0x1b, 0x41, 0x32, 0xc3, 0x59, 0x98, 0x62, 0x7a, 0x39, 0x1d, 0xde, 0xf3, 0x9f, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x23, 0x14, 0x26, 0x96, 0x30, 0x02, 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -254,6 +278,23 @@ type EchoServer interface { BidirectionalStreamingEcho(Echo_BidirectionalStreamingEchoServer) error } +// UnimplementedEchoServer can be embedded to have forward compatible implementations. +type UnimplementedEchoServer struct { +} + +func (*UnimplementedEchoServer) UnaryEcho(ctx context.Context, req *EchoRequest) (*EchoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnaryEcho not implemented") +} +func (*UnimplementedEchoServer) ServerStreamingEcho(req *EchoRequest, srv Echo_ServerStreamingEchoServer) error { + return status.Errorf(codes.Unimplemented, "method ServerStreamingEcho not implemented") +} +func (*UnimplementedEchoServer) ClientStreamingEcho(srv Echo_ClientStreamingEchoServer) error { + return status.Errorf(codes.Unimplemented, "method ClientStreamingEcho not implemented") +} +func (*UnimplementedEchoServer) BidirectionalStreamingEcho(srv Echo_BidirectionalStreamingEchoServer) error { + return status.Errorf(codes.Unimplemented, "method BidirectionalStreamingEcho not implemented") +} + func RegisterEchoServer(s *grpc.Server, srv EchoServer) { s.RegisterService(&_Echo_serviceDesc, srv) } @@ -378,24 +419,3 @@ var _Echo_serviceDesc = grpc.ServiceDesc{ }, Metadata: "echo.proto", } - -func init() { proto.RegisterFile("echo.proto", fileDescriptor_echo_9d6886b3223721ca) } - -var fileDescriptor_echo_9d6886b3223721ca = []byte{ - // 234 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0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x59, 0xb5, 0xb8, 0x7d, 0x9a, 0x3b, 0x66, - 0x17, 0xa0, 0x1d, 0x07, 0x1b, 0x9d, 0x66, 0x71, 0xa6, 0xac, 0x9a, 0xdd, 0xaa, 0x79, 0x83, 0xcd, - 0x1b, 0x41, 0x32, 0xc3, 0x59, 0x98, 0x62, 0x7a, 0x39, 0x1d, 0xde, 0xf3, 0x9f, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x23, 0x14, 0x26, 0x96, 0x30, 0x02, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/examples/features/reflection/server/main.go b/vendor/google.golang.org/grpc/examples/features/reflection/server/main.go index c5630025d7c..569273dfdd3 100644 --- a/vendor/google.golang.org/grpc/examples/features/reflection/server/main.go +++ b/vendor/google.golang.org/grpc/examples/features/reflection/server/main.go @@ -27,41 +27,32 @@ import ( "net" "google.golang.org/grpc" - "google.golang.org/grpc/codes" + "google.golang.org/grpc/reflection" + ecpb "google.golang.org/grpc/examples/features/proto/echo" hwpb "google.golang.org/grpc/examples/helloworld/helloworld" - "google.golang.org/grpc/reflection" - "google.golang.org/grpc/status" ) var port = flag.Int("port", 50051, "the port to serve on") // hwServer is used to implement helloworld.GreeterServer. -type hwServer struct{} +type hwServer struct { + hwpb.UnimplementedGreeterServer +} // SayHello implements helloworld.GreeterServer func (s *hwServer) SayHello(ctx context.Context, in *hwpb.HelloRequest) (*hwpb.HelloReply, error) { return &hwpb.HelloReply{Message: "Hello " + in.Name}, nil } -type ecServer struct{} +type ecServer struct { + ecpb.UnimplementedEchoServer +} func (s *ecServer) UnaryEcho(ctx context.Context, req *ecpb.EchoRequest) (*ecpb.EchoResponse, error) { return &ecpb.EchoResponse{Message: req.Message}, nil } -func (s *ecServer) ServerStreamingEcho(*ecpb.EchoRequest, ecpb.Echo_ServerStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") -} - -func (s *ecServer) ClientStreamingEcho(ecpb.Echo_ClientStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") -} - -func (s *ecServer) BidirectionalStreamingEcho(ecpb.Echo_BidirectionalStreamingEchoServer) error { - return status.Errorf(codes.Unimplemented, "not implemented") -} - func main() { flag.Parse() lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port)) diff --git a/vendor/google.golang.org/grpc/examples/features/retry/README.md b/vendor/google.golang.org/grpc/examples/features/retry/README.md new file mode 100644 index 00000000000..f56d438adc2 --- /dev/null +++ b/vendor/google.golang.org/grpc/examples/features/retry/README.md @@ -0,0 +1,66 @@ +# Retry + +This example shows how to enable and configure retry on gRPC clients. + +## Documentation + +[gRFC for client-side retry support](https://github.com/grpc/proposal/blob/master/A6-client-retries.md) + +## Try it + +This example includes a service implementation that fails requests three times with status +code `Unavailable`, then passes the fourth. The client is configured to make four retry attempts +when receiving an `Unavailable` status code. + +First start the server: + +```bash +go run server/main.go +``` + +Then run the client. Note that when running the client, `GRPC_GO_RETRY=on` must be set in +your environment: + +```bash +GRPC_GO_RETRY=on go run client/main.go +``` + +## Usage + +### Define your retry policy + +Retry is enabled via the service config, which can be provided by the name resolver or +a DialOption (described below). In the below config, we set retry policy for the +"grpc.example.echo.Echo" method. + +MaxAttempts: how many times to attempt the RPC before failing. +InitialBackoff, MaxBackoff, BackoffMultiplier: configures delay between attempts. +RetryableStatusCodes: Retry only when receiving these status codes. + +```go + var retryPolicy = `{ + "methodConfig": [{ + // config per method or all methods under service + "name": [{"service": "grpc.examples.echo.Echo"}], + "waitForReady": true, + + "retryPolicy": { + "MaxAttempts": 4, + "InitialBackoff": ".01s", + "MaxBackoff": ".01s", + "BackoffMultiplier": 1.0, + // this value is grpc code + "RetryableStatusCodes": [ "UNAVAILABLE" ] + } + }] + }` +``` + +### Providing the retry policy as a DialOption + +To use the above service config, pass it with `grpc.WithDefaultServiceConfig` to +`grpc.Dial`. + +```go +conn, err := grpc.Dial(ctx,grpc.WithInsecure(), grpc.WithDefaultServiceConfig(retryPolicy)) +``` diff --git a/vendor/google.golang.org/grpc/examples/features/retry/client/main.go b/vendor/google.golang.org/grpc/examples/features/retry/client/main.go new file mode 100644 index 00000000000..73147cfe0a2 --- /dev/null +++ b/vendor/google.golang.org/grpc/examples/features/retry/client/main.go @@ -0,0 +1,78 @@ +/* + * + * 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. + * + */ + +// Binary client is an example client. +package main + +import ( + "context" + "flag" + "log" + "time" + + "google.golang.org/grpc" + pb "google.golang.org/grpc/examples/features/proto/echo" +) + +var ( + addr = flag.String("addr", "localhost:50052", "the address to connect to") + // see https://github.com/grpc/grpc/blob/master/doc/service_config.md to know more about service config + retryPolicy = `{ + "methodConfig": [{ + "name": [{"service": "grpc.examples.echo.Echo"}], + "waitForReady": true, + "retryPolicy": { + "MaxAttempts": 4, + "InitialBackoff": ".01s", + "MaxBackoff": ".01s", + "BackoffMultiplier": 1.0, + "RetryableStatusCodes": [ "UNAVAILABLE" ] + } + }]}` +) + +// use grpc.WithDefaultServiceConfig() to set service config +func retryDial() (*grpc.ClientConn, error) { + return grpc.Dial(*addr, grpc.WithInsecure(), grpc.WithDefaultServiceConfig(retryPolicy)) +} + +func main() { + flag.Parse() + + // Set up a connection to the server. + conn, err := retryDial() + if err != nil { + log.Fatalf("did not connect: %v", err) + } + defer func() { + if e := conn.Close(); e != nil { + log.Printf("failed to close connection: %s", e) + } + }() + + c := pb.NewEchoClient(conn) + + ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second) + defer cancel() + + reply, err := c.UnaryEcho(ctx, &pb.EchoRequest{Message: "Try and Success"}) + if err != nil { + log.Fatalf("UnaryEcho error: %v", err) + } + log.Printf("UnaryEcho reply: %v", reply) +} diff --git a/vendor/google.golang.org/grpc/examples/features/retry/server/main.go b/vendor/google.golang.org/grpc/examples/features/retry/server/main.go new file mode 100644 index 00000000000..fdec2f052e2 --- /dev/null +++ b/vendor/google.golang.org/grpc/examples/features/retry/server/main.go @@ -0,0 +1,93 @@ +/* + * + * 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. + * + */ + +// Binary server is an example server. +package main + +import ( + "context" + "flag" + "fmt" + "log" + "net" + "sync" + + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + pb "google.golang.org/grpc/examples/features/proto/echo" +) + +var port = flag.Int("port", 50052, "port number") + +type failingServer struct { + pb.UnimplementedEchoServer + mu sync.Mutex + + reqCounter uint + reqModulo uint +} + +// this method will fail reqModulo - 1 times RPCs and return status code Unavailable, +// and succeeded RPC on reqModulo times. +func (s *failingServer) maybeFailRequest() error { + s.mu.Lock() + defer s.mu.Unlock() + s.reqCounter++ + if (s.reqModulo > 0) && (s.reqCounter%s.reqModulo == 0) { + return nil + } + + return status.Errorf(codes.Unavailable, "maybeFailRequest: failing it") +} + +func (s *failingServer) UnaryEcho(ctx context.Context, req *pb.EchoRequest) (*pb.EchoResponse, error) { + if err := s.maybeFailRequest(); err != nil { + log.Println("request failed count:", s.reqCounter) + return nil, err + } + + log.Println("request succeeded count:", s.reqCounter) + return &pb.EchoResponse{Message: req.Message}, nil +} + +func main() { + flag.Parse() + + address := fmt.Sprintf(":%v", *port) + lis, err := net.Listen("tcp", address) + if err != nil { + log.Fatalf("failed to listen: %v", err) + } + fmt.Println("listen on address", address) + + s := grpc.NewServer() + + // Configure server to pass every fourth RPC; + // client is configured to make four attempts. + failingservice := &failingServer{ + reqCounter: 0, + reqModulo: 4, + } + + pb.RegisterEchoServer(s, failingservice) + if err := s.Serve(lis); err != nil { + log.Fatalf("failed to serve: %v", err) + } +} diff --git a/vendor/google.golang.org/grpc/examples/features/wait_for_ready/main.go b/vendor/google.golang.org/grpc/examples/features/wait_for_ready/main.go index b7df3bc320f..f865410f1aa 100644 --- a/vendor/google.golang.org/grpc/examples/features/wait_for_ready/main.go +++ b/vendor/google.golang.org/grpc/examples/features/wait_for_ready/main.go @@ -29,29 +29,20 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" - pb "google.golang.org/grpc/examples/features/proto/echo" "google.golang.org/grpc/status" + + pb "google.golang.org/grpc/examples/features/proto/echo" ) // server is used to implement EchoServer. -type server struct{} +type server struct { + pb.UnimplementedEchoServer +} func (s *server) UnaryEcho(ctx context.Context, req *pb.EchoRequest) (*pb.EchoResponse, error) { return &pb.EchoResponse{Message: req.Message}, nil } -func (s *server) ServerStreamingEcho(req *pb.EchoRequest, stream pb.Echo_ServerStreamingEchoServer) error { - return status.Error(codes.Unimplemented, "RPC unimplemented") -} - -func (s *server) ClientStreamingEcho(stream pb.Echo_ClientStreamingEchoServer) error { - return status.Error(codes.Unimplemented, "RPC unimplemented") -} - -func (s *server) BidirectionalStreamingEcho(stream pb.Echo_BidirectionalStreamingEchoServer) error { - return status.Error(codes.Unimplemented, "RPC unimplemented") -} - // serve starts listening with a 2 seconds delay. func serve() { lis, err := net.Listen("tcp", ":50053") diff --git a/vendor/google.golang.org/grpc/examples/helloworld/greeter_client/main.go b/vendor/google.golang.org/grpc/examples/helloworld/greeter_client/main.go index 4330b9e51fc..0ca4cbaa344 100644 --- a/vendor/google.golang.org/grpc/examples/helloworld/greeter_client/main.go +++ b/vendor/google.golang.org/grpc/examples/helloworld/greeter_client/main.go @@ -36,7 +36,7 @@ const ( func main() { // Set up a connection to the server. - conn, err := grpc.Dial(address, grpc.WithInsecure()) + conn, err := grpc.Dial(address, grpc.WithInsecure(), grpc.WithBlock()) if err != nil { log.Fatalf("did not connect: %v", err) } @@ -54,5 +54,5 @@ func main() { if err != nil { log.Fatalf("could not greet: %v", err) } - log.Printf("Greeting: %s", r.Message) + log.Printf("Greeting: %s", r.GetMessage()) } diff --git a/vendor/google.golang.org/grpc/examples/helloworld/greeter_server/main.go b/vendor/google.golang.org/grpc/examples/helloworld/greeter_server/main.go index e99fb26a314..eb2fa0ef8e2 100644 --- a/vendor/google.golang.org/grpc/examples/helloworld/greeter_server/main.go +++ b/vendor/google.golang.org/grpc/examples/helloworld/greeter_server/main.go @@ -35,12 +35,14 @@ const ( ) // server is used to implement helloworld.GreeterServer. -type server struct{} +type server struct { + pb.UnimplementedGreeterServer +} // SayHello implements helloworld.GreeterServer func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) { - log.Printf("Received: %v", in.Name) - return &pb.HelloReply{Message: "Hello " + in.Name}, nil + log.Printf("Received: %v", in.GetName()) + return &pb.HelloReply{Message: "Hello " + in.GetName()}, nil } func main() { diff --git a/vendor/google.golang.org/grpc/examples/helloworld/helloworld/helloworld.pb.go b/vendor/google.golang.org/grpc/examples/helloworld/helloworld/helloworld.pb.go index 11383d7402d..0a823946c58 100644 --- a/vendor/google.golang.org/grpc/examples/helloworld/helloworld/helloworld.pb.go +++ b/vendor/google.golang.org/grpc/examples/helloworld/helloworld/helloworld.pb.go @@ -3,13 +3,14 @@ package helloworld -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -21,7 +22,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // The request message containing the user's name. type HelloRequest struct { @@ -35,16 +36,17 @@ func (m *HelloRequest) Reset() { *m = HelloRequest{} } func (m *HelloRequest) String() string { return proto.CompactTextString(m) } func (*HelloRequest) ProtoMessage() {} func (*HelloRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_helloworld_71e208cbdc16936b, []int{0} + return fileDescriptor_17b8c58d586b62f2, []int{0} } + func (m *HelloRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_HelloRequest.Unmarshal(m, b) } func (m *HelloRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_HelloRequest.Marshal(b, m, deterministic) } -func (dst *HelloRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_HelloRequest.Merge(dst, src) +func (m *HelloRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_HelloRequest.Merge(m, src) } func (m *HelloRequest) XXX_Size() int { return xxx_messageInfo_HelloRequest.Size(m) @@ -74,16 +76,17 @@ func (m *HelloReply) Reset() { *m = HelloReply{} } func (m *HelloReply) String() string { return proto.CompactTextString(m) } func (*HelloReply) ProtoMessage() {} func (*HelloReply) Descriptor() ([]byte, []int) { - return fileDescriptor_helloworld_71e208cbdc16936b, []int{1} + return fileDescriptor_17b8c58d586b62f2, []int{1} } + func (m *HelloReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_HelloReply.Unmarshal(m, b) } func (m *HelloReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_HelloReply.Marshal(b, m, deterministic) } -func (dst *HelloReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_HelloReply.Merge(dst, src) +func (m *HelloReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_HelloReply.Merge(m, src) } func (m *HelloReply) XXX_Size() int { return xxx_messageInfo_HelloReply.Size(m) @@ -106,6 +109,23 @@ func init() { proto.RegisterType((*HelloReply)(nil), "helloworld.HelloReply") } +func init() { proto.RegisterFile("helloworld.proto", fileDescriptor_17b8c58d586b62f2) } + +var fileDescriptor_17b8c58d586b62f2 = []byte{ + // 175 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xc8, 0x48, 0xcd, 0xc9, + 0xc9, 0x2f, 0xcf, 0x2f, 0xca, 0x49, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x42, 0x88, + 0x28, 0x29, 0x71, 0xf1, 0x78, 0x80, 0x78, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x42, 0x42, + 0x5c, 0x2c, 0x79, 0x89, 0xb9, 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x60, 0xb6, 0x92, + 0x1a, 0x17, 0x17, 0x54, 0x4d, 0x41, 0x4e, 0xa5, 0x90, 0x04, 0x17, 0x7b, 0x6e, 0x6a, 0x71, 0x71, + 0x62, 0x3a, 0x4c, 0x11, 0x8c, 0x6b, 0xe4, 0xc9, 0xc5, 0xee, 0x5e, 0x94, 0x9a, 0x5a, 0x92, 0x5a, + 0x24, 0x64, 0xc7, 0xc5, 0x11, 0x9c, 0x58, 0x09, 0xd6, 0x25, 0x24, 0xa1, 0x87, 0xe4, 0x02, 0x64, + 0xcb, 0xa4, 0xc4, 0xb0, 0xc8, 0x14, 0xe4, 0x54, 0x2a, 0x31, 0x38, 0x19, 0x70, 0x49, 0x67, 0xe6, + 0xeb, 0xa5, 0x17, 0x15, 0x24, 0xeb, 0xa5, 0x56, 0x24, 0xe6, 0x16, 0xe4, 0xa4, 0x16, 0x23, 0xa9, + 0x75, 0xe2, 0x07, 0x2b, 0x0e, 0x07, 0xb1, 0x03, 0x40, 0x5e, 0x0a, 0x60, 0x4c, 0x62, 0x03, 0xfb, + 0xcd, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x0f, 0xb7, 0xcd, 0xf2, 0xef, 0x00, 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -145,6 +165,14 @@ type GreeterServer interface { SayHello(context.Context, *HelloRequest) (*HelloReply, error) } +// UnimplementedGreeterServer can be embedded to have forward compatible implementations. +type UnimplementedGreeterServer struct { +} + +func (*UnimplementedGreeterServer) SayHello(ctx context.Context, req *HelloRequest) (*HelloReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented") +} + func RegisterGreeterServer(s *grpc.Server, srv GreeterServer) { s.RegisterService(&_Greeter_serviceDesc, srv) } @@ -179,20 +207,3 @@ var _Greeter_serviceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, Metadata: "helloworld.proto", } - -func init() { proto.RegisterFile("helloworld.proto", fileDescriptor_helloworld_71e208cbdc16936b) } - -var fileDescriptor_helloworld_71e208cbdc16936b = []byte{ - // 175 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xc8, 0x48, 0xcd, 0xc9, - 0xc9, 0x2f, 0xcf, 0x2f, 0xca, 0x49, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x42, 0x88, - 0x28, 0x29, 0x71, 0xf1, 0x78, 0x80, 0x78, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x42, 0x42, - 0x5c, 0x2c, 0x79, 0x89, 0xb9, 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x60, 0xb6, 0x92, - 0x1a, 0x17, 0x17, 0x54, 0x4d, 0x41, 0x4e, 0xa5, 0x90, 0x04, 0x17, 0x7b, 0x6e, 0x6a, 0x71, 0x71, - 0x62, 0x3a, 0x4c, 0x11, 0x8c, 0x6b, 0xe4, 0xc9, 0xc5, 0xee, 0x5e, 0x94, 0x9a, 0x5a, 0x92, 0x5a, - 0x24, 0x64, 0xc7, 0xc5, 0x11, 0x9c, 0x58, 0x09, 0xd6, 0x25, 0x24, 0xa1, 0x87, 0xe4, 0x02, 0x64, - 0xcb, 0xa4, 0xc4, 0xb0, 0xc8, 0x14, 0xe4, 0x54, 0x2a, 0x31, 0x38, 0x19, 0x70, 0x49, 0x67, 0xe6, - 0xeb, 0xa5, 0x17, 0x15, 0x24, 0xeb, 0xa5, 0x56, 0x24, 0xe6, 0x16, 0xe4, 0xa4, 0x16, 0x23, 0xa9, - 0x75, 0xe2, 0x07, 0x2b, 0x0e, 0x07, 0xb1, 0x03, 0x40, 0x5e, 0x0a, 0x60, 0x4c, 0x62, 0x03, 0xfb, - 0xcd, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x0f, 0xb7, 0xcd, 0xf2, 0xef, 0x00, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/examples/helloworld/mock_helloworld/hw_mock.go b/vendor/google.golang.org/grpc/examples/helloworld/mock_helloworld/hw_mock.go index 14957ed5fce..2113386076e 100644 --- a/vendor/google.golang.org/grpc/examples/helloworld/mock_helloworld/hw_mock.go +++ b/vendor/google.golang.org/grpc/examples/helloworld/mock_helloworld/hw_mock.go @@ -4,8 +4,8 @@ package mock_helloworld import ( + context "context" gomock "github.com/golang/mock/gomock" - context "golang.org/x/net/context" grpc "google.golang.org/grpc" helloworld "google.golang.org/grpc/examples/helloworld/helloworld" ) diff --git a/vendor/google.golang.org/grpc/examples/route_guide/client/client.go b/vendor/google.golang.org/grpc/examples/route_guide/client/client.go index dc51edee9c8..db20b1e9dfc 100644 --- a/vendor/google.golang.org/grpc/examples/route_guide/client/client.go +++ b/vendor/google.golang.org/grpc/examples/route_guide/client/client.go @@ -39,7 +39,7 @@ import ( var ( tls = flag.Bool("tls", false, "Connection uses TLS if true, else plain TCP") caFile = flag.String("ca_file", "", "The file containing the CA root cert file") - serverAddr = flag.String("server_addr", "127.0.0.1:10000", "The server address in the format of host:port") + serverAddr = flag.String("server_addr", "localhost:10000", "The server address in the format of host:port") serverHostOverride = flag.String("server_host_override", "x.test.youtube.com", "The server name use to verify the hostname returned by TLS handshake") ) @@ -165,6 +165,8 @@ func main() { } else { opts = append(opts, grpc.WithInsecure()) } + + opts = append(opts, grpc.WithBlock()) conn, err := grpc.Dial(*serverAddr, opts...) if err != nil { log.Fatalf("fail to dial: %v", err) diff --git a/vendor/google.golang.org/grpc/examples/route_guide/mock_routeguide/rg_mock.go b/vendor/google.golang.org/grpc/examples/route_guide/mock_routeguide/rg_mock.go index 328c929fa8e..65687b3f5df 100644 --- a/vendor/google.golang.org/grpc/examples/route_guide/mock_routeguide/rg_mock.go +++ b/vendor/google.golang.org/grpc/examples/route_guide/mock_routeguide/rg_mock.go @@ -4,8 +4,8 @@ package mock_routeguide import ( + context "context" gomock "github.com/golang/mock/gomock" - context "golang.org/x/net/context" grpc "google.golang.org/grpc" routeguide "google.golang.org/grpc/examples/route_guide/routeguide" metadata "google.golang.org/grpc/metadata" diff --git a/vendor/google.golang.org/grpc/examples/route_guide/routeguide/route_guide.pb.go b/vendor/google.golang.org/grpc/examples/route_guide/routeguide/route_guide.pb.go index 199a2ee0510..0031144ef83 100644 --- a/vendor/google.golang.org/grpc/examples/route_guide/routeguide/route_guide.pb.go +++ b/vendor/google.golang.org/grpc/examples/route_guide/routeguide/route_guide.pb.go @@ -3,13 +3,14 @@ package routeguide -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -21,7 +22,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // Points are represented as latitude-longitude pairs in the E7 representation // (degrees multiplied by 10**7 and rounded to the nearest integer). @@ -39,16 +40,17 @@ func (m *Point) Reset() { *m = Point{} } func (m *Point) String() string { return proto.CompactTextString(m) } func (*Point) ProtoMessage() {} func (*Point) Descriptor() ([]byte, []int) { - return fileDescriptor_route_guide_dc79de2de4c66c19, []int{0} + return fileDescriptor_b7d679f20da65b7b, []int{0} } + func (m *Point) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Point.Unmarshal(m, b) } func (m *Point) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Point.Marshal(b, m, deterministic) } -func (dst *Point) XXX_Merge(src proto.Message) { - xxx_messageInfo_Point.Merge(dst, src) +func (m *Point) XXX_Merge(src proto.Message) { + xxx_messageInfo_Point.Merge(m, src) } func (m *Point) XXX_Size() int { return xxx_messageInfo_Point.Size(m) @@ -89,16 +91,17 @@ func (m *Rectangle) Reset() { *m = Rectangle{} } func (m *Rectangle) String() string { return proto.CompactTextString(m) } func (*Rectangle) ProtoMessage() {} func (*Rectangle) Descriptor() ([]byte, []int) { - return fileDescriptor_route_guide_dc79de2de4c66c19, []int{1} + return fileDescriptor_b7d679f20da65b7b, []int{1} } + func (m *Rectangle) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Rectangle.Unmarshal(m, b) } func (m *Rectangle) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Rectangle.Marshal(b, m, deterministic) } -func (dst *Rectangle) XXX_Merge(src proto.Message) { - xxx_messageInfo_Rectangle.Merge(dst, src) +func (m *Rectangle) XXX_Merge(src proto.Message) { + xxx_messageInfo_Rectangle.Merge(m, src) } func (m *Rectangle) XXX_Size() int { return xxx_messageInfo_Rectangle.Size(m) @@ -140,16 +143,17 @@ func (m *Feature) Reset() { *m = Feature{} } func (m *Feature) String() string { return proto.CompactTextString(m) } func (*Feature) ProtoMessage() {} func (*Feature) Descriptor() ([]byte, []int) { - return fileDescriptor_route_guide_dc79de2de4c66c19, []int{2} + return fileDescriptor_b7d679f20da65b7b, []int{2} } + func (m *Feature) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Feature.Unmarshal(m, b) } func (m *Feature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Feature.Marshal(b, m, deterministic) } -func (dst *Feature) XXX_Merge(src proto.Message) { - xxx_messageInfo_Feature.Merge(dst, src) +func (m *Feature) XXX_Merge(src proto.Message) { + xxx_messageInfo_Feature.Merge(m, src) } func (m *Feature) XXX_Size() int { return xxx_messageInfo_Feature.Size(m) @@ -189,16 +193,17 @@ func (m *RouteNote) Reset() { *m = RouteNote{} } func (m *RouteNote) String() string { return proto.CompactTextString(m) } func (*RouteNote) ProtoMessage() {} func (*RouteNote) Descriptor() ([]byte, []int) { - return fileDescriptor_route_guide_dc79de2de4c66c19, []int{3} + return fileDescriptor_b7d679f20da65b7b, []int{3} } + func (m *RouteNote) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RouteNote.Unmarshal(m, b) } func (m *RouteNote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_RouteNote.Marshal(b, m, deterministic) } -func (dst *RouteNote) XXX_Merge(src proto.Message) { - xxx_messageInfo_RouteNote.Merge(dst, src) +func (m *RouteNote) XXX_Merge(src proto.Message) { + xxx_messageInfo_RouteNote.Merge(m, src) } func (m *RouteNote) XXX_Size() int { return xxx_messageInfo_RouteNote.Size(m) @@ -246,16 +251,17 @@ func (m *RouteSummary) Reset() { *m = RouteSummary{} } func (m *RouteSummary) String() string { return proto.CompactTextString(m) } func (*RouteSummary) ProtoMessage() {} func (*RouteSummary) Descriptor() ([]byte, []int) { - return fileDescriptor_route_guide_dc79de2de4c66c19, []int{4} + return fileDescriptor_b7d679f20da65b7b, []int{4} } + func (m *RouteSummary) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RouteSummary.Unmarshal(m, b) } func (m *RouteSummary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_RouteSummary.Marshal(b, m, deterministic) } -func (dst *RouteSummary) XXX_Merge(src proto.Message) { - xxx_messageInfo_RouteSummary.Merge(dst, src) +func (m *RouteSummary) XXX_Merge(src proto.Message) { + xxx_messageInfo_RouteSummary.Merge(m, src) } func (m *RouteSummary) XXX_Size() int { return xxx_messageInfo_RouteSummary.Size(m) @@ -302,6 +308,38 @@ func init() { proto.RegisterType((*RouteSummary)(nil), "routeguide.RouteSummary") } +func init() { proto.RegisterFile("route_guide.proto", fileDescriptor_b7d679f20da65b7b) } + +var fileDescriptor_b7d679f20da65b7b = []byte{ + // 404 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0xdd, 0xca, 0xd3, 0x40, + 0x10, 0xfd, 0x36, 0x7e, 0x9f, 0x6d, 0x26, 0x11, 0xe9, 0x88, 0x10, 0xa2, 0xa0, 0x8d, 0x37, 0xbd, + 0x31, 0x94, 0x0a, 0x5e, 0x56, 0x6c, 0xc1, 0xde, 0x14, 0xa9, 0xb1, 0xf7, 0x65, 0x4d, 0xc6, 0x74, + 0x61, 0x93, 0x0d, 0xc9, 0x06, 0xf4, 0x01, 0x7c, 0x02, 0x5f, 0x58, 0xb2, 0x49, 0xda, 0x54, 0x5b, + 0xbc, 0xdb, 0x39, 0x73, 0xce, 0xfc, 0x9c, 0x61, 0x61, 0x52, 0xaa, 0x5a, 0xd3, 0x21, 0xad, 0x45, + 0x42, 0x61, 0x51, 0x2a, 0xad, 0x10, 0x0c, 0x64, 0x90, 0xe0, 0x23, 0x3c, 0xec, 0x94, 0xc8, 0x35, + 0xfa, 0x30, 0x96, 0x5c, 0x0b, 0x5d, 0x27, 0xe4, 0xb1, 0xd7, 0x6c, 0xf6, 0x10, 0x9d, 0x62, 0x7c, + 0x09, 0xb6, 0x54, 0x79, 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53, 0xff, 0xd9, 0x10, 0xea, + 0x78, 0xc1, 0x1d, 0x2e, 0xc1, 0xdd, 0x8a, 0xaa, 0x17, 0x56, 0xf8, 0x7c, 0x48, 0x3b, 0x5d, 0xfb, + 0x86, 0x7a, 0xce, 0x70, 0x09, 0x4e, 0x44, 0xb1, 0x2a, 0x13, 0x33, 0xcb, 0xb5, 0xc6, 0xde, 0x45, + 0xc5, 0x81, 0x8f, 0xc1, 0xdd, 0x8c, 0xe1, 0x87, 0xee, 0x64, 0xeb, 0x23, 0xd7, 0x7f, 0x35, 0xef, + 0x2f, 0xe9, 0x5f, 0x87, 0x1b, 0xf9, 0x9c, 0xad, 0xe6, 0xf0, 0x42, 0xa8, 0x30, 0x2d, 0x8b, 0x38, + 0xa4, 0x1f, 0x3c, 0x2b, 0x24, 0x55, 0x03, 0xfa, 0xea, 0xe9, 0xd9, 0xa3, 0x5d, 0xf3, 0x27, 0x76, + 0xec, 0xdb, 0x63, 0xf3, 0x39, 0xde, 0xfd, 0x09, 0x00, 0x00, 0xff, 0xff, 0xc8, 0xe4, 0xef, 0xe6, + 0x31, 0x03, 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -482,6 +520,23 @@ type RouteGuideServer interface { RouteChat(RouteGuide_RouteChatServer) error } +// UnimplementedRouteGuideServer can be embedded to have forward compatible implementations. +type UnimplementedRouteGuideServer struct { +} + +func (*UnimplementedRouteGuideServer) GetFeature(ctx context.Context, req *Point) (*Feature, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFeature not implemented") +} +func (*UnimplementedRouteGuideServer) ListFeatures(req *Rectangle, srv RouteGuide_ListFeaturesServer) error { + return status.Errorf(codes.Unimplemented, "method ListFeatures not implemented") +} +func (*UnimplementedRouteGuideServer) RecordRoute(srv RouteGuide_RecordRouteServer) error { + return status.Errorf(codes.Unimplemented, "method RecordRoute not implemented") +} +func (*UnimplementedRouteGuideServer) RouteChat(srv RouteGuide_RouteChatServer) error { + return status.Errorf(codes.Unimplemented, "method RouteChat not implemented") +} + func RegisterRouteGuideServer(s *grpc.Server, srv RouteGuideServer) { s.RegisterService(&_RouteGuide_serviceDesc, srv) } @@ -606,35 +661,3 @@ var _RouteGuide_serviceDesc = grpc.ServiceDesc{ }, Metadata: "route_guide.proto", } - -func init() { proto.RegisterFile("route_guide.proto", fileDescriptor_route_guide_dc79de2de4c66c19) } - -var fileDescriptor_route_guide_dc79de2de4c66c19 = []byte{ - // 404 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0xdd, 0xca, 0xd3, 0x40, - 0x10, 0xfd, 0x36, 0x7e, 0x9f, 0x6d, 0x26, 0x11, 0xe9, 0x88, 0x10, 0xa2, 0xa0, 0x8d, 0x37, 0xbd, - 0x31, 0x94, 0x0a, 0x5e, 0x56, 0x6c, 0xc1, 0xde, 0x14, 0xa9, 0xb1, 0xf7, 0x65, 0x4d, 0xc6, 0x74, - 0x61, 0x93, 0x0d, 0xc9, 0x06, 0xf4, 0x01, 0x7c, 0x02, 0x5f, 0x58, 0xb2, 0x49, 0xda, 0x54, 0x5b, - 0xbc, 0xdb, 0x39, 0x73, 0xce, 0xfc, 0x9c, 0x61, 0x61, 0x52, 0xaa, 0x5a, 0xd3, 0x21, 0xad, 0x45, - 0x42, 0x61, 0x51, 0x2a, 0xad, 0x10, 0x0c, 0x64, 0x90, 0xe0, 0x23, 0x3c, 0xec, 0x94, 0xc8, 0x35, - 0xfa, 0x30, 0x96, 0x5c, 0x0b, 0x5d, 0x27, 0xe4, 0xb1, 0xd7, 0x6c, 0xf6, 0x10, 0x9d, 0x62, 0x7c, - 0x09, 0xb6, 0x54, 0x79, 0xda, 0x26, 0x2d, 0x93, 0x3c, 0x03, 0xc1, 0x17, 0xb0, 0x23, 0x8a, 0x35, - 0xcf, 0x53, 0x49, 0x38, 0x05, 0x4b, 0x2a, 0x53, 0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 0xfb, - 0x86, 0x7a, 0xce, 0x70, 0x09, 0x4e, 0x44, 0xb1, 0x2a, 0x13, 0x33, 0xcb, 0xb5, 0xc6, 0xde, 0x45, - 0xc5, 0x81, 0x8f, 0xc1, 0xdd, 0x8c, 0xe1, 0x87, 0xee, 0x64, 0xeb, 0x23, 0xd7, 0x7f, 0x35, 0xef, - 0x2f, 0xe9, 0x5f, 0x87, 0x1b, 0xf9, 0x9c, 0xad, 0xe6, 0xf0, 0x42, 0xa8, 0x30, 0x2d, 0x8b, 0x38, - 0xa4, 0x1f, 0x3c, 0x2b, 0x24, 0x55, 0x03, 0xfa, 0xea, 0xe9, 0xd9, 0xa3, 0x5d, 0xf3, 0x27, 0x76, - 0xec, 0xdb, 0x63, 0xf3, 0x39, 0xde, 0xfd, 0x09, 0x00, 0x00, 0xff, 0xff, 0xc8, 0xe4, 0xef, 0xe6, - 0x31, 0x03, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/examples/route_guide/server/server.go b/vendor/google.golang.org/grpc/examples/route_guide/server/server.go index b7dc66c81e7..9f523e21f4e 100644 --- a/vendor/google.golang.org/grpc/examples/route_guide/server/server.go +++ b/vendor/google.golang.org/grpc/examples/route_guide/server/server.go @@ -56,6 +56,7 @@ var ( ) type routeGuideServer struct { + pb.UnimplementedRouteGuideServer savedFeatures []*pb.Feature // read-only after initialized mu sync.Mutex // protects routeNotes diff --git a/vendor/google.golang.org/grpc/go.mod b/vendor/google.golang.org/grpc/go.mod index c1a8340c5ba..2378361302f 100644 --- a/vendor/google.golang.org/grpc/go.mod +++ b/vendor/google.golang.org/grpc/go.mod @@ -1,19 +1,16 @@ module google.golang.org/grpc +go 1.11 + require ( - cloud.google.com/go v0.26.0 // indirect - github.com/BurntSushi/toml v0.3.1 // indirect - github.com/client9/misspell v0.3.4 + github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473 + github.com/envoyproxy/protoc-gen-validate v0.1.0 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/golang/mock v1.1.1 - github.com/golang/protobuf v1.2.0 + github.com/golang/protobuf v1.3.2 github.com/google/go-cmp v0.2.0 - golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 golang.org/x/net v0.0.0-20190311183353-d8887717615a golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a - golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 - google.golang.org/appengine v1.1.0 // indirect - google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 - honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc + google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 ) diff --git a/vendor/google.golang.org/grpc/go.sum b/vendor/google.golang.org/grpc/go.sum index 741677d2e81..dd5d0cee7ad 100644 --- a/vendor/google.golang.org/grpc/go.sum +++ b/vendor/google.golang.org/grpc/go.sum @@ -1,37 +1,53 @@ cloud.google.com/go v0.26.0 h1:e0WKqKTd5BnrG8aKH3J3h+QvEIQtSUcf2n5UZ5ZgLtQ= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473 h1:4cmBvAEBNJaGARUEs3/suWRyfyBfhf7I60WBZq+bv2w= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/protoc-gen-validate v0.1.0 h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1 h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd h1:/e+gpKk9r3dJobndpTytxS2gOy6m5uvpg+ISQoEcusQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 h1:5Beo0mZN8dRzgrMMkDp0jc8YXQKx9DiJ2k1dkvGsn5A= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= +google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/vendor/google.golang.org/grpc/grpc_test.go b/vendor/google.golang.org/grpc/grpc_test.go index 5c132dd9737..7c41c57ae6d 100644 --- a/vendor/google.golang.org/grpc/grpc_test.go +++ b/vendor/google.golang.org/grpc/grpc_test.go @@ -24,6 +24,8 @@ import ( "google.golang.org/grpc/internal/grpctest" "google.golang.org/grpc/internal/leakcheck" + + _ "google.golang.org/grpc/grpclog/glogger" ) type s struct{} diff --git a/vendor/google.golang.org/grpc/grpclog/grpclog.go b/vendor/google.golang.org/grpc/grpclog/grpclog.go index 51bb9457cda..874ea6d98a6 100644 --- a/vendor/google.golang.org/grpc/grpclog/grpclog.go +++ b/vendor/google.golang.org/grpc/grpclog/grpclog.go @@ -89,7 +89,7 @@ func Fatal(args ...interface{}) { } // Fatalf logs to the FATAL log. Arguments are handled in the manner of fmt.Printf. -// It calles os.Exit() with exit code 1. +// It calls os.Exit() with exit code 1. func Fatalf(format string, args ...interface{}) { logger.Fatalf(format, args...) // Make sure fatal logs will exit. diff --git a/vendor/google.golang.org/grpc/health/client.go b/vendor/google.golang.org/grpc/health/client.go index b43746e616c..b5bee483802 100644 --- a/vendor/google.golang.org/grpc/health/client.go +++ b/vendor/google.golang.org/grpc/health/client.go @@ -33,20 +33,20 @@ import ( "google.golang.org/grpc/status" ) -const maxDelay = 120 * time.Second - -var backoffStrategy = backoff.Exponential{MaxDelay: maxDelay} -var backoffFunc = func(ctx context.Context, retries int) bool { - d := backoffStrategy.Backoff(retries) - timer := time.NewTimer(d) - select { - case <-timer.C: - return true - case <-ctx.Done(): - timer.Stop() - return false +var ( + backoffStrategy = backoff.DefaultExponential + backoffFunc = func(ctx context.Context, retries int) bool { + d := backoffStrategy.Backoff(retries) + timer := time.NewTimer(d) + select { + case <-timer.C: + return true + case <-ctx.Done(): + timer.Stop() + return false + } } -} +) func init() { internal.HealthCheckFunc = clientHealthCheck @@ -56,7 +56,7 @@ const healthCheckMethod = "/grpc.health.v1.Health/Watch" // This function implements the protocol defined at: // https://github.com/grpc/grpc/blob/master/doc/health-checking.md -func clientHealthCheck(ctx context.Context, newStream func(string) (interface{}, error), setConnectivityState func(connectivity.State), service string) error { +func clientHealthCheck(ctx context.Context, newStream func(string) (interface{}, error), setConnectivityState func(connectivity.State, error), service string) error { tryCnt := 0 retryConnection: @@ -70,7 +70,7 @@ retryConnection: if ctx.Err() != nil { return nil } - setConnectivityState(connectivity.Connecting) + setConnectivityState(connectivity.Connecting, nil) rawS, err := newStream(healthCheckMethod) if err != nil { continue retryConnection @@ -79,7 +79,7 @@ retryConnection: s, ok := rawS.(grpc.ClientStream) // Ideally, this should never happen. But if it happens, the server is marked as healthy for LBing purposes. if !ok { - setConnectivityState(connectivity.Ready) + setConnectivityState(connectivity.Ready, nil) return fmt.Errorf("newStream returned %v (type %T); want grpc.ClientStream", rawS, rawS) } @@ -95,22 +95,22 @@ retryConnection: // Reports healthy for the LBing purposes if health check is not implemented in the server. if status.Code(err) == codes.Unimplemented { - setConnectivityState(connectivity.Ready) + setConnectivityState(connectivity.Ready, nil) return err } // Reports unhealthy if server's Watch method gives an error other than UNIMPLEMENTED. if err != nil { - setConnectivityState(connectivity.TransientFailure) + setConnectivityState(connectivity.TransientFailure, fmt.Errorf("connection active but received health check RPC error: %v", err)) continue retryConnection } - // As a message has been received, removes the need for backoff for the next retry by reseting the try count. + // As a message has been received, removes the need for backoff for the next retry by resetting the try count. tryCnt = 0 if resp.Status == healthpb.HealthCheckResponse_SERVING { - setConnectivityState(connectivity.Ready) + setConnectivityState(connectivity.Ready, nil) } else { - setConnectivityState(connectivity.TransientFailure) + setConnectivityState(connectivity.TransientFailure, fmt.Errorf("connection active but health check failed. status=%s", resp.Status)) } } } diff --git a/vendor/google.golang.org/grpc/health/client_test.go b/vendor/google.golang.org/grpc/health/client_test.go index 394c62d168e..ee712981458 100644 --- a/vendor/google.golang.org/grpc/health/client_test.go +++ b/vendor/google.golang.org/grpc/health/client_test.go @@ -51,7 +51,7 @@ func TestClientHealthCheckBackoff(t *testing.T) { } defer func() { backoffFunc = oldBackoffFunc }() - clientHealthCheck(context.Background(), newStream, func(connectivity.State) {}, "test") + clientHealthCheck(context.Background(), newStream, func(connectivity.State, error) {}, "test") if !reflect.DeepEqual(got, want) { t.Fatalf("Backoff durations for %v retries are %v. (expected: %v)", maxRetries, got, want) diff --git a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go index c2f2c7729d0..c99e27ae5b6 100644 --- a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go +++ b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go @@ -1,15 +1,16 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: grpc/health/v1/health.proto -package grpc_health_v1 // import "google.golang.org/grpc/health/grpc_health_v1" - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +package grpc_health_v1 import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -21,7 +22,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type HealthCheckResponse_ServingStatus int32 @@ -38,6 +39,7 @@ var HealthCheckResponse_ServingStatus_name = map[int32]string{ 2: "NOT_SERVING", 3: "SERVICE_UNKNOWN", } + var HealthCheckResponse_ServingStatus_value = map[string]int32{ "UNKNOWN": 0, "SERVING": 1, @@ -48,8 +50,9 @@ var HealthCheckResponse_ServingStatus_value = map[string]int32{ func (x HealthCheckResponse_ServingStatus) String() string { return proto.EnumName(HealthCheckResponse_ServingStatus_name, int32(x)) } + func (HealthCheckResponse_ServingStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_health_6b1a06aa67f91efd, []int{1, 0} + return fileDescriptor_e265fd9d4e077217, []int{1, 0} } type HealthCheckRequest struct { @@ -63,16 +66,17 @@ func (m *HealthCheckRequest) Reset() { *m = HealthCheckRequest{} } func (m *HealthCheckRequest) String() string { return proto.CompactTextString(m) } func (*HealthCheckRequest) ProtoMessage() {} func (*HealthCheckRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_health_6b1a06aa67f91efd, []int{0} + return fileDescriptor_e265fd9d4e077217, []int{0} } + func (m *HealthCheckRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_HealthCheckRequest.Unmarshal(m, b) } func (m *HealthCheckRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_HealthCheckRequest.Marshal(b, m, deterministic) } -func (dst *HealthCheckRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_HealthCheckRequest.Merge(dst, src) +func (m *HealthCheckRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_HealthCheckRequest.Merge(m, src) } func (m *HealthCheckRequest) XXX_Size() int { return xxx_messageInfo_HealthCheckRequest.Size(m) @@ -101,16 +105,17 @@ func (m *HealthCheckResponse) Reset() { *m = HealthCheckResponse{} } func (m *HealthCheckResponse) String() string { return proto.CompactTextString(m) } func (*HealthCheckResponse) ProtoMessage() {} func (*HealthCheckResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_health_6b1a06aa67f91efd, []int{1} + return fileDescriptor_e265fd9d4e077217, []int{1} } + func (m *HealthCheckResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_HealthCheckResponse.Unmarshal(m, b) } func (m *HealthCheckResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_HealthCheckResponse.Marshal(b, m, deterministic) } -func (dst *HealthCheckResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_HealthCheckResponse.Merge(dst, src) +func (m *HealthCheckResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_HealthCheckResponse.Merge(m, src) } func (m *HealthCheckResponse) XXX_Size() int { return xxx_messageInfo_HealthCheckResponse.Size(m) @@ -129,9 +134,34 @@ func (m *HealthCheckResponse) GetStatus() HealthCheckResponse_ServingStatus { } func init() { + proto.RegisterEnum("grpc.health.v1.HealthCheckResponse_ServingStatus", HealthCheckResponse_ServingStatus_name, HealthCheckResponse_ServingStatus_value) proto.RegisterType((*HealthCheckRequest)(nil), "grpc.health.v1.HealthCheckRequest") proto.RegisterType((*HealthCheckResponse)(nil), "grpc.health.v1.HealthCheckResponse") - proto.RegisterEnum("grpc.health.v1.HealthCheckResponse_ServingStatus", HealthCheckResponse_ServingStatus_name, HealthCheckResponse_ServingStatus_value) +} + +func init() { proto.RegisterFile("grpc/health/v1/health.proto", fileDescriptor_e265fd9d4e077217) } + +var fileDescriptor_e265fd9d4e077217 = []byte{ + // 297 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0x2f, 0x2a, 0x48, + 0xd6, 0xcf, 0x48, 0x4d, 0xcc, 0x29, 0xc9, 0xd0, 0x2f, 0x33, 0x84, 0xb2, 0xf4, 0x0a, 0x8a, 0xf2, + 0x4b, 0xf2, 0x85, 0xf8, 0x40, 0x92, 0x7a, 0x50, 0xa1, 0x32, 0x43, 0x25, 0x3d, 0x2e, 0x21, 0x0f, + 0x30, 0xc7, 0x39, 0x23, 0x35, 0x39, 0x3b, 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x44, 0x48, 0x82, + 0x8b, 0xbd, 0x38, 0xb5, 0xa8, 0x2c, 0x33, 0x39, 0x55, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, 0x08, + 0xc6, 0x55, 0xda, 0xc8, 0xc8, 0x25, 0x8c, 0xa2, 0xa1, 0xb8, 0x20, 0x3f, 0xaf, 0x38,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, 0x19, 0x26, 0xb1, 0x81, 0x93, 0x83, 0x31, 0x20, 0x00, 0x00, 0xff, + 0xff, 0x12, 0x7d, 0x96, 0xcb, 0x2d, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -239,6 +269,17 @@ type HealthServer interface { Watch(*HealthCheckRequest, Health_WatchServer) error } +// UnimplementedHealthServer can be embedded to have forward compatible implementations. +type UnimplementedHealthServer struct { +} + +func (*UnimplementedHealthServer) Check(ctx context.Context, req *HealthCheckRequest) (*HealthCheckResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Check not implemented") +} +func (*UnimplementedHealthServer) Watch(req *HealthCheckRequest, srv Health_WatchServer) error { + return status.Errorf(codes.Unimplemented, "method Watch not implemented") +} + func RegisterHealthServer(s *grpc.Server, srv HealthServer) { s.RegisterService(&_Health_serviceDesc, srv) } @@ -300,28 +341,3 @@ var _Health_serviceDesc = grpc.ServiceDesc{ }, Metadata: "grpc/health/v1/health.proto", } - -func init() { proto.RegisterFile("grpc/health/v1/health.proto", fileDescriptor_health_6b1a06aa67f91efd) } - -var fileDescriptor_health_6b1a06aa67f91efd = []byte{ - // 297 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0x2f, 0x2a, 0x48, - 0xd6, 0xcf, 0x48, 0x4d, 0xcc, 0x29, 0xc9, 0xd0, 0x2f, 0x33, 0x84, 0xb2, 0xf4, 0x0a, 0x8a, 0xf2, - 0x4b, 0xf2, 0x85, 0xf8, 0x40, 0x92, 0x7a, 0x50, 0xa1, 0x32, 0x43, 0x25, 0x3d, 0x2e, 0x21, 0x0f, - 0x30, 0xc7, 0x39, 0x23, 0x35, 0x39, 0x3b, 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x44, 0x48, 0x82, - 0x8b, 0xbd, 0x38, 0xb5, 0xa8, 0x2c, 0x33, 0x39, 0x55,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 0x7d, 0xe4, 0x78, 0x07, 0xb1, 0xe3, 0x21, 0xec, 0xf8, 0x32, 0xc3, 0x55, 0x4c, 0x7c, 0xee, 0x20, - 0xd3, 0x20, 0x46, 0xe8, 0x85, 0x19, 0x26, 0xb1, 0x81, 0x93, 0x83, 0x31, 0x20, 0x00, 0x00, 0xff, - 0xff, 0x12, 0x7d, 0x96, 0xcb, 0x2d, 0x02, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/health/server.go b/vendor/google.golang.org/grpc/health/server.go index c79f9d2ab80..2262607f882 100644 --- a/vendor/google.golang.org/grpc/health/server.go +++ b/vendor/google.golang.org/grpc/health/server.go @@ -35,7 +35,7 @@ import ( // Server implements `service Health`. type Server struct { - mu sync.Mutex + mu sync.RWMutex // If shutdown is true, it's expected all serving status is NOT_SERVING, and // will stay in NOT_SERVING. shutdown bool @@ -54,8 +54,8 @@ func NewServer() *Server { // Check implements `service Health`. func (s *Server) Check(ctx context.Context, in *healthpb.HealthCheckRequest) (*healthpb.HealthCheckResponse, error) { - s.mu.Lock() - defer s.mu.Unlock() + s.mu.RLock() + defer s.mu.RUnlock() if servingStatus, ok := s.statusMap[in.Service]; ok { return &healthpb.HealthCheckResponse{ Status: servingStatus, @@ -139,7 +139,7 @@ func (s *Server) setServingStatusLocked(service string, servingStatus healthpb.H // Shutdown sets all serving status to NOT_SERVING, and configures the server to // ignore all future status changes. // -// This changes serving status for all services. To set status for a perticular +// This changes serving status for all services. To set status for a particular // services, call SetServingStatus(). func (s *Server) Shutdown() { s.mu.Lock() @@ -153,7 +153,7 @@ func (s *Server) Shutdown() { // Resume sets all serving status to SERVING, and configures the server to // accept all future status changes. // -// This changes serving status for all services. To set status for a perticular +// This changes serving status for all services. To set status for a particular // services, call SetServingStatus(). func (s *Server) Resume() { s.mu.Lock() diff --git a/vendor/google.golang.org/grpc/internal/backoff/backoff.go b/vendor/google.golang.org/grpc/internal/backoff/backoff.go index 1bd0cce5abd..5fc0ee3da53 100644 --- a/vendor/google.golang.org/grpc/internal/backoff/backoff.go +++ b/vendor/google.golang.org/grpc/internal/backoff/backoff.go @@ -25,44 +25,39 @@ package backoff import ( "time" + grpcbackoff "google.golang.org/grpc/backoff" "google.golang.org/grpc/internal/grpcrand" ) // Strategy defines the methodology for backing off after a grpc connection // failure. -// type Strategy interface { // Backoff returns the amount of time to wait before the next retry given // the number of consecutive failures. Backoff(retries int) time.Duration } -const ( - // baseDelay is the amount of time to wait before retrying after the first - // failure. - baseDelay = 1.0 * time.Second - // factor is applied to the backoff after each retry. - factor = 1.6 - // jitter provides a range to randomize backoff delays. - jitter = 0.2 -) +// DefaultExponential is an exponential backoff implementation using the +// default values for all the configurable knobs defined in +// https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. +var DefaultExponential = Exponential{Config: grpcbackoff.DefaultConfig} // Exponential implements exponential backoff algorithm as defined in // https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. type Exponential struct { - // MaxDelay is the upper bound of backoff delay. - MaxDelay time.Duration + // Config contains all options to configure the backoff algorithm. + Config grpcbackoff.Config } // Backoff returns the amount of time to wait before the next retry given the // number of retries. func (bc Exponential) Backoff(retries int) time.Duration { if retries == 0 { - return baseDelay + return bc.Config.BaseDelay } - backoff, max := float64(baseDelay), float64(bc.MaxDelay) + backoff, max := float64(bc.Config.BaseDelay), float64(bc.Config.MaxDelay) for backoff < max && retries > 0 { - backoff *= factor + backoff *= bc.Config.Multiplier retries-- } if backoff > max { @@ -70,7 +65,7 @@ func (bc Exponential) Backoff(retries int) time.Duration { } // Randomize backoff delays so that if a cluster of requests start at // the same time, they won't operate in lockstep. - backoff *= 1 + jitter*(grpcrand.Float64()*2-1) + backoff *= 1 + bc.Config.Jitter*(grpcrand.Float64()*2-1) if backoff < 0 { return 0 } diff --git a/vendor/google.golang.org/grpc/internal/binarylog/binarylog.go b/vendor/google.golang.org/grpc/internal/binarylog/binarylog.go index fee6aecd08f..8b105167491 100644 --- a/vendor/google.golang.org/grpc/internal/binarylog/binarylog.go +++ b/vendor/google.golang.org/grpc/internal/binarylog/binarylog.go @@ -34,7 +34,7 @@ type Logger interface { } // binLogger is the global binary logger for the binary. One of this should be -// built at init time from the configuration (environment varialbe or flags). +// built at init time from the configuration (environment variable or flags). // // It is used to get a methodLogger for each individual method. var binLogger Logger @@ -98,7 +98,7 @@ func (l *logger) setDefaultMethodLogger(ml *methodLoggerConfig) error { // New methodLogger with same service overrides the old one. func (l *logger) setServiceMethodLogger(service string, ml *methodLoggerConfig) error { if _, ok := l.services[service]; ok { - return fmt.Errorf("conflicting rules for service %v found", service) + return fmt.Errorf("conflicting service rules for service %v found", service) } if l.services == nil { l.services = make(map[string]*methodLoggerConfig) @@ -112,10 +112,10 @@ func (l *logger) setServiceMethodLogger(service string, ml *methodLoggerConfig) // New methodLogger with same method overrides the old one. func (l *logger) setMethodMethodLogger(method string, ml *methodLoggerConfig) error { if _, ok := l.blacklist[method]; ok { - return fmt.Errorf("conflicting rules for method %v found", method) + return fmt.Errorf("conflicting blacklist rules for method %v found", method) } if _, ok := l.methods[method]; ok { - return fmt.Errorf("conflicting rules for method %v found", method) + return fmt.Errorf("conflicting method rules for method %v found", method) } if l.methods == nil { l.methods = make(map[string]*methodLoggerConfig) @@ -127,10 +127,10 @@ func (l *logger) setMethodMethodLogger(method string, ml *methodLoggerConfig) er // Set blacklist method for "-service/method". func (l *logger) setBlacklist(method string) error { if _, ok := l.blacklist[method]; ok { - return fmt.Errorf("conflicting rules for method %v found", method) + return fmt.Errorf("conflicting blacklist rules for method %v found", method) } if _, ok := l.methods[method]; ok { - return fmt.Errorf("conflicting rules for method %v found", method) + return fmt.Errorf("conflicting method rules for method %v found", method) } if l.blacklist == nil { l.blacklist = make(map[string]struct{}) diff --git a/vendor/google.golang.org/grpc/internal/binarylog/binarylog_end2end_test.go b/vendor/google.golang.org/grpc/internal/binarylog/binarylog_end2end_test.go index 3f555dcfd78..c529ba01597 100644 --- a/vendor/google.golang.org/grpc/internal/binarylog/binarylog_end2end_test.go +++ b/vendor/google.golang.org/grpc/internal/binarylog/binarylog_end2end_test.go @@ -104,6 +104,7 @@ var ( ) type testServer struct { + testpb.UnimplementedTestServiceServer te *test } diff --git a/vendor/google.golang.org/grpc/internal/binarylog/env_config.go b/vendor/google.golang.org/grpc/internal/binarylog/env_config.go index 4cc2525df7f..be30d0e65e7 100644 --- a/vendor/google.golang.org/grpc/internal/binarylog/env_config.go +++ b/vendor/google.golang.org/grpc/internal/binarylog/env_config.go @@ -43,7 +43,7 @@ import ( // Foo. // // If two configs exist for one certain method or service, the one specified -// later overrides the privous config. +// later overrides the previous config. func NewLoggerFromConfigString(s string) Logger { if s == "" { return nil @@ -74,7 +74,7 @@ func (l *logger) fillMethodLoggerWithConfigString(config string) error { return fmt.Errorf("invalid config: %q, %v", config, err) } if m == "*" { - return fmt.Errorf("invalid config: %q, %v", config, "* not allowd in blacklist config") + return fmt.Errorf("invalid config: %q, %v", config, "* not allowed in blacklist config") } if suffix != "" { return fmt.Errorf("invalid config: %q, %v", config, "header/message limit not allowed in blacklist config") diff --git a/vendor/google.golang.org/grpc/internal/binarylog/sink.go b/vendor/google.golang.org/grpc/internal/binarylog/sink.go index 20d044f0fd7..a2e7c346dd0 100644 --- a/vendor/google.golang.org/grpc/internal/binarylog/sink.go +++ b/vendor/google.golang.org/grpc/internal/binarylog/sink.go @@ -63,7 +63,7 @@ func (ns *noopSink) Close() error { return nil } // newWriterSink creates a binary log sink with the given writer. // -// Write() marshalls the proto message and writes it to the given writer. Each +// Write() marshals the proto message and writes it to the given writer. Each // message is prefixed with a 4 byte big endian unsigned integer as the length. // // No buffer is done, Close() doesn't try to close the writer. diff --git a/vendor/google.golang.org/grpc/internal/buffer/unbounded.go b/vendor/google.golang.org/grpc/internal/buffer/unbounded.go new file mode 100644 index 00000000000..9f6a0c1200d --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/buffer/unbounded.go @@ -0,0 +1,85 @@ +/* + * 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. + * + */ + +// Package buffer provides an implementation of an unbounded buffer. +package buffer + +import "sync" + +// Unbounded is an implementation of an unbounded buffer which does not use +// extra goroutines. This is typically used for passing updates from one entity +// to another within gRPC. +// +// All methods on this type are thread-safe and don't block on anything except +// the underlying mutex used for synchronization. +// +// Unbounded supports values of any type to be stored in it by using a channel +// of `interface{}`. This means that a call to Put() incurs an extra memory +// allocation, and also that users need a type assertion while reading. For +// performance critical code paths, using Unbounded is strongly discouraged and +// defining a new type specific implementation of this buffer is preferred. See +// internal/transport/transport.go for an example of this. +type Unbounded struct { + c chan interface{} + mu sync.Mutex + backlog []interface{} +} + +// NewUnbounded returns a new instance of Unbounded. +func NewUnbounded() *Unbounded { + return &Unbounded{c: make(chan interface{}, 1)} +} + +// Put adds t to the unbounded buffer. +func (b *Unbounded) Put(t interface{}) { + b.mu.Lock() + if len(b.backlog) == 0 { + select { + case b.c <- t: + b.mu.Unlock() + return + default: + } + } + b.backlog = append(b.backlog, t) + b.mu.Unlock() +} + +// Load sends the earliest buffered data, if any, onto the read channel +// returned by Get(). Users are expected to call this every time they read a +// value from the read channel. +func (b *Unbounded) Load() { + b.mu.Lock() + if len(b.backlog) > 0 { + select { + case b.c <- b.backlog[0]: + b.backlog[0] = nil + b.backlog = b.backlog[1:] + default: + } + } + b.mu.Unlock() +} + +// Get returns a read channel on which values added to the buffer, via Put(), +// are sent on. +// +// Upon reading a value from this channel, users are expected to call Load() to +// send the next buffered value onto the channel if there is any. +func (b *Unbounded) Get() <-chan interface{} { + return b.c +} diff --git a/vendor/google.golang.org/grpc/internal/buffer/unbounded_test.go b/vendor/google.golang.org/grpc/internal/buffer/unbounded_test.go new file mode 100644 index 00000000000..c8067019ba8 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/buffer/unbounded_test.go @@ -0,0 +1,111 @@ +/* + * 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. + * + */ + +package buffer + +import ( + "reflect" + "sort" + "sync" + "testing" +) + +const ( + numWriters = 10 + numWrites = 10 +) + +// wantReads contains the set of values expected to be read by the reader +// goroutine in the tests. +var wantReads []int + +func init() { + for i := 0; i < numWriters; i++ { + for j := 0; j < numWrites; j++ { + wantReads = append(wantReads, i) + } + } +} + +// TestSingleWriter starts one reader and one writer goroutine and makes sure +// that the reader gets all the value added to the buffer by the writer. +func TestSingleWriter(t *testing.T) { + ub := NewUnbounded() + reads := []int{} + + var wg sync.WaitGroup + wg.Add(1) + go func() { + defer wg.Done() + ch := ub.Get() + for i := 0; i < numWriters*numWrites; i++ { + r := <-ch + reads = append(reads, r.(int)) + ub.Load() + } + }() + + wg.Add(1) + go func() { + defer wg.Done() + for i := 0; i < numWriters; i++ { + for j := 0; j < numWrites; j++ { + ub.Put(i) + } + } + }() + + wg.Wait() + if !reflect.DeepEqual(reads, wantReads) { + t.Errorf("reads: %#v, wantReads: %#v", reads, wantReads) + } +} + +// TestMultipleWriters starts multiple writers and one reader goroutine and +// makes sure that the reader gets all the data written by all writers. +func TestMultipleWriters(t *testing.T) { + ub := NewUnbounded() + reads := []int{} + + var wg sync.WaitGroup + wg.Add(1) + go func() { + defer wg.Done() + ch := ub.Get() + for i := 0; i < numWriters*numWrites; i++ { + r := <-ch + reads = append(reads, r.(int)) + ub.Load() + } + }() + + wg.Add(numWriters) + for i := 0; i < numWriters; i++ { + go func(index int) { + defer wg.Done() + for j := 0; j < numWrites; j++ { + ub.Put(index) + } + }(i) + } + + wg.Wait() + sort.Ints(reads) + if !reflect.DeepEqual(reads, wantReads) { + t.Errorf("reads: %#v, wantReads: %#v", reads, wantReads) + } +} diff --git a/vendor/google.golang.org/grpc/internal/cache/timeoutCache.go b/vendor/google.golang.org/grpc/internal/cache/timeoutCache.go new file mode 100644 index 00000000000..94cd33898be --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/cache/timeoutCache.go @@ -0,0 +1,131 @@ +/* + * 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. + */ + +// Package cache implements caches to be used in gRPC. +package cache + +import ( + "sync" + "time" +) + +type cacheEntry struct { + item interface{} + callback func() + timer *time.Timer + // deleted is set to true in Remove() when the call to timer.Stop() fails. + // This can happen when the timer in the cache entry fires around the same + // time that timer.stop() is called in Remove(). + deleted bool +} + +// TimeoutCache is a cache with items to be deleted after a timeout. +type TimeoutCache struct { + mu sync.Mutex + timeout time.Duration + cache map[interface{}]*cacheEntry +} + +// NewTimeoutCache creates a TimeoutCache with the given timeout. +func NewTimeoutCache(timeout time.Duration) *TimeoutCache { + return &TimeoutCache{ + timeout: timeout, + cache: make(map[interface{}]*cacheEntry), + } +} + +// Add adds an item to the cache, with the specified callback to be called when +// the item is removed from the cache upon timeout. If the item is removed from +// the cache using a call to Remove before the timeout expires, the callback +// will not be called. +// +// If the Add was successful, it returns (newly added item, true). If there is +// an existing entry for the specified key, the cache entry is not be updated +// with the specified item and it returns (existing item, false). +func (c *TimeoutCache) Add(key, item interface{}, callback func()) (interface{}, bool) { + c.mu.Lock() + defer c.mu.Unlock() + if e, ok := c.cache[key]; ok { + return e.item, false + } + + entry := &cacheEntry{ + item: item, + callback: callback, + } + entry.timer = time.AfterFunc(c.timeout, func() { + c.mu.Lock() + if entry.deleted { + c.mu.Unlock() + // Abort the delete since this has been taken care of in Remove(). + return + } + delete(c.cache, key) + c.mu.Unlock() + entry.callback() + }) + c.cache[key] = entry + return item, true +} + +// Remove the item with the key from the cache. +// +// If the specified key exists in the cache, it returns (item associated with +// key, true) and the callback associated with the item is guaranteed to be not +// called. If the given key is not found in the cache, it returns (nil, false) +func (c *TimeoutCache) Remove(key interface{}) (item interface{}, ok bool) { + c.mu.Lock() + defer c.mu.Unlock() + entry, ok := c.removeInternal(key, false) + if !ok { + return nil, false + } + return entry.item, true +} + +// removeInternal removes and returns the item with key. +// +// caller must hold c.mu. +func (c *TimeoutCache) removeInternal(key interface{}, runCallback bool) (*cacheEntry, bool) { + entry, ok := c.cache[key] + if !ok { + return nil, false + } + delete(c.cache, key) + if !entry.timer.Stop() { + // If stop was not successful, the timer has fired (this can only happen + // in a race). But the deleting function is blocked on c.mu because the + // mutex was held by the caller of this function. + // + // Set deleted to true to abort the deleting function. When the lock is + // released, the delete function will acquire the lock, check the value + // of deleted and return. + entry.deleted = true + } + if runCallback { + entry.callback() + } + return entry, true +} + +// Clear removes all entries, and runs the callbacks if runCallback is true. +func (c *TimeoutCache) Clear(runCallback bool) { + c.mu.Lock() + defer c.mu.Unlock() + for key := range c.cache { + c.removeInternal(key, runCallback) + } +} diff --git a/vendor/google.golang.org/grpc/internal/cache/timeoutCache_test.go b/vendor/google.golang.org/grpc/internal/cache/timeoutCache_test.go new file mode 100644 index 00000000000..e2621170d00 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/cache/timeoutCache_test.go @@ -0,0 +1,220 @@ +/* + * + * 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. + */ + +package cache + +import ( + "strconv" + "sync" + "testing" + "time" +) + +const ( + testCacheTimeout = 100 * time.Millisecond +) + +func (c *TimeoutCache) getForTesting(key interface{}) (*cacheEntry, bool) { + c.mu.Lock() + defer c.mu.Unlock() + r, ok := c.cache[key] + return r, ok +} + +// TestCacheExpire attempts to add an entry to the cache and verifies that it +// was added successfully. It then makes sure that on timeout, it's removed and +// the associated callback is called. +func TestCacheExpire(t *testing.T) { + const k, v = 1, "1" + c := NewTimeoutCache(testCacheTimeout) + + callbackChan := make(chan struct{}) + c.Add(k, v, func() { close(callbackChan) }) + + if gotV, ok := c.getForTesting(k); !ok || gotV.item != v { + t.Fatalf("After Add(), before timeout, from cache got: %v, %v, want %v, %v", gotV.item, ok, v, true) + } + + select { + case <-callbackChan: + case <-time.After(testCacheTimeout * 2): + t.Fatalf("timeout waiting for callback") + } + + if _, ok := c.getForTesting(k); ok { + t.Fatalf("After Add(), after timeout, from cache got: _, %v, want _, %v", ok, false) + } +} + +// TestCacheRemove attempts to remove an existing entry from the cache and +// verifies that the entry is removed and the associated callback is not +// invoked. +func TestCacheRemove(t *testing.T) { + const k, v = 1, "1" + c := NewTimeoutCache(testCacheTimeout) + + callbackChan := make(chan struct{}) + c.Add(k, v, func() { close(callbackChan) }) + + if got, ok := c.getForTesting(k); !ok || got.item != v { + t.Fatalf("After Add(), before timeout, from cache got: %v, %v, want %v, %v", got.item, ok, v, true) + } + + time.Sleep(testCacheTimeout / 2) + + gotV, gotOK := c.Remove(k) + if !gotOK || gotV != v { + t.Fatalf("After Add(), before timeout, Remove() got: %v, %v, want %v, %v", gotV, gotOK, v, true) + } + + if _, ok := c.getForTesting(k); ok { + t.Fatalf("After Add(), before timeout, after Remove(), from cache got: _, %v, want _, %v", ok, false) + } + + select { + case <-callbackChan: + t.Fatalf("unexpected callback after retrieve") + case <-time.After(testCacheTimeout * 2): + } +} + +// TestCacheClearWithoutCallback attempts to clear all entries from the cache +// and verifies that the associated callbacks are not invoked. +func TestCacheClearWithoutCallback(t *testing.T) { + var values []string + const itemCount = 3 + for i := 0; i < itemCount; i++ { + values = append(values, strconv.Itoa(i)) + } + c := NewTimeoutCache(testCacheTimeout) + + done := make(chan struct{}) + defer close(done) + callbackChan := make(chan struct{}, itemCount) + + for i, v := range values { + callbackChanTemp := make(chan struct{}) + c.Add(i, v, func() { close(callbackChanTemp) }) + go func() { + select { + case <-callbackChanTemp: + callbackChan <- struct{}{} + case <-done: + } + }() + } + + for i, v := range values { + if got, ok := c.getForTesting(i); !ok || got.item != v { + t.Fatalf("After Add(), before timeout, from cache got: %v, %v, want %v, %v", got.item, ok, v, true) + } + } + + time.Sleep(testCacheTimeout / 2) + c.Clear(false) + + for i := range values { + if _, ok := c.getForTesting(i); ok { + t.Fatalf("After Add(), before timeout, after Remove(), from cache got: _, %v, want _, %v", ok, false) + } + } + + select { + case <-callbackChan: + t.Fatalf("unexpected callback after Clear") + case <-time.After(testCacheTimeout * 2): + } +} + +// TestCacheClearWithCallback attempts to clear all entries from the cache and +// verifies that the associated callbacks are invoked. +func TestCacheClearWithCallback(t *testing.T) { + var values []string + const itemCount = 3 + for i := 0; i < itemCount; i++ { + values = append(values, strconv.Itoa(i)) + } + c := NewTimeoutCache(time.Hour) + + testDone := make(chan struct{}) + defer close(testDone) + + var wg sync.WaitGroup + wg.Add(itemCount) + for i, v := range values { + callbackChanTemp := make(chan struct{}) + c.Add(i, v, func() { close(callbackChanTemp) }) + go func() { + defer wg.Done() + select { + case <-callbackChanTemp: + case <-testDone: + } + }() + } + + allGoroutineDone := make(chan struct{}, itemCount) + go func() { + wg.Wait() + close(allGoroutineDone) + }() + + for i, v := range values { + if got, ok := c.getForTesting(i); !ok || got.item != v { + t.Fatalf("After Add(), before timeout, from cache got: %v, %v, want %v, %v", got.item, ok, v, true) + } + } + + time.Sleep(testCacheTimeout / 2) + c.Clear(true) + + for i := range values { + if _, ok := c.getForTesting(i); ok { + t.Fatalf("After Add(), before timeout, after Remove(), from cache got: _, %v, want _, %v", ok, false) + } + } + + select { + case <-allGoroutineDone: + case <-time.After(testCacheTimeout * 2): + t.Fatalf("timeout waiting for all callbacks") + } +} + +// TestCacheRetrieveTimeoutRace simulates the case where an entry's timer fires +// around the same time that Remove() is called for it. It verifies that there +// is no deadlock. +func TestCacheRetrieveTimeoutRace(t *testing.T) { + c := NewTimeoutCache(time.Nanosecond) + + done := make(chan struct{}) + go func() { + for i := 0; i < 1000; i++ { + // Add starts a timer with 1 ns timeout, then remove will race + // with the timer. + c.Add(i, strconv.Itoa(i), func() {}) + c.Remove(i) + } + close(done) + }() + + select { + case <-time.After(time.Second): + t.Fatalf("Test didn't finish within 1 second. Deadlock") + case <-done: + } +} diff --git a/vendor/google.golang.org/grpc/internal/internal.go b/vendor/google.golang.org/grpc/internal/internal.go index bc1f99ac803..eae18e18ccd 100644 --- a/vendor/google.golang.org/grpc/internal/internal.go +++ b/vendor/google.golang.org/grpc/internal/internal.go @@ -28,9 +28,9 @@ import ( ) var ( - // WithResolverBuilder is exported by dialoptions.go + // WithResolverBuilder is set by dialoptions.go WithResolverBuilder interface{} // func (resolver.Builder) grpc.DialOption - // WithHealthCheckFunc is not exported by dialoptions.go + // WithHealthCheckFunc is set by dialoptions.go WithHealthCheckFunc interface{} // func (HealthChecker) DialOption // HealthCheckFunc is used to provide client-side LB channel health checking HealthCheckFunc HealthChecker @@ -39,14 +39,17 @@ var ( // KeepaliveMinPingTime is the minimum ping interval. This must be 10s by // default, but tests may wish to set it lower for convenience. KeepaliveMinPingTime = 10 * time.Second - // ParseServiceConfig is a function to parse JSON service configs into - // opaque data structures. - ParseServiceConfig func(sc string) (interface{}, error) // StatusRawProto is exported by status/status.go. This func returns a // pointer to the wrapped Status proto for a given status.Status without a // call to proto.Clone(). The returned Status proto should not be mutated by // the caller. StatusRawProto interface{} // func (*status.Status) *spb.Status + // NewRequestInfoContext creates a new context based on the argument context attaching + // the passed in RequestInfo to the new context. + NewRequestInfoContext interface{} // func(context.Context, credentials.RequestInfo) context.Context + // ParseServiceConfigForTesting is for creating a fake + // ClientConn for resolver testing only + ParseServiceConfigForTesting interface{} // func(string) *serviceconfig.ParseResult ) // HealthChecker defines the signature of the client-side LB channel health checking function. @@ -57,7 +60,7 @@ var ( // // The health checking protocol is defined at: // https://github.com/grpc/grpc/blob/master/doc/health-checking.md -type HealthChecker func(ctx context.Context, newStream func(string) (interface{}, error), setConnectivityState func(connectivity.State), serviceName string) error +type HealthChecker func(ctx context.Context, newStream func(string) (interface{}, error), setConnectivityState func(connectivity.State, error), serviceName string) error const ( // CredsBundleModeFallback switches GoogleDefaultCreds to fallback mode. diff --git a/vendor/google.golang.org/grpc/internal/leakcheck/leakcheck.go b/vendor/google.golang.org/grpc/internal/leakcheck/leakcheck.go index 76f9fc54176..946c575f140 100644 --- a/vendor/google.golang.org/grpc/internal/leakcheck/leakcheck.go +++ b/vendor/google.golang.org/grpc/internal/leakcheck/leakcheck.go @@ -111,7 +111,7 @@ func check(efer Errorfer, timeout time.Duration) { } // Check looks at the currently-running goroutines and checks if there are any -// interestring (created by gRPC) goroutines leaked. It waits up to 10 seconds +// interesting (created by gRPC) goroutines leaked. It waits up to 10 seconds // in the error cases. func Check(efer Errorfer) { check(efer, 10*time.Second) diff --git a/vendor/google.golang.org/grpc/internal/profiling/buffer/buffer.go b/vendor/google.golang.org/grpc/internal/profiling/buffer/buffer.go new file mode 100644 index 00000000000..45745cd0919 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/profiling/buffer/buffer.go @@ -0,0 +1,274 @@ +// +build !appengine + +/* + * + * 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. + * + */ + +// Package buffer provides a high-performant lock free implementation of a +// circular buffer used by the profiling code. +package buffer + +import ( + "errors" + "math/bits" + "runtime" + "sync" + "sync/atomic" + "unsafe" +) + +type queue struct { + // An array of pointers as references to the items stored in this queue. + arr []unsafe.Pointer + // The maximum number of elements this queue may store before it wraps around + // and overwrites older values. Must be an exponent of 2. + size uint32 + // Always size - 1. A bitwise AND is performed with this mask in place of a + // modulo operation by the Push operation. + mask uint32 + // Each Push operation into this queue increments the acquired counter before + // proceeding forwarding with the actual write to arr. This counter is also + // used by the Drain operation's drainWait subroutine to wait for all pushes + // to complete. + acquired uint32 // Accessed atomically. + // After the completion of a Push operation, the written counter is + // incremented. Also used by drainWait to wait for all pushes to complete. + written uint32 +} + +// Allocates and returns a new *queue. size needs to be a exponent of two. +func newQueue(size uint32) *queue { + return &queue{ + arr: make([]unsafe.Pointer, size), + size: size, + mask: size - 1, + } +} + +// drainWait blocks the caller until all Pushes on this queue are complete. +func (q *queue) drainWait() { + for atomic.LoadUint32(&q.acquired) != atomic.LoadUint32(&q.written) { + runtime.Gosched() + } +} + +// A queuePair has two queues. At any given time, Pushes go into the queue +// referenced by queuePair.q. The active queue gets switched when there's a +// drain operation on the circular buffer. +type queuePair struct { + q0 unsafe.Pointer + q1 unsafe.Pointer + q unsafe.Pointer +} + +// Allocates and returns a new *queuePair with its internal queues allocated. +func newQueuePair(size uint32) *queuePair { + qp := &queuePair{} + qp.q0 = unsafe.Pointer(newQueue(size)) + qp.q1 = unsafe.Pointer(newQueue(size)) + qp.q = qp.q0 + return qp +} + +// Switches the current queue for future Pushes to proceed to the other queue +// so that there's no blocking in Push. Returns a pointer to the old queue that +// was in place before the switch. +func (qp *queuePair) switchQueues() *queue { + // Even though we have mutual exclusion across drainers (thanks to mu.Lock in + // drain), Push operations may access qp.q whilst we're writing to it. + if atomic.CompareAndSwapPointer(&qp.q, qp.q0, qp.q1) { + return (*queue)(qp.q0) + } + + atomic.CompareAndSwapPointer(&qp.q, qp.q1, qp.q0) + return (*queue)(qp.q1) +} + +// In order to not have expensive modulo operations, we require the maximum +// number of elements in the circular buffer (N) to be an exponent of two to +// use a bitwise AND mask. Since a CircularBuffer is a collection of queuePairs +// (see below), we need to divide N; since exponents of two are only divisible +// by other exponents of two, we use floorCPUCount number of queuePairs within +// each CircularBuffer. +// +// Floor of the number of CPUs (and not the ceiling) was found to the be the +// optimal number through experiments. +func floorCPUCount() uint32 { + floorExponent := bits.Len32(uint32(runtime.NumCPU())) - 1 + if floorExponent < 0 { + floorExponent = 0 + } + return 1 << uint32(floorExponent) +} + +var numCircularBufferPairs = floorCPUCount() + +// CircularBuffer is a lock-free data structure that supports Push and Drain +// operations. +// +// Note that CircularBuffer is built for performance more than reliability. +// That is, some Push operations may fail without retries in some situations +// (such as during a Drain operation). Order of pushes is not maintained +// either; that is, if A was pushed before B, the Drain operation may return an +// array with B before A. These restrictions are acceptable within gRPC's +// profiling, but if your use-case does not permit these relaxed constraints +// or if performance is not a primary concern, you should probably use a +// lock-based data structure such as internal/buffer.UnboundedBuffer. +type CircularBuffer struct { + drainMutex sync.Mutex + qp []*queuePair + // qpn is an monotonically incrementing counter that's used to determine + // which queuePair a Push operation should write to. This approach's + // performance was found to be better than writing to a random queue. + qpn uint32 + qpMask uint32 +} + +var errInvalidCircularBufferSize = errors.New("buffer size is not an exponent of two") + +// NewCircularBuffer allocates a circular buffer of size size and returns a +// reference to the struct. Only circular buffers of size 2^k are allowed +// (saves us from having to do expensive modulo operations). +func NewCircularBuffer(size uint32) (*CircularBuffer, error) { + if size&(size-1) != 0 { + return nil, errInvalidCircularBufferSize + } + + n := numCircularBufferPairs + if size/numCircularBufferPairs < 8 { + // If each circular buffer is going to hold less than a very small number + // of items (let's say 8), using multiple circular buffers is very likely + // wasteful. Instead, fallback to one circular buffer holding everything. + n = 1 + } + + cb := &CircularBuffer{ + qp: make([]*queuePair, n), + qpMask: n - 1, + } + + for i := uint32(0); i < n; i++ { + cb.qp[i] = newQueuePair(size / n) + } + + return cb, nil +} + +// Push pushes an element in to the circular buffer. Guaranteed to complete in +// a finite number of steps (also lock-free). Does not guarantee that push +// order will be retained. Does not guarantee that the operation will succeed +// if a Drain operation concurrently begins execution. +func (cb *CircularBuffer) Push(x interface{}) { + n := atomic.AddUint32(&cb.qpn, 1) & cb.qpMask + qptr := atomic.LoadPointer(&cb.qp[n].q) + q := (*queue)(qptr) + + acquired := atomic.AddUint32(&q.acquired, 1) - 1 + + // If true, it means that we have incremented acquired before any queuePair + // was switched, and therefore before any drainWait completion. Therefore, it + // is safe to proceed with the Push operation on this queue. Otherwise, it + // means that a Drain operation has begun execution, but we don't know how + // far along the process it is. If it is past the drainWait check, it is not + // safe to proceed with the Push operation. We choose to drop this sample + // entirely instead of retrying, as retrying may potentially send the Push + // operation into a spin loop (we want to guarantee completion of the Push + // operation within a finite time). Before exiting, we increment written so + // that any existing drainWaits can proceed. + if atomic.LoadPointer(&cb.qp[n].q) != qptr { + atomic.AddUint32(&q.written, 1) + return + } + + // At this point, we're definitely writing to the right queue. That is, one + // of the following is true: + // 1. No drainer is in execution on this queue. + // 2. A drainer is in execution on this queue and it is waiting at the + // acquired == written barrier. + // + // Let's say two Pushes A and B happen on the same queue. Say A and B are + // q.size apart; i.e. they get the same index. That is, + // + // index_A = index_B + // acquired_A + q.size = acquired_B + // + // We say "B has wrapped around A" when this happens. In this case, since A + // occurred before B, B's Push should be the final value. However, we + // accommodate A being the final value because wrap-arounds are extremely + // rare and accounting for them requires an additional counter and a + // significant performance penalty. Note that the below approach never leads + // to any data corruption. + index := acquired & q.mask + atomic.StorePointer(&q.arr[index], unsafe.Pointer(&x)) + + // Allows any drainWait checks to proceed. + atomic.AddUint32(&q.written, 1) +} + +// Dereferences non-nil pointers from arr into result. Range of elements from +// arr that are copied is [from, to). Assumes that the result slice is already +// allocated and is large enough to hold all the elements that might be copied. +// Also assumes mutual exclusion on the array of pointers. +func dereferenceAppend(result []interface{}, arr []unsafe.Pointer, from, to uint32) []interface{} { + for i := from; i < to; i++ { + // We have mutual exclusion on arr, there's no need for atomics. + x := (*interface{})(arr[i]) + if x != nil { + result = append(result, *x) + } + } + return result +} + +// Drain allocates and returns an array of things Pushed in to the circular +// buffer. Push order is not maintained; that is, if B was Pushed after A, +// drain may return B at a lower index than A in the returned array. +func (cb *CircularBuffer) Drain() []interface{} { + cb.drainMutex.Lock() + + qs := make([]*queue, len(cb.qp)) + for i := 0; i < len(cb.qp); i++ { + qs[i] = cb.qp[i].switchQueues() + } + + var wg sync.WaitGroup + wg.Add(int(len(qs))) + for i := 0; i < len(qs); i++ { + go func(qi int) { + qs[qi].drainWait() + wg.Done() + }(i) + } + wg.Wait() + + result := make([]interface{}, 0) + for i := 0; i < len(qs); i++ { + if acquired := atomic.LoadUint32(&qs[i].acquired); acquired < qs[i].size { + result = dereferenceAppend(result, qs[i].arr, 0, acquired) + } else { + result = dereferenceAppend(result, qs[i].arr, 0, qs[i].size) + } + } + + for i := 0; i < len(qs); i++ { + atomic.StoreUint32(&qs[i].acquired, 0) + atomic.StoreUint32(&qs[i].written, 0) + } + + cb.drainMutex.Unlock() + return result +} diff --git a/vendor/google.golang.org/grpc/internal/profiling/buffer/buffer_appengine.go b/vendor/google.golang.org/grpc/internal/profiling/buffer/buffer_appengine.go new file mode 100644 index 00000000000..c92599e5b9c --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/profiling/buffer/buffer_appengine.go @@ -0,0 +1,43 @@ +// +build appengine + +/* + * + * 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. + * + */ + +package buffer + +// CircularBuffer is a no-op implementation for appengine builds. +// +// Appengine does not support stats because of lack of the support for unsafe +// pointers, which are necessary to efficiently store and retrieve things into +// and from a circular buffer. As a result, Push does not do anything and Drain +// returns an empty slice. +type CircularBuffer struct{} + +// NewCircularBuffer returns a no-op for appengine builds. +func NewCircularBuffer(size uint32) (*CircularBuffer, error) { + return nil, nil +} + +// Push returns a no-op for appengine builds. +func (cb *CircularBuffer) Push(x interface{}) { +} + +// Drain returns a no-op for appengine builds. +func (cb *CircularBuffer) Drain() []interface{} { + return nil +} diff --git a/vendor/google.golang.org/grpc/internal/profiling/buffer/buffer_test.go b/vendor/google.golang.org/grpc/internal/profiling/buffer/buffer_test.go new file mode 100644 index 00000000000..6698098f32f --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/profiling/buffer/buffer_test.go @@ -0,0 +1,178 @@ +// +build !appengine + +/* + * + * 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. + * + */ + +package buffer + +import ( + "fmt" + "sync" + "testing" + "time" +) + +func TestCircularBufferSerial(t *testing.T) { + var size, i uint32 + var result []interface{} + + size = 1 << 15 + cb, err := NewCircularBuffer(size) + if err != nil { + t.Fatalf("error allocating CircularBuffer: %v", err) + } + + for i = 0; i < size/2; i++ { + cb.Push(i) + } + + result = cb.Drain() + if uint32(len(result)) != size/2 { + t.Fatalf("len(result) = %d; want %d", len(result), size/2) + } + + // The returned result isn't necessarily sorted. + seen := make(map[uint32]bool) + for _, r := range result { + seen[r.(uint32)] = true + } + + for i = 0; i < uint32(len(result)); i++ { + if !seen[i] { + t.Fatalf("seen[%d] = false; want true", i) + } + } + + for i = 0; i < size; i++ { + cb.Push(i) + } + + result = cb.Drain() + if uint32(len(result)) != size { + t.Fatalf("len(result) = %d; want %d", len(result), size/2) + } +} + +func TestCircularBufferOverflow(t *testing.T) { + var size, i uint32 + var result []interface{} + + size = 1 << 10 + cb, err := NewCircularBuffer(size) + if err != nil { + t.Fatalf("error allocating CircularBuffer: %v", err) + } + + for i = 0; i < 10*size; i++ { + cb.Push(i) + } + + result = cb.Drain() + + if uint32(len(result)) != size { + t.Fatalf("len(result) = %d; want %d", len(result), size) + } + + for idx, x := range result { + if x.(uint32) < size { + t.Fatalf("result[%d] = %d; want it to be >= %d", idx, x, size) + } + } +} + +func TestCircularBufferConcurrent(t *testing.T) { + for tn := 0; tn < 2; tn++ { + var size uint32 + var result []interface{} + + size = 1 << 6 + cb, err := NewCircularBuffer(size) + if err != nil { + t.Fatalf("error allocating CircularBuffer: %v", err) + } + + type item struct { + R uint32 + N uint32 + T time.Time + } + + var wg sync.WaitGroup + for r := uint32(0); r < 1024; r++ { + wg.Add(1) + go func(r uint32) { + for n := uint32(0); n < size; n++ { + cb.Push(item{R: r, N: n, T: time.Now()}) + } + wg.Done() + }(r) + } + + // Wait for all goroutines to finish only in one test. Draining + // concurrently while Pushes are still happening will test for races in the + // Draining lock. + if tn == 0 { + wg.Wait() + } + + result = cb.Drain() + + // Can't expect the buffer to be full if the Pushes aren't necessarily done. + if tn == 0 { + if uint32(len(result)) != size { + t.Fatalf("len(result) = %d; want %d", len(result), size) + } + } + + // There can be absolutely no expectation on the order of the data returned + // by Drain because: (a) everything is happening concurrently (b) a + // round-robin is used to write to different queues (and therefore + // different cachelines) for less write contention. + + // Wait for all goroutines to complete before moving on to other tests. If + // the benchmarks run after this, it might affect performance unfairly. + wg.Wait() + } +} + +func BenchmarkCircularBuffer(b *testing.B) { + x := 1 + for size := 1 << 16; size <= 1<<20; size <<= 1 { + for routines := 1; routines <= 1<<8; routines <<= 1 { + b.Run(fmt.Sprintf("goroutines:%d/size:%d", routines, size), func(b *testing.B) { + cb, err := NewCircularBuffer(uint32(size)) + if err != nil { + b.Fatalf("error allocating CircularBuffer: %v", err) + } + + perRoutine := b.N / routines + var wg sync.WaitGroup + for r := 0; r < routines; r++ { + wg.Add(1) + go func() { + for i := 0; i < perRoutine; i++ { + cb.Push(&x) + } + wg.Done() + }() + } + wg.Wait() + }) + } + } +} diff --git a/vendor/google.golang.org/grpc/internal/profiling/goid_modified.go b/vendor/google.golang.org/grpc/internal/profiling/goid_modified.go new file mode 100644 index 00000000000..b186499cd0d --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/profiling/goid_modified.go @@ -0,0 +1,81 @@ +// +build grpcgoid + +/* + * + * 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. + * + */ + +package profiling + +import ( + "runtime" +) + +// This stubbed function usually returns zero (see goid_regular.go); however, +// if grpc is built with `-tags 'grpcgoid'`, a runtime.Goid function, which +// does not exist in the Go standard library, is expected. While not necessary, +// sometimes, visualising grpc profiling data in trace-viewer is much nicer +// with goroutines separated from each other. +// +// Several other approaches were considered before arriving at this: +// +// 1. Using a CGO module: CGO usually has access to some things that regular +// Go does not. Till go1.4, CGO used to have access to the goroutine struct +// because the Go runtime was written in C. However, 1.5+ uses a native Go +// runtime; as a result, CGO does not have access to the goroutine structure +// anymore in modern Go. Besides, CGO interop wasn't fast enough (estimated +// to be ~170ns/op). This would also make building grpc require a C +// compiler, which isn't a requirement currently, breaking a lot of stuff. +// +// 2. Using runtime.Stack stacktrace: While this would remove the need for a +// modified Go runtime, this is ridiculously slow, thanks to the all the +// string processing shenanigans required to extract the goroutine ID (about +// ~2000ns/op). +// +// 3. Using Go version-specific build tags: For any given Go version, the +// goroutine struct has a fixed structure. As a result, the goroutine ID +// could be extracted if we know the offset using some assembly. This would +// be faster then #1 and #2, but is harder to maintain. This would require +// special Go code that's both architecture-specific and go version-specific +// (a quadratic number of variants to maintain). +// +// 4. This approach, which requires a simple modification [1] to the Go runtime +// to expose the current goroutine's ID. This is the chosen approach and it +// takes about ~2 ns/op, which is negligible in the face of the tens of +// microseconds that grpc takes to complete a RPC request. +// +// [1] To make the goroutine ID visible to Go programs apply the following +// change to the runtime2.go file in your Go runtime installation: +// +// diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go +// --- a/src/runtime/runtime2.go +// +++ b/src/runtime/runtime2.go +// @@ -392,6 +392,10 @@ type stack struct { +// hi uintptr +// } +// +// +func Goid() int64 { +// + return getg().goid +// +} +// + +// type g struct { +// // Stack parameters. +// // stack describes the actual stack memory: [stack.lo, stack.hi). +// +// The exposed runtime.Goid() function will return a int64 goroutine ID. +func goid() int64 { + return runtime.Goid() +} diff --git a/vendor/google.golang.org/grpc/internal/profiling/goid_regular.go b/vendor/google.golang.org/grpc/internal/profiling/goid_regular.go new file mode 100644 index 00000000000..891c2e98f9d --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/profiling/goid_regular.go @@ -0,0 +1,29 @@ +// +build !grpcgoid + +/* + * + * 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. + * + */ + +package profiling + +// This dummy function always returns 0. In some modified dev environments, +// this may be replaced with a call to a function in a modified Go runtime that +// retrieves the goroutine ID efficiently. See goid_modified.go for a different +// version of goId that requires a grpcgoid build tag to compile. +func goid() int64 { + return 0 +} diff --git a/vendor/google.golang.org/grpc/internal/profiling/profiling.go b/vendor/google.golang.org/grpc/internal/profiling/profiling.go new file mode 100644 index 00000000000..21651445f4b --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/profiling/profiling.go @@ -0,0 +1,220 @@ +/* + * + * 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. + * + */ + +// Package profiling contains two logical components: buffer.go and +// profiling.go. The former implements a circular buffer (a.k.a. ring buffer) +// in a lock-free manner using atomics. This ring buffer is used by +// profiling.go to store various statistics. For example, StreamStats is a +// circular buffer of Stat objects, each of which is comprised of Timers. +// +// This abstraction is designed to accommodate more stats in the future; for +// example, if one wants to profile the load balancing layer, which is +// independent of RPC queries, a separate CircularBuffer can be used. +// +// Note that the circular buffer simply takes any interface{}. In the future, +// more types of measurements (such as the number of memory allocations) could +// be measured, which might require a different type of object being pushed +// into the circular buffer. +package profiling + +import ( + "sync" + "sync/atomic" + "time" + + "google.golang.org/grpc/internal/profiling/buffer" +) + +// 0 or 1 representing profiling off and on, respectively. Use IsEnabled and +// Enable to get and set this in a safe manner. +var profilingEnabled uint32 + +// IsEnabled returns whether or not profiling is enabled. +func IsEnabled() bool { + return atomic.LoadUint32(&profilingEnabled) > 0 +} + +// Enable turns profiling on and off. +// +// Note that it is impossible to enable profiling for one server and leave it +// turned off for another. This is intentional and by design -- if the status +// of profiling was server-specific, clients wouldn't be able to profile +// themselves. As a result, Enable turns profiling on and off for all servers +// and clients in the binary. Each stat will be, however, tagged with whether +// it's a client stat or a server stat; so you should be able to filter for the +// right type of stats in post-processing. +func Enable(enabled bool) { + if enabled { + atomic.StoreUint32(&profilingEnabled, 1) + } else { + atomic.StoreUint32(&profilingEnabled, 0) + } +} + +// A Timer represents the wall-clock beginning and ending of a logical +// operation. +type Timer struct { + // Tags is a comma-separated list of strings (usually forward-slash-separated + // hierarchical strings) used to categorize a Timer. + Tags string + // Begin marks the beginning of this timer. The timezone is unspecified, but + // must use the same timezone as End; this is so shave off the small, but + // non-zero time required to convert to a standard timezone such as UTC. + Begin time.Time + // End marks the end of a timer. + End time.Time + // Each Timer must be started and ended within the same goroutine; GoID + // captures this goroutine ID. The Go runtime does not typically expose this + // information, so this is set to zero in the typical case. However, a + // trivial patch to the runtime package can make this field useful. See + // goid_modified.go in this package for more details. + GoID int64 +} + +// NewTimer creates and returns a new Timer object. This is useful when you +// don't already have a Stat object to associate this Timer with; for example, +// before the context of a new RPC query is created, a Timer may be needed to +// measure transport-related operations. +// +// Use AppendTimer to append the returned Timer to a Stat. +func NewTimer(tags string) *Timer { + return &Timer{ + Tags: tags, + Begin: time.Now(), + GoID: goid(), + } +} + +// Egress sets the End field of a timer to the current time. +func (timer *Timer) Egress() { + if timer == nil { + return + } + + timer.End = time.Now() +} + +// A Stat is a collection of Timers that represent timing information for +// different components within this Stat. For example, a Stat may be used to +// reference the entire lifetime of an RPC request, with Timers within it +// representing different components such as encoding, compression, and +// transport. +// +// The user is expected to use the included helper functions to do operations +// on the Stat such as creating or appending a new timer. Direct operations on +// the Stat's exported fields (which are exported for encoding reasons) may +// lead to data races. +type Stat struct { + // Tags is a comma-separated list of strings used to categorize a Stat. + Tags string + // Stats may also need to store other unstructured information specific to + // this stat. For example, a StreamStat will use these bytes to encode the + // connection ID and stream ID for each RPC to uniquely identify it. The + // encoding that must be used is unspecified. + Metadata []byte + // A collection of *Timers and a mutex for append operations on the slice. + mu sync.Mutex + Timers []*Timer +} + +// A power of two that's large enough to hold all timers within an average RPC +// request (defined to be a unary request) without any reallocation. A typical +// unary RPC creates 80-100 timers for various things. While this number is +// purely anecdotal and may change in the future as the resolution of profiling +// increases or decreases, it serves as a good estimate for what the initial +// allocation size should be. +const defaultStatAllocatedTimers int32 = 128 + +// NewStat creates and returns a new Stat object. +func NewStat(tags string) *Stat { + return &Stat{ + Tags: tags, + Timers: make([]*Timer, 0, defaultStatAllocatedTimers), + } +} + +// NewTimer creates a Timer object within the given stat if stat is non-nil. +// The value passed in tags will be attached to the newly created Timer. +// NewTimer also automatically sets the Begin value of the Timer to the current +// time. The user is expected to call stat.Egress with the returned index as +// argument to mark the end. +func (stat *Stat) NewTimer(tags string) *Timer { + if stat == nil { + return nil + } + + timer := &Timer{ + Tags: tags, + GoID: goid(), + Begin: time.Now(), + } + stat.mu.Lock() + stat.Timers = append(stat.Timers, timer) + stat.mu.Unlock() + return timer +} + +// AppendTimer appends a given Timer object to the internal slice of timers. A +// deep copy of the timer is made (i.e. no reference is retained to this +// pointer) and the user is expected to lose their reference to the timer to +// allow the Timer object to be garbage collected. +func (stat *Stat) AppendTimer(timer *Timer) { + if stat == nil || timer == nil { + return + } + + stat.mu.Lock() + stat.Timers = append(stat.Timers, timer) + stat.mu.Unlock() +} + +// statsInitialized is 0 before InitStats has been called. Changed to 1 by +// exactly one call to InitStats. +var statsInitialized int32 + +// Stats for the last defaultStreamStatsBufsize RPCs will be stored in memory. +// This is can be configured by the registering server at profiling service +// initialization with google.golang.org/grpc/profiling/service.ProfilingConfig +const defaultStreamStatsSize uint32 = 16 << 10 + +// StreamStats is a CircularBuffer containing data from the last N RPC calls +// served, where N is set by the user. This will contain both server stats and +// client stats (but each stat will be tagged with whether it's a server or a +// client in its Tags). +var StreamStats *buffer.CircularBuffer + +// InitStats initializes all the relevant Stat objects. Must be called exactly +// once per lifetime of a process; calls after the first one are ignored. +func InitStats(streamStatsSize uint32) error { + var err error + if !atomic.CompareAndSwapInt32(&statsInitialized, 0, 1) { + // If initialized, do nothing. + return nil + } + + if streamStatsSize == 0 { + streamStatsSize = defaultStreamStatsSize + } + + StreamStats, err = buffer.NewCircularBuffer(streamStatsSize) + if err != nil { + return err + } + + return nil +} diff --git a/vendor/google.golang.org/grpc/internal/profiling/profiling_test.go b/vendor/google.golang.org/grpc/internal/profiling/profiling_test.go new file mode 100644 index 00000000000..257997b63be --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/profiling/profiling_test.go @@ -0,0 +1,147 @@ +// +build !appengine + +/* + * + * 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. + * + */ + +package profiling + +import ( + "fmt" + "strconv" + "sync" + "testing" + "time" + + "google.golang.org/grpc/internal/profiling/buffer" +) + +func TestProfiling(t *testing.T) { + cb, err := buffer.NewCircularBuffer(128) + if err != nil { + t.Fatalf("error creating circular buffer: %v", err) + } + + stat := NewStat("foo") + cb.Push(stat) + bar := func(n int) { + if n%2 == 0 { + defer stat.NewTimer(strconv.Itoa(n)).Egress() + } else { + timer := NewTimer(strconv.Itoa(n)) + stat.AppendTimer(timer) + defer timer.Egress() + } + time.Sleep(1 * time.Microsecond) + } + + numTimers := int(8 * defaultStatAllocatedTimers) + for i := 0; i < numTimers; i++ { + bar(i) + } + + results := cb.Drain() + if len(results) != 1 { + t.Fatalf("len(results) = %d; want 1", len(results)) + } + + statReturned := results[0].(*Stat) + if stat.Tags != "foo" { + t.Fatalf("stat.Tags = %s; want foo", stat.Tags) + } + + if len(stat.Timers) != numTimers { + t.Fatalf("len(stat.Timers) = %d; want %d", len(stat.Timers), numTimers) + } + + lastIdx := 0 + for i, timer := range statReturned.Timers { + // Check that they're in the order of append. + if n, err := strconv.Atoi(timer.Tags); err != nil && n != lastIdx { + t.Fatalf("stat.Timers[%d].Tags = %s; wanted %d", i, timer.Tags, lastIdx) + } + + // Check that the timestamps are consistent. + if diff := timer.End.Sub(timer.Begin); diff.Nanoseconds() < 1000 { + t.Fatalf("stat.Timers[%d].End - stat.Timers[%d].Begin = %v; want >= 1000ns", i, i, diff) + } + + lastIdx++ + } +} + +func TestProfilingRace(t *testing.T) { + stat := NewStat("foo") + + var wg sync.WaitGroup + numTimers := int(8 * defaultStatAllocatedTimers) // also tests the slice growth code path + wg.Add(numTimers) + for i := 0; i < numTimers; i++ { + go func(n int) { + defer wg.Done() + if n%2 == 0 { + defer stat.NewTimer(strconv.Itoa(n)).Egress() + } else { + timer := NewTimer(strconv.Itoa(n)) + stat.AppendTimer(timer) + defer timer.Egress() + } + }(i) + } + wg.Wait() + + if len(stat.Timers) != numTimers { + t.Fatalf("len(stat.Timers) = %d; want %d", len(stat.Timers), numTimers) + } + + // The timers need not be ordered, so we can't expect them to be consecutive + // like above. + seen := make(map[int]bool) + for i, timer := range stat.Timers { + n, err := strconv.Atoi(timer.Tags) + if err != nil { + t.Fatalf("stat.Timers[%d].Tags = %s; wanted integer", i, timer.Tags) + } + seen[n] = true + } + + for i := 0; i < numTimers; i++ { + if _, ok := seen[i]; !ok { + t.Fatalf("seen[%d] = false or does not exist; want it to be true", i) + } + } +} + +func BenchmarkProfiling(b *testing.B) { + for routines := 1; routines <= 1<<8; routines <<= 1 { + b.Run(fmt.Sprintf("goroutines:%d", routines), func(b *testing.B) { + perRoutine := b.N / routines + stat := NewStat("foo") + var wg sync.WaitGroup + wg.Add(routines) + for r := 0; r < routines; r++ { + go func() { + for i := 0; i < perRoutine; i++ { + stat.NewTimer("bar").Egress() + } + wg.Done() + }() + } + wg.Wait() + }) + } +} diff --git a/vendor/google.golang.org/grpc/internal/proto/grpc_service_config/example_test.go b/vendor/google.golang.org/grpc/internal/proto/grpc_service_config/example_test.go new file mode 100644 index 00000000000..038542b4bac --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/proto/grpc_service_config/example_test.go @@ -0,0 +1,59 @@ +/* + * + * 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. + */ + +//go:generate ./regenerate.sh + +package grpc_service_config_test + +import ( + "testing" + + "github.com/golang/protobuf/jsonpb" + wrapperspb "github.com/golang/protobuf/ptypes/wrappers" + scpb "google.golang.org/grpc/internal/proto/grpc_service_config" +) + +// TestXdsConfigMarshalToJSON is an example to print json format of xds_config. +func TestXdsConfigMarshalToJSON(t *testing.T) { + c := &scpb.XdsConfig{ + ChildPolicy: []*scpb.LoadBalancingConfig{ + {Policy: &scpb.LoadBalancingConfig_Grpclb{ + Grpclb: &scpb.GrpcLbConfig{}, + }}, + {Policy: &scpb.LoadBalancingConfig_RoundRobin{ + RoundRobin: &scpb.RoundRobinConfig{}, + }}, + }, + FallbackPolicy: []*scpb.LoadBalancingConfig{ + {Policy: &scpb.LoadBalancingConfig_Grpclb{ + Grpclb: &scpb.GrpcLbConfig{}, + }}, + {Policy: &scpb.LoadBalancingConfig_PickFirst{ + PickFirst: &scpb.PickFirstConfig{}, + }}, + }, + EdsServiceName: "eds.service.name", + LrsLoadReportingServerName: &wrapperspb.StringValue{ + Value: "lrs.server.name", + }, + } + j, err := (&jsonpb.Marshaler{}).MarshalToString(c) + if err != nil { + t.Fatalf("failed to marshal proto to json: %v", err) + } + t.Logf(j) +} diff --git a/vendor/google.golang.org/grpc/internal/proto/grpc_service_config/regenerate.sh b/vendor/google.golang.org/grpc/internal/proto/grpc_service_config/regenerate.sh new file mode 100755 index 00000000000..b67a25c3646 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/proto/grpc_service_config/regenerate.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# 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. + +set -eux -o pipefail + +TMP=$(mktemp -d) + +function finish { + rm -rf "$TMP" +} +trap finish EXIT + +pushd "$TMP" +mkdir -p grpc/service_config +curl https://raw.githubusercontent.com/grpc/grpc-proto/master/grpc/service_config/service_config.proto > grpc/service_config/service_config.proto +mkdir -p google/rpc +curl https://raw.githubusercontent.com/googleapis/googleapis/master/google/rpc/code.proto > google/rpc/code.proto + +protoc --go_out=plugins=grpc,paths=source_relative:. -I. grpc/service_config/*.proto +popd +rm -f ./*.pb.go +cp "$TMP"/grpc/service_config/*.pb.go ./ + diff --git a/vendor/google.golang.org/grpc/internal/proto/grpc_service_config/service_config.pb.go b/vendor/google.golang.org/grpc/internal/proto/grpc_service_config/service_config.pb.go new file mode 100644 index 00000000000..b9d3c2553c6 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/proto/grpc_service_config/service_config.pb.go @@ -0,0 +1,1131 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: grpc/service_config/service_config.proto + +package grpc_service_config + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + duration "github.com/golang/protobuf/ptypes/duration" + wrappers "github.com/golang/protobuf/ptypes/wrappers" + code "google.golang.org/genproto/googleapis/rpc/code" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// Load balancing policy. +// +// Note that load_balancing_policy is deprecated in favor of +// load_balancing_config; the former will be used only if the latter +// is unset. +// +// If no LB policy is configured here, then the default is pick_first. +// If the policy name is set via the client API, that value overrides +// the value specified here. +// +// If the deprecated load_balancing_policy field is used, note that if the +// resolver returns at least one balancer address (as opposed to backend +// addresses), gRPC will use grpclb (see +// https://github.com/grpc/grpc/blob/master/doc/load-balancing.md), +// regardless of what policy is configured here. However, if the resolver +// returns at least one backend address in addition to the balancer +// address(es), the client may fall back to the requested policy if it +// is unable to reach any of the grpclb load balancers. +type ServiceConfig_LoadBalancingPolicy int32 + +const ( + ServiceConfig_UNSPECIFIED ServiceConfig_LoadBalancingPolicy = 0 + ServiceConfig_ROUND_ROBIN ServiceConfig_LoadBalancingPolicy = 1 +) + +var ServiceConfig_LoadBalancingPolicy_name = map[int32]string{ + 0: "UNSPECIFIED", + 1: "ROUND_ROBIN", +} + +var ServiceConfig_LoadBalancingPolicy_value = map[string]int32{ + "UNSPECIFIED": 0, + "ROUND_ROBIN": 1, +} + +func (x ServiceConfig_LoadBalancingPolicy) String() string { + return proto.EnumName(ServiceConfig_LoadBalancingPolicy_name, int32(x)) +} + +func (ServiceConfig_LoadBalancingPolicy) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e32d3cb2c41c77ce, []int{7, 0} +} + +// Configuration for a method. +type MethodConfig struct { + Name []*MethodConfig_Name `protobuf:"bytes,1,rep,name=name,proto3" json:"name,omitempty"` + // Whether RPCs sent to this method should wait until the connection is + // ready by default. If false, the RPC will abort immediately if there is + // a transient failure connecting to the server. Otherwise, gRPC will + // attempt to connect until the deadline is exceeded. + // + // The value specified via the gRPC client API will override the value + // set here. However, note that setting the value in the client API will + // also affect transient errors encountered during name resolution, which + // cannot be caught by the value here, since the service config is + // obtained by the gRPC client via name resolution. + WaitForReady *wrappers.BoolValue `protobuf:"bytes,2,opt,name=wait_for_ready,json=waitForReady,proto3" json:"wait_for_ready,omitempty"` + // The default timeout in seconds for RPCs sent to this method. This can be + // overridden in code. If no reply is received in the specified amount of + // time, the request is aborted and a DEADLINE_EXCEEDED error status + // is returned to the caller. + // + // The actual deadline used will be the minimum of the value specified here + // and the value set by the application via the gRPC client API. If either + // one is not set, then the other will be used. If neither is set, then the + // request has no deadline. + Timeout *duration.Duration `protobuf:"bytes,3,opt,name=timeout,proto3" json:"timeout,omitempty"` + // The maximum allowed payload size for an individual request or object in a + // stream (client->server) in bytes. The size which is measured is the + // serialized payload after per-message compression (but before stream + // compression) in bytes. This applies both to streaming and non-streaming + // requests. + // + // The actual value used is the minimum of the value specified here and the + // value set by the application via the gRPC client API. If either one is + // not set, then the other will be used. If neither is set, then the + // built-in default is used. + // + // If a client attempts to send an object larger than this value, it will not + // be sent and the client will see a ClientError. + // Note that 0 is a valid value, meaning that the request message + // must be empty. + MaxRequestMessageBytes *wrappers.UInt32Value `protobuf:"bytes,4,opt,name=max_request_message_bytes,json=maxRequestMessageBytes,proto3" json:"max_request_message_bytes,omitempty"` + // The maximum allowed payload size for an individual response or object in a + // stream (server->client) in bytes. The size which is measured is the + // serialized payload after per-message compression (but before stream + // compression) in bytes. This applies both to streaming and non-streaming + // requests. + // + // The actual value used is the minimum of the value specified here and the + // value set by the application via the gRPC client API. If either one is + // not set, then the other will be used. If neither is set, then the + // built-in default is used. + // + // If a server attempts to send an object larger than this value, it will not + // be sent, and a ServerError will be sent to the client instead. + // Note that 0 is a valid value, meaning that the response message + // must be empty. + MaxResponseMessageBytes *wrappers.UInt32Value `protobuf:"bytes,5,opt,name=max_response_message_bytes,json=maxResponseMessageBytes,proto3" json:"max_response_message_bytes,omitempty"` + // Only one of retry_policy or hedging_policy may be set. If neither is set, + // RPCs will not be retried or hedged. + // + // Types that are valid to be assigned to RetryOrHedgingPolicy: + // *MethodConfig_RetryPolicy_ + // *MethodConfig_HedgingPolicy_ + RetryOrHedgingPolicy isMethodConfig_RetryOrHedgingPolicy `protobuf_oneof:"retry_or_hedging_policy"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MethodConfig) Reset() { *m = MethodConfig{} } +func (m *MethodConfig) String() string { return proto.CompactTextString(m) } +func (*MethodConfig) ProtoMessage() {} +func (*MethodConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_e32d3cb2c41c77ce, []int{0} +} + +func (m *MethodConfig) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MethodConfig.Unmarshal(m, b) +} +func (m *MethodConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MethodConfig.Marshal(b, m, deterministic) +} +func (m *MethodConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_MethodConfig.Merge(m, src) +} +func (m *MethodConfig) XXX_Size() int { + return xxx_messageInfo_MethodConfig.Size(m) +} +func (m *MethodConfig) XXX_DiscardUnknown() { + xxx_messageInfo_MethodConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_MethodConfig proto.InternalMessageInfo + +func (m *MethodConfig) GetName() []*MethodConfig_Name { + if m != nil { + return m.Name + } + return nil +} + +func (m *MethodConfig) GetWaitForReady() *wrappers.BoolValue { + if m != nil { + return m.WaitForReady + } + return nil +} + +func (m *MethodConfig) GetTimeout() *duration.Duration { + if m != nil { + return m.Timeout + } + return nil +} + +func (m *MethodConfig) GetMaxRequestMessageBytes() *wrappers.UInt32Value { + if m != nil { + return m.MaxRequestMessageBytes + } + return nil +} + +func (m *MethodConfig) GetMaxResponseMessageBytes() *wrappers.UInt32Value { + if m != nil { + return m.MaxResponseMessageBytes + } + return nil +} + +type isMethodConfig_RetryOrHedgingPolicy interface { + isMethodConfig_RetryOrHedgingPolicy() +} + +type MethodConfig_RetryPolicy_ struct { + RetryPolicy *MethodConfig_RetryPolicy `protobuf:"bytes,6,opt,name=retry_policy,json=retryPolicy,proto3,oneof"` +} + +type MethodConfig_HedgingPolicy_ struct { + HedgingPolicy *MethodConfig_HedgingPolicy `protobuf:"bytes,7,opt,name=hedging_policy,json=hedgingPolicy,proto3,oneof"` +} + +func (*MethodConfig_RetryPolicy_) isMethodConfig_RetryOrHedgingPolicy() {} + +func (*MethodConfig_HedgingPolicy_) isMethodConfig_RetryOrHedgingPolicy() {} + +func (m *MethodConfig) GetRetryOrHedgingPolicy() isMethodConfig_RetryOrHedgingPolicy { + if m != nil { + return m.RetryOrHedgingPolicy + } + return nil +} + +func (m *MethodConfig) GetRetryPolicy() *MethodConfig_RetryPolicy { + if x, ok := m.GetRetryOrHedgingPolicy().(*MethodConfig_RetryPolicy_); ok { + return x.RetryPolicy + } + return nil +} + +func (m *MethodConfig) GetHedgingPolicy() *MethodConfig_HedgingPolicy { + if x, ok := m.GetRetryOrHedgingPolicy().(*MethodConfig_HedgingPolicy_); ok { + return x.HedgingPolicy + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*MethodConfig) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*MethodConfig_RetryPolicy_)(nil), + (*MethodConfig_HedgingPolicy_)(nil), + } +} + +// The names of the methods to which this configuration applies. There must +// be at least one name. Each name entry must be unique across the entire +// ClientConfig. If the 'method' field is empty, then this MethodConfig +// specifies the defaults for all methods for the specified service. +// +// For example, let's say that the service config contains the following +// MethodConfig entries: +// +// method_config { name { service: "MyService" } ... } +// method_config { name { service: "MyService" method: "Foo" } ... } +// +// For a request for MyService/Foo, we will use the second entry, because it +// exactly matches the service and method name. +// For a request for MyService/Bar, we will use the first entry, because it +// provides the default for all methods of MyService. +type MethodConfig_Name struct { + Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` + Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MethodConfig_Name) Reset() { *m = MethodConfig_Name{} } +func (m *MethodConfig_Name) String() string { return proto.CompactTextString(m) } +func (*MethodConfig_Name) ProtoMessage() {} +func (*MethodConfig_Name) Descriptor() ([]byte, []int) { + return fileDescriptor_e32d3cb2c41c77ce, []int{0, 0} +} + +func (m *MethodConfig_Name) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MethodConfig_Name.Unmarshal(m, b) +} +func (m *MethodConfig_Name) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MethodConfig_Name.Marshal(b, m, deterministic) +} +func (m *MethodConfig_Name) XXX_Merge(src proto.Message) { + xxx_messageInfo_MethodConfig_Name.Merge(m, src) +} +func (m *MethodConfig_Name) XXX_Size() int { + return xxx_messageInfo_MethodConfig_Name.Size(m) +} +func (m *MethodConfig_Name) XXX_DiscardUnknown() { + xxx_messageInfo_MethodConfig_Name.DiscardUnknown(m) +} + +var xxx_messageInfo_MethodConfig_Name proto.InternalMessageInfo + +func (m *MethodConfig_Name) GetService() string { + if m != nil { + return m.Service + } + return "" +} + +func (m *MethodConfig_Name) GetMethod() string { + if m != nil { + return m.Method + } + return "" +} + +// The retry policy for outgoing RPCs. +type MethodConfig_RetryPolicy struct { + // The maximum number of RPC attempts, including the original attempt. + // + // This field is required and must be greater than 1. + // Any value greater than 5 will be treated as if it were 5. + MaxAttempts uint32 `protobuf:"varint,1,opt,name=max_attempts,json=maxAttempts,proto3" json:"max_attempts,omitempty"` + // Exponential backoff parameters. The initial retry attempt will occur at + // random(0, initial_backoff). In general, the nth attempt will occur at + // random(0, + // min(initial_backoff*backoff_multiplier**(n-1), max_backoff)). + // Required. Must be greater than zero. + InitialBackoff *duration.Duration `protobuf:"bytes,2,opt,name=initial_backoff,json=initialBackoff,proto3" json:"initial_backoff,omitempty"` + // Required. Must be greater than zero. + MaxBackoff *duration.Duration `protobuf:"bytes,3,opt,name=max_backoff,json=maxBackoff,proto3" json:"max_backoff,omitempty"` + BackoffMultiplier float32 `protobuf:"fixed32,4,opt,name=backoff_multiplier,json=backoffMultiplier,proto3" json:"backoff_multiplier,omitempty"` + // The set of status codes which may be retried. + // + // This field is required and must be non-empty. + RetryableStatusCodes []code.Code `protobuf:"varint,5,rep,packed,name=retryable_status_codes,json=retryableStatusCodes,proto3,enum=google.rpc.Code" json:"retryable_status_codes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MethodConfig_RetryPolicy) Reset() { *m = MethodConfig_RetryPolicy{} } +func (m *MethodConfig_RetryPolicy) String() string { return proto.CompactTextString(m) } +func (*MethodConfig_RetryPolicy) ProtoMessage() {} +func (*MethodConfig_RetryPolicy) Descriptor() ([]byte, []int) { + return fileDescriptor_e32d3cb2c41c77ce, []int{0, 1} +} + +func (m *MethodConfig_RetryPolicy) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MethodConfig_RetryPolicy.Unmarshal(m, b) +} +func (m *MethodConfig_RetryPolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MethodConfig_RetryPolicy.Marshal(b, m, deterministic) +} +func (m *MethodConfig_RetryPolicy) XXX_Merge(src proto.Message) { + xxx_messageInfo_MethodConfig_RetryPolicy.Merge(m, src) +} +func (m *MethodConfig_RetryPolicy) XXX_Size() int { + return xxx_messageInfo_MethodConfig_RetryPolicy.Size(m) +} +func (m *MethodConfig_RetryPolicy) XXX_DiscardUnknown() { + xxx_messageInfo_MethodConfig_RetryPolicy.DiscardUnknown(m) +} + +var xxx_messageInfo_MethodConfig_RetryPolicy proto.InternalMessageInfo + +func (m *MethodConfig_RetryPolicy) GetMaxAttempts() uint32 { + if m != nil { + return m.MaxAttempts + } + return 0 +} + +func (m *MethodConfig_RetryPolicy) GetInitialBackoff() *duration.Duration { + if m != nil { + return m.InitialBackoff + } + return nil +} + +func (m *MethodConfig_RetryPolicy) GetMaxBackoff() *duration.Duration { + if m != nil { + return m.MaxBackoff + } + return nil +} + +func (m *MethodConfig_RetryPolicy) GetBackoffMultiplier() float32 { + if m != nil { + return m.BackoffMultiplier + } + return 0 +} + +func (m *MethodConfig_RetryPolicy) GetRetryableStatusCodes() []code.Code { + if m != nil { + return m.RetryableStatusCodes + } + return nil +} + +// The hedging policy for outgoing RPCs. Hedged RPCs may execute more than +// once on the server, so only idempotent methods should specify a hedging +// policy. +type MethodConfig_HedgingPolicy struct { + // The hedging policy will send up to max_requests RPCs. + // This number represents the total number of all attempts, including + // the original attempt. + // + // This field is required and must be greater than 1. + // Any value greater than 5 will be treated as if it were 5. + MaxAttempts uint32 `protobuf:"varint,1,opt,name=max_attempts,json=maxAttempts,proto3" json:"max_attempts,omitempty"` + // The first RPC will be sent immediately, but the max_requests-1 subsequent + // hedged RPCs will be sent at intervals of every hedging_delay. Set this + // to 0 to immediately send all max_requests RPCs. + HedgingDelay *duration.Duration `protobuf:"bytes,2,opt,name=hedging_delay,json=hedgingDelay,proto3" json:"hedging_delay,omitempty"` + // The set of status codes which indicate other hedged RPCs may still + // succeed. If a non-fatal status code is returned by the server, hedged + // RPCs will continue. Otherwise, outstanding requests will be canceled and + // the error returned to the client application layer. + // + // This field is optional. + NonFatalStatusCodes []code.Code `protobuf:"varint,3,rep,packed,name=non_fatal_status_codes,json=nonFatalStatusCodes,proto3,enum=google.rpc.Code" json:"non_fatal_status_codes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MethodConfig_HedgingPolicy) Reset() { *m = MethodConfig_HedgingPolicy{} } +func (m *MethodConfig_HedgingPolicy) String() string { return proto.CompactTextString(m) } +func (*MethodConfig_HedgingPolicy) ProtoMessage() {} +func (*MethodConfig_HedgingPolicy) Descriptor() ([]byte, []int) { + return fileDescriptor_e32d3cb2c41c77ce, []int{0, 2} +} + +func (m *MethodConfig_HedgingPolicy) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MethodConfig_HedgingPolicy.Unmarshal(m, b) +} +func (m *MethodConfig_HedgingPolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MethodConfig_HedgingPolicy.Marshal(b, m, deterministic) +} +func (m *MethodConfig_HedgingPolicy) XXX_Merge(src proto.Message) { + xxx_messageInfo_MethodConfig_HedgingPolicy.Merge(m, src) +} +func (m *MethodConfig_HedgingPolicy) XXX_Size() int { + return xxx_messageInfo_MethodConfig_HedgingPolicy.Size(m) +} +func (m *MethodConfig_HedgingPolicy) XXX_DiscardUnknown() { + xxx_messageInfo_MethodConfig_HedgingPolicy.DiscardUnknown(m) +} + +var xxx_messageInfo_MethodConfig_HedgingPolicy proto.InternalMessageInfo + +func (m *MethodConfig_HedgingPolicy) GetMaxAttempts() uint32 { + if m != nil { + return m.MaxAttempts + } + return 0 +} + +func (m *MethodConfig_HedgingPolicy) GetHedgingDelay() *duration.Duration { + if m != nil { + return m.HedgingDelay + } + return nil +} + +func (m *MethodConfig_HedgingPolicy) GetNonFatalStatusCodes() []code.Code { + if m != nil { + return m.NonFatalStatusCodes + } + return nil +} + +// Configuration for pick_first LB policy. +type PickFirstConfig struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PickFirstConfig) Reset() { *m = PickFirstConfig{} } +func (m *PickFirstConfig) String() string { return proto.CompactTextString(m) } +func (*PickFirstConfig) ProtoMessage() {} +func (*PickFirstConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_e32d3cb2c41c77ce, []int{1} +} + +func (m *PickFirstConfig) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PickFirstConfig.Unmarshal(m, b) +} +func (m *PickFirstConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PickFirstConfig.Marshal(b, m, deterministic) +} +func (m *PickFirstConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_PickFirstConfig.Merge(m, src) +} +func (m *PickFirstConfig) XXX_Size() int { + return xxx_messageInfo_PickFirstConfig.Size(m) +} +func (m *PickFirstConfig) XXX_DiscardUnknown() { + xxx_messageInfo_PickFirstConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_PickFirstConfig proto.InternalMessageInfo + +// Configuration for round_robin LB policy. +type RoundRobinConfig struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RoundRobinConfig) Reset() { *m = RoundRobinConfig{} } +func (m *RoundRobinConfig) String() string { return proto.CompactTextString(m) } +func (*RoundRobinConfig) ProtoMessage() {} +func (*RoundRobinConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_e32d3cb2c41c77ce, []int{2} +} + +func (m *RoundRobinConfig) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RoundRobinConfig.Unmarshal(m, b) +} +func (m *RoundRobinConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RoundRobinConfig.Marshal(b, m, deterministic) +} +func (m *RoundRobinConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_RoundRobinConfig.Merge(m, src) +} +func (m *RoundRobinConfig) XXX_Size() int { + return xxx_messageInfo_RoundRobinConfig.Size(m) +} +func (m *RoundRobinConfig) XXX_DiscardUnknown() { + xxx_messageInfo_RoundRobinConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_RoundRobinConfig proto.InternalMessageInfo + +// Configuration for grpclb LB policy. +type GrpcLbConfig struct { + // Optional. What LB policy to use for routing between the backend + // addresses. If unset, defaults to round_robin. + // Currently, the only supported values are round_robin and pick_first. + // Note that this will be used both in balancer mode and in fallback mode. + // Multiple LB policies can be specified; clients will iterate through + // the list in order and stop at the first policy that they support. + ChildPolicy []*LoadBalancingConfig `protobuf:"bytes,1,rep,name=child_policy,json=childPolicy,proto3" json:"child_policy,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GrpcLbConfig) Reset() { *m = GrpcLbConfig{} } +func (m *GrpcLbConfig) String() string { return proto.CompactTextString(m) } +func (*GrpcLbConfig) ProtoMessage() {} +func (*GrpcLbConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_e32d3cb2c41c77ce, []int{3} +} + +func (m *GrpcLbConfig) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GrpcLbConfig.Unmarshal(m, b) +} +func (m *GrpcLbConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GrpcLbConfig.Marshal(b, m, deterministic) +} +func (m *GrpcLbConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_GrpcLbConfig.Merge(m, src) +} +func (m *GrpcLbConfig) XXX_Size() int { + return xxx_messageInfo_GrpcLbConfig.Size(m) +} +func (m *GrpcLbConfig) XXX_DiscardUnknown() { + xxx_messageInfo_GrpcLbConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_GrpcLbConfig proto.InternalMessageInfo + +func (m *GrpcLbConfig) GetChildPolicy() []*LoadBalancingConfig { + if m != nil { + return m.ChildPolicy + } + return nil +} + +// Configuration for the cds LB policy. +type CdsConfig struct { + Cluster string `protobuf:"bytes,1,opt,name=cluster,proto3" json:"cluster,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CdsConfig) Reset() { *m = CdsConfig{} } +func (m *CdsConfig) String() string { return proto.CompactTextString(m) } +func (*CdsConfig) ProtoMessage() {} +func (*CdsConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_e32d3cb2c41c77ce, []int{4} +} + +func (m *CdsConfig) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CdsConfig.Unmarshal(m, b) +} +func (m *CdsConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CdsConfig.Marshal(b, m, deterministic) +} +func (m *CdsConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_CdsConfig.Merge(m, src) +} +func (m *CdsConfig) XXX_Size() int { + return xxx_messageInfo_CdsConfig.Size(m) +} +func (m *CdsConfig) XXX_DiscardUnknown() { + xxx_messageInfo_CdsConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_CdsConfig proto.InternalMessageInfo + +func (m *CdsConfig) GetCluster() string { + if m != nil { + return m.Cluster + } + return "" +} + +// Configuration for xds LB policy. +type XdsConfig struct { + // Name of balancer to connect to. + BalancerName string `protobuf:"bytes,1,opt,name=balancer_name,json=balancerName,proto3" json:"balancer_name,omitempty"` // Deprecated: Do not use. + // Optional. What LB policy to use for intra-locality routing. + // If unset, will use whatever algorithm is specified by the balancer. + // Multiple LB policies can be specified; clients will iterate through + // the list in order and stop at the first policy that they support. + ChildPolicy []*LoadBalancingConfig `protobuf:"bytes,2,rep,name=child_policy,json=childPolicy,proto3" json:"child_policy,omitempty"` + // Optional. What LB policy to use in fallback mode. If not + // specified, defaults to round_robin. + // Multiple LB policies can be specified; clients will iterate through + // the list in order and stop at the first policy that they support. + FallbackPolicy []*LoadBalancingConfig `protobuf:"bytes,3,rep,name=fallback_policy,json=fallbackPolicy,proto3" json:"fallback_policy,omitempty"` + // Optional. Name to use in EDS query. If not present, defaults to + // the server name from the target URI. + EdsServiceName string `protobuf:"bytes,4,opt,name=eds_service_name,json=edsServiceName,proto3" json:"eds_service_name,omitempty"` + // LRS server to send load reports to. + // If not present, load reporting will be disabled. + // If set to the empty string, load reporting will be sent to the same + // server that we obtained CDS data from. + LrsLoadReportingServerName *wrappers.StringValue `protobuf:"bytes,5,opt,name=lrs_load_reporting_server_name,json=lrsLoadReportingServerName,proto3" json:"lrs_load_reporting_server_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *XdsConfig) Reset() { *m = XdsConfig{} } +func (m *XdsConfig) String() string { return proto.CompactTextString(m) } +func (*XdsConfig) ProtoMessage() {} +func (*XdsConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_e32d3cb2c41c77ce, []int{5} +} + +func (m *XdsConfig) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_XdsConfig.Unmarshal(m, b) +} +func (m *XdsConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_XdsConfig.Marshal(b, m, deterministic) +} +func (m *XdsConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_XdsConfig.Merge(m, src) +} +func (m *XdsConfig) XXX_Size() int { + return xxx_messageInfo_XdsConfig.Size(m) +} +func (m *XdsConfig) XXX_DiscardUnknown() { + xxx_messageInfo_XdsConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_XdsConfig proto.InternalMessageInfo + +// Deprecated: Do not use. +func (m *XdsConfig) GetBalancerName() string { + if m != nil { + return m.BalancerName + } + return "" +} + +func (m *XdsConfig) GetChildPolicy() []*LoadBalancingConfig { + if m != nil { + return m.ChildPolicy + } + return nil +} + +func (m *XdsConfig) GetFallbackPolicy() []*LoadBalancingConfig { + if m != nil { + return m.FallbackPolicy + } + return nil +} + +func (m *XdsConfig) GetEdsServiceName() string { + if m != nil { + return m.EdsServiceName + } + return "" +} + +func (m *XdsConfig) GetLrsLoadReportingServerName() *wrappers.StringValue { + if m != nil { + return m.LrsLoadReportingServerName + } + return nil +} + +// Selects LB policy and provides corresponding configuration. +// +// In general, all instances of this field should be repeated. +// Clients will iterate through the list in order and stop at the first +// policy that they support. This allows the service config to specify +// custom policies that may not be known to all clients. +type LoadBalancingConfig struct { + // Exactly one LB policy may be configured. + // + // Types that are valid to be assigned to Policy: + // *LoadBalancingConfig_PickFirst + // *LoadBalancingConfig_RoundRobin + // *LoadBalancingConfig_Grpclb + // *LoadBalancingConfig_Cds + // *LoadBalancingConfig_Xds + // *LoadBalancingConfig_XdsExperimental + Policy isLoadBalancingConfig_Policy `protobuf_oneof:"policy"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LoadBalancingConfig) Reset() { *m = LoadBalancingConfig{} } +func (m *LoadBalancingConfig) String() string { return proto.CompactTextString(m) } +func (*LoadBalancingConfig) ProtoMessage() {} +func (*LoadBalancingConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_e32d3cb2c41c77ce, []int{6} +} + +func (m *LoadBalancingConfig) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LoadBalancingConfig.Unmarshal(m, b) +} +func (m *LoadBalancingConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LoadBalancingConfig.Marshal(b, m, deterministic) +} +func (m *LoadBalancingConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_LoadBalancingConfig.Merge(m, src) +} +func (m *LoadBalancingConfig) XXX_Size() int { + return xxx_messageInfo_LoadBalancingConfig.Size(m) +} +func (m *LoadBalancingConfig) XXX_DiscardUnknown() { + xxx_messageInfo_LoadBalancingConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_LoadBalancingConfig proto.InternalMessageInfo + +type isLoadBalancingConfig_Policy interface { + isLoadBalancingConfig_Policy() +} + +type LoadBalancingConfig_PickFirst struct { + PickFirst *PickFirstConfig `protobuf:"bytes,4,opt,name=pick_first,proto3,oneof"` +} + +type LoadBalancingConfig_RoundRobin struct { + RoundRobin *RoundRobinConfig `protobuf:"bytes,1,opt,name=round_robin,proto3,oneof"` +} + +type LoadBalancingConfig_Grpclb struct { + Grpclb *GrpcLbConfig `protobuf:"bytes,3,opt,name=grpclb,proto3,oneof"` +} + +type LoadBalancingConfig_Cds struct { + Cds *CdsConfig `protobuf:"bytes,6,opt,name=cds,proto3,oneof"` +} + +type LoadBalancingConfig_Xds struct { + Xds *XdsConfig `protobuf:"bytes,2,opt,name=xds,proto3,oneof"` +} + +type LoadBalancingConfig_XdsExperimental struct { + XdsExperimental *XdsConfig `protobuf:"bytes,5,opt,name=xds_experimental,proto3,oneof"` +} + +func (*LoadBalancingConfig_PickFirst) isLoadBalancingConfig_Policy() {} + +func (*LoadBalancingConfig_RoundRobin) isLoadBalancingConfig_Policy() {} + +func (*LoadBalancingConfig_Grpclb) isLoadBalancingConfig_Policy() {} + +func (*LoadBalancingConfig_Cds) isLoadBalancingConfig_Policy() {} + +func (*LoadBalancingConfig_Xds) isLoadBalancingConfig_Policy() {} + +func (*LoadBalancingConfig_XdsExperimental) isLoadBalancingConfig_Policy() {} + +func (m *LoadBalancingConfig) GetPolicy() isLoadBalancingConfig_Policy { + if m != nil { + return m.Policy + } + return nil +} + +func (m *LoadBalancingConfig) GetPickFirst() *PickFirstConfig { + if x, ok := m.GetPolicy().(*LoadBalancingConfig_PickFirst); ok { + return x.PickFirst + } + return nil +} + +func (m *LoadBalancingConfig) GetRoundRobin() *RoundRobinConfig { + if x, ok := m.GetPolicy().(*LoadBalancingConfig_RoundRobin); ok { + return x.RoundRobin + } + return nil +} + +func (m *LoadBalancingConfig) GetGrpclb() *GrpcLbConfig { + if x, ok := m.GetPolicy().(*LoadBalancingConfig_Grpclb); ok { + return x.Grpclb + } + return nil +} + +func (m *LoadBalancingConfig) GetCds() *CdsConfig { + if x, ok := m.GetPolicy().(*LoadBalancingConfig_Cds); ok { + return x.Cds + } + return nil +} + +func (m *LoadBalancingConfig) GetXds() *XdsConfig { + if x, ok := m.GetPolicy().(*LoadBalancingConfig_Xds); ok { + return x.Xds + } + return nil +} + +func (m *LoadBalancingConfig) GetXdsExperimental() *XdsConfig { + if x, ok := m.GetPolicy().(*LoadBalancingConfig_XdsExperimental); ok { + return x.XdsExperimental + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*LoadBalancingConfig) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*LoadBalancingConfig_PickFirst)(nil), + (*LoadBalancingConfig_RoundRobin)(nil), + (*LoadBalancingConfig_Grpclb)(nil), + (*LoadBalancingConfig_Cds)(nil), + (*LoadBalancingConfig_Xds)(nil), + (*LoadBalancingConfig_XdsExperimental)(nil), + } +} + +// A ServiceConfig represents information about a service but is not specific to +// any name resolver. +type ServiceConfig struct { + LoadBalancingPolicy ServiceConfig_LoadBalancingPolicy `protobuf:"varint,1,opt,name=load_balancing_policy,json=loadBalancingPolicy,proto3,enum=grpc.service_config.ServiceConfig_LoadBalancingPolicy" json:"load_balancing_policy,omitempty"` // Deprecated: Do not use. + // Multiple LB policies can be specified; clients will iterate through + // the list in order and stop at the first policy that they support. If none + // are supported, the service config is considered invalid. + LoadBalancingConfig []*LoadBalancingConfig `protobuf:"bytes,4,rep,name=load_balancing_config,json=loadBalancingConfig,proto3" json:"load_balancing_config,omitempty"` + // Per-method configuration. + MethodConfig []*MethodConfig `protobuf:"bytes,2,rep,name=method_config,json=methodConfig,proto3" json:"method_config,omitempty"` + RetryThrottling *ServiceConfig_RetryThrottlingPolicy `protobuf:"bytes,3,opt,name=retry_throttling,json=retryThrottling,proto3" json:"retry_throttling,omitempty"` + HealthCheckConfig *ServiceConfig_HealthCheckConfig `protobuf:"bytes,5,opt,name=health_check_config,json=healthCheckConfig,proto3" json:"health_check_config,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServiceConfig) Reset() { *m = ServiceConfig{} } +func (m *ServiceConfig) String() string { return proto.CompactTextString(m) } +func (*ServiceConfig) ProtoMessage() {} +func (*ServiceConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_e32d3cb2c41c77ce, []int{7} +} + +func (m *ServiceConfig) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServiceConfig.Unmarshal(m, b) +} +func (m *ServiceConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServiceConfig.Marshal(b, m, deterministic) +} +func (m *ServiceConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceConfig.Merge(m, src) +} +func (m *ServiceConfig) XXX_Size() int { + return xxx_messageInfo_ServiceConfig.Size(m) +} +func (m *ServiceConfig) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceConfig proto.InternalMessageInfo + +// Deprecated: Do not use. +func (m *ServiceConfig) GetLoadBalancingPolicy() ServiceConfig_LoadBalancingPolicy { + if m != nil { + return m.LoadBalancingPolicy + } + return ServiceConfig_UNSPECIFIED +} + +func (m *ServiceConfig) GetLoadBalancingConfig() []*LoadBalancingConfig { + if m != nil { + return m.LoadBalancingConfig + } + return nil +} + +func (m *ServiceConfig) GetMethodConfig() []*MethodConfig { + if m != nil { + return m.MethodConfig + } + return nil +} + +func (m *ServiceConfig) GetRetryThrottling() *ServiceConfig_RetryThrottlingPolicy { + if m != nil { + return m.RetryThrottling + } + return nil +} + +func (m *ServiceConfig) GetHealthCheckConfig() *ServiceConfig_HealthCheckConfig { + if m != nil { + return m.HealthCheckConfig + } + return nil +} + +// If a RetryThrottlingPolicy is provided, gRPC will automatically throttle +// retry attempts and hedged RPCs when the client's ratio of failures to +// successes exceeds a threshold. +// +// For each server name, the gRPC client will maintain a token_count which is +// initially set to max_tokens. Every outgoing RPC (regardless of service or +// method invoked) will change token_count as follows: +// +// - Every failed RPC will decrement the token_count by 1. +// - Every successful RPC will increment the token_count by token_ratio. +// +// If token_count is less than or equal to max_tokens / 2, then RPCs will not +// be retried and hedged RPCs will not be sent. +type ServiceConfig_RetryThrottlingPolicy struct { + // The number of tokens starts at max_tokens. The token_count will always be + // between 0 and max_tokens. + // + // This field is required and must be greater than zero. + MaxTokens uint32 `protobuf:"varint,1,opt,name=max_tokens,json=maxTokens,proto3" json:"max_tokens,omitempty"` + // The amount of tokens to add on each successful RPC. Typically this will + // be some number between 0 and 1, e.g., 0.1. + // + // This field is required and must be greater than zero. Up to 3 decimal + // places are supported. + TokenRatio float32 `protobuf:"fixed32,2,opt,name=token_ratio,json=tokenRatio,proto3" json:"token_ratio,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServiceConfig_RetryThrottlingPolicy) Reset() { *m = ServiceConfig_RetryThrottlingPolicy{} } +func (m *ServiceConfig_RetryThrottlingPolicy) String() string { return proto.CompactTextString(m) } +func (*ServiceConfig_RetryThrottlingPolicy) ProtoMessage() {} +func (*ServiceConfig_RetryThrottlingPolicy) Descriptor() ([]byte, []int) { + return fileDescriptor_e32d3cb2c41c77ce, []int{7, 0} +} + +func (m *ServiceConfig_RetryThrottlingPolicy) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServiceConfig_RetryThrottlingPolicy.Unmarshal(m, b) +} +func (m *ServiceConfig_RetryThrottlingPolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServiceConfig_RetryThrottlingPolicy.Marshal(b, m, deterministic) +} +func (m *ServiceConfig_RetryThrottlingPolicy) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceConfig_RetryThrottlingPolicy.Merge(m, src) +} +func (m *ServiceConfig_RetryThrottlingPolicy) XXX_Size() int { + return xxx_messageInfo_ServiceConfig_RetryThrottlingPolicy.Size(m) +} +func (m *ServiceConfig_RetryThrottlingPolicy) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceConfig_RetryThrottlingPolicy.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceConfig_RetryThrottlingPolicy proto.InternalMessageInfo + +func (m *ServiceConfig_RetryThrottlingPolicy) GetMaxTokens() uint32 { + if m != nil { + return m.MaxTokens + } + return 0 +} + +func (m *ServiceConfig_RetryThrottlingPolicy) GetTokenRatio() float32 { + if m != nil { + return m.TokenRatio + } + return 0 +} + +type ServiceConfig_HealthCheckConfig struct { + // Service name to use in the health-checking request. + ServiceName *wrappers.StringValue `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServiceConfig_HealthCheckConfig) Reset() { *m = ServiceConfig_HealthCheckConfig{} } +func (m *ServiceConfig_HealthCheckConfig) String() string { return proto.CompactTextString(m) } +func (*ServiceConfig_HealthCheckConfig) ProtoMessage() {} +func (*ServiceConfig_HealthCheckConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_e32d3cb2c41c77ce, []int{7, 1} +} + +func (m *ServiceConfig_HealthCheckConfig) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServiceConfig_HealthCheckConfig.Unmarshal(m, b) +} +func (m *ServiceConfig_HealthCheckConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServiceConfig_HealthCheckConfig.Marshal(b, m, deterministic) +} +func (m *ServiceConfig_HealthCheckConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceConfig_HealthCheckConfig.Merge(m, src) +} +func (m *ServiceConfig_HealthCheckConfig) XXX_Size() int { + return xxx_messageInfo_ServiceConfig_HealthCheckConfig.Size(m) +} +func (m *ServiceConfig_HealthCheckConfig) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceConfig_HealthCheckConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceConfig_HealthCheckConfig proto.InternalMessageInfo + +func (m *ServiceConfig_HealthCheckConfig) GetServiceName() *wrappers.StringValue { + if m != nil { + return m.ServiceName + } + return nil +} + +func init() { + proto.RegisterEnum("grpc.service_config.ServiceConfig_LoadBalancingPolicy", ServiceConfig_LoadBalancingPolicy_name, ServiceConfig_LoadBalancingPolicy_value) + proto.RegisterType((*MethodConfig)(nil), "grpc.service_config.MethodConfig") + proto.RegisterType((*MethodConfig_Name)(nil), "grpc.service_config.MethodConfig.Name") + proto.RegisterType((*MethodConfig_RetryPolicy)(nil), "grpc.service_config.MethodConfig.RetryPolicy") + proto.RegisterType((*MethodConfig_HedgingPolicy)(nil), "grpc.service_config.MethodConfig.HedgingPolicy") + proto.RegisterType((*PickFirstConfig)(nil), "grpc.service_config.PickFirstConfig") + proto.RegisterType((*RoundRobinConfig)(nil), "grpc.service_config.RoundRobinConfig") + proto.RegisterType((*GrpcLbConfig)(nil), "grpc.service_config.GrpcLbConfig") + proto.RegisterType((*CdsConfig)(nil), "grpc.service_config.CdsConfig") + proto.RegisterType((*XdsConfig)(nil), "grpc.service_config.XdsConfig") + proto.RegisterType((*LoadBalancingConfig)(nil), "grpc.service_config.LoadBalancingConfig") + proto.RegisterType((*ServiceConfig)(nil), "grpc.service_config.ServiceConfig") + proto.RegisterType((*ServiceConfig_RetryThrottlingPolicy)(nil), "grpc.service_config.ServiceConfig.RetryThrottlingPolicy") + proto.RegisterType((*ServiceConfig_HealthCheckConfig)(nil), "grpc.service_config.ServiceConfig.HealthCheckConfig") +} + +func init() { + proto.RegisterFile("grpc/service_config/service_config.proto", fileDescriptor_e32d3cb2c41c77ce) +} + +var fileDescriptor_e32d3cb2c41c77ce = []byte{ + // 1155 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xed, 0x6e, 0x1b, 0x45, + 0x14, 0x8d, 0xed, 0x34, 0xa9, 0xaf, 0x3f, 0xe2, 0x4c, 0x48, 0xea, 0x5a, 0x50, 0x5a, 0x8b, 0x82, + 0xff, 0xd4, 0x91, 0x5c, 0x04, 0x55, 0x91, 0xf8, 0x70, 0x52, 0xe3, 0x88, 0x36, 0x0d, 0x93, 0x96, + 0x16, 0x81, 0x34, 0x8c, 0x77, 0xc7, 0xf6, 0x2a, 0xbb, 0x3b, 0xcb, 0xcc, 0x98, 0x3a, 0x0f, 0x84, + 0x78, 0x06, 0xde, 0x84, 0x5f, 0x88, 0x47, 0x41, 0xf3, 0xb1, 0x8e, 0xd7, 0x76, 0x71, 0x2a, 0x7e, + 0xee, 0x9d, 0x7b, 0xce, 0x9c, 0xb9, 0xf7, 0xcc, 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7b, 0x63, 0x46, 0x43, 0x35, 0x26, 0xde, 0x98, 0x79, 0x17, 0xa9, + 0x64, 0xdb, 0xe7, 0x4f, 0xaf, 0xb1, 0x4f, 0xdf, 0xa0, 0x8f, 0x34, 0xd8, 0x9d, 0x62, 0x77, 0xbc, + 0x18, 0x6a, 0xbc, 0x82, 0xfd, 0x95, 0x7a, 0xd0, 0x07, 0xa0, 0x5f, 0x47, 0xa2, 0xf8, 0x05, 0x8b, + 0xd3, 0x47, 0xa8, 0x18, 0xd1, 0xe9, 0x0b, 0x13, 0x40, 0x1f, 0x42, 0xc9, 0x2c, 0x11, 0xf3, 0xc0, + 0x18, 0xfb, 0xe6, 0x31, 0x98, 0x10, 0xd6, 0x91, 0xc6, 0x0b, 0xd8, 0x5d, 0x12, 0x80, 0xbe, 0x82, + 0x72, 0x66, 0x20, 0xe5, 0xae, 0x31, 0x58, 0x4a, 0xf2, 0x6a, 0x56, 0x35, 0x3f, 0x5f, 0x18, 0x24, + 0x4e, 0xec, 0x0e, 0x94, 0x5e, 0x9e, 0x9e, 0x9f, 0x3d, 0x39, 0x3a, 0xe9, 0x9d, 0x3c, 0x39, 0xae, + 0x6d, 0xe8, 0x00, 0x7e, 0xfe, 0xf2, 0xf4, 0x98, 0xe0, 0xe7, 0xdd, 0x93, 0xd3, 0x5a, 0xae, 0xfb, + 0x00, 0xf6, 0x03, 0x9e, 0x29, 0x9a, 0xad, 0x59, 0x17, 0x65, 0x8a, 0x76, 0xa6, 0x15, 0x9c, 0xe5, + 0x06, 0x5b, 0x46, 0xca, 0xc3, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x83, 0x5e, 0xd9, 0x3c, 0xbf, + 0x0b, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go b/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go new file mode 100644 index 00000000000..7705ca22eb2 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go @@ -0,0 +1,420 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * 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. + * + */ + +// Package dns implements a dns resolver to be installed as the default resolver +// in grpc. +package dns + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "net" + "os" + "strconv" + "strings" + "sync" + "time" + + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal/grpcrand" + "google.golang.org/grpc/resolver" + "google.golang.org/grpc/serviceconfig" +) + +// EnableSRVLookups controls whether the DNS resolver attempts to fetch gRPCLB +// addresses from SRV records. Must not be changed after init time. +var EnableSRVLookups = false + +func init() { + resolver.Register(NewBuilder()) +} + +const ( + defaultPort = "443" + defaultDNSSvrPort = "53" + golang = "GO" + // txtPrefix is the prefix string to be prepended to the host name for txt record lookup. + txtPrefix = "_grpc_config." + // In DNS, service config is encoded in a TXT record via the mechanism + // described in RFC-1464 using the attribute name grpc_config. + txtAttribute = "grpc_config=" +) + +var ( + errMissingAddr = errors.New("dns resolver: missing address") + + // Addresses ending with a colon that is supposed to be the separator + // between host and port is not allowed. E.g. "::" is a valid address as + // it is an IPv6 address (host only) and "[::]:" is invalid as it ends with + // a colon as the host and port separator + errEndsWithColon = errors.New("dns resolver: missing port after port-separator colon") +) + +var ( + defaultResolver netResolver = net.DefaultResolver + // To prevent excessive re-resolution, we enforce a rate limit on DNS + // resolution requests. + minDNSResRate = 30 * time.Second +) + +var customAuthorityDialler = func(authority string) func(ctx context.Context, network, address string) (net.Conn, error) { + return func(ctx context.Context, network, address string) (net.Conn, error) { + var dialer net.Dialer + return dialer.DialContext(ctx, network, authority) + } +} + +var customAuthorityResolver = func(authority string) (netResolver, error) { + host, port, err := parseTarget(authority, defaultDNSSvrPort) + if err != nil { + return nil, err + } + + authorityWithPort := net.JoinHostPort(host, port) + + return &net.Resolver{ + PreferGo: true, + Dial: customAuthorityDialler(authorityWithPort), + }, nil +} + +// NewBuilder creates a dnsBuilder which is used to factory DNS resolvers. +func NewBuilder() resolver.Builder { + return &dnsBuilder{} +} + +type dnsBuilder struct{} + +// Build creates and starts a DNS resolver that watches the name resolution of the target. +func (b *dnsBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) { + host, port, err := parseTarget(target.Endpoint, defaultPort) + if err != nil { + return nil, err + } + + // IP address. + if ipAddr, ok := formatIP(host); ok { + addr := []resolver.Address{{Addr: ipAddr + ":" + port}} + cc.UpdateState(resolver.State{Addresses: addr}) + return deadResolver{}, nil + } + + // DNS address (non-IP). + ctx, cancel := context.WithCancel(context.Background()) + d := &dnsResolver{ + host: host, + port: port, + ctx: ctx, + cancel: cancel, + cc: cc, + rn: make(chan struct{}, 1), + disableServiceConfig: opts.DisableServiceConfig, + } + + if target.Authority == "" { + d.resolver = defaultResolver + } else { + d.resolver, err = customAuthorityResolver(target.Authority) + if err != nil { + return nil, err + } + } + + d.wg.Add(1) + go d.watcher() + d.ResolveNow(resolver.ResolveNowOptions{}) + return d, nil +} + +// Scheme returns the naming scheme of this resolver builder, which is "dns". +func (b *dnsBuilder) Scheme() string { + return "dns" +} + +type netResolver interface { + LookupHost(ctx context.Context, host string) (addrs []string, err error) + LookupSRV(ctx context.Context, service, proto, name string) (cname string, addrs []*net.SRV, err error) + LookupTXT(ctx context.Context, name string) (txts []string, err error) +} + +// deadResolver is a resolver that does nothing. +type deadResolver struct{} + +func (deadResolver) ResolveNow(resolver.ResolveNowOptions) {} + +func (deadResolver) Close() {} + +// dnsResolver watches for the name resolution update for a non-IP target. +type dnsResolver struct { + host string + port string + resolver netResolver + ctx context.Context + cancel context.CancelFunc + cc resolver.ClientConn + // rn channel is used by ResolveNow() to force an immediate resolution of the target. + rn chan struct{} + // wg is used to enforce Close() to return after the watcher() goroutine has finished. + // Otherwise, data race will be possible. [Race Example] in dns_resolver_test we + // replace the real lookup functions with mocked ones to facilitate testing. + // If Close() doesn't wait for watcher() goroutine finishes, race detector sometimes + // will warns lookup (READ the lookup function pointers) inside watcher() goroutine + // has data race with replaceNetFunc (WRITE the lookup function pointers). + wg sync.WaitGroup + disableServiceConfig bool +} + +// ResolveNow invoke an immediate resolution of the target that this dnsResolver watches. +func (d *dnsResolver) ResolveNow(resolver.ResolveNowOptions) { + select { + case d.rn <- struct{}{}: + default: + } +} + +// Close closes the dnsResolver. +func (d *dnsResolver) Close() { + d.cancel() + d.wg.Wait() +} + +func (d *dnsResolver) watcher() { + defer d.wg.Done() + for { + select { + case <-d.ctx.Done(): + return + case <-d.rn: + } + + state := d.lookup() + d.cc.UpdateState(*state) + + // Sleep to prevent excessive re-resolutions. Incoming resolution requests + // will be queued in d.rn. + t := time.NewTimer(minDNSResRate) + select { + case <-t.C: + case <-d.ctx.Done(): + t.Stop() + return + } + } +} + +func (d *dnsResolver) lookupSRV() []resolver.Address { + if !EnableSRVLookups { + return nil + } + var newAddrs []resolver.Address + _, srvs, err := d.resolver.LookupSRV(d.ctx, "grpclb", "tcp", d.host) + if err != nil { + grpclog.Infof("grpc: failed dns SRV record lookup due to %v.\n", err) + return nil + } + for _, s := range srvs { + lbAddrs, err := d.resolver.LookupHost(d.ctx, s.Target) + if err != nil { + grpclog.Infof("grpc: failed load balancer address dns lookup due to %v.\n", err) + continue + } + for _, a := range lbAddrs { + a, ok := formatIP(a) + if !ok { + grpclog.Errorf("grpc: failed IP parsing due to %v.\n", err) + continue + } + addr := a + ":" + strconv.Itoa(int(s.Port)) + newAddrs = append(newAddrs, resolver.Address{Addr: addr, Type: resolver.GRPCLB, ServerName: s.Target}) + } + } + return newAddrs +} + +var filterError = func(err error) error { + if dnsErr, ok := err.(*net.DNSError); ok && !dnsErr.IsTimeout && !dnsErr.IsTemporary { + // Timeouts and temporary errors should be communicated to gRPC to + // attempt another DNS query (with backoff). Other errors should be + // suppressed (they may represent the absence of a TXT record). + return nil + } + return err +} + +func (d *dnsResolver) lookupTXT() *serviceconfig.ParseResult { + ss, err := d.resolver.LookupTXT(d.ctx, txtPrefix+d.host) + if err != nil { + err = filterError(err) + if err != nil { + err = fmt.Errorf("error from DNS TXT record lookup: %v", err) + grpclog.Infoln("grpc:", err) + return &serviceconfig.ParseResult{Err: err} + } + return nil + } + var res string + for _, s := range ss { + res += s + } + + // TXT record must have "grpc_config=" attribute in order to be used as service config. + if !strings.HasPrefix(res, txtAttribute) { + grpclog.Warningf("grpc: DNS TXT record %v missing %v attribute", res, txtAttribute) + // This is not an error; it is the equivalent of not having a service config. + return nil + } + sc := canaryingSC(strings.TrimPrefix(res, txtAttribute)) + return d.cc.ParseServiceConfig(sc) +} + +func (d *dnsResolver) lookupHost() []resolver.Address { + var newAddrs []resolver.Address + addrs, err := d.resolver.LookupHost(d.ctx, d.host) + if err != nil { + grpclog.Warningf("grpc: failed dns A record lookup due to %v.\n", err) + return nil + } + for _, a := range addrs { + a, ok := formatIP(a) + if !ok { + grpclog.Errorf("grpc: failed IP parsing due to %v.\n", err) + continue + } + addr := a + ":" + d.port + newAddrs = append(newAddrs, resolver.Address{Addr: addr}) + } + return newAddrs +} + +func (d *dnsResolver) lookup() *resolver.State { + srv := d.lookupSRV() + state := &resolver.State{ + Addresses: append(d.lookupHost(), srv...), + } + if !d.disableServiceConfig { + state.ServiceConfig = d.lookupTXT() + } + return state +} + +// formatIP returns ok = false if addr is not a valid textual representation of an IP address. +// If addr is an IPv4 address, return the addr and ok = true. +// If addr is an IPv6 address, return the addr enclosed in square brackets and ok = true. +func formatIP(addr string) (addrIP string, ok bool) { + ip := net.ParseIP(addr) + if ip == nil { + return "", false + } + if ip.To4() != nil { + return addr, true + } + return "[" + addr + "]", true +} + +// parseTarget takes the user input target string and default port, returns formatted host and port info. +// If target doesn't specify a port, set the port to be the defaultPort. +// If target is in IPv6 format and host-name is enclosed in square brackets, brackets +// are stripped when setting the host. +// examples: +// target: "www.google.com" defaultPort: "443" returns host: "www.google.com", port: "443" +// target: "ipv4-host:80" defaultPort: "443" returns host: "ipv4-host", port: "80" +// target: "[ipv6-host]" defaultPort: "443" returns host: "ipv6-host", port: "443" +// target: ":80" defaultPort: "443" returns host: "localhost", port: "80" +func parseTarget(target, defaultPort string) (host, port string, err error) { + if target == "" { + return "", "", errMissingAddr + } + if ip := net.ParseIP(target); ip != nil { + // target is an IPv4 or IPv6(without brackets) address + return target, defaultPort, nil + } + if host, port, err = net.SplitHostPort(target); err == nil { + if port == "" { + // If the port field is empty (target ends with colon), e.g. "[::1]:", this is an error. + return "", "", errEndsWithColon + } + // target has port, i.e ipv4-host:port, [ipv6-host]:port, host-name:port + if host == "" { + // Keep consistent with net.Dial(): If the host is empty, as in ":80", the local system is assumed. + host = "localhost" + } + return host, port, nil + } + if host, port, err = net.SplitHostPort(target + ":" + defaultPort); err == nil { + // target doesn't have port + return host, port, nil + } + return "", "", fmt.Errorf("invalid target address %v, error info: %v", target, err) +} + +type rawChoice struct { + ClientLanguage *[]string `json:"clientLanguage,omitempty"` + Percentage *int `json:"percentage,omitempty"` + ClientHostName *[]string `json:"clientHostName,omitempty"` + ServiceConfig *json.RawMessage `json:"serviceConfig,omitempty"` +} + +func containsString(a *[]string, b string) bool { + if a == nil { + return true + } + for _, c := range *a { + if c == b { + return true + } + } + return false +} + +func chosenByPercentage(a *int) bool { + if a == nil { + return true + } + return grpcrand.Intn(100)+1 <= *a +} + +func canaryingSC(js string) string { + if js == "" { + return "" + } + var rcs []rawChoice + err := json.Unmarshal([]byte(js), &rcs) + if err != nil { + grpclog.Warningf("grpc: failed to parse service config json string due to %v.\n", err) + return "" + } + cliHostname, err := os.Hostname() + if err != nil { + grpclog.Warningf("grpc: failed to get client hostname due to %v.\n", err) + return "" + } + var sc string + for _, c := range rcs { + if !containsString(c.ClientLanguage, golang) || + !chosenByPercentage(c.Percentage) || + !containsString(c.ClientHostName, cliHostname) || + c.ServiceConfig == nil { + continue + } + sc = string(*c.ServiceConfig) + break + } + return sc +} diff --git a/vendor/google.golang.org/grpc/resolver/dns/dns_resolver_test.go b/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver_test.go similarity index 76% rename from vendor/google.golang.org/grpc/resolver/dns/dns_resolver_test.go rename to vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver_test.go index b03486b11d7..be3ae2aa311 100644 --- a/vendor/google.golang.org/grpc/resolver/dns/dns_resolver_test.go +++ b/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver_test.go @@ -31,17 +31,15 @@ import ( "google.golang.org/grpc/internal/leakcheck" "google.golang.org/grpc/resolver" + "google.golang.org/grpc/serviceconfig" ) func TestMain(m *testing.M) { - // Set a valid duration for the re-resolution rate only for tests which are - // actually testing that feature. - dc := replaceDNSResRate(time.Duration(0)) - defer dc() - - cleanup := replaceNetFunc(nil) + // Set a non-zero duration only for tests which are actually testing that + // feature. + replaceDNSResRate(time.Duration(0)) // No nead to clean up since we os.Exit + replaceNetFunc(nil) // No nead to clean up since we os.Exit code := m.Run() - cleanup() os.Exit(code) } @@ -50,43 +48,47 @@ const ( ) type testClientConn struct { - target string - m1 sync.Mutex - addrs []resolver.Address - a int // how many times NewAddress() has been called - m2 sync.Mutex - sc string - s int + resolver.ClientConn // For unimplemented functions + target string + m1 sync.Mutex + state resolver.State + updateStateCalls int } func (t *testClientConn) UpdateState(s resolver.State) { - panic("unused") -} - -func (t *testClientConn) NewAddress(addresses []resolver.Address) { t.m1.Lock() defer t.m1.Unlock() - t.addrs = addresses - t.a++ + t.state = s + t.updateStateCalls++ } -func (t *testClientConn) getAddress() ([]resolver.Address, int) { +func (t *testClientConn) getState() (resolver.State, int) { t.m1.Lock() defer t.m1.Unlock() - return t.addrs, t.a + return t.state, t.updateStateCalls +} + +func scFromState(s resolver.State) string { + if s.ServiceConfig != nil { + if s.ServiceConfig.Err != nil { + return "" + } + return s.ServiceConfig.Config.(unparsedServiceConfig).config + } + return "" +} + +type unparsedServiceConfig struct { + serviceconfig.Config + config string } -func (t *testClientConn) NewServiceConfig(serviceConfig string) { - t.m2.Lock() - defer t.m2.Unlock() - t.sc = serviceConfig - t.s++ +func (t *testClientConn) ParseServiceConfig(s string) *serviceconfig.ParseResult { + return &serviceconfig.ParseResult{Config: unparsedServiceConfig{config: s}} } -func (t *testClientConn) getSc() (string, int) { - t.m2.Lock() - defer t.m2.Unlock() - return t.sc, t.s +func (t *testClientConn) ReportError(error) { + panic("not implemented") } type testResolver struct { @@ -174,20 +176,6 @@ func srvLookup(service, proto, name string) (string, []*net.SRV, error) { return "", nil, fmt.Errorf("failed to lookup srv record for %s in srvLookupTbl", cname) } -// div divides a byte slice into a slice of strings, each of which is of maximum -// 255 bytes length, which is the length limit per TXT record in DNS. -func div(b []byte) []string { - var r []string - for i := 0; i < len(b); i += txtBytesLimit { - if i+txtBytesLimit > len(b) { - r = append(r, string(b[i:])) - } else { - r = append(r, string(b[i:i+txtBytesLimit])) - } - } - return r -} - // scfs contains an array of service config file string in JSON format. // Notes about the scfs contents and usage: // scfs contains 4 service config file JSON strings for testing. Inside each @@ -596,52 +584,36 @@ var scs = []string{ }`, } -// scLookupTbl is a set, which contains targets that have service config. Target -// not in this set should not have service config. -var scLookupTbl = map[string]bool{ - txtPrefix + "foo.bar.com": true, - txtPrefix + "srv.ipv4.single.fake": true, - txtPrefix + "srv.ipv4.multi.fake": true, - txtPrefix + "no.attribute": true, -} - -// generateSCF generates a slice of strings (aggregately representing a single -// service config file) for the input name, which mocks the result from a real -// DNS TXT record lookup. -func generateSCF(name string) []string { - var b []byte - switch name { - case "foo.bar.com": - b = []byte(scfs[0]) - case "srv.ipv4.single.fake": - b = []byte(scfs[1]) - case "srv.ipv4.multi.fake": - b = []byte(scfs[2]) - default: - b = []byte(scfs[3]) - } - if name == "no.attribute" { - return div(b) - } - return div(append([]byte(txtAttribute), b...)) +// scLookupTbl is a map, which contains targets that have service config to +// their configs. Targets not in this set should not have service config. +var scLookupTbl = map[string]string{ + "foo.bar.com": scs[0], + "srv.ipv4.single.fake": scs[1], + "srv.ipv4.multi.fake": scs[2], } // generateSC returns a service config string in JSON format for the input name. func generateSC(name string) string { - _, cnt := scLookupTbl[name] - if !cnt || name == "no.attribute" { - return "" - } - switch name { - case "foo.bar.com": - return scs[0] - case "srv.ipv4.single.fake": - return scs[1] - case "srv.ipv4.multi.fake": - return scs[2] - default: - return "" + return scLookupTbl[name] +} + +// generateSCF generates a slice of strings (aggregately representing a single +// service config file) for the input config string, which mocks the result +// from a real DNS TXT record lookup. +func generateSCF(cfg string) []string { + b := append([]byte(txtAttribute), []byte(cfg)...) + + // Split b into multiple strings, each with a max of 255 bytes, which is + // the DNS TXT record limit. + var r []string + for i := 0; i < len(b); i += txtBytesLimit { + if i+txtBytesLimit > len(b) { + r = append(r, string(b[i:])) + } else { + r = append(r, string(b[i:i+txtBytesLimit])) + } } + return r } var txtLookupTbl = struct { @@ -649,12 +621,11 @@ var txtLookupTbl = struct { tbl map[string][]string }{ tbl: map[string][]string{ - "foo.bar.com": generateSCF("foo.bar.com"), - "srv.ipv4.single.fake": generateSCF("srv.ipv4.single.fake"), - "srv.ipv4.multi.fake": generateSCF("srv.ipv4.multi.fake"), - "srv.ipv6.single.fake": generateSCF("srv.ipv6.single.fake"), - "srv.ipv6.multi.fake": generateSCF("srv.ipv6.multi.fake"), - "no.attribute": generateSCF("no.attribute"), + txtPrefix + "foo.bar.com": generateSCF(scfs[0]), + txtPrefix + "srv.ipv4.single.fake": generateSCF(scfs[1]), + txtPrefix + "srv.ipv4.multi.fake": generateSCF(scfs[2]), + txtPrefix + "srv.ipv6.single.fake": generateSCF(scfs[3]), + txtPrefix + "srv.ipv6.multi.fake": generateSCF(scfs[3]), }, } @@ -669,6 +640,7 @@ func txtLookup(host string) ([]string, error) { func TestResolve(t *testing.T) { testDNSResolver(t) + testDNSResolverWithSRV(t) testDNSResolveNow(t) testIPResolver(t) } @@ -692,7 +664,80 @@ func testDNSResolver(t *testing.T) { }, { "srv.ipv4.single.fake", - []resolver.Address{{Addr: "1.2.3.4:1234", Type: resolver.GRPCLB, ServerName: "ipv4.single.fake"}, {Addr: "2.4.6.8" + colonDefaultPort}}, + []resolver.Address{{Addr: "2.4.6.8" + colonDefaultPort}}, + generateSC("srv.ipv4.single.fake"), + }, + { + "srv.ipv4.multi.fake", + nil, + generateSC("srv.ipv4.multi.fake"), + }, + { + "srv.ipv6.single.fake", + nil, + generateSC("srv.ipv6.single.fake"), + }, + { + "srv.ipv6.multi.fake", + nil, + generateSC("srv.ipv6.multi.fake"), + }, + } + + for _, a := range tests { + b := NewBuilder() + cc := &testClientConn{target: a.target} + r, err := b.Build(resolver.Target{Endpoint: a.target}, cc, resolver.BuildOptions{}) + if err != nil { + t.Fatalf("%v\n", err) + } + var state resolver.State + var cnt int + for i := 0; i < 2000; i++ { + state, cnt = cc.getState() + if cnt > 0 { + break + } + time.Sleep(time.Millisecond) + } + if cnt == 0 { + t.Fatalf("UpdateState not called after 2s; aborting") + } + if !reflect.DeepEqual(a.addrWant, state.Addresses) { + t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", a.target, state.Addresses, a.addrWant) + } + sc := scFromState(state) + if a.scWant != sc { + t.Errorf("Resolved service config of target: %q = %+v, want %+v\n", a.target, sc, a.scWant) + } + r.Close() + } +} + +func testDNSResolverWithSRV(t *testing.T) { + EnableSRVLookups = true + defer func() { + EnableSRVLookups = false + }() + defer leakcheck.Check(t) + tests := []struct { + target string + addrWant []resolver.Address + scWant string + }{ + { + "foo.bar.com", + []resolver.Address{{Addr: "1.2.3.4" + colonDefaultPort}, {Addr: "5.6.7.8" + colonDefaultPort}}, + generateSC("foo.bar.com"), + }, + { + "foo.bar.com:1234", + []resolver.Address{{Addr: "1.2.3.4:1234"}, {Addr: "5.6.7.8:1234"}}, + generateSC("foo.bar.com"), + }, + { + "srv.ipv4.single.fake", + []resolver.Address{{Addr: "2.4.6.8" + colonDefaultPort}, {Addr: "1.2.3.4:1234", Type: resolver.GRPCLB, ServerName: "ipv4.single.fake"}}, generateSC("srv.ipv4.single.fake"), }, { @@ -718,44 +763,35 @@ func testDNSResolver(t *testing.T) { }, generateSC("srv.ipv6.multi.fake"), }, - { - "no.attribute", - nil, - generateSC("no.attribute"), - }, } for _, a := range tests { b := NewBuilder() cc := &testClientConn{target: a.target} - r, err := b.Build(resolver.Target{Endpoint: a.target}, cc, resolver.BuildOption{}) + r, err := b.Build(resolver.Target{Endpoint: a.target}, cc, resolver.BuildOptions{}) if err != nil { t.Fatalf("%v\n", err) } - var addrs []resolver.Address + defer r.Close() + var state resolver.State var cnt int - for { - addrs, cnt = cc.getAddress() + for i := 0; i < 2000; i++ { + state, cnt = cc.getState() if cnt > 0 { break } time.Sleep(time.Millisecond) } - var sc string - for { - sc, cnt = cc.getSc() - if cnt > 0 { - break - } - time.Sleep(time.Millisecond) + if cnt == 0 { + t.Fatalf("UpdateState not called after 2s; aborting") } - if !reflect.DeepEqual(a.addrWant, addrs) { - t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", a.target, addrs, a.addrWant) + if !reflect.DeepEqual(a.addrWant, state.Addresses) { + t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", a.target, state.Addresses, a.addrWant) } - if !reflect.DeepEqual(a.scWant, sc) { + sc := scFromState(state) + if a.scWant != sc { t.Errorf("Resolved service config of target: %q = %+v, want %+v\n", a.target, sc, a.scWant) } - r.Close() } } @@ -765,8 +801,8 @@ func mutateTbl(target string) func() { hostLookupTbl.tbl[target] = hostLookupTbl.tbl[target][:len(oldHostTblEntry)-1] hostLookupTbl.Unlock() txtLookupTbl.Lock() - oldTxtTblEntry := txtLookupTbl.tbl[target] - txtLookupTbl.tbl[target] = []string{""} + oldTxtTblEntry := txtLookupTbl.tbl[txtPrefix+target] + txtLookupTbl.tbl[txtPrefix+target] = []string{txtAttribute + `[{"serviceConfig":{"loadBalancingPolicy": "grpclb"}}]`} txtLookupTbl.Unlock() return func() { @@ -774,7 +810,7 @@ func mutateTbl(target string) func() { hostLookupTbl.tbl[target] = oldHostTblEntry hostLookupTbl.Unlock() txtLookupTbl.Lock() - txtLookupTbl.tbl[target] = oldTxtTblEntry + txtLookupTbl.tbl[txtPrefix+target] = oldTxtTblEntry txtLookupTbl.Unlock() } } @@ -793,64 +829,58 @@ func testDNSResolveNow(t *testing.T) { []resolver.Address{{Addr: "1.2.3.4" + colonDefaultPort}, {Addr: "5.6.7.8" + colonDefaultPort}}, []resolver.Address{{Addr: "1.2.3.4" + colonDefaultPort}}, generateSC("foo.bar.com"), - "", + `{"loadBalancingPolicy": "grpclb"}`, }, } for _, a := range tests { b := NewBuilder() cc := &testClientConn{target: a.target} - r, err := b.Build(resolver.Target{Endpoint: a.target}, cc, resolver.BuildOption{}) + r, err := b.Build(resolver.Target{Endpoint: a.target}, cc, resolver.BuildOptions{}) if err != nil { t.Fatalf("%v\n", err) } - var addrs []resolver.Address + defer r.Close() + var state resolver.State var cnt int - for { - addrs, cnt = cc.getAddress() + for i := 0; i < 2000; i++ { + state, cnt = cc.getState() if cnt > 0 { break } time.Sleep(time.Millisecond) } - var sc string - for { - sc, cnt = cc.getSc() - if cnt > 0 { - break - } - time.Sleep(time.Millisecond) + if cnt == 0 { + t.Fatalf("UpdateState not called after 2s; aborting. state=%v", state) } - if !reflect.DeepEqual(a.addrWant, addrs) { - t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", a.target, addrs, a.addrWant) + if !reflect.DeepEqual(a.addrWant, state.Addresses) { + t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", a.target, state.Addresses, a.addrWant) } - if !reflect.DeepEqual(a.scWant, sc) { + sc := scFromState(state) + if a.scWant != sc { t.Errorf("Resolved service config of target: %q = %+v, want %+v\n", a.target, sc, a.scWant) } + revertTbl := mutateTbl(a.target) - r.ResolveNow(resolver.ResolveNowOption{}) - for { - addrs, cnt = cc.getAddress() + r.ResolveNow(resolver.ResolveNowOptions{}) + for i := 0; i < 2000; i++ { + state, cnt = cc.getState() if cnt == 2 { break } time.Sleep(time.Millisecond) } - for { - sc, cnt = cc.getSc() - if cnt == 2 { - break - } - time.Sleep(time.Millisecond) + if cnt != 2 { + t.Fatalf("UpdateState not called after 2s; aborting. state=%v", state) } - if !reflect.DeepEqual(a.addrNext, addrs) { - t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", a.target, addrs, a.addrNext) + sc = scFromState(state) + if !reflect.DeepEqual(a.addrNext, state.Addresses) { + t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", a.target, state.Addresses, a.addrNext) } - if !reflect.DeepEqual(a.scNext, sc) { + if a.scNext != sc { t.Errorf("Resolved service config of target: %q = %+v, want %+v\n", a.target, sc, a.scNext) } revertTbl() - r.Close() } } @@ -877,33 +907,30 @@ func testIPResolver(t *testing.T) { for _, v := range tests { b := NewBuilder() cc := &testClientConn{target: v.target} - r, err := b.Build(resolver.Target{Endpoint: v.target}, cc, resolver.BuildOption{}) + r, err := b.Build(resolver.Target{Endpoint: v.target}, cc, resolver.BuildOptions{}) if err != nil { t.Fatalf("%v\n", err) } - var addrs []resolver.Address + var state resolver.State var cnt int for { - addrs, cnt = cc.getAddress() + state, cnt = cc.getState() if cnt > 0 { break } time.Sleep(time.Millisecond) } - if !reflect.DeepEqual(v.want, addrs) { - t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", v.target, addrs, v.want) + if !reflect.DeepEqual(v.want, state.Addresses) { + t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", v.target, state.Addresses, v.want) } - r.ResolveNow(resolver.ResolveNowOption{}) - for { - addrs, cnt = cc.getAddress() - if cnt == 2 { - break + r.ResolveNow(resolver.ResolveNowOptions{}) + for i := 0; i < 50; i++ { + state, cnt = cc.getState() + if cnt > 1 { + t.Fatalf("Unexpected second call by resolver to UpdateState. state: %v", state) } time.Sleep(time.Millisecond) } - if !reflect.DeepEqual(v.want, addrs) { - t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", v.target, addrs, v.want) - } r.Close() } } @@ -936,12 +963,12 @@ func TestResolveFunc(t *testing.T) { b := NewBuilder() for _, v := range tests { cc := &testClientConn{target: v.addr} - r, err := b.Build(resolver.Target{Endpoint: v.addr}, cc, resolver.BuildOption{}) + r, err := b.Build(resolver.Target{Endpoint: v.addr}, cc, resolver.BuildOptions{}) if err == nil { r.Close() } if !reflect.DeepEqual(err, v.want) { - t.Errorf("Build(%q, cc, resolver.BuildOption{}) = %v, want %v", v.addr, err, v.want) + t.Errorf("Build(%q, cc, _) = %v, want %v", v.addr, err, v.want) } } } @@ -968,23 +995,27 @@ func TestDisableServiceConfig(t *testing.T) { for _, a := range tests { b := NewBuilder() cc := &testClientConn{target: a.target} - r, err := b.Build(resolver.Target{Endpoint: a.target}, cc, resolver.BuildOption{DisableServiceConfig: a.disableServiceConfig}) + r, err := b.Build(resolver.Target{Endpoint: a.target}, cc, resolver.BuildOptions{DisableServiceConfig: a.disableServiceConfig}) if err != nil { t.Fatalf("%v\n", err) } + defer r.Close() var cnt int - var sc string - for { - sc, cnt = cc.getSc() + var state resolver.State + for i := 0; i < 2000; i++ { + state, cnt = cc.getState() if cnt > 0 { break } time.Sleep(time.Millisecond) } - if !reflect.DeepEqual(a.scWant, sc) { + if cnt == 0 { + t.Fatalf("UpdateState not called after 2s; aborting") + } + sc := scFromState(state) + if a.scWant != sc { t.Errorf("Resolved service config of target: %q = %+v, want %+v\n", a.target, sc, a.scWant) } - r.Close() } } @@ -992,57 +1023,53 @@ func TestDNSResolverRetry(t *testing.T) { b := NewBuilder() target := "ipv4.single.fake" cc := &testClientConn{target: target} - r, err := b.Build(resolver.Target{Endpoint: target}, cc, resolver.BuildOption{}) + r, err := b.Build(resolver.Target{Endpoint: target}, cc, resolver.BuildOptions{}) if err != nil { t.Fatalf("%v\n", err) } - var addrs []resolver.Address - for { - addrs, _ = cc.getAddress() - if len(addrs) == 1 { + defer r.Close() + var state resolver.State + for i := 0; i < 2000; i++ { + state, _ = cc.getState() + if len(state.Addresses) == 1 { break } time.Sleep(time.Millisecond) } + if len(state.Addresses) != 1 { + t.Fatalf("UpdateState not called with 1 address after 2s; aborting. state=%v", state) + } want := []resolver.Address{{Addr: "1.2.3.4" + colonDefaultPort}} - if !reflect.DeepEqual(want, addrs) { - t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", target, addrs, want) + if !reflect.DeepEqual(want, state.Addresses) { + t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", target, state.Addresses, want) } // mutate the host lookup table so the target has 0 address returned. revertTbl := mutateTbl(target) // trigger a resolve that will get empty address list - r.ResolveNow(resolver.ResolveNowOption{}) - for { - addrs, _ = cc.getAddress() - if len(addrs) == 0 { + r.ResolveNow(resolver.ResolveNowOptions{}) + for i := 0; i < 2000; i++ { + state, _ = cc.getState() + if len(state.Addresses) == 0 { break } time.Sleep(time.Millisecond) } + if len(state.Addresses) != 0 { + t.Fatalf("UpdateState not called with 0 address after 2s; aborting. state=%v", state) + } revertTbl() // wait for the retry to happen in two seconds. - timer := time.NewTimer(2 * time.Second) - for { - b := false - select { - case <-timer.C: - b = true - default: - addrs, _ = cc.getAddress() - if len(addrs) == 1 { - b = true - break - } - time.Sleep(time.Millisecond) - } - if b { + r.ResolveNow(resolver.ResolveNowOptions{}) + for i := 0; i < 2000; i++ { + state, _ = cc.getState() + if len(state.Addresses) == 1 { break } + time.Sleep(time.Millisecond) } - if !reflect.DeepEqual(want, addrs) { - t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", target, addrs, want) + if !reflect.DeepEqual(want, state.Addresses) { + t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", target, state.Addresses, want) } - r.Close() } func TestCustomAuthority(t *testing.T) { @@ -1129,7 +1156,7 @@ func TestCustomAuthority(t *testing.T) { b := NewBuilder() cc := &testClientConn{target: "foo.bar.com"} - r, err := b.Build(resolver.Target{Endpoint: "foo.bar.com", Authority: a.authority}, cc, resolver.BuildOption{}) + r, err := b.Build(resolver.Target{Endpoint: "foo.bar.com", Authority: a.authority}, cc, resolver.BuildOptions{}) if err == nil { r.Close() @@ -1167,7 +1194,7 @@ func TestRateLimitedResolve(t *testing.T) { target := "foo.bar.com" b := NewBuilder() cc := &testClientConn{target: target} - r, err := b.Build(resolver.Target{Endpoint: target}, cc, resolver.BuildOption{}) + r, err := b.Build(resolver.Target{Endpoint: target}, cc, resolver.BuildOptions{}) if err != nil { t.Fatalf("resolver.Build() returned error: %v\n", err) } @@ -1200,7 +1227,7 @@ func TestRateLimitedResolve(t *testing.T) { case <-done: return default: - r.ResolveNow(resolver.ResolveNowOption{}) + r.ResolveNow(resolver.ResolveNowOptions{}) time.Sleep(1 * time.Millisecond) } } @@ -1229,16 +1256,16 @@ func TestRateLimitedResolve(t *testing.T) { } wantAddrs := []resolver.Address{{Addr: "1.2.3.4" + colonDefaultPort}, {Addr: "5.6.7.8" + colonDefaultPort}} - var gotAddrs []resolver.Address + var state resolver.State for { var cnt int - gotAddrs, cnt = cc.getAddress() + state, cnt = cc.getState() if cnt > 0 { break } time.Sleep(time.Millisecond) } - if !reflect.DeepEqual(gotAddrs, wantAddrs) { - t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", target, gotAddrs, wantAddrs) + if !reflect.DeepEqual(state.Addresses, wantAddrs) { + t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", target, state.Addresses, wantAddrs) } } diff --git a/vendor/google.golang.org/grpc/internal/resolver/dns/go113.go b/vendor/google.golang.org/grpc/internal/resolver/dns/go113.go new file mode 100644 index 00000000000..8783a8cf821 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/resolver/dns/go113.go @@ -0,0 +1,33 @@ +// +build go1.13 + +/* + * + * 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. + * + */ + +package dns + +import "net" + +func init() { + filterError = func(err error) error { + if dnsErr, ok := err.(*net.DNSError); ok && dnsErr.IsNotFound { + // The name does not exist; not an error. + return nil + } + return err + } +} diff --git a/vendor/google.golang.org/grpc/internal/resolver/passthrough/passthrough.go b/vendor/google.golang.org/grpc/internal/resolver/passthrough/passthrough.go new file mode 100644 index 00000000000..520d9229e1e --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/resolver/passthrough/passthrough.go @@ -0,0 +1,57 @@ +/* + * + * 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. + * + */ + +// Package passthrough implements a pass-through resolver. It sends the target +// name without scheme back to gRPC as resolved address. +package passthrough + +import "google.golang.org/grpc/resolver" + +const scheme = "passthrough" + +type passthroughBuilder struct{} + +func (*passthroughBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) { + r := &passthroughResolver{ + target: target, + cc: cc, + } + r.start() + return r, nil +} + +func (*passthroughBuilder) Scheme() string { + return scheme +} + +type passthroughResolver struct { + target resolver.Target + cc resolver.ClientConn +} + +func (r *passthroughResolver) start() { + r.cc.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: r.target.Endpoint}}}) +} + +func (*passthroughResolver) ResolveNow(o resolver.ResolveNowOptions) {} + +func (*passthroughResolver) Close() {} + +func init() { + resolver.Register(&passthroughBuilder{}) +} diff --git a/vendor/google.golang.org/grpc/internal/testutils/pipe_listener_test.go b/vendor/google.golang.org/grpc/internal/testutils/pipe_listener_test.go index 9bd399cb0be..07cb486ee90 100644 --- a/vendor/google.golang.org/grpc/internal/testutils/pipe_listener_test.go +++ b/vendor/google.golang.org/grpc/internal/testutils/pipe_listener_test.go @@ -27,7 +27,7 @@ import ( func TestPipeListener(t *testing.T) { pl := testutils.NewPipeListener() - recvdBytes := make(chan []byte) + recvdBytes := make(chan []byte, 1) const want = "hello world" go func() { diff --git a/vendor/google.golang.org/grpc/internal/transport/controlbuf.go b/vendor/google.golang.org/grpc/internal/transport/controlbuf.go index b8e0aa4db27..ddee20b6bef 100644 --- a/vendor/google.golang.org/grpc/internal/transport/controlbuf.go +++ b/vendor/google.golang.org/grpc/internal/transport/controlbuf.go @@ -107,8 +107,8 @@ func (*registerStream) isTransportResponseFrame() bool { return false } type headerFrame struct { streamID uint32 hf []hpack.HeaderField - endStream bool // Valid on server side. - initStream func(uint32) (bool, error) // Used only on the client side. + endStream bool // Valid on server side. + initStream func(uint32) error // Used only on the client side. onWrite func() wq *writeQuota // write quota for the stream created. cleanup *cleanupStream // Valid on the server side. @@ -637,21 +637,17 @@ func (l *loopyWriter) headerHandler(h *headerFrame) error { func (l *loopyWriter) originateStream(str *outStream) error { hdr := str.itl.dequeue().(*headerFrame) - sendPing, err := hdr.initStream(str.id) - if err != nil { + if err := hdr.initStream(str.id); err != nil { if err == ErrConnClosing { return err } // Other errors(errStreamDrain) need not close transport. return nil } - if err = l.writeHeader(str.id, hdr.endStream, hdr.hf, hdr.onWrite); err != nil { + if err := l.writeHeader(str.id, hdr.endStream, hdr.hf, hdr.onWrite); err != nil { return err } l.estdStreams[str.id] = str - if sendPing { - return l.pingHandler(&ping{data: [8]byte{}}) - } return nil } diff --git a/vendor/google.golang.org/grpc/internal/transport/handler_server.go b/vendor/google.golang.org/grpc/internal/transport/handler_server.go index 78f9ddc3d3a..fbf01d5fe75 100644 --- a/vendor/google.golang.org/grpc/internal/transport/handler_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/handler_server.go @@ -227,7 +227,9 @@ func (ht *serverHandlerTransport) WriteStatus(s *Stream, st *status.Status) erro if err == nil { // transport has not been closed if ht.stats != nil { - ht.stats.HandleRPC(s.Context(), &stats.OutTrailer{}) + ht.stats.HandleRPC(s.Context(), &stats.OutTrailer{ + Trailer: s.trailer.Copy(), + }) } } ht.Close() @@ -289,7 +291,9 @@ func (ht *serverHandlerTransport) WriteHeader(s *Stream, md metadata.MD) error { if err == nil { if ht.stats != nil { - ht.stats.HandleRPC(s.Context(), &stats.OutHeader{}) + ht.stats.HandleRPC(s.Context(), &stats.OutHeader{ + Header: md.Copy(), + }) } } return err diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_client.go b/vendor/google.golang.org/grpc/internal/transport/http2_client.go index 41a79c56702..e18935653c1 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_client.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_client.go @@ -35,6 +35,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/internal" "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/internal/syscall" "google.golang.org/grpc/keepalive" @@ -44,8 +45,14 @@ import ( "google.golang.org/grpc/status" ) +// clientConnectionCounter counts the number of connections a client has +// initiated (equal to the number of http2Clients created). Must be accessed +// atomically. +var clientConnectionCounter uint64 + // http2Client implements the ClientTransport interface with HTTP2. type http2Client struct { + lastRead int64 // Keep this field 64-bit aligned. Accessed atomically. ctx context.Context cancel context.CancelFunc ctxDone <-chan struct{} // Cache the ctx.Done() chan. @@ -62,8 +69,6 @@ type http2Client struct { // goAway is closed to notify the upper layer (i.e., addrConn.transportMonitor) // that the server sent GoAway on this transport. goAway chan struct{} - // awakenKeepalive is used to wake up keepalive when after it has gone dormant. - awakenKeepalive chan struct{} framer *framer // controlBuf delivers all the control related tasks (e.g., window @@ -77,9 +82,6 @@ type http2Client struct { perRPCCreds []credentials.PerRPCCredentials - // Boolean to keep track of reading activity on transport. - // 1 is true and 0 is false. - activity uint32 // Accessed atomically. kp keepalive.ClientParameters keepaliveEnabled bool @@ -110,6 +112,16 @@ type http2Client struct { // goAwayReason records the http2.ErrCode and debug data received with the // GoAway frame. goAwayReason GoAwayReason + // A condition variable used to signal when the keepalive goroutine should + // go dormant. The condition for dormancy is based on the number of active + // streams and the `PermitWithoutStream` keepalive client parameter. And + // since the number of active streams is guarded by the above mutex, we use + // the same for this condition variable as well. + kpDormancyCond *sync.Cond + // A boolean to track whether the keepalive goroutine is dormant or not. + // This is checked before attempting to signal the above condition + // variable. + kpDormant bool // Fields below are for channelz metric collection. channelzID int64 // channelz unique identification number @@ -119,6 +131,8 @@ type http2Client struct { onClose func() bufferPool *bufferPool + + connectionID uint64 } func dial(ctx context.Context, fn func(context.Context, string) (net.Conn, error), addr string) (net.Conn, error) { @@ -232,7 +246,6 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne readerDone: make(chan struct{}), writerDone: make(chan struct{}), goAway: make(chan struct{}), - awakenKeepalive: make(chan struct{}, 1), framer: newFramer(conn, writeBufSize, readBufSize, maxHeaderListSize), fc: &trInFlow{limit: uint32(icwz)}, scheme: scheme, @@ -264,9 +277,6 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne updateFlowControl: t.updateFlowControl, } } - // Make sure awakenKeepalive can't be written upon. - // keepalive routine will make it writable, if need be. - t.awakenKeepalive <- struct{}{} if t.statsHandler != nil { t.ctx = t.statsHandler.TagConn(t.ctx, &stats.ConnTagInfo{ RemoteAddr: t.remoteAddr, @@ -281,6 +291,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne t.channelzID = channelz.RegisterNormalSocket(t, opts.ChannelzParentID, fmt.Sprintf("%s -> %s", t.localAddr, t.remoteAddr)) } if t.keepaliveEnabled { + t.kpDormancyCond = sync.NewCond(&t.mu) go t.keepalive() } // Start the reader goroutine for incoming message. Each transport has @@ -325,6 +336,8 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne } } + t.connectionID = atomic.AddUint64(&clientConnectionCounter, 1) + if err := t.framer.writer.Flush(); err != nil { return nil, err } @@ -347,6 +360,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream { // TODO(zhaoq): Handle uint32 overflow of Stream.id. s := &Stream{ + ct: t, done: make(chan struct{}), method: callHdr.Method, sendCompress: callHdr.SendCompress, @@ -380,23 +394,23 @@ func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream { } func (t *http2Client) getPeer() *peer.Peer { - pr := &peer.Peer{ - Addr: t.remoteAddr, + return &peer.Peer{ + Addr: t.remoteAddr, + AuthInfo: t.authInfo, } - // Attach Auth info if there is any. - if t.authInfo != nil { - pr.AuthInfo = t.authInfo - } - return pr } func (t *http2Client) createHeaderFields(ctx context.Context, callHdr *CallHdr) ([]hpack.HeaderField, error) { aud := t.createAudience(callHdr) - authData, err := t.getTrAuthData(ctx, aud) + ri := credentials.RequestInfo{ + Method: callHdr.Method, + } + ctxWithRequestInfo := internal.NewRequestInfoContext.(func(context.Context, credentials.RequestInfo) context.Context)(ctx, ri) + authData, err := t.getTrAuthData(ctxWithRequestInfo, aud) if err != nil { return nil, err } - callAuthData, err := t.getCallAuthData(ctx, aud, callHdr) + callAuthData, err := t.getCallAuthData(ctxWithRequestInfo, aud, callHdr) if err != nil { return nil, err } @@ -419,6 +433,7 @@ func (t *http2Client) createHeaderFields(ctx context.Context, callHdr *CallHdr) if callHdr.SendCompress != "" { headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-encoding", Value: callHdr.SendCompress}) + headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-accept-encoding", Value: callHdr.SendCompress}) } if dl, ok := ctx.Deadline(); ok { // Send out timeout regardless its value. The server can detect timeout context by itself. @@ -564,7 +579,7 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea hdr := &headerFrame{ hf: headerFields, endStream: false, - initStream: func(id uint32) (bool, error) { + initStream: func(id uint32) error { t.mu.Lock() if state := t.state; state != reachable { t.mu.Unlock() @@ -574,29 +589,19 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea err = ErrConnClosing } cleanup(err) - return false, err + return err } t.activeStreams[id] = s if channelz.IsOn() { atomic.AddInt64(&t.czData.streamsStarted, 1) atomic.StoreInt64(&t.czData.lastStreamCreatedTime, time.Now().UnixNano()) } - var sendPing bool - // If the number of active streams change from 0 to 1, then check if keepalive - // has gone dormant. If so, wake it up. - if len(t.activeStreams) == 1 && t.keepaliveEnabled { - select { - case t.awakenKeepalive <- struct{}{}: - sendPing = true - // Fill the awakenKeepalive channel again as this channel must be - // kept non-writable except at the point that the keepalive() - // goroutine is waiting either to be awaken or shutdown. - t.awakenKeepalive <- struct{}{} - default: - } + // If the keepalive goroutine has gone dormant, wake it up. + if t.kpDormant { + t.kpDormancyCond.Signal() } t.mu.Unlock() - return sendPing, nil + return nil }, onOrphaned: cleanup, wq: s.wq, @@ -674,12 +679,14 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea } } if t.statsHandler != nil { + header, _, _ := metadata.FromOutgoingContextRaw(ctx) outHeader := &stats.OutHeader{ Client: true, FullMethod: callHdr.Method, RemoteAddr: t.remoteAddr, LocalAddr: t.localAddr, Compression: callHdr.SendCompress, + Header: header.Copy(), } t.statsHandler.HandleRPC(s.ctx, outHeader) } @@ -778,6 +785,11 @@ func (t *http2Client) Close() error { t.state = closing streams := t.activeStreams t.activeStreams = nil + if t.kpDormant { + // If the keepalive goroutine is blocked on this condition variable, we + // should unblock it so that the goroutine eventually exits. + t.kpDormancyCond.Signal() + } t.mu.Unlock() t.controlBuf.finish() t.cancel() @@ -853,11 +865,11 @@ func (t *http2Client) Write(s *Stream, hdr []byte, data []byte, opts *Options) e return t.controlBuf.put(df) } -func (t *http2Client) getStream(f http2.Frame) (*Stream, bool) { +func (t *http2Client) getStream(f http2.Frame) *Stream { t.mu.Lock() - defer t.mu.Unlock() - s, ok := t.activeStreams[f.Header().StreamID] - return s, ok + s := t.activeStreams[f.Header().StreamID] + t.mu.Unlock() + return s } // adjustWindow sends out extra window update over the initial window size @@ -937,8 +949,8 @@ func (t *http2Client) handleData(f *http2.DataFrame) { t.controlBuf.put(bdpPing) } // Select the right stream to dispatch. - s, ok := t.getStream(f) - if !ok { + s := t.getStream(f) + if s == nil { return } if size > 0 { @@ -969,8 +981,8 @@ func (t *http2Client) handleData(f *http2.DataFrame) { } func (t *http2Client) handleRSTStream(f *http2.RSTStreamFrame) { - s, ok := t.getStream(f) - if !ok { + s := t.getStream(f) + if s == nil { return } if f.ErrCode == http2.ErrCodeRefusedStream { @@ -1147,8 +1159,8 @@ func (t *http2Client) handleWindowUpdate(f *http2.WindowUpdateFrame) { // operateHeaders takes action on the decoded headers. func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { - s, ok := t.getStream(frame) - if !ok { + s := t.getStream(frame) + if s == nil { return } endStream := frame.StreamEnded() @@ -1177,12 +1189,14 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { inHeader := &stats.InHeader{ Client: true, WireLength: int(frame.Header().Length), + Header: s.header.Copy(), } t.statsHandler.HandleRPC(s.ctx, inHeader) } else { inTrailer := &stats.InTrailer{ Client: true, WireLength: int(frame.Header().Length), + Trailer: s.trailer.Copy(), } t.statsHandler.HandleRPC(s.ctx, inTrailer) } @@ -1191,6 +1205,7 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { // If headerChan hasn't been closed yet if atomic.CompareAndSwapUint32(&s.headerChanClosed, 0, 1) { + s.headerValid = true if !endStream { // HEADERS frame block carries a Response-Headers. isHeader = true @@ -1233,7 +1248,7 @@ func (t *http2Client) reader() { } t.conn.SetReadDeadline(time.Time{}) // reset deadline once we get the settings frame (we didn't time out, yay!) if t.keepaliveEnabled { - atomic.CompareAndSwapUint32(&t.activity, 0, 1) + atomic.StoreInt64(&t.lastRead, time.Now().UnixNano()) } sf, ok := frame.(*http2.SettingsFrame) if !ok { @@ -1248,7 +1263,7 @@ func (t *http2Client) reader() { t.controlBuf.throttle() frame, err := t.framer.fr.ReadFrame() if t.keepaliveEnabled { - atomic.CompareAndSwapUint32(&t.activity, 0, 1) + atomic.StoreInt64(&t.lastRead, time.Now().UnixNano()) } if err != nil { // Abort an active stream if the http2.Framer returns a @@ -1292,56 +1307,83 @@ func (t *http2Client) reader() { } } +func minTime(a, b time.Duration) time.Duration { + if a < b { + return a + } + return b +} + // keepalive running in a separate goroutune makes sure the connection is alive by sending pings. func (t *http2Client) keepalive() { p := &ping{data: [8]byte{}} + // True iff a ping has been sent, and no data has been received since then. + outstandingPing := false + // Amount of time remaining before which we should receive an ACK for the + // last sent ping. + timeoutLeft := time.Duration(0) + // Records the last value of t.lastRead before we go block on the timer. + // This is required to check for read activity since then. + prevNano := time.Now().UnixNano() timer := time.NewTimer(t.kp.Time) for { select { case <-timer.C: - if atomic.CompareAndSwapUint32(&t.activity, 1, 0) { - timer.Reset(t.kp.Time) + lastRead := atomic.LoadInt64(&t.lastRead) + if lastRead > prevNano { + // There has been read activity since the last time we were here. + outstandingPing = false + // Next timer should fire at kp.Time seconds from lastRead time. + timer.Reset(time.Duration(lastRead) + t.kp.Time - time.Duration(time.Now().UnixNano())) + prevNano = lastRead continue } - // Check if keepalive should go dormant. + if outstandingPing && timeoutLeft <= 0 { + t.Close() + return + } t.mu.Lock() - if len(t.activeStreams) < 1 && !t.kp.PermitWithoutStream { - // Make awakenKeepalive writable. - <-t.awakenKeepalive - t.mu.Unlock() - select { - case <-t.awakenKeepalive: - // If the control gets here a ping has been sent - // need to reset the timer with keepalive.Timeout. - case <-t.ctx.Done(): - return - } - } else { + if t.state == closing { + // If the transport is closing, we should exit from the + // keepalive goroutine here. If not, we could have a race + // between the call to Signal() from Close() and the call to + // Wait() here, whereby the keepalive goroutine ends up + // blocking on the condition variable which will never be + // signalled again. t.mu.Unlock() + return + } + if len(t.activeStreams) < 1 && !t.kp.PermitWithoutStream { + // If a ping was sent out previously (because there were active + // streams at that point) which wasn't acked and its timeout + // hadn't fired, but we got here and are about to go dormant, + // we should make sure that we unconditionally send a ping once + // we awaken. + outstandingPing = false + t.kpDormant = true + t.kpDormancyCond.Wait() + } + t.kpDormant = false + t.mu.Unlock() + + // We get here either because we were dormant and a new stream was + // created which unblocked the Wait() call, or because the + // keepalive timer expired. In both cases, we need to send a ping. + if !outstandingPing { if channelz.IsOn() { atomic.AddInt64(&t.czData.kpCount, 1) } - // Send ping. t.controlBuf.put(p) + timeoutLeft = t.kp.Timeout + outstandingPing = true } - - // By the time control gets here a ping has been sent one way or the other. - timer.Reset(t.kp.Timeout) - select { - case <-timer.C: - if atomic.CompareAndSwapUint32(&t.activity, 1, 0) { - timer.Reset(t.kp.Time) - continue - } - infof("transport: closing client transport due to idleness.") - t.Close() - return - case <-t.ctx.Done(): - if !timer.Stop() { - <-timer.C - } - return - } + // The amount of time to sleep here is the minimum of kp.Time and + // timeoutLeft. This will ensure that we wait only for kp.Time + // before sending out the next ping (for cases where the ping is + // acked). + sleepDuration := minTime(t.kp.Time, timeoutLeft) + timeoutLeft -= sleepDuration + timer.Reset(sleepDuration) case <-t.ctx.Done(): if !timer.Stop() { <-timer.C diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_server.go b/vendor/google.golang.org/grpc/internal/transport/http2_server.go index 83439b5627d..8b04b0392a0 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_server.go @@ -62,11 +62,15 @@ var ( statusRawProto = internal.StatusRawProto.(func(*status.Status) *spb.Status) ) +// serverConnectionCounter counts the number of connections a server has seen +// (equal to the number of http2Servers created). Must be accessed atomically. +var serverConnectionCounter uint64 + // http2Server implements the ServerTransport interface with HTTP2. type http2Server struct { + lastRead int64 // Keep this field 64-bit aligned. Accessed atomically. ctx context.Context - ctxDone <-chan struct{} // Cache the context.Done() chan - cancel context.CancelFunc + done chan struct{} conn net.Conn loopy *loopyWriter readerDone chan struct{} // sync point to enable testing. @@ -84,12 +88,8 @@ type http2Server struct { controlBuf *controlBuffer fc *trInFlow stats stats.Handler - // Flag to keep track of reading activity on transport. - // 1 is true and 0 is false. - activity uint32 // Accessed atomically. // Keepalive and max-age parameters for the server. kp keepalive.ServerParameters - // Keepalive enforcement policy. kep keepalive.EnforcementPolicy // The time instance last ping was received. @@ -125,6 +125,8 @@ type http2Server struct { channelzID int64 // channelz unique identification number czData *channelzData bufferPool *bufferPool + + connectionID uint64 } // newHTTP2Server constructs a ServerTransport based on HTTP2. ConnectionError is @@ -138,7 +140,10 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err } framer := newFramer(conn, writeBufSize, readBufSize, maxHeaderListSize) // Send initial settings as connection preface to client. - var isettings []http2.Setting + isettings := []http2.Setting{{ + ID: http2.SettingMaxFrameSize, + Val: http2MaxFrameLen, + }} // TODO(zhaoq): Have a better way to signal "no limit" because 0 is // permitted in the HTTP2 spec. maxStreams := config.MaxStreams @@ -172,6 +177,12 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err Val: *config.MaxHeaderListSize, }) } + if config.HeaderTableSize != nil { + isettings = append(isettings, http2.Setting{ + ID: http2.SettingHeaderTableSize, + Val: *config.HeaderTableSize, + }) + } if err := framer.fr.WriteSettings(isettings...); err != nil { return nil, connectionErrorf(false, err, "transport: %v", err) } @@ -203,11 +214,10 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err if kep.MinTime == 0 { kep.MinTime = defaultKeepalivePolicyMinTime } - ctx, cancel := context.WithCancel(context.Background()) + done := make(chan struct{}) t := &http2Server{ - ctx: ctx, - cancel: cancel, - ctxDone: ctx.Done(), + ctx: context.Background(), + done: done, conn: conn, remoteAddr: conn.RemoteAddr(), localAddr: conn.LocalAddr(), @@ -228,7 +238,7 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err czData: new(channelzData), bufferPool: newBufferPool(), } - t.controlBuf = newControlBuffer(t.ctxDone) + t.controlBuf = newControlBuffer(t.done) if dynamicWindow { t.bdpEst = &bdpEstimator{ bdp: initialWindowSize, @@ -246,6 +256,9 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err if channelz.IsOn() { t.channelzID = channelz.RegisterNormalSocket(t, config.ChannelzParentID, fmt.Sprintf("%s -> %s", t.remoteAddr, t.localAddr)) } + + t.connectionID = atomic.AddUint64(&serverConnectionCounter, 1) + t.framer.writer.Flush() defer func() { @@ -270,7 +283,7 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err if err != nil { return nil, connectionErrorf(false, err, "transport: http2Server.HandleStreams failed to read initial settings frame: %v", err) } - atomic.StoreUint32(&t.activity, 1) + atomic.StoreInt64(&t.lastRead, time.Now().UnixNano()) sf, ok := frame.(*http2.SettingsFrame) if !ok { return nil, connectionErrorf(false, nil, "transport: http2Server.HandleStreams saw invalid preface type %T from client", frame) @@ -359,12 +372,14 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( rstCode: http2.ErrCodeRefusedStream, onWrite: func() {}, }) + s.cancel() return false } } t.mu.Lock() if t.state != reachable { t.mu.Unlock() + s.cancel() return false } if uint32(len(t.activeStreams)) >= t.maxStreams { @@ -375,12 +390,14 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( rstCode: http2.ErrCodeRefusedStream, onWrite: func() {}, }) + s.cancel() return false } if streamID%2 != 1 || streamID <= t.maxStreamID { t.mu.Unlock() // illegal gRPC stream id. errorf("transport: http2Server.HandleStreams received an illegal stream id: %v", streamID) + s.cancel() return true } t.maxStreamID = streamID @@ -405,6 +422,7 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( LocalAddr: t.localAddr, Compression: s.recvCompress, WireLength: int(frame.Header().Length), + Header: metadata.MD(state.data.mdata).Copy(), } t.stats.HandleRPC(s.ctx, inHeader) } @@ -438,7 +456,7 @@ func (t *http2Server) HandleStreams(handle func(*Stream), traceCtx func(context. for { t.controlBuf.throttle() frame, err := t.framer.fr.ReadFrame() - atomic.StoreUint32(&t.activity, 1) + atomic.StoreInt64(&t.lastRead, time.Now().UnixNano()) if err != nil { if se, ok := err.(http2.StreamError); ok { warningf("transport: http2Server.HandleStreams encountered http2.StreamError: %v", se) @@ -746,7 +764,7 @@ func (t *http2Server) checkForHeaderListSize(it interface{}) bool { return true } -// WriteHeader sends the header metedata md back to the client. +// WriteHeader sends the header metadata md back to the client. func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error { if s.updateHeaderSent() || s.getState() == streamDone { return ErrIllegalHeaderWrite @@ -797,7 +815,9 @@ func (t *http2Server) writeHeaderLocked(s *Stream) error { if t.stats != nil { // Note: WireLength is not set in outHeader. // TODO(mmukhi): Revisit this later, if needed. - outHeader := &stats.OutHeader{} + outHeader := &stats.OutHeader{ + Header: s.header.Copy(), + } t.stats.HandleRPC(s.Context(), outHeader) } return nil @@ -860,7 +880,9 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { rst := s.getState() == streamActive t.finishStream(s, rst, http2.ErrCodeNo, trailingHeader, true) if t.stats != nil { - t.stats.HandleRPC(s.Context(), &stats.OutTrailer{}) + t.stats.HandleRPC(s.Context(), &stats.OutTrailer{ + Trailer: s.trailer.Copy(), + }) } return nil } @@ -882,7 +904,7 @@ func (t *http2Server) Write(s *Stream, hdr []byte, data []byte, opts *Options) e // TODO(mmukhi, dfawley): Should the server write also return io.EOF? s.cancel() select { - case <-t.ctx.Done(): + case <-t.done: return ErrConnClosing default: } @@ -904,7 +926,7 @@ func (t *http2Server) Write(s *Stream, hdr []byte, data []byte, opts *Options) e } if err := s.wq.get(int32(len(hdr) + len(data))); err != nil { select { - case <-t.ctx.Done(): + case <-t.done: return ErrConnClosing default: } @@ -921,32 +943,35 @@ func (t *http2Server) Write(s *Stream, hdr []byte, data []byte, opts *Options) e // after an additional duration of keepalive.Timeout. func (t *http2Server) keepalive() { p := &ping{} - var pingSent bool - maxIdle := time.NewTimer(t.kp.MaxConnectionIdle) - maxAge := time.NewTimer(t.kp.MaxConnectionAge) - keepalive := time.NewTimer(t.kp.Time) - // NOTE: All exit paths of this function should reset their - // respective timers. A failure to do so will cause the - // following clean-up to deadlock and eventually leak. + // True iff a ping has been sent, and no data has been received since then. + outstandingPing := false + // Amount of time remaining before which we should receive an ACK for the + // last sent ping. + kpTimeoutLeft := time.Duration(0) + // Records the last value of t.lastRead before we go block on the timer. + // This is required to check for read activity since then. + prevNano := time.Now().UnixNano() + // Initialize the different timers to their default values. + idleTimer := time.NewTimer(t.kp.MaxConnectionIdle) + ageTimer := time.NewTimer(t.kp.MaxConnectionAge) + kpTimer := time.NewTimer(t.kp.Time) defer func() { - if !maxIdle.Stop() { - <-maxIdle.C - } - if !maxAge.Stop() { - <-maxAge.C - } - if !keepalive.Stop() { - <-keepalive.C - } + // We need to drain the underlying channel in these timers after a call + // to Stop(), only if we are interested in resetting them. Clearly we + // are not interested in resetting them here. + idleTimer.Stop() + ageTimer.Stop() + kpTimer.Stop() }() + for { select { - case <-maxIdle.C: + case <-idleTimer.C: t.mu.Lock() idle := t.idle if idle.IsZero() { // The connection is non-idle. t.mu.Unlock() - maxIdle.Reset(t.kp.MaxConnectionIdle) + idleTimer.Reset(t.kp.MaxConnectionIdle) continue } val := t.kp.MaxConnectionIdle - time.Since(idle) @@ -955,44 +980,52 @@ func (t *http2Server) keepalive() { // The connection has been idle for a duration of keepalive.MaxConnectionIdle or more. // Gracefully close the connection. t.drain(http2.ErrCodeNo, []byte{}) - // Resetting the timer so that the clean-up doesn't deadlock. - maxIdle.Reset(infinity) return } - maxIdle.Reset(val) - case <-maxAge.C: + idleTimer.Reset(val) + case <-ageTimer.C: t.drain(http2.ErrCodeNo, []byte{}) - maxAge.Reset(t.kp.MaxConnectionAgeGrace) + ageTimer.Reset(t.kp.MaxConnectionAgeGrace) select { - case <-maxAge.C: + case <-ageTimer.C: // Close the connection after grace period. infof("transport: closing server transport due to maximum connection age.") t.Close() - // Resetting the timer so that the clean-up doesn't deadlock. - maxAge.Reset(infinity) - case <-t.ctx.Done(): + case <-t.done: } return - case <-keepalive.C: - if atomic.CompareAndSwapUint32(&t.activity, 1, 0) { - pingSent = false - keepalive.Reset(t.kp.Time) + case <-kpTimer.C: + lastRead := atomic.LoadInt64(&t.lastRead) + if lastRead > prevNano { + // There has been read activity since the last time we were + // here. Setup the timer to fire at kp.Time seconds from + // lastRead time and continue. + outstandingPing = false + kpTimer.Reset(time.Duration(lastRead) + t.kp.Time - time.Duration(time.Now().UnixNano())) + prevNano = lastRead continue } - if pingSent { + if outstandingPing && kpTimeoutLeft <= 0 { infof("transport: closing server transport due to idleness.") t.Close() - // Resetting the timer so that the clean-up doesn't deadlock. - keepalive.Reset(infinity) return } - pingSent = true - if channelz.IsOn() { - atomic.AddInt64(&t.czData.kpCount, 1) + if !outstandingPing { + if channelz.IsOn() { + atomic.AddInt64(&t.czData.kpCount, 1) + } + t.controlBuf.put(p) + kpTimeoutLeft = t.kp.Timeout + outstandingPing = true } - t.controlBuf.put(p) - keepalive.Reset(t.kp.Timeout) - case <-t.ctx.Done(): + // The amount of time to sleep here is the minimum of kp.Time and + // timeoutLeft. This will ensure that we wait only for kp.Time + // before sending out the next ping (for cases where the ping is + // acked). + sleepDuration := minTime(t.kp.Time, kpTimeoutLeft) + kpTimeoutLeft -= sleepDuration + kpTimer.Reset(sleepDuration) + case <-t.done: return } } @@ -1012,7 +1045,7 @@ func (t *http2Server) Close() error { t.activeStreams = nil t.mu.Unlock() t.controlBuf.finish() - t.cancel() + close(t.done) err := t.conn.Close() if channelz.IsOn() { channelz.RemoveEntry(t.channelzID) @@ -1152,7 +1185,7 @@ func (t *http2Server) outgoingGoAwayHandler(g *goAway) (bool, error) { select { case <-t.drainChan: case <-timer.C: - case <-t.ctx.Done(): + case <-t.done: return } t.controlBuf.put(&goAway{code: g.code, debugData: g.debugData}) @@ -1202,7 +1235,7 @@ func (t *http2Server) getOutFlowWindow() int64 { select { case sz := <-resp: return int64(sz) - case <-t.ctxDone: + case <-t.done: return -1 case <-timer.C: return -2 diff --git a/vendor/google.golang.org/grpc/internal/transport/http_util.go b/vendor/google.golang.org/grpc/internal/transport/http_util.go index 9d212867ce2..8f5f3349d90 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http_util.go +++ b/vendor/google.golang.org/grpc/internal/transport/http_util.go @@ -667,6 +667,7 @@ func newFramer(conn net.Conn, writeBufferSize, readBufferSize int, maxHeaderList writer: w, fr: http2.NewFramer(w, r), } + f.fr.SetMaxReadFrameSize(http2MaxFrameLen) // Opt-in to Frame reuse API on framer to reduce garbage. // Frames aren't safe to read from after a subsequent call to ReadFrame. f.fr.SetReuseFrames() diff --git a/vendor/google.golang.org/grpc/internal/transport/keepalive_test.go b/vendor/google.golang.org/grpc/internal/transport/keepalive_test.go new file mode 100644 index 00000000000..5736aaa97d3 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/transport/keepalive_test.go @@ -0,0 +1,653 @@ +/* + * + * 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. + * + */ + +// This file contains tests related to the following proposals: +// https://github.com/grpc/proposal/blob/master/A8-client-side-keepalive.md +// https://github.com/grpc/proposal/blob/master/A9-server-side-conn-mgt.md +// https://github.com/grpc/proposal/blob/master/A18-tcp-user-timeout.md +package transport + +import ( + "context" + "io" + "net" + "testing" + "time" + + "golang.org/x/net/http2" + "google.golang.org/grpc/internal/syscall" + "google.golang.org/grpc/keepalive" +) + +// TestMaxConnectionIdle tests that a server will send GoAway to an idle +// client. An idle client is one who doesn't make any RPC calls for a duration +// of MaxConnectionIdle time. +func TestMaxConnectionIdle(t *testing.T) { + serverConfig := &ServerConfig{ + KeepaliveParams: keepalive.ServerParameters{ + MaxConnectionIdle: 2 * time.Second, + }, + } + server, client, cancel := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}) + defer func() { + client.Close() + server.stop() + cancel() + }() + + stream, err := client.NewStream(context.Background(), &CallHdr{}) + if err != nil { + t.Fatalf("client.NewStream() failed: %v", err) + } + client.CloseStream(stream, io.EOF) + + // Wait for the server's MaxConnectionIdle timeout to kick in, and for it + // to send a GoAway. + timeout := time.NewTimer(time.Second * 4) + select { + case <-client.Error(): + if !timeout.Stop() { + <-timeout.C + } + if reason := client.GetGoAwayReason(); reason != GoAwayNoReason { + t.Fatalf("GoAwayReason is %v, want %v", reason, GoAwayNoReason) + } + case <-timeout.C: + t.Fatalf("MaxConnectionIdle timeout expired, expected a GoAway from the server.") + } +} + +// TestMaxConenctionIdleBusyClient tests that a server will not send GoAway to +// a busy client. +func TestMaxConnectionIdleBusyClient(t *testing.T) { + serverConfig := &ServerConfig{ + KeepaliveParams: keepalive.ServerParameters{ + MaxConnectionIdle: 2 * time.Second, + }, + } + server, client, cancel := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}) + defer func() { + client.Close() + server.stop() + cancel() + }() + + _, err := client.NewStream(context.Background(), &CallHdr{}) + if err != nil { + t.Fatalf("client.NewStream() failed: %v", err) + } + + // Wait for double the MaxConnectionIdle time to make sure the server does + // not send a GoAway, as the client has an open stream. + timeout := time.NewTimer(time.Second * 4) + select { + case <-client.GoAway(): + if !timeout.Stop() { + <-timeout.C + } + t.Fatalf("A non-idle client received a GoAway.") + case <-timeout.C: + } +} + +// TestMaxConnectionAge tests that a server will send GoAway after a duration +// of MaxConnectionAge. +func TestMaxConnectionAge(t *testing.T) { + serverConfig := &ServerConfig{ + KeepaliveParams: keepalive.ServerParameters{ + MaxConnectionAge: 1 * time.Second, + MaxConnectionAgeGrace: 1 * time.Second, + }, + } + server, client, cancel := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}) + defer func() { + client.Close() + server.stop() + cancel() + }() + + _, err := client.NewStream(context.Background(), &CallHdr{}) + if err != nil { + t.Fatalf("client.NewStream() failed: %v", err) + } + + // Wait for the server's MaxConnectionAge timeout to kick in, and for it + // to send a GoAway. + timeout := time.NewTimer(4 * time.Second) + select { + case <-client.Error(): + if !timeout.Stop() { + <-timeout.C + } + if reason := client.GetGoAwayReason(); reason != GoAwayNoReason { + t.Fatalf("GoAwayReason is %v, want %v", reason, GoAwayNoReason) + } + case <-timeout.C: + t.Fatalf("MaxConnectionAge timeout expired, expected a GoAway from the server.") + } +} + +const ( + defaultWriteBufSize = 32 * 1024 + defaultReadBufSize = 32 * 1024 +) + +// TestKeepaliveServerClosesUnresponsiveClient tests that a server closes +// the connection with a client that doesn't respond to keepalive pings. +// +// This test creates a regular net.Conn connection to the server and sends the +// clientPreface and the initial Settings frame, and then remains unresponsive. +func TestKeepaliveServerClosesUnresponsiveClient(t *testing.T) { + serverConfig := &ServerConfig{ + KeepaliveParams: keepalive.ServerParameters{ + Time: 1 * time.Second, + Timeout: 1 * time.Second, + }, + } + server, client, cancel := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}) + defer func() { + client.Close() + server.stop() + cancel() + }() + + addr := server.addr() + conn, err := net.Dial("tcp", addr) + if err != nil { + t.Fatalf("net.Dial(tcp, %v) failed: %v", addr, err) + } + defer conn.Close() + + if n, err := conn.Write(clientPreface); err != nil || n != len(clientPreface) { + t.Fatalf("conn.Write(clientPreface) failed: n=%v, err=%v", n, err) + } + framer := newFramer(conn, defaultWriteBufSize, defaultReadBufSize, 0) + if err := framer.fr.WriteSettings(http2.Setting{}); err != nil { + t.Fatal("framer.WriteSettings(http2.Setting{}) failed:", err) + } + framer.writer.Flush() + + // We read from the net.Conn till we get an error, which is expected when + // the server closes the connection as part of the keepalive logic. + errCh := make(chan error) + go func() { + b := make([]byte, 24) + for { + if _, err = conn.Read(b); err != nil { + errCh <- err + return + } + } + }() + + // Server waits for KeepaliveParams.Time seconds before sending out a ping, + // and then waits for KeepaliveParams.Timeout for a ping ack. + timeout := time.NewTimer(4 * time.Second) + select { + case err := <-errCh: + if err != io.EOF { + t.Fatalf("client.Read(_) = _,%v, want io.EOF", err) + + } + case <-timeout.C: + t.Fatalf("keepalive timeout expired, server should have closed the connection.") + } +} + +// TestKeepaliveServerWithResponsiveClient tests that a server doesn't close +// the connection with a client that responds to keepalive pings. +func TestKeepaliveServerWithResponsiveClient(t *testing.T) { + serverConfig := &ServerConfig{ + KeepaliveParams: keepalive.ServerParameters{ + Time: 1 * time.Second, + Timeout: 1 * time.Second, + }, + } + server, client, cancel := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}) + defer func() { + client.Close() + server.stop() + cancel() + }() + + // Give keepalive logic some time by sleeping. + time.Sleep(4 * time.Second) + + // Make sure the client transport is healthy. + if _, err := client.NewStream(context.Background(), &CallHdr{}); err != nil { + t.Fatalf("client.NewStream() failed: %v", err) + } +} + +// TestKeepaliveClientClosesUnresponsiveServer creates a server which does not +// respond to keepalive pings, and makes sure that the client closes the +// transport once the keepalive logic kicks in. Here, we set the +// `PermitWithoutStream` parameter to true which ensures that the keepalive +// logic is running even without any active streams. +func TestKeepaliveClientClosesUnresponsiveServer(t *testing.T) { + connCh := make(chan net.Conn, 1) + client, cancel := setUpWithNoPingServer(t, ConnectOptions{KeepaliveParams: keepalive.ClientParameters{ + Time: 1 * time.Second, + Timeout: 1 * time.Second, + PermitWithoutStream: true, + }}, connCh) + defer cancel() + defer client.Close() + + conn, ok := <-connCh + if !ok { + t.Fatalf("Server didn't return connection object") + } + defer conn.Close() + + // Sleep for keepalive to close the connection. + time.Sleep(4 * time.Second) + + // Make sure the client transport is not healthy. + if _, err := client.NewStream(context.Background(), &CallHdr{}); err == nil { + t.Fatal("client.NewStream() should have failed, but succeeded") + } +} + +// TestKeepaliveClientOpenWithUnresponsiveServer creates a server which does +// not respond to keepalive pings, and makes sure that the client does not +// close the transport. Here, we do not set the `PermitWithoutStream` parameter +// to true which ensures that the keepalive logic is turned off without any +// active streams, and therefore the transport stays open. +func TestKeepaliveClientOpenWithUnresponsiveServer(t *testing.T) { + connCh := make(chan net.Conn, 1) + client, cancel := setUpWithNoPingServer(t, ConnectOptions{KeepaliveParams: keepalive.ClientParameters{ + Time: 1 * time.Second, + Timeout: 1 * time.Second, + }}, connCh) + defer cancel() + defer client.Close() + + conn, ok := <-connCh + if !ok { + t.Fatalf("Server didn't return connection object") + } + defer conn.Close() + + // Give keepalive some time. + time.Sleep(4 * time.Second) + + // Make sure the client transport is healthy. + if _, err := client.NewStream(context.Background(), &CallHdr{}); err != nil { + t.Fatalf("client.NewStream() failed: %v", err) + } +} + +// TestKeepaliveClientClosesWithActiveStreams creates a server which does not +// respond to keepalive pings, and makes sure that the client closes the +// transport even when there is an active stream. +func TestKeepaliveClientClosesWithActiveStreams(t *testing.T) { + connCh := make(chan net.Conn, 1) + client, cancel := setUpWithNoPingServer(t, ConnectOptions{KeepaliveParams: keepalive.ClientParameters{ + Time: 1 * time.Second, + Timeout: 1 * time.Second, + }}, connCh) + defer cancel() + defer client.Close() + + conn, ok := <-connCh + if !ok { + t.Fatalf("Server didn't return connection object") + } + defer conn.Close() + + // Create a stream, but send no data on it. + if _, err := client.NewStream(context.Background(), &CallHdr{}); err != nil { + t.Fatalf("client.NewStream() failed: %v", err) + } + + // Give keepalive some time. + time.Sleep(4 * time.Second) + + // Make sure the client transport is not healthy. + if _, err := client.NewStream(context.Background(), &CallHdr{}); err == nil { + t.Fatal("client.NewStream() should have failed, but succeeded") + } +} + +// TestKeepaliveClientStaysHealthyWithResponsiveServer creates a server which +// responds to keepalive pings, and makes sure than a client transport stays +// healthy without any active streams. +func TestKeepaliveClientStaysHealthyWithResponsiveServer(t *testing.T) { + server, client, cancel := setUpWithOptions(t, 0, &ServerConfig{}, normal, ConnectOptions{ + KeepaliveParams: keepalive.ClientParameters{ + Time: 1 * time.Second, + Timeout: 1 * time.Second, + PermitWithoutStream: true, + }}) + defer func() { + client.Close() + server.stop() + cancel() + }() + + // Give keepalive some time. + time.Sleep(4 * time.Second) + + // Make sure the client transport is healthy. + if _, err := client.NewStream(context.Background(), &CallHdr{}); err != nil { + t.Fatalf("client.NewStream() failed: %v", err) + } +} + +// TestKeepaliveClientFrequency creates a server which expects at most 1 client +// ping for every 1.2 seconds, while the client is configured to send a ping +// every 1 second. So, this configuration should end up with the client +// transport being closed. But we had a bug wherein the client was sending one +// ping every [Time+Timeout] instead of every [Time] period, and this test +// explicitly makes sure the fix works and the client sends a ping every [Time] +// period. +func TestKeepaliveClientFrequency(t *testing.T) { + serverConfig := &ServerConfig{ + KeepalivePolicy: keepalive.EnforcementPolicy{ + MinTime: 1200 * time.Millisecond, // 1.2 seconds + PermitWithoutStream: true, + }, + } + clientOptions := ConnectOptions{ + KeepaliveParams: keepalive.ClientParameters{ + Time: 1 * time.Second, + Timeout: 2 * time.Second, + PermitWithoutStream: true, + }, + } + server, client, cancel := setUpWithOptions(t, 0, serverConfig, normal, clientOptions) + defer func() { + client.Close() + server.stop() + cancel() + }() + + timeout := time.NewTimer(6 * time.Second) + select { + case <-client.Error(): + if !timeout.Stop() { + <-timeout.C + } + if reason := client.GetGoAwayReason(); reason != GoAwayTooManyPings { + t.Fatalf("GoAwayReason is %v, want %v", reason, GoAwayTooManyPings) + } + case <-timeout.C: + t.Fatalf("client transport still healthy; expected GoAway from the server.") + } + + // Make sure the client transport is not healthy. + if _, err := client.NewStream(context.Background(), &CallHdr{}); err == nil { + t.Fatal("client.NewStream() should have failed, but succeeded") + } +} + +// TestKeepaliveServerEnforcementWithAbusiveClientNoRPC verifies that the +// server closes a client transport when it sends too many keepalive pings +// (when there are no active streams), based on the configured +// EnforcementPolicy. +func TestKeepaliveServerEnforcementWithAbusiveClientNoRPC(t *testing.T) { + serverConfig := &ServerConfig{ + KeepalivePolicy: keepalive.EnforcementPolicy{ + MinTime: 2 * time.Second, + }, + } + clientOptions := ConnectOptions{ + KeepaliveParams: keepalive.ClientParameters{ + Time: 50 * time.Millisecond, + Timeout: 1 * time.Second, + PermitWithoutStream: true, + }, + } + server, client, cancel := setUpWithOptions(t, 0, serverConfig, normal, clientOptions) + defer func() { + client.Close() + server.stop() + cancel() + }() + + timeout := time.NewTimer(4 * time.Second) + select { + case <-client.Error(): + if !timeout.Stop() { + <-timeout.C + } + if reason := client.GetGoAwayReason(); reason != GoAwayTooManyPings { + t.Fatalf("GoAwayReason is %v, want %v", reason, GoAwayTooManyPings) + } + case <-timeout.C: + t.Fatalf("client transport still healthy; expected GoAway from the server.") + } + + // Make sure the client transport is not healthy. + if _, err := client.NewStream(context.Background(), &CallHdr{}); err == nil { + t.Fatal("client.NewStream() should have failed, but succeeded") + } +} + +// TestKeepaliveServerEnforcementWithAbusiveClientWithRPC verifies that the +// server closes a client transport when it sends too many keepalive pings +// (even when there is an active stream), based on the configured +// EnforcementPolicy. +func TestKeepaliveServerEnforcementWithAbusiveClientWithRPC(t *testing.T) { + serverConfig := &ServerConfig{ + KeepalivePolicy: keepalive.EnforcementPolicy{ + MinTime: 2 * time.Second, + }, + } + clientOptions := ConnectOptions{ + KeepaliveParams: keepalive.ClientParameters{ + Time: 50 * time.Millisecond, + Timeout: 1 * time.Second, + }, + } + server, client, cancel := setUpWithOptions(t, 0, serverConfig, suspended, clientOptions) + defer func() { + client.Close() + server.stop() + cancel() + }() + + if _, err := client.NewStream(context.Background(), &CallHdr{}); err != nil { + t.Fatalf("client.NewStream() failed: %v", err) + } + + timeout := time.NewTimer(4 * time.Second) + select { + case <-client.Error(): + if !timeout.Stop() { + <-timeout.C + } + if reason := client.GetGoAwayReason(); reason != GoAwayTooManyPings { + t.Fatalf("GoAwayReason is %v, want %v", reason, GoAwayTooManyPings) + } + case <-timeout.C: + t.Fatalf("client transport still healthy; expected GoAway from the server.") + } + + // Make sure the client transport is not healthy. + if _, err := client.NewStream(context.Background(), &CallHdr{}); err == nil { + t.Fatal("client.NewStream() should have failed, but succeeded") + } +} + +// TestKeepaliveServerEnforcementWithObeyingClientNoRPC verifies that the +// server does not close a client transport (with no active streams) which +// sends keepalive pings in accordance to the configured keepalive +// EnforcementPolicy. +func TestKeepaliveServerEnforcementWithObeyingClientNoRPC(t *testing.T) { + serverConfig := &ServerConfig{ + KeepalivePolicy: keepalive.EnforcementPolicy{ + MinTime: 100 * time.Millisecond, + PermitWithoutStream: true, + }, + } + clientOptions := ConnectOptions{ + KeepaliveParams: keepalive.ClientParameters{ + Time: 101 * time.Millisecond, + Timeout: 1 * time.Second, + PermitWithoutStream: true, + }, + } + server, client, cancel := setUpWithOptions(t, 0, serverConfig, normal, clientOptions) + defer func() { + client.Close() + server.stop() + cancel() + }() + + // Give keepalive enough time. + time.Sleep(3 * time.Second) + + // Make sure the client transport is healthy. + if _, err := client.NewStream(context.Background(), &CallHdr{}); err != nil { + t.Fatalf("client.NewStream() failed: %v", err) + } +} + +// TestKeepaliveServerEnforcementWithObeyingClientWithRPC verifies that the +// server does not close a client transport (with active streams) which +// sends keepalive pings in accordance to the configured keepalive +// EnforcementPolicy. +func TestKeepaliveServerEnforcementWithObeyingClientWithRPC(t *testing.T) { + serverConfig := &ServerConfig{ + KeepalivePolicy: keepalive.EnforcementPolicy{ + MinTime: 100 * time.Millisecond, + }, + } + clientOptions := ConnectOptions{ + KeepaliveParams: keepalive.ClientParameters{ + Time: 101 * time.Millisecond, + Timeout: 1 * time.Second, + }, + } + server, client, cancel := setUpWithOptions(t, 0, serverConfig, suspended, clientOptions) + defer func() { + client.Close() + server.stop() + cancel() + }() + + if _, err := client.NewStream(context.Background(), &CallHdr{}); err != nil { + t.Fatalf("client.NewStream() failed: %v", err) + } + + // Give keepalive enough time. + time.Sleep(3 * time.Second) + + // Make sure the client transport is healthy. + if _, err := client.NewStream(context.Background(), &CallHdr{}); err != nil { + t.Fatalf("client.NewStream() failed: %v", err) + } +} + +// TestKeepaliveServerEnforcementWithDormantKeepaliveOnClient verifies that the +// server does not closes a client transport, which has been configured to send +// more pings than allowed by the server's EnforcementPolicy. This client +// transport does not have any active streams and `PermitWithoutStream` is set +// to false. This should ensure that the keepalive functionality on the client +// side enters a dormant state. +func TestKeepaliveServerEnforcementWithDormantKeepaliveOnClient(t *testing.T) { + serverConfig := &ServerConfig{ + KeepalivePolicy: keepalive.EnforcementPolicy{ + MinTime: 2 * time.Second, + }, + } + clientOptions := ConnectOptions{ + KeepaliveParams: keepalive.ClientParameters{ + Time: 50 * time.Millisecond, + Timeout: 1 * time.Second, + }, + } + server, client, cancel := setUpWithOptions(t, 0, serverConfig, normal, clientOptions) + defer func() { + client.Close() + server.stop() + cancel() + }() + + // No active streams on the client. Give keepalive enough time. + time.Sleep(5 * time.Second) + + // Make sure the client transport is healthy. + if _, err := client.NewStream(context.Background(), &CallHdr{}); err != nil { + t.Fatalf("client.NewStream() failed: %v", err) + } +} + +// TestTCPUserTimeout tests that the TCP_USER_TIMEOUT socket option is set to +// the keepalive timeout, as detailed in proposal A18. +func TestTCPUserTimeout(t *testing.T) { + tests := []struct { + time time.Duration + timeout time.Duration + wantTimeout time.Duration + }{ + { + 10 * time.Second, + 10 * time.Second, + 10 * 1000 * time.Millisecond, + }, + { + 0, + 0, + 0, + }, + } + for _, tt := range tests { + server, client, cancel := setUpWithOptions( + t, + 0, + &ServerConfig{ + KeepaliveParams: keepalive.ServerParameters{ + Time: tt.timeout, + Timeout: tt.timeout, + }, + }, + normal, + ConnectOptions{ + KeepaliveParams: keepalive.ClientParameters{ + Time: tt.time, + Timeout: tt.timeout, + }, + }, + ) + defer func() { + client.Close() + server.stop() + cancel() + }() + + stream, err := client.NewStream(context.Background(), &CallHdr{}) + if err != nil { + t.Fatalf("client.NewStream() failed: %v", err) + } + client.CloseStream(stream, io.EOF) + + opt, err := syscall.GetTCPUserTimeout(client.conn) + if err != nil { + t.Fatalf("syscall.GetTCPUserTimeout() failed: %v", err) + } + if opt < 0 { + t.Skipf("skipping test on unsupported environment") + } + if gotTimeout := time.Duration(opt) * time.Millisecond; gotTimeout != tt.wantTimeout { + t.Fatalf("syscall.GetTCPUserTimeout() = %d, want %d", gotTimeout, tt.wantTimeout) + } + } +} diff --git a/vendor/google.golang.org/grpc/internal/transport/transport.go b/vendor/google.golang.org/grpc/internal/transport/transport.go index 1c1d106709a..a30da9eb324 100644 --- a/vendor/google.golang.org/grpc/internal/transport/transport.go +++ b/vendor/google.golang.org/grpc/internal/transport/transport.go @@ -73,10 +73,11 @@ type recvMsg struct { } // recvBuffer is an unbounded channel of recvMsg structs. -// Note recvBuffer differs from controlBuffer only in that recvBuffer -// holds a channel of only recvMsg structs instead of objects implementing "item" interface. -// recvBuffer is written to much more often than -// controlBuffer and using strict recvMsg structs helps avoid allocation in "recvBuffer.put" +// +// Note: recvBuffer differs from buffer.Unbounded only in the fact that it +// holds a channel of recvMsg structs instead of objects implementing "item" +// interface. recvBuffer is written to much more often and using strict recvMsg +// structs helps avoid allocation in "recvBuffer.put" type recvBuffer struct { c chan recvMsg mu sync.Mutex @@ -233,6 +234,7 @@ const ( type Stream struct { id uint32 st ServerTransport // nil for client side Stream + ct *http2Client // nil for server side Stream ctx context.Context // the associated context of the stream cancel context.CancelFunc // always nil for client side Stream done chan struct{} // closed at the end of stream to unblock writers. On the client side. @@ -251,6 +253,10 @@ type Stream struct { headerChan chan struct{} // closed to indicate the end of header metadata. headerChanClosed uint32 // set when headerChan is closed. Used to avoid closing headerChan multiple times. + // headerValid indicates whether a valid header was received. Only + // meaningful after headerChan is closed (always call waitOnHeader() before + // reading its value). Not valid on server side. + headerValid bool // hdrMu protects header and trailer metadata on the server-side. hdrMu sync.Mutex @@ -303,34 +309,28 @@ func (s *Stream) getState() streamState { return streamState(atomic.LoadUint32((*uint32)(&s.state))) } -func (s *Stream) waitOnHeader() error { +func (s *Stream) waitOnHeader() { if s.headerChan == nil { // On the server headerChan is always nil since a stream originates // only after having received headers. - return nil + return } select { case <-s.ctx.Done(): - // We prefer success over failure when reading messages because we delay - // context error in stream.Read(). To keep behavior consistent, we also - // prefer success here. - select { - case <-s.headerChan: - return nil - default: - } - return ContextErr(s.ctx.Err()) + // Close the stream to prevent headers/trailers from changing after + // this function returns. + s.ct.CloseStream(s, ContextErr(s.ctx.Err())) + // headerChan could possibly not be closed yet if closeStream raced + // with operateHeaders; wait until it is closed explicitly here. + <-s.headerChan case <-s.headerChan: - return nil } } // RecvCompress returns the compression algorithm applied to the inbound // message. It is empty string if there is no compression applied. func (s *Stream) RecvCompress() string { - if err := s.waitOnHeader(); err != nil { - return "" - } + s.waitOnHeader() return s.recvCompress } @@ -351,36 +351,27 @@ func (s *Stream) Done() <-chan struct{} { // available. It blocks until i) the metadata is ready or ii) there is no header // metadata or iii) the stream is canceled/expired. // -// On server side, it returns the out header after t.WriteHeader is called. +// On server side, it returns the out header after t.WriteHeader is called. It +// does not block and must not be called until after WriteHeader. func (s *Stream) Header() (metadata.MD, error) { - if s.headerChan == nil && s.header != nil { + if s.headerChan == nil { // On server side, return the header in stream. It will be the out // header after t.WriteHeader is called. return s.header.Copy(), nil } - err := s.waitOnHeader() - // Even if the stream is closed, header is returned if available. - select { - case <-s.headerChan: - if s.header == nil { - return nil, nil - } - return s.header.Copy(), nil - default: + s.waitOnHeader() + if !s.headerValid { + return nil, s.status.Err() } - return nil, err + return s.header.Copy(), nil } // TrailersOnly blocks until a header or trailers-only frame is received and // then returns true if the stream was trailers-only. If the stream ends -// before headers are received, returns true, nil. If a context error happens -// first, returns it as a status error. Client-side only. -func (s *Stream) TrailersOnly() (bool, error) { - err := s.waitOnHeader() - if err != nil { - return false, err - } - return s.noHeaders, nil +// before headers are received, returns true, nil. Client-side only. +func (s *Stream) TrailersOnly() bool { + s.waitOnHeader() + return s.noHeaders } // Trailer returns the cached trailer metedata. Note that if it is not called @@ -534,6 +525,7 @@ type ServerConfig struct { ReadBufferSize int ChannelzParentID int64 MaxHeaderListSize *uint32 + HeaderTableSize *uint32 } // NewServerTransport creates a ServerTransport with conn or non-nil error diff --git a/vendor/google.golang.org/grpc/internal/transport/transport_test.go b/vendor/google.golang.org/grpc/internal/transport/transport_test.go index a3a34319300..c5ee74848cc 100644 --- a/vendor/google.golang.org/grpc/internal/transport/transport_test.go +++ b/vendor/google.golang.org/grpc/internal/transport/transport_test.go @@ -38,9 +38,7 @@ import ( "golang.org/x/net/http2/hpack" "google.golang.org/grpc/codes" "google.golang.org/grpc/internal/leakcheck" - "google.golang.org/grpc/internal/syscall" "google.golang.org/grpc/internal/testutils" - "google.golang.org/grpc/keepalive" "google.golang.org/grpc/status" ) @@ -403,6 +401,13 @@ func (s *server) stop() { s.mu.Unlock() } +func (s *server) addr() string { + if s.lis == nil { + return "" + } + return s.lis.Addr().String() +} + func setUpServerOnly(t *testing.T, port int, serverConfig *ServerConfig, ht hType) *server { server := &server{startedErr: make(chan error, 1), ready: make(chan struct{})} go server.start(t, port, serverConfig, ht) @@ -429,7 +434,7 @@ func setUpWithOptions(t *testing.T, port int, serverConfig *ServerConfig, ht hTy return server, ct.(*http2Client), cancel } -func setUpWithNoPingServer(t *testing.T, copts ConnectOptions, done chan net.Conn) (*http2Client, func()) { +func setUpWithNoPingServer(t *testing.T, copts ConnectOptions, connCh chan net.Conn) (*http2Client, func()) { lis, err := net.Listen("tcp", "localhost:0") if err != nil { t.Fatalf("Failed to listen: %v", err) @@ -440,10 +445,10 @@ func setUpWithNoPingServer(t *testing.T, copts ConnectOptions, done chan net.Con conn, err := lis.Accept() if err != nil { t.Errorf("Error at server-side while accepting: %v", err) - close(done) + close(connCh) return } - done <- conn + connCh <- conn }() connectCtx, cancel := context.WithDeadline(context.Background(), time.Now().Add(2*time.Second)) tr, err := NewClientTransport(connectCtx, context.Background(), TargetInfo{Addr: lis.Addr().String()}, copts, func() {}, func(GoAwayReason) {}, func() {}) @@ -451,7 +456,7 @@ func setUpWithNoPingServer(t *testing.T, copts ConnectOptions, done chan net.Con cancel() // Do not cancel in success path. // Server clean-up. lis.Close() - if conn, ok := <-done; ok { + if conn, ok := <-connCh; ok { conn.Close() } t.Fatalf("Failed to dial: %v", err) @@ -497,387 +502,6 @@ func TestInflightStreamClosing(t *testing.T) { } } -// TestMaxConnectionIdle tests that a server will send GoAway to a idle client. -// An idle client is one who doesn't make any RPC calls for a duration of -// MaxConnectionIdle time. -func TestMaxConnectionIdle(t *testing.T) { - serverConfig := &ServerConfig{ - KeepaliveParams: keepalive.ServerParameters{ - MaxConnectionIdle: 2 * time.Second, - }, - } - server, client, cancel := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}) - defer cancel() - defer server.stop() - defer client.Close() - stream, err := client.NewStream(context.Background(), &CallHdr{}) - if err != nil { - t.Fatalf("Client failed to create RPC request: %v", err) - } - client.closeStream(stream, io.EOF, true, http2.ErrCodeCancel, nil, nil, false) - // wait for server to see that closed stream and max-age logic to send goaway after no new RPCs are mode - timeout := time.NewTimer(time.Second * 4) - select { - case <-client.GoAway(): - if !timeout.Stop() { - <-timeout.C - } - case <-timeout.C: - t.Fatalf("Test timed out, expected a GoAway from the server.") - } -} - -// TestMaxConenctionIdleNegative tests that a server will not send GoAway to a non-idle(busy) client. -func TestMaxConnectionIdleNegative(t *testing.T) { - serverConfig := &ServerConfig{ - KeepaliveParams: keepalive.ServerParameters{ - MaxConnectionIdle: 2 * time.Second, - }, - } - server, client, cancel := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}) - defer cancel() - defer server.stop() - defer client.Close() - _, err := client.NewStream(context.Background(), &CallHdr{}) - if err != nil { - t.Fatalf("Client failed to create RPC request: %v", err) - } - timeout := time.NewTimer(time.Second * 4) - select { - case <-client.GoAway(): - if !timeout.Stop() { - <-timeout.C - } - t.Fatalf("A non-idle client received a GoAway.") - case <-timeout.C: - } - -} - -// TestMaxConnectionAge tests that a server will send GoAway after a duration of MaxConnectionAge. -func TestMaxConnectionAge(t *testing.T) { - serverConfig := &ServerConfig{ - KeepaliveParams: keepalive.ServerParameters{ - MaxConnectionAge: 2 * time.Second, - }, - } - server, client, cancel := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}) - defer cancel() - defer server.stop() - defer client.Close() - _, err := client.NewStream(context.Background(), &CallHdr{}) - if err != nil { - t.Fatalf("Client failed to create stream: %v", err) - } - // Wait for max-age logic to send GoAway. - timeout := time.NewTimer(4 * time.Second) - select { - case <-client.GoAway(): - if !timeout.Stop() { - <-timeout.C - } - case <-timeout.C: - t.Fatalf("Test timer out, expected a GoAway from the server.") - } -} - -const ( - defaultWriteBufSize = 32 * 1024 - defaultReadBufSize = 32 * 1024 -) - -// TestKeepaliveServer tests that a server closes connection with a client that doesn't respond to keepalive pings. -func TestKeepaliveServer(t *testing.T) { - serverConfig := &ServerConfig{ - KeepaliveParams: keepalive.ServerParameters{ - Time: 2 * time.Second, - Timeout: 1 * time.Second, - }, - } - server, c, cancel := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}) - defer cancel() - defer server.stop() - defer c.Close() - client, err := net.Dial("tcp", server.lis.Addr().String()) - if err != nil { - t.Fatalf("Failed to dial: %v", err) - } - defer client.Close() - - // Set read deadline on client conn so that it doesn't block forever in errorsome cases. - client.SetDeadline(time.Now().Add(10 * time.Second)) - - if n, err := client.Write(clientPreface); err != nil || n != len(clientPreface) { - t.Fatalf("Error writing client preface; n=%v, err=%v", n, err) - } - framer := newFramer(client, defaultWriteBufSize, defaultReadBufSize, 0) - if err := framer.fr.WriteSettings(http2.Setting{}); err != nil { - t.Fatal("Error writing settings frame:", err) - } - framer.writer.Flush() - // Wait for keepalive logic to close the connection. - time.Sleep(4 * time.Second) - b := make([]byte, 24) - for { - _, err = client.Read(b) - if err == nil { - continue - } - if err != io.EOF { - t.Fatalf("client.Read(_) = _,%v, want io.EOF", err) - } - break - } -} - -// TestKeepaliveServerNegative tests that a server doesn't close connection with a client that responds to keepalive pings. -func TestKeepaliveServerNegative(t *testing.T) { - serverConfig := &ServerConfig{ - KeepaliveParams: keepalive.ServerParameters{ - Time: 2 * time.Second, - Timeout: 1 * time.Second, - }, - } - server, client, cancel := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}) - defer cancel() - defer server.stop() - defer client.Close() - // Give keepalive logic some time by sleeping. - time.Sleep(4 * time.Second) - // Assert that client is still active. - client.mu.Lock() - defer client.mu.Unlock() - if client.state != reachable { - t.Fatalf("Test failed: Expected server-client connection to be healthy.") - } -} - -func TestKeepaliveClientClosesIdleTransport(t *testing.T) { - done := make(chan net.Conn, 1) - tr, cancel := setUpWithNoPingServer(t, ConnectOptions{KeepaliveParams: keepalive.ClientParameters{ - Time: 2 * time.Second, // Keepalive time = 2 sec. - Timeout: 1 * time.Second, // Keepalive timeout = 1 sec. - PermitWithoutStream: true, // Run keepalive even with no RPCs. - }}, done) - defer cancel() - defer tr.Close() - conn, ok := <-done - if !ok { - t.Fatalf("Server didn't return connection object") - } - defer conn.Close() - // Sleep for keepalive to close the connection. - time.Sleep(4 * time.Second) - // Assert that the connection was closed. - tr.mu.Lock() - defer tr.mu.Unlock() - if tr.state == reachable { - t.Fatalf("Test Failed: Expected client transport to have closed.") - } -} - -func TestKeepaliveClientStaysHealthyOnIdleTransport(t *testing.T) { - done := make(chan net.Conn, 1) - tr, cancel := setUpWithNoPingServer(t, ConnectOptions{KeepaliveParams: keepalive.ClientParameters{ - Time: 2 * time.Second, // Keepalive time = 2 sec. - Timeout: 1 * time.Second, // Keepalive timeout = 1 sec. - }}, done) - defer cancel() - defer tr.Close() - conn, ok := <-done - if !ok { - t.Fatalf("server didn't reutrn connection object") - } - defer conn.Close() - // Give keepalive some time. - time.Sleep(4 * time.Second) - // Assert that connections is still healthy. - tr.mu.Lock() - defer tr.mu.Unlock() - if tr.state != reachable { - t.Fatalf("Test failed: Expected client transport to be healthy.") - } -} - -func TestKeepaliveClientClosesWithActiveStreams(t *testing.T) { - done := make(chan net.Conn, 1) - tr, cancel := setUpWithNoPingServer(t, ConnectOptions{KeepaliveParams: keepalive.ClientParameters{ - Time: 2 * time.Second, // Keepalive time = 2 sec. - Timeout: 1 * time.Second, // Keepalive timeout = 1 sec. - }}, done) - defer cancel() - defer tr.Close() - conn, ok := <-done - if !ok { - t.Fatalf("Server didn't return connection object") - } - defer conn.Close() - // Create a stream. - _, err := tr.NewStream(context.Background(), &CallHdr{}) - if err != nil { - t.Fatalf("Failed to create a new stream: %v", err) - } - // Give keepalive some time. - time.Sleep(4 * time.Second) - // Assert that transport was closed. - tr.mu.Lock() - defer tr.mu.Unlock() - if tr.state == reachable { - t.Fatalf("Test failed: Expected client transport to have closed.") - } -} - -func TestKeepaliveClientStaysHealthyWithResponsiveServer(t *testing.T) { - s, tr, cancel := setUpWithOptions(t, 0, &ServerConfig{MaxStreams: math.MaxUint32}, normal, ConnectOptions{KeepaliveParams: keepalive.ClientParameters{ - Time: 2 * time.Second, // Keepalive time = 2 sec. - Timeout: 1 * time.Second, // Keepalive timeout = 1 sec. - PermitWithoutStream: true, // Run keepalive even with no RPCs. - }}) - defer cancel() - defer s.stop() - defer tr.Close() - // Give keep alive some time. - time.Sleep(4 * time.Second) - // Assert that transport is healthy. - tr.mu.Lock() - defer tr.mu.Unlock() - if tr.state != reachable { - t.Fatalf("Test failed: Expected client transport to be healthy.") - } -} - -func TestKeepaliveServerEnforcementWithAbusiveClientNoRPC(t *testing.T) { - serverConfig := &ServerConfig{ - KeepalivePolicy: keepalive.EnforcementPolicy{ - MinTime: 2 * time.Second, - }, - } - clientOptions := ConnectOptions{ - KeepaliveParams: keepalive.ClientParameters{ - Time: 50 * time.Millisecond, - Timeout: 1 * time.Second, - PermitWithoutStream: true, - }, - } - server, client, cancel := setUpWithOptions(t, 0, serverConfig, normal, clientOptions) - defer cancel() - defer server.stop() - defer client.Close() - - timeout := time.NewTimer(10 * time.Second) - select { - case <-client.GoAway(): - if !timeout.Stop() { - <-timeout.C - } - case <-timeout.C: - t.Fatalf("Test failed: Expected a GoAway from server.") - } - time.Sleep(500 * time.Millisecond) - client.mu.Lock() - defer client.mu.Unlock() - if client.state == reachable { - t.Fatalf("Test failed: Expected the connection to be closed.") - } -} - -func TestKeepaliveServerEnforcementWithAbusiveClientWithRPC(t *testing.T) { - serverConfig := &ServerConfig{ - KeepalivePolicy: keepalive.EnforcementPolicy{ - MinTime: 2 * time.Second, - }, - } - clientOptions := ConnectOptions{ - KeepaliveParams: keepalive.ClientParameters{ - Time: 50 * time.Millisecond, - Timeout: 1 * time.Second, - }, - } - server, client, cancel := setUpWithOptions(t, 0, serverConfig, suspended, clientOptions) - defer cancel() - defer server.stop() - defer client.Close() - - if _, err := client.NewStream(context.Background(), &CallHdr{}); err != nil { - t.Fatalf("Client failed to create stream.") - } - timeout := time.NewTimer(10 * time.Second) - select { - case <-client.GoAway(): - if !timeout.Stop() { - <-timeout.C - } - case <-timeout.C: - t.Fatalf("Test failed: Expected a GoAway from server.") - } - time.Sleep(500 * time.Millisecond) - client.mu.Lock() - defer client.mu.Unlock() - if client.state == reachable { - t.Fatalf("Test failed: Expected the connection to be closed.") - } -} - -func TestKeepaliveServerEnforcementWithObeyingClientNoRPC(t *testing.T) { - serverConfig := &ServerConfig{ - KeepalivePolicy: keepalive.EnforcementPolicy{ - MinTime: 100 * time.Millisecond, - PermitWithoutStream: true, - }, - } - clientOptions := ConnectOptions{ - KeepaliveParams: keepalive.ClientParameters{ - Time: 101 * time.Millisecond, - Timeout: 1 * time.Second, - PermitWithoutStream: true, - }, - } - server, client, cancel := setUpWithOptions(t, 0, serverConfig, normal, clientOptions) - defer cancel() - defer server.stop() - defer client.Close() - - // Give keepalive enough time. - time.Sleep(3 * time.Second) - // Assert that connection is healthy. - client.mu.Lock() - defer client.mu.Unlock() - if client.state != reachable { - t.Fatalf("Test failed: Expected connection to be healthy.") - } -} - -func TestKeepaliveServerEnforcementWithObeyingClientWithRPC(t *testing.T) { - serverConfig := &ServerConfig{ - KeepalivePolicy: keepalive.EnforcementPolicy{ - MinTime: 100 * time.Millisecond, - }, - } - clientOptions := ConnectOptions{ - KeepaliveParams: keepalive.ClientParameters{ - Time: 101 * time.Millisecond, - Timeout: 1 * time.Second, - }, - } - server, client, cancel := setUpWithOptions(t, 0, serverConfig, suspended, clientOptions) - defer cancel() - defer server.stop() - defer client.Close() - - if _, err := client.NewStream(context.Background(), &CallHdr{}); err != nil { - t.Fatalf("Client failed to create stream.") - } - - // Give keepalive enough time. - time.Sleep(3 * time.Second) - // Assert that connection is healthy. - client.mu.Lock() - defer client.mu.Unlock() - if client.state != reachable { - t.Fatalf("Test failed: Expected connection to be healthy.") - } -} - func TestClientSendAndReceive(t *testing.T) { server, ct, cancel := setUp(t, 0, math.MaxUint32, normal) defer cancel() @@ -2185,61 +1809,3 @@ func TestHeaderTblSize(t *testing.T) { t.Fatalf("expected len(limits) = 2 within 10s, got != 2") } } - -// TestTCPUserTimeout tests that the TCP_USER_TIMEOUT socket option is set to the -// keepalive timeout, as detailed in proposal A18 -func TestTCPUserTimeout(t *testing.T) { - tests := []struct { - time time.Duration - timeout time.Duration - }{ - { - 10 * time.Second, - 10 * time.Second, - }, - { - 0, - 0, - }, - } - for _, tt := range tests { - server, client, cancel := setUpWithOptions( - t, - 0, - &ServerConfig{ - KeepaliveParams: keepalive.ServerParameters{ - Time: tt.timeout, - Timeout: tt.timeout, - }, - }, - normal, - ConnectOptions{ - KeepaliveParams: keepalive.ClientParameters{ - Time: tt.time, - Timeout: tt.timeout, - }, - }, - ) - defer cancel() - defer server.stop() - defer client.Close() - - stream, err := client.NewStream(context.Background(), &CallHdr{}) - if err != nil { - t.Fatalf("Client failed to create RPC request: %v", err) - } - client.closeStream(stream, io.EOF, true, http2.ErrCodeCancel, nil, nil, false) - - opt, err := syscall.GetTCPUserTimeout(client.conn) - if err != nil { - t.Fatalf("GetTCPUserTimeout error: %v", err) - } - if opt < 0 { - t.Skipf("skipping test on unsupported environment") - } - if timeoutMS := int(tt.timeout / time.Millisecond); timeoutMS != opt { - t.Fatalf("wrong TCP_USER_TIMEOUT set on conn. expected %d. got %d", - timeoutMS, opt) - } - } -} diff --git a/vendor/google.golang.org/grpc/interop/grpc_testing/test.pb.go b/vendor/google.golang.org/grpc/interop/grpc_testing/test.pb.go index 051d0089f9c..507ae592875 100644 --- a/vendor/google.golang.org/grpc/interop/grpc_testing/test.pb.go +++ b/vendor/google.golang.org/grpc/interop/grpc_testing/test.pb.go @@ -3,13 +3,14 @@ package grpc_testing -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -21,7 +22,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // The type of payload that should be returned. type PayloadType int32 @@ -40,6 +41,7 @@ var PayloadType_name = map[int32]string{ 1: "UNCOMPRESSABLE", 2: "RANDOM", } + var PayloadType_value = map[string]int32{ "COMPRESSABLE": 0, "UNCOMPRESSABLE": 1, @@ -49,8 +51,46 @@ var PayloadType_value = map[string]int32{ func (x PayloadType) String() string { return proto.EnumName(PayloadType_name, int32(x)) } + func (PayloadType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_test_56dd6f68792c8a57, []int{0} + return fileDescriptor_e1cda82041fed8bf, []int{0} +} + +// 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 dependant. +type GrpclbRouteType int32 + +const ( + // Server didn't detect the route that a client took to reach it. + GrpclbRouteType_GRPCLB_ROUTE_TYPE_UNKNOWN GrpclbRouteType = 0 + // Indicates that a client reached a server via gRPCLB fallback. + GrpclbRouteType_GRPCLB_ROUTE_TYPE_FALLBACK GrpclbRouteType = 1 + // Indicates that a client reached a server as a gRPCLB-given backend. + GrpclbRouteType_GRPCLB_ROUTE_TYPE_BACKEND GrpclbRouteType = 2 +) + +var GrpclbRouteType_name = map[int32]string{ + 0: "GRPCLB_ROUTE_TYPE_UNKNOWN", + 1: "GRPCLB_ROUTE_TYPE_FALLBACK", + 2: "GRPCLB_ROUTE_TYPE_BACKEND", +} + +var GrpclbRouteType_value = map[string]int32{ + "GRPCLB_ROUTE_TYPE_UNKNOWN": 0, + "GRPCLB_ROUTE_TYPE_FALLBACK": 1, + "GRPCLB_ROUTE_TYPE_BACKEND": 2, +} + +func (x GrpclbRouteType) String() string { + return proto.EnumName(GrpclbRouteType_name, int32(x)) +} + +func (GrpclbRouteType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e1cda82041fed8bf, []int{1} } type Empty struct { @@ -63,16 +103,17 @@ func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} func (*Empty) Descriptor() ([]byte, []int) { - return fileDescriptor_test_56dd6f68792c8a57, []int{0} + return fileDescriptor_e1cda82041fed8bf, []int{0} } + func (m *Empty) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Empty.Unmarshal(m, b) } func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Empty.Marshal(b, m, deterministic) } -func (dst *Empty) XXX_Merge(src proto.Message) { - xxx_messageInfo_Empty.Merge(dst, src) +func (m *Empty) XXX_Merge(src proto.Message) { + xxx_messageInfo_Empty.Merge(m, src) } func (m *Empty) XXX_Size() int { return xxx_messageInfo_Empty.Size(m) @@ -98,16 +139,17 @@ func (m *Payload) Reset() { *m = Payload{} } func (m *Payload) String() string { return proto.CompactTextString(m) } func (*Payload) ProtoMessage() {} func (*Payload) Descriptor() ([]byte, []int) { - return fileDescriptor_test_56dd6f68792c8a57, []int{1} + return fileDescriptor_e1cda82041fed8bf, []int{1} } + func (m *Payload) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Payload.Unmarshal(m, b) } func (m *Payload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Payload.Marshal(b, m, deterministic) } -func (dst *Payload) XXX_Merge(src proto.Message) { - xxx_messageInfo_Payload.Merge(dst, src) +func (m *Payload) XXX_Merge(src proto.Message) { + xxx_messageInfo_Payload.Merge(m, src) } func (m *Payload) XXX_Size() int { return xxx_messageInfo_Payload.Size(m) @@ -146,16 +188,17 @@ func (m *EchoStatus) Reset() { *m = EchoStatus{} } func (m *EchoStatus) String() string { return proto.CompactTextString(m) } func (*EchoStatus) ProtoMessage() {} func (*EchoStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_test_56dd6f68792c8a57, []int{2} + return fileDescriptor_e1cda82041fed8bf, []int{2} } + func (m *EchoStatus) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EchoStatus.Unmarshal(m, b) } func (m *EchoStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_EchoStatus.Marshal(b, m, deterministic) } -func (dst *EchoStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_EchoStatus.Merge(dst, src) +func (m *EchoStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_EchoStatus.Merge(m, src) } func (m *EchoStatus) XXX_Size() int { return xxx_messageInfo_EchoStatus.Size(m) @@ -197,7 +240,9 @@ type SimpleRequest struct { // Whether server should return a given status ResponseStatus *EchoStatus `protobuf:"bytes,7,opt,name=response_status,json=responseStatus,proto3" json:"response_status,omitempty"` // Whether SimpleResponse should include server_id. - FillServerId bool `protobuf:"varint,9,opt,name=fill_server_id,json=fillServerId,proto3" json:"fill_server_id,omitempty"` + FillServerId bool `protobuf:"varint,9,opt,name=fill_server_id,json=fillServerId,proto3" json:"fill_server_id,omitempty"` + // Whether SimpleResponse should include grpclb_route_type. + FillGrpclbRouteType bool `protobuf:"varint,10,opt,name=fill_grpclb_route_type,json=fillGrpclbRouteType,proto3" json:"fill_grpclb_route_type,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -207,16 +252,17 @@ func (m *SimpleRequest) Reset() { *m = SimpleRequest{} } func (m *SimpleRequest) String() string { return proto.CompactTextString(m) } func (*SimpleRequest) ProtoMessage() {} func (*SimpleRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_test_56dd6f68792c8a57, []int{3} + return fileDescriptor_e1cda82041fed8bf, []int{3} } + func (m *SimpleRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SimpleRequest.Unmarshal(m, b) } func (m *SimpleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SimpleRequest.Marshal(b, m, deterministic) } -func (dst *SimpleRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SimpleRequest.Merge(dst, src) +func (m *SimpleRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleRequest.Merge(m, src) } func (m *SimpleRequest) XXX_Size() int { return xxx_messageInfo_SimpleRequest.Size(m) @@ -276,6 +322,13 @@ func (m *SimpleRequest) GetFillServerId() bool { return false } +func (m *SimpleRequest) GetFillGrpclbRouteType() bool { + if m != nil { + return m.FillGrpclbRouteType + } + return false +} + // Unary response, as configured by the request. type SimpleResponse struct { // Payload to increase message size. @@ -287,26 +340,29 @@ type SimpleResponse struct { OauthScope string `protobuf:"bytes,3,opt,name=oauth_scope,json=oauthScope,proto3" json:"oauth_scope,omitempty"` // Server ID. This must be unique among different server instances, // but the same across all RPC's made to a particular server instance. - ServerId string `protobuf:"bytes,4,opt,name=server_id,json=serverId,proto3" json:"server_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ServerId string `protobuf:"bytes,4,opt,name=server_id,json=serverId,proto3" json:"server_id,omitempty"` + // gRPCLB Path. + GrpclbRouteType GrpclbRouteType `protobuf:"varint,5,opt,name=grpclb_route_type,json=grpclbRouteType,proto3,enum=grpc.testing.GrpclbRouteType" json:"grpclb_route_type,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SimpleResponse) Reset() { *m = SimpleResponse{} } func (m *SimpleResponse) String() string { return proto.CompactTextString(m) } func (*SimpleResponse) ProtoMessage() {} func (*SimpleResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_test_56dd6f68792c8a57, []int{4} + return fileDescriptor_e1cda82041fed8bf, []int{4} } + func (m *SimpleResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SimpleResponse.Unmarshal(m, b) } func (m *SimpleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SimpleResponse.Marshal(b, m, deterministic) } -func (dst *SimpleResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SimpleResponse.Merge(dst, src) +func (m *SimpleResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleResponse.Merge(m, src) } func (m *SimpleResponse) XXX_Size() int { return xxx_messageInfo_SimpleResponse.Size(m) @@ -345,6 +401,13 @@ func (m *SimpleResponse) GetServerId() string { return "" } +func (m *SimpleResponse) GetGrpclbRouteType() GrpclbRouteType { + if m != nil { + return m.GrpclbRouteType + } + return GrpclbRouteType_GRPCLB_ROUTE_TYPE_UNKNOWN +} + // Client-streaming request. type StreamingInputCallRequest struct { // Optional input payload sent along with the request. @@ -358,16 +421,17 @@ func (m *StreamingInputCallRequest) Reset() { *m = StreamingInputCallReq func (m *StreamingInputCallRequest) String() string { return proto.CompactTextString(m) } func (*StreamingInputCallRequest) ProtoMessage() {} func (*StreamingInputCallRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_test_56dd6f68792c8a57, []int{5} + return fileDescriptor_e1cda82041fed8bf, []int{5} } + func (m *StreamingInputCallRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StreamingInputCallRequest.Unmarshal(m, b) } func (m *StreamingInputCallRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_StreamingInputCallRequest.Marshal(b, m, deterministic) } -func (dst *StreamingInputCallRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamingInputCallRequest.Merge(dst, src) +func (m *StreamingInputCallRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingInputCallRequest.Merge(m, src) } func (m *StreamingInputCallRequest) XXX_Size() int { return xxx_messageInfo_StreamingInputCallRequest.Size(m) @@ -398,16 +462,17 @@ func (m *StreamingInputCallResponse) Reset() { *m = StreamingInputCallRe func (m *StreamingInputCallResponse) String() string { return proto.CompactTextString(m) } func (*StreamingInputCallResponse) ProtoMessage() {} func (*StreamingInputCallResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_test_56dd6f68792c8a57, []int{6} + return fileDescriptor_e1cda82041fed8bf, []int{6} } + func (m *StreamingInputCallResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StreamingInputCallResponse.Unmarshal(m, b) } func (m *StreamingInputCallResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_StreamingInputCallResponse.Marshal(b, m, deterministic) } -func (dst *StreamingInputCallResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamingInputCallResponse.Merge(dst, src) +func (m *StreamingInputCallResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingInputCallResponse.Merge(m, src) } func (m *StreamingInputCallResponse) XXX_Size() int { return xxx_messageInfo_StreamingInputCallResponse.Size(m) @@ -442,16 +507,17 @@ func (m *ResponseParameters) Reset() { *m = ResponseParameters{} } func (m *ResponseParameters) String() string { return proto.CompactTextString(m) } func (*ResponseParameters) ProtoMessage() {} func (*ResponseParameters) Descriptor() ([]byte, []int) { - return fileDescriptor_test_56dd6f68792c8a57, []int{7} + return fileDescriptor_e1cda82041fed8bf, []int{7} } + func (m *ResponseParameters) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResponseParameters.Unmarshal(m, b) } func (m *ResponseParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ResponseParameters.Marshal(b, m, deterministic) } -func (dst *ResponseParameters) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseParameters.Merge(dst, src) +func (m *ResponseParameters) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseParameters.Merge(m, src) } func (m *ResponseParameters) XXX_Size() int { return xxx_messageInfo_ResponseParameters.Size(m) @@ -498,16 +564,17 @@ func (m *StreamingOutputCallRequest) Reset() { *m = StreamingOutputCallR func (m *StreamingOutputCallRequest) String() string { return proto.CompactTextString(m) } func (*StreamingOutputCallRequest) ProtoMessage() {} func (*StreamingOutputCallRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_test_56dd6f68792c8a57, []int{8} + return fileDescriptor_e1cda82041fed8bf, []int{8} } + func (m *StreamingOutputCallRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StreamingOutputCallRequest.Unmarshal(m, b) } func (m *StreamingOutputCallRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_StreamingOutputCallRequest.Marshal(b, m, deterministic) } -func (dst *StreamingOutputCallRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamingOutputCallRequest.Merge(dst, src) +func (m *StreamingOutputCallRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingOutputCallRequest.Merge(m, src) } func (m *StreamingOutputCallRequest) XXX_Size() int { return xxx_messageInfo_StreamingOutputCallRequest.Size(m) @@ -559,16 +626,17 @@ func (m *StreamingOutputCallResponse) Reset() { *m = StreamingOutputCall func (m *StreamingOutputCallResponse) String() string { return proto.CompactTextString(m) } func (*StreamingOutputCallResponse) ProtoMessage() {} func (*StreamingOutputCallResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_test_56dd6f68792c8a57, []int{9} + return fileDescriptor_e1cda82041fed8bf, []int{9} } + func (m *StreamingOutputCallResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StreamingOutputCallResponse.Unmarshal(m, b) } func (m *StreamingOutputCallResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_StreamingOutputCallResponse.Marshal(b, m, deterministic) } -func (dst *StreamingOutputCallResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamingOutputCallResponse.Merge(dst, src) +func (m *StreamingOutputCallResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingOutputCallResponse.Merge(m, src) } func (m *StreamingOutputCallResponse) XXX_Size() int { return xxx_messageInfo_StreamingOutputCallResponse.Size(m) @@ -587,6 +655,8 @@ func (m *StreamingOutputCallResponse) GetPayload() *Payload { } func init() { + proto.RegisterEnum("grpc.testing.PayloadType", PayloadType_name, PayloadType_value) + proto.RegisterEnum("grpc.testing.GrpclbRouteType", GrpclbRouteType_name, GrpclbRouteType_value) proto.RegisterType((*Empty)(nil), "grpc.testing.Empty") proto.RegisterType((*Payload)(nil), "grpc.testing.Payload") proto.RegisterType((*EchoStatus)(nil), "grpc.testing.EchoStatus") @@ -597,7 +667,63 @@ func init() { proto.RegisterType((*ResponseParameters)(nil), "grpc.testing.ResponseParameters") proto.RegisterType((*StreamingOutputCallRequest)(nil), "grpc.testing.StreamingOutputCallRequest") proto.RegisterType((*StreamingOutputCallResponse)(nil), "grpc.testing.StreamingOutputCallResponse") - proto.RegisterEnum("grpc.testing.PayloadType", PayloadType_name, PayloadType_value) +} + +func init() { proto.RegisterFile("grpc_testing/test.proto", fileDescriptor_e1cda82041fed8bf) } + +var fileDescriptor_e1cda82041fed8bf = []byte{ + // 801 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xdd, 0x4e, 0xdb, 0x48, + 0x14, 0xc6, 0xf9, 0x21, 0xe4, 0x24, 0x84, 0x30, 0x59, 0x16, 0x13, 0x96, 0xdd, 0xc8, 0xbb, 0xd2, + 0x7a, 0x91, 0x36, 0xac, 0x82, 0xb6, 0x17, 0x95, 0xda, 0x2a, 0x84, 0x40, 0x23, 0x42, 0x92, 0xda, + 0xb1, 0xaa, 0x5e, 0x59, 0x43, 0x32, 0x18, 0x4b, 0x8e, 0xed, 0xda, 0x63, 0xd4, 0xf0, 0x18, 0x7d, + 0x85, 0x3e, 0x46, 0xdf, 0xa7, 0xcf, 0x51, 0xcd, 0xd8, 0xce, 0x3f, 0x2a, 0x14, 0xb5, 0x57, 0x78, + 0xce, 0xf9, 0xce, 0xcf, 0xf7, 0xcd, 0x39, 0x43, 0x60, 0xd7, 0xf0, 0xdc, 0x81, 0x4e, 0x89, 0x4f, + 0x4d, 0xdb, 0x38, 0x62, 0x7f, 0xab, 0xae, 0xe7, 0x50, 0x07, 0xe5, 0x99, 0xa3, 0x1a, 0x39, 0xa4, + 0x0c, 0xa4, 0x9b, 0x23, 0x97, 0x8e, 0xa5, 0x36, 0x64, 0x7a, 0x78, 0x6c, 0x39, 0x78, 0x88, 0xfe, + 0x85, 0x14, 0x1d, 0xbb, 0x44, 0x14, 0x2a, 0x82, 0x5c, 0xa8, 0xed, 0x55, 0x67, 0x03, 0xaa, 0x11, + 0xa8, 0x3f, 0x76, 0x89, 0xc2, 0x61, 0x08, 0x41, 0xea, 0xca, 0x19, 0x8e, 0xc5, 0x44, 0x45, 0x90, + 0xf3, 0x0a, 0xff, 0x96, 0x9e, 0x03, 0x34, 0x07, 0x37, 0x8e, 0x4a, 0x31, 0x0d, 0x7c, 0x86, 0x18, + 0x38, 0xc3, 0x30, 0x61, 0x5a, 0xe1, 0xdf, 0x48, 0x84, 0xcc, 0x88, 0xf8, 0x3e, 0x36, 0x08, 0x0f, + 0xcc, 0x2a, 0xf1, 0x51, 0xfa, 0x98, 0x84, 0x4d, 0xd5, 0x1c, 0xb9, 0x16, 0x51, 0xc8, 0xfb, 0x80, + 0xf8, 0x14, 0xbd, 0x84, 0x4d, 0x8f, 0xf8, 0xae, 0x63, 0xfb, 0x44, 0x7f, 0x58, 0x67, 0xf9, 0x18, + 0xcf, 0x4e, 0xe8, 0xcf, 0x99, 0x78, 0xdf, 0xbc, 0x0b, 0x2b, 0xa6, 0xa7, 0x20, 0xd5, 0xbc, 0x23, + 0xe8, 0x08, 0x32, 0x6e, 0x98, 0x41, 0x4c, 0x56, 0x04, 0x39, 0x57, 0xdb, 0x59, 0x99, 0x5e, 0x89, + 0x51, 0x2c, 0xeb, 0xb5, 0x69, 0x59, 0x7a, 0xe0, 0x13, 0xcf, 0xc6, 0x23, 0x22, 0xa6, 0x2a, 0x82, + 0xbc, 0xa1, 0xe4, 0x99, 0x51, 0x8b, 0x6c, 0x48, 0x86, 0x22, 0x07, 0x39, 0x38, 0xa0, 0x37, 0xba, + 0x3f, 0x70, 0x5c, 0x22, 0xa6, 0x39, 0xae, 0xc0, 0xec, 0x5d, 0x66, 0x56, 0x99, 0x15, 0xd5, 0x61, + 0x6b, 0xda, 0x24, 0xd7, 0x4d, 0xcc, 0xf0, 0x3e, 0xc4, 0xf9, 0x3e, 0xa6, 0xba, 0x2a, 0x85, 0x09, + 0x81, 0x50, 0xe7, 0xbf, 0x80, 0x27, 0xd5, 0x7d, 0xe2, 0xdd, 0x12, 0x4f, 0x37, 0x87, 0x62, 0x76, + 0xda, 0x92, 0xca, 0x8d, 0xad, 0x21, 0x3a, 0x86, 0x5f, 0x39, 0x8a, 0x65, 0xb5, 0xae, 0x74, 0xcf, + 0x09, 0x68, 0x24, 0x2b, 0x70, 0x74, 0x89, 0x79, 0xcf, 0xb9, 0x53, 0x61, 0x3e, 0x26, 0xa1, 0xf4, + 0x45, 0x80, 0x42, 0x7c, 0x29,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52, 0x85, 0xb3, 0xc0, 0xb2, 0x4e, 0x03, 0xd7, 0x22, 0x1f, 0x7e, 0x18, 0x27, 0x59, 0xe0, + 0xac, 0x0a, 0xaf, 0xb1, 0x75, 0xfd, 0x13, 0x4a, 0xd5, 0x34, 0xf8, 0x45, 0xb3, 0xf9, 0x0d, 0x8e, + 0x88, 0x4d, 0xc9, 0x30, 0x9e, 0xa2, 0x17, 0xb0, 0x3d, 0x67, 0x7f, 0xdc, 0x34, 0x5d, 0xad, 0xf3, + 0x5f, 0x34, 0xc7, 0x5f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xc3, 0xf6, 0xdc, 0x4c, 0xec, 0x08, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -812,6 +938,29 @@ type TestServiceServer interface { HalfDuplexCall(TestService_HalfDuplexCallServer) error } +// UnimplementedTestServiceServer can be embedded to have forward compatible implementations. +type UnimplementedTestServiceServer struct { +} + +func (*UnimplementedTestServiceServer) EmptyCall(ctx context.Context, req *Empty) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method EmptyCall not implemented") +} +func (*UnimplementedTestServiceServer) UnaryCall(ctx context.Context, req *SimpleRequest) (*SimpleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnaryCall not implemented") +} +func (*UnimplementedTestServiceServer) StreamingOutputCall(req *StreamingOutputCallRequest, srv TestService_StreamingOutputCallServer) error { + return status.Errorf(codes.Unimplemented, "method StreamingOutputCall not implemented") +} +func (*UnimplementedTestServiceServer) StreamingInputCall(srv TestService_StreamingInputCallServer) error { + return status.Errorf(codes.Unimplemented, "method StreamingInputCall not implemented") +} +func (*UnimplementedTestServiceServer) FullDuplexCall(srv TestService_FullDuplexCallServer) error { + return status.Errorf(codes.Unimplemented, "method FullDuplexCall not implemented") +} +func (*UnimplementedTestServiceServer) HalfDuplexCall(srv TestService_HalfDuplexCallServer) error { + return status.Errorf(codes.Unimplemented, "method HalfDuplexCall not implemented") +} + func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer) { s.RegisterService(&_TestService_serviceDesc, srv) } @@ -1022,6 +1171,14 @@ type UnimplementedServiceServer interface { UnimplementedCall(context.Context, *Empty) (*Empty, error) } +// UnimplementedUnimplementedServiceServer can be embedded to have forward compatible implementations. +type UnimplementedUnimplementedServiceServer struct { +} + +func (*UnimplementedUnimplementedServiceServer) UnimplementedCall(ctx context.Context, req *Empty) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnimplementedCall not implemented") +} + func RegisterUnimplementedServiceServer(s *grpc.Server, srv UnimplementedServiceServer) { s.RegisterService(&_UnimplementedService_serviceDesc, srv) } @@ -1056,53 +1213,3 @@ var _UnimplementedService_serviceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, Metadata: "grpc_testing/test.proto", } - -func init() { proto.RegisterFile("grpc_testing/test.proto", fileDescriptor_test_56dd6f68792c8a57) } - -var fileDescriptor_test_56dd6f68792c8a57 = []byte{ - // 695 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0xdd, 0x6e, 0xd3, 0x4a, - 0x10, 0x3e, 0x4e, 0x93, 0xa6, 0x99, 0xa4, 0x39, 0x39, 0xdb, 0x53, 0xd5, 0x4d, 0x91, 0x88, 0x0c, - 0x12, 0x06, 0x89, 0x14, 0x05, 0xc1, 0x05, 0x12, 0xa0, 0xd2, 0xa6, 0xa2, 0x52, 0xdb, 0x14, 0xbb, - 0xb9, 0x8e, 0xb6, 0xf1, 0xd4, 0xb5, 0xe4, 0x3f, 0xbc, 0xeb, 0x8a, 0xf4, 0x55, 0xb8, 0xe4, 0x31, - 0x78, 0x16, 0xde, 0x05, 0xed, 0xda, 0x8e, 0x9d, 0x34, 0x15, 0x2d, 0x15, 0x5c, 0xc5, 0x3b, 0xf3, - 0xcd, 0xcc, 0xf7, 0x8d, 0xbf, 0x75, 0x60, 0xc3, 0x8e, 0xc2, 0xf1, 0x88, 0x23, 0xe3, 0x8e, 0x6f, - 0x6f, 0x8b, 0xdf, 0x6e, 0x18, 0x05, 0x3c, 0x20, 0x0d, 0x91, 0xe8, 0xa6, 0x09, 0xad, 0x0a, 0x95, - 0xbe, 0x17, 0xf2, 0x89, 0x76, 0x08, 0xd5, 0x13, 0x3a, 0x71, 0x03, 0x6a, 0x91, 0xe7, 0x50, 0xe6, - 0x93, 0x10, 0x55, 0xa5, 0xa3, 0xe8, 0xcd, 0xde, 0x66, 0xb7, 0x58, 0xd0, 0x4d, 0x41, 0xa7, 0x93, - 0x10, 0x0d, 0x09, 0x23, 0x04, 0xca, 0x67, 0x81, 0x35, 0x51, 0x4b, 0x1d, 0x45, 0x6f, 0x18, 0xf2, - 0x59, 0x7b, 0x03, 0xd0, 0x1f, 0x5f, 0x04, 0x26, 0xa7, 0x3c, 0x66, 0x02, 0x31, 0x0e, 0xac, 0xa4, - 0x61, 0xc5, 0x90, 0xcf, 0x44, 0x85, 0xaa, 0x87, 0x8c, 0x51, 0x1b, 0x65, 0x61, 0xcd, 0xc8, 0x8e, - 0xda, 0x8f, 0x12, 0xac, 0x9a, 0x8e, 0x17, 0xba, 0x68, 0xe0, 0xe7, 0x18, 0x19, 0x27, 0xef, 0x60, - 0x35, 0x42, 0x16, 0x06, 0x3e, 0xc3, 0xd1, 0xed, 0x98, 0x35, 0x32, 0xbc, 0x38, 0x91, 0x47, 0x85, - 0x7a, 0xe6, 0x5c, 0x25, 0x13, 0x2b, 0x39, 0xc8, 0x74, 0xae, 0x90, 0x6c, 0x43, 0x35, 0x4c, 0x3a, - 0xa8, 0x4b, 0x1d, 0x45, 0xaf, 0xf7, 0xd6, 0x17, 0xb6, 0x37, 0x32, 0x94, 0xe8, 0x7a, 0xee, 0xb8, - 0xee, 0x28, 0x66, 0x18, 0xf9, 0xd4, 0x43, 0xb5, 0xdc, 0x51, 0xf4, 0x15, 0xa3, 0x21, 0x82, 0xc3, - 0x34, 0x46, 0x74, 0x68, 0x49, 0x50, 0x40, 0x63, 0x7e, 0x31, 0x62, 0xe3, 0x20, 0x44, 0xb5, 0x22, - 0x71, 0x4d, 0x11, 0x1f, 0x88, 0xb0, 0x29, 0xa2, 0x64, 0x07, 0xfe, 0xcd, 0x49, 0xca, 0xbd, 0xa9, - 0x55, 0xc9, 0x43, 0x9d, 0xe5, 0x91, 0xef, 0xd5, 0x68, 0x4e, 0x05, 0x24, 0x7b, 0x7e, 0x0c, 0xb2, - 0xe9, 0x88, 0x61, 0x74, 0x89, 0xd1, 0xc8, 0xb1, 0xd4, 0x5a, 0x4e, 0xc9, 0x94, 0xc1, 0x03, 0x4b, - 0xfb, 0xaa, 0x40, 0x33, 0xdb, 0x6f, 0x52, 0x5e, 0xd4, 0xae, 0xdc, 0x4a, 0x7b, 0x1b, 0x56, 0xa6, - 0xb2, 0x93, 0xd7, 0x37, 0x3d, 0x93, 0x87, 0x50, 0x2f, 0xaa, 0x5d, 0x92, 0x69, 0x08, 0x72, 0xa5, - 0x5b, 0x50, 0xcb, 0x19, 0x96, 0x93, 0x6a, 0x96, 0xb1, 0x3b, 0x84, 0x4d, 0x93, 0x47, 0x48, 0x3d, - 0xc7, 0xb7, 0x0f, 0xfc, 0x30, 0xe6, 0xbb, 0xd4, 0x75, 0x33, 0x23, 0xdc, 0x95, 0xa7, 0x76, 0x0a, - 0xed, 0x45, 0xdd, 0x52, 0xd9, 0xaf, 0x61, 0x83, 0xda, 0x76, 0x84, 0x36, 0xe5, 0x68, 0x8d, 0xd2, - 0x9a, 0xc4, 0x21, 0x89, 0x55, 0xd7, 0xf3, 0x74, 0xda, 0x5a, 0x58, 0x45, 0x3b, 0x00, 0x92, 0xf5, - 0x38, 0xa1, 0x11, 0xf5, 0x90, 0x63, 0x24, 0x5d, 0x5e, 0x28, 0x95, 0xcf, 0x62, 0x17, 0x8e, 0xcf, - 0x31, 0xba, 0xa4, 0xc2, 0x27, 0xa9, 0xef, 0x20, 0x0b, 0x0d, 0x99,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f9, 0x63, 0x9a, 0x74, 0x45, 0xaa, 0x6a, 0x7e, 0xa4, 0xee, 0xf9, 0x5f, 0x18, 0xd5, 0x1b, - 0xc2, 0xff, 0x43, 0x5f, 0xbe, 0x41, 0x0f, 0x7d, 0x8e, 0x56, 0xe6, 0xa2, 0xb7, 0xf0, 0xdf, 0x4c, - 0xfc, 0x6e, 0x6e, 0x3a, 0x5b, 0x96, 0x7f, 0xf0, 0x2f, 0x7f, 0x06, 0x00, 0x00, 0xff, 0xff, 0xf1, - 0xe0, 0xc2, 0x5f, 0xfb, 0x07, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/interop/grpc_testing/test.proto b/vendor/google.golang.org/grpc/interop/grpc_testing/test.proto index f6fbdf8db5a..5d6e0a17ac1 100644 --- a/vendor/google.golang.org/grpc/interop/grpc_testing/test.proto +++ b/vendor/google.golang.org/grpc/interop/grpc_testing/test.proto @@ -47,6 +47,21 @@ message EchoStatus { string message = 2; } +// 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 dependant. +enum GrpclbRouteType { + // Server didn't detect the route that a client took to reach it. + GRPCLB_ROUTE_TYPE_UNKNOWN = 0; + // Indicates that a client reached a server via gRPCLB fallback. + GRPCLB_ROUTE_TYPE_FALLBACK = 1; + // Indicates that a client reached a server as a gRPCLB-given backend. + GRPCLB_ROUTE_TYPE_BACKEND = 2; +} + // Unary request. message SimpleRequest { // Desired payload type in the response from the server. @@ -71,6 +86,9 @@ message SimpleRequest { // Whether SimpleResponse should include server_id. bool fill_server_id = 9; + + // Whether SimpleResponse should include grpclb_route_type. + bool fill_grpclb_route_type = 10; } // Unary response, as configured by the request. @@ -88,6 +106,9 @@ message SimpleResponse { // Server ID. This must be unique among different server instances, // but the same across all RPC's made to a particular server instance. string server_id = 4; + + // gRPCLB Path. + GrpclbRouteType grpclb_route_type = 5; } // Client-streaming request. diff --git a/vendor/google.golang.org/grpc/interop/grpclb_fallback/client.go b/vendor/google.golang.org/grpc/interop/grpclb_fallback/client.go new file mode 100644 index 00000000000..77aac1a65c4 --- /dev/null +++ b/vendor/google.golang.org/grpc/interop/grpclb_fallback/client.go @@ -0,0 +1,224 @@ +// +build !appengine +// +build go1.11 + +/* + * + * 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. + * + */ + +package main + +import ( + "context" + "flag" + "log" + "net" + "os" + "os/exec" + "syscall" + "time" + + "golang.org/x/sys/unix" + "google.golang.org/grpc" + _ "google.golang.org/grpc/balancer/grpclb" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/alts" + "google.golang.org/grpc/credentials/google" + testpb "google.golang.org/grpc/interop/grpc_testing" +) + +var ( + customCredentialsType = flag.String("custom_credentials_type", "", "Client creds to use") + serverURI = flag.String("server_uri", "dns:///staging-grpc-directpath-fallback-test.googleapis.com:443", "The server host name") + unrouteLBAndBackendAddrsCmd = flag.String("unroute_lb_and_backend_addrs_cmd", "", "Command to make LB and backend address unroutable") + blackholeLBAndBackendAddrsCmd = flag.String("blackhole_lb_and_backend_addrs_cmd", "", "Command to make LB and backend addresses blackholed") + testCase = flag.String("test_case", "", + `Configure different test cases. Valid options are: + fast_fallback_before_startup : LB/backend connections fail fast before RPC's have been made; + fast_fallback_after_startup : LB/backend connections fail fast after RPC's have been made; + slow_fallback_before_startup : LB/backend connections black hole before RPC's have been made; + slow_fallback_after_startup : LB/backend connections black hole after RPC's have been made;`) + infoLog = log.New(os.Stderr, "INFO: ", log.Ldate|log.Ltime|log.Lshortfile) + errorLog = log.New(os.Stderr, "ERROR: ", log.Ldate|log.Ltime|log.Lshortfile) +) + +func doRPCAndGetPath(client testpb.TestServiceClient, timeout time.Duration) testpb.GrpclbRouteType { + infoLog.Printf("doRPCAndGetPath timeout:%v\n", timeout) + ctx, cancel := context.WithTimeout(context.Background(), timeout) + defer cancel() + req := &testpb.SimpleRequest{ + FillGrpclbRouteType: true, + } + reply, err := client.UnaryCall(ctx, req) + if err != nil { + infoLog.Printf("doRPCAndGetPath error:%v\n", err) + return testpb.GrpclbRouteType_GRPCLB_ROUTE_TYPE_UNKNOWN + } + g := reply.GetGrpclbRouteType() + infoLog.Printf("doRPCAndGetPath got grpclb route type: %v\n", g) + if g != testpb.GrpclbRouteType_GRPCLB_ROUTE_TYPE_FALLBACK && g != testpb.GrpclbRouteType_GRPCLB_ROUTE_TYPE_BACKEND { + errorLog.Fatalf("Expected grpclb route type to be either backend or fallback; got: %d", g) + } + return g +} + +func dialTCPUserTimeout(ctx context.Context, addr string) (net.Conn, error) { + control := func(network, address string, c syscall.RawConn) error { + var syscallErr error + controlErr := c.Control(func(fd uintptr) { + syscallErr = syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, unix.TCP_USER_TIMEOUT, 20000) + }) + if syscallErr != nil { + errorLog.Fatalf("syscall error setting sockopt TCP_USER_TIMEOUT: %v", syscallErr) + } + if controlErr != nil { + errorLog.Fatalf("control error setting sockopt TCP_USER_TIMEOUT: %v", syscallErr) + } + return nil + } + d := &net.Dialer{ + Control: control, + } + return d.DialContext(ctx, "tcp", addr) +} + +func createTestConn() *grpc.ClientConn { + opts := []grpc.DialOption{ + grpc.WithContextDialer(dialTCPUserTimeout), + grpc.WithBlock(), + } + switch *customCredentialsType { + case "tls": + creds := credentials.NewClientTLSFromCert(nil, "") + opts = append(opts, grpc.WithTransportCredentials(creds)) + case "alts": + creds := alts.NewClientCreds(alts.DefaultClientOptions()) + opts = append(opts, grpc.WithTransportCredentials(creds)) + case "google_default_credentials": + opts = append(opts, grpc.WithCredentialsBundle(google.NewDefaultCredentials())) + case "compute_engine_channel_creds": + opts = append(opts, grpc.WithCredentialsBundle(google.NewComputeEngineCredentials())) + default: + errorLog.Fatalf("Invalid --custom_credentials_type:%v", *customCredentialsType) + } + conn, err := grpc.Dial(*serverURI, opts...) + if err != nil { + errorLog.Fatalf("Fail to dial: %v", err) + } + return conn +} + +func runCmd(command string) { + infoLog.Printf("Running cmd:|%v|\n", command) + if err := exec.Command("bash", "-c", command).Run(); err != nil { + errorLog.Fatalf("error running cmd:|%v| : %v", command, err) + } +} + +func waitForFallbackAndDoRPCs(client testpb.TestServiceClient, fallbackDeadline time.Time) { + fallbackRetryCount := 0 + fellBack := false + for time.Now().Before(fallbackDeadline) { + g := doRPCAndGetPath(client, 1*time.Second) + if g == testpb.GrpclbRouteType_GRPCLB_ROUTE_TYPE_FALLBACK { + infoLog.Println("Made one successul RPC to a fallback. Now expect the same for the rest.") + fellBack = true + break + } else if g == testpb.GrpclbRouteType_GRPCLB_ROUTE_TYPE_BACKEND { + errorLog.Fatalf("Got RPC type backend. This suggests an error in test implementation") + } else { + infoLog.Println("Retryable RPC failure on iteration:", fallbackRetryCount) + } + fallbackRetryCount++ + } + if !fellBack { + infoLog.Fatalf("Didn't fall back before deadline: %v\n", fallbackDeadline) + } + for i := 0; i < 30; i++ { + if g := doRPCAndGetPath(client, 20*time.Second); g != testpb.GrpclbRouteType_GRPCLB_ROUTE_TYPE_FALLBACK { + errorLog.Fatalf("Expected RPC to take grpclb route type FALLBACK. Got: %v", g) + } + time.Sleep(time.Second) + } +} + +func doFastFallbackBeforeStartup() { + runCmd(*unrouteLBAndBackendAddrsCmd) + fallbackDeadline := time.Now().Add(5 * time.Second) + conn := createTestConn() + defer conn.Close() + client := testpb.NewTestServiceClient(conn) + waitForFallbackAndDoRPCs(client, fallbackDeadline) +} + +func doSlowFallbackBeforeStartup() { + runCmd(*blackholeLBAndBackendAddrsCmd) + fallbackDeadline := time.Now().Add(20 * time.Second) + conn := createTestConn() + defer conn.Close() + client := testpb.NewTestServiceClient(conn) + waitForFallbackAndDoRPCs(client, fallbackDeadline) +} + +func doFastFallbackAfterStartup() { + conn := createTestConn() + defer conn.Close() + client := testpb.NewTestServiceClient(conn) + if g := doRPCAndGetPath(client, 20*time.Second); g != testpb.GrpclbRouteType_GRPCLB_ROUTE_TYPE_BACKEND { + errorLog.Fatalf("Expected RPC to take grpclb route type BACKEND. Got: %v", g) + } + runCmd(*unrouteLBAndBackendAddrsCmd) + fallbackDeadline := time.Now().Add(40 * time.Second) + waitForFallbackAndDoRPCs(client, fallbackDeadline) +} + +func doSlowFallbackAfterStartup() { + conn := createTestConn() + defer conn.Close() + client := testpb.NewTestServiceClient(conn) + if g := doRPCAndGetPath(client, 20*time.Second); g != testpb.GrpclbRouteType_GRPCLB_ROUTE_TYPE_BACKEND { + errorLog.Fatalf("Expected RPC to take grpclb route type BACKEND. Got: %v", g) + } + runCmd(*blackholeLBAndBackendAddrsCmd) + fallbackDeadline := time.Now().Add(40 * time.Second) + waitForFallbackAndDoRPCs(client, fallbackDeadline) +} + +func main() { + flag.Parse() + if len(*unrouteLBAndBackendAddrsCmd) == 0 { + errorLog.Fatalf("--unroute_lb_and_backend_addrs_cmd unset") + } + if len(*blackholeLBAndBackendAddrsCmd) == 0 { + errorLog.Fatalf("--blackhole_lb_and_backend_addrs_cmd unset") + } + switch *testCase { + case "fast_fallback_before_startup": + doFastFallbackBeforeStartup() + log.Printf("FastFallbackBeforeStartup done!\n") + case "fast_fallback_after_startup": + doFastFallbackAfterStartup() + log.Printf("FastFallbackAfterStartup done!\n") + case "slow_fallback_before_startup": + doSlowFallbackBeforeStartup() + log.Printf("SlowFallbackBeforeStartup done!\n") + case "slow_fallback_after_startup": + doSlowFallbackAfterStartup() + log.Printf("SlowFallbackAfterStartup done!\n") + default: + errorLog.Fatalf("Unsupported test case: %v", *testCase) + } +} diff --git a/vendor/google.golang.org/grpc/interop/http2/negative_http2_client.go b/vendor/google.golang.org/grpc/interop/http2/negative_http2_client.go index 2d7da138f34..44a5d0de3b3 100644 --- a/vendor/google.golang.org/grpc/interop/http2/negative_http2_client.go +++ b/vendor/google.golang.org/grpc/interop/http2/negative_http2_client.go @@ -40,7 +40,7 @@ import ( ) var ( - serverHost = flag.String("server_host", "127.0.0.1", "The server host name") + serverHost = flag.String("server_host", "localhost", "The server host name") serverPort = flag.Int("server_port", 8080, "The server port number") testCase = flag.String("test_case", "goaway", `Configure different test cases. Valid options are: diff --git a/vendor/google.golang.org/grpc/interop/interop_test.sh b/vendor/google.golang.org/grpc/interop/interop_test.sh new file mode 100755 index 00000000000..15bf9cc0f95 --- /dev/null +++ b/vendor/google.golang.org/grpc/interop/interop_test.sh @@ -0,0 +1,102 @@ +#!/bin/bash +# +# 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. +# + +set -e +x + +export TMPDIR=$(mktemp -d) +trap "rm -rf ${TMPDIR}" EXIT + +clean () { + for i in {1..10}; do + jobs -p | xargs -n1 pkill -P + # A simple "wait" just hangs sometimes. Running `jobs` seems to help. + sleep 1 + if jobs | read; then + return + fi + done + echo "$(tput setaf 1) clean failed to kill tests $(tput sgr 0)" + jobs + pstree + exit 1 +} + +fail () { + echo "$(tput setaf 1) $1 $(tput sgr 0)" + clean + exit 1 +} + +pass () { + echo "$(tput setaf 2) $1 $(tput sgr 0)" +} + +# Don't run some tests that need a special environment: +# "google_default_credentials" +# "compute_engine_channel_credentials" +# "compute_engine_creds" +# "service_account_creds" +# "jwt_token_creds" +# "oauth2_auth_token" +# "per_rpc_creds" +# "pick_first_unary" + +CASES=( + "empty_unary" + "large_unary" + "client_streaming" + "server_streaming" + "ping_pong" + "empty_stream" + "timeout_on_sleeping_server" + "cancel_after_begin" + "cancel_after_first_response" + "status_code_and_message" + "special_status_message" + "custom_metadata" + "unimplemented_method" + "unimplemented_service" +) + +# Build server +if ! go build -o /dev/null ./interop/server; then + fail "failed to build server" +else + pass "successfully built server" +fi + +# Start server +SERVER_LOG="$(mktemp)" +go run ./interop/server --use_tls &> $SERVER_LOG & + +for case in ${CASES[@]}; do + echo "$(tput setaf 4) testing: ${case} $(tput sgr 0)" + + CLIENT_LOG="$(mktemp)" + if ! timeout 20 go run ./interop/client --use_tls --server_host_override=foo.test.google.fr --use_test_ca --test_case="${case}" &> $CLIENT_LOG; then + fail "FAIL: test case ${case} + got server log: + $(cat $SERVER_LOG) + got client log: + $(cat $CLIENT_LOG) + " + else + pass "PASS: test case ${case}" + fi +done + +clean diff --git a/vendor/google.golang.org/grpc/picker_wrapper.go b/vendor/google.golang.org/grpc/picker_wrapper.go index 45baa2ae13d..00447894f07 100644 --- a/vendor/google.golang.org/grpc/picker_wrapper.go +++ b/vendor/google.golang.org/grpc/picker_wrapper.go @@ -20,6 +20,7 @@ package grpc import ( "context" + "fmt" "io" "sync" @@ -31,49 +32,78 @@ import ( "google.golang.org/grpc/status" ) +// v2PickerWrapper wraps a balancer.Picker while providing the +// balancer.V2Picker API. It requires a pickerWrapper to generate errors +// including the latest connectionError. To be deleted when balancer.Picker is +// updated to the balancer.V2Picker API. +type v2PickerWrapper struct { + picker balancer.Picker + connErr *connErr +} + +func (v *v2PickerWrapper) Pick(info balancer.PickInfo) (balancer.PickResult, error) { + sc, done, err := v.picker.Pick(info.Ctx, info) + if err != nil { + if err == balancer.ErrTransientFailure { + return balancer.PickResult{}, balancer.TransientFailureError(fmt.Errorf("%v, latest connection error: %v", err, v.connErr.connectionError())) + } + return balancer.PickResult{}, err + } + return balancer.PickResult{SubConn: sc, Done: done}, nil +} + // pickerWrapper is a wrapper of balancer.Picker. It blocks on certain pick // actions and unblock when there's a picker update. type pickerWrapper struct { mu sync.Mutex done bool blockingCh chan struct{} - picker balancer.Picker + picker balancer.V2Picker - // The latest connection happened. - connErrMu sync.Mutex - connErr error + // The latest connection error. TODO: remove when V1 picker is deprecated; + // balancer should be responsible for providing the error. + *connErr } -func newPickerWrapper() *pickerWrapper { - bp := &pickerWrapper{blockingCh: make(chan struct{})} - return bp +type connErr struct { + mu sync.Mutex + err error } -func (bp *pickerWrapper) updateConnectionError(err error) { - bp.connErrMu.Lock() - bp.connErr = err - bp.connErrMu.Unlock() +func (c *connErr) updateConnectionError(err error) { + c.mu.Lock() + c.err = err + c.mu.Unlock() } -func (bp *pickerWrapper) connectionError() error { - bp.connErrMu.Lock() - err := bp.connErr - bp.connErrMu.Unlock() +func (c *connErr) connectionError() error { + c.mu.Lock() + err := c.err + c.mu.Unlock() return err } +func newPickerWrapper() *pickerWrapper { + return &pickerWrapper{blockingCh: make(chan struct{}), connErr: &connErr{}} +} + // updatePicker is called by UpdateBalancerState. It unblocks all blocked pick. -func (bp *pickerWrapper) updatePicker(p balancer.Picker) { - bp.mu.Lock() - if bp.done { - bp.mu.Unlock() +func (pw *pickerWrapper) updatePicker(p balancer.Picker) { + pw.updatePickerV2(&v2PickerWrapper{picker: p, connErr: pw.connErr}) +} + +// updatePicker is called by UpdateBalancerState. It unblocks all blocked pick. +func (pw *pickerWrapper) updatePickerV2(p balancer.V2Picker) { + pw.mu.Lock() + if pw.done { + pw.mu.Unlock() return } - bp.picker = p - // bp.blockingCh should never be nil. - close(bp.blockingCh) - bp.blockingCh = make(chan struct{}) - bp.mu.Unlock() + pw.picker = p + // pw.blockingCh should never be nil. + close(pw.blockingCh) + pw.blockingCh = make(chan struct{}) + pw.mu.Unlock() } func doneChannelzWrapper(acw *acBalancerWrapper, done func(balancer.DoneInfo)) func(balancer.DoneInfo) { @@ -100,83 +130,85 @@ func doneChannelzWrapper(acw *acBalancerWrapper, done func(balancer.DoneInfo)) f // - the current picker returns other errors and failfast is false. // - the subConn returned by the current picker is not READY // When one of these situations happens, pick blocks until the picker gets updated. -func (bp *pickerWrapper) pick(ctx context.Context, failfast bool, opts balancer.PickOptions) (transport.ClientTransport, func(balancer.DoneInfo), error) { +func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer.PickInfo) (transport.ClientTransport, func(balancer.DoneInfo), error) { var ch chan struct{} + var lastPickErr error for { - bp.mu.Lock() - if bp.done { - bp.mu.Unlock() + pw.mu.Lock() + if pw.done { + pw.mu.Unlock() return nil, nil, ErrClientConnClosing } - if bp.picker == nil { - ch = bp.blockingCh + if pw.picker == nil { + ch = pw.blockingCh } - if ch == bp.blockingCh { + if ch == pw.blockingCh { // This could happen when either: - // - bp.picker is nil (the previous if condition), or + // - pw.picker is nil (the previous if condition), or // - has called pick on the current picker. - bp.mu.Unlock() + pw.mu.Unlock() select { case <-ctx.Done(): - if connectionErr := bp.connectionError(); connectionErr != nil { - switch ctx.Err() { - case context.DeadlineExceeded: - return nil, nil, status.Errorf(codes.DeadlineExceeded, "latest connection error: %v", connectionErr) - case context.Canceled: - return nil, nil, status.Errorf(codes.Canceled, "latest connection error: %v", connectionErr) - } + var errStr string + if lastPickErr != nil { + errStr = "latest balancer error: " + lastPickErr.Error() + } else if connectionErr := pw.connectionError(); connectionErr != nil { + errStr = "latest connection error: " + connectionErr.Error() + } else { + errStr = ctx.Err().Error() + } + switch ctx.Err() { + case context.DeadlineExceeded: + return nil, nil, status.Error(codes.DeadlineExceeded, errStr) + case context.Canceled: + return nil, nil, status.Error(codes.Canceled, errStr) } - return nil, nil, ctx.Err() case <-ch: } continue } - ch = bp.blockingCh - p := bp.picker - bp.mu.Unlock() + ch = pw.blockingCh + p := pw.picker + pw.mu.Unlock() - subConn, done, err := p.Pick(ctx, opts) + pickResult, err := p.Pick(info) if err != nil { - switch err { - case balancer.ErrNoSubConnAvailable: + if err == balancer.ErrNoSubConnAvailable { continue - case balancer.ErrTransientFailure: + } + if tfe, ok := err.(interface{ IsTransientFailure() bool }); ok && tfe.IsTransientFailure() { if !failfast { + lastPickErr = err continue } - return nil, nil, status.Errorf(codes.Unavailable, "%v, latest connection error: %v", err, bp.connectionError()) - case context.DeadlineExceeded: - return nil, nil, status.Error(codes.DeadlineExceeded, err.Error()) - case context.Canceled: - return nil, nil, status.Error(codes.Canceled, err.Error()) - default: - if _, ok := status.FromError(err); ok { - return nil, nil, err - } - // err is some other error. - return nil, nil, status.Error(codes.Unknown, err.Error()) + return nil, nil, status.Error(codes.Unavailable, err.Error()) } + if _, ok := status.FromError(err); ok { + return nil, nil, err + } + // err is some other error. + return nil, nil, status.Error(codes.Unknown, err.Error()) } - acw, ok := subConn.(*acBalancerWrapper) + acw, ok := pickResult.SubConn.(*acBalancerWrapper) if !ok { grpclog.Error("subconn returned from pick is not *acBalancerWrapper") continue } if t, ok := acw.getAddrConn().getReadyTransport(); ok { if channelz.IsOn() { - return t, doneChannelzWrapper(acw, done), nil + return t, doneChannelzWrapper(acw, pickResult.Done), nil } - return t, done, nil + return t, pickResult.Done, nil } - if done != nil { + if pickResult.Done != nil { // Calling done with nil error, no bytes sent and no bytes received. // DoneInfo with default value works. - done(balancer.DoneInfo{}) + pickResult.Done(balancer.DoneInfo{}) } grpclog.Infof("blockingPicker: the picked transport is not ready, loop back to repick") // If ok == false, ac.state is not READY. @@ -186,12 +218,12 @@ func (bp *pickerWrapper) pick(ctx context.Context, failfast bool, opts balancer. } } -func (bp *pickerWrapper) close() { - bp.mu.Lock() - defer bp.mu.Unlock() - if bp.done { +func (pw *pickerWrapper) close() { + pw.mu.Lock() + defer pw.mu.Unlock() + if pw.done { return } - bp.done = true - close(bp.blockingCh) + pw.done = true + close(pw.blockingCh) } diff --git a/vendor/google.golang.org/grpc/picker_wrapper_test.go b/vendor/google.golang.org/grpc/picker_wrapper_test.go index d6e8c36361b..50916a2dfde 100644 --- a/vendor/google.golang.org/grpc/picker_wrapper_test.go +++ b/vendor/google.golang.org/grpc/picker_wrapper_test.go @@ -26,9 +26,10 @@ import ( "time" "google.golang.org/grpc/balancer" + "google.golang.org/grpc/codes" "google.golang.org/grpc/connectivity" - _ "google.golang.org/grpc/grpclog/glogger" "google.golang.org/grpc/internal/transport" + "google.golang.org/grpc/status" ) const goroutineCount = 5 @@ -54,7 +55,7 @@ type testingPicker struct { maxCalled int64 } -func (p *testingPicker) Pick(ctx context.Context, opts balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error) { +func (p *testingPicker) Pick(ctx context.Context, info balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error) { if atomic.AddInt64(&p.maxCalled, -1) < 0 { return nil, nil, fmt.Errorf("pick called to many times (> goroutineCount)") } @@ -68,7 +69,7 @@ func (s) TestBlockingPickTimeout(t *testing.T) { bp := newPickerWrapper() ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond) defer cancel() - if _, _, err := bp.pick(ctx, true, balancer.PickOptions{}); err != context.DeadlineExceeded { + if _, _, err := bp.pick(ctx, true, balancer.PickInfo{}); status.Code(err) != codes.DeadlineExceeded { t.Errorf("bp.pick returned error %v, want DeadlineExceeded", err) } } @@ -79,7 +80,7 @@ func (s) TestBlockingPick(t *testing.T) { var finishedCount uint64 for i := goroutineCount; i > 0; i-- { go func() { - if tr, _, err := bp.pick(context.Background(), true, balancer.PickOptions{}); err != nil || tr != testT { + if tr, _, err := bp.pick(context.Background(), true, balancer.PickInfo{}); err != nil || tr != testT { t.Errorf("bp.pick returned non-nil error: %v", err) } atomic.AddUint64(&finishedCount, 1) @@ -99,7 +100,7 @@ func (s) TestBlockingPickNoSubAvailable(t *testing.T) { // All goroutines should block because picker returns no sc available. for i := goroutineCount; i > 0; i-- { go func() { - if tr, _, err := bp.pick(context.Background(), true, balancer.PickOptions{}); err != nil || tr != testT { + if tr, _, err := bp.pick(context.Background(), true, balancer.PickInfo{}); err != nil || tr != testT { t.Errorf("bp.pick returned non-nil error: %v", err) } atomic.AddUint64(&finishedCount, 1) @@ -120,7 +121,7 @@ func (s) TestBlockingPickTransientWaitforready(t *testing.T) { // picks are not failfast. for i := goroutineCount; i > 0; i-- { go func() { - if tr, _, err := bp.pick(context.Background(), false, balancer.PickOptions{}); err != nil || tr != testT { + if tr, _, err := bp.pick(context.Background(), false, balancer.PickInfo{}); err != nil || tr != testT { t.Errorf("bp.pick returned non-nil error: %v", err) } atomic.AddUint64(&finishedCount, 1) @@ -140,7 +141,7 @@ func (s) TestBlockingPickSCNotReady(t *testing.T) { // All goroutines should block because sc is not ready. for i := goroutineCount; i > 0; i-- { go func() { - if tr, _, err := bp.pick(context.Background(), true, balancer.PickOptions{}); err != nil || tr != testT { + if tr, _, err := bp.pick(context.Background(), true, balancer.PickInfo{}); err != nil || tr != testT { t.Errorf("bp.pick returned non-nil error: %v", err) } atomic.AddUint64(&finishedCount, 1) diff --git a/vendor/google.golang.org/grpc/pickfirst.go b/vendor/google.golang.org/grpc/pickfirst.go index ed05b02ed96..c43dac9ad84 100644 --- a/vendor/google.golang.org/grpc/pickfirst.go +++ b/vendor/google.golang.org/grpc/pickfirst.go @@ -19,12 +19,14 @@ package grpc import ( - "context" + "errors" "google.golang.org/grpc/balancer" + "google.golang.org/grpc/codes" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/resolver" + "google.golang.org/grpc/status" ) // PickFirstBalancerName is the name of the pick_first balancer. @@ -45,35 +47,67 @@ func (*pickfirstBuilder) Name() string { } type pickfirstBalancer struct { - cc balancer.ClientConn - sc balancer.SubConn + state connectivity.State + cc balancer.ClientConn + sc balancer.SubConn } +var _ balancer.V2Balancer = &pickfirstBalancer{} // Assert we implement v2 + func (b *pickfirstBalancer) HandleResolvedAddrs(addrs []resolver.Address, err error) { if err != nil { - if grpclog.V(2) { - grpclog.Infof("pickfirstBalancer: HandleResolvedAddrs called with error %v", err) - } + b.ResolverError(err) return } + b.UpdateClientConnState(balancer.ClientConnState{ResolverState: resolver.State{Addresses: addrs}}) // Ignore error +} + +func (b *pickfirstBalancer) HandleSubConnStateChange(sc balancer.SubConn, s connectivity.State) { + b.UpdateSubConnState(sc, balancer.SubConnState{ConnectivityState: s}) +} + +func (b *pickfirstBalancer) ResolverError(err error) { + switch b.state { + case connectivity.TransientFailure, connectivity.Idle, connectivity.Connecting: + // Set a failing picker if we don't have a good picker. + b.cc.UpdateState(balancer.State{ConnectivityState: connectivity.TransientFailure, + Picker: &picker{err: status.Errorf(codes.Unavailable, "name resolver error: %v", err)}}, + ) + } + if grpclog.V(2) { + grpclog.Infof("pickfirstBalancer: ResolverError called with error %v", err) + } +} + +func (b *pickfirstBalancer) UpdateClientConnState(cs balancer.ClientConnState) error { + if len(cs.ResolverState.Addresses) == 0 { + b.ResolverError(errors.New("produced zero addresses")) + return balancer.ErrBadResolverState + } if b.sc == nil { - b.sc, err = b.cc.NewSubConn(addrs, balancer.NewSubConnOptions{}) + var err error + b.sc, err = b.cc.NewSubConn(cs.ResolverState.Addresses, balancer.NewSubConnOptions{}) if err != nil { - //TODO(yuxuanli): why not change the cc state to Idle? if grpclog.V(2) { grpclog.Errorf("pickfirstBalancer: failed to NewSubConn: %v", err) } - return + b.state = connectivity.TransientFailure + b.cc.UpdateState(balancer.State{ConnectivityState: connectivity.TransientFailure, + Picker: &picker{err: status.Errorf(codes.Unavailable, "error creating connection: %v", err)}}, + ) + return balancer.ErrBadResolverState } - b.cc.UpdateBalancerState(connectivity.Idle, &picker{sc: b.sc}) + b.state = connectivity.Idle + b.cc.UpdateState(balancer.State{ConnectivityState: connectivity.Idle, Picker: &picker{result: balancer.PickResult{SubConn: b.sc}}}) b.sc.Connect() } else { - b.sc.UpdateAddresses(addrs) + b.sc.UpdateAddresses(cs.ResolverState.Addresses) b.sc.Connect() } + return nil } -func (b *pickfirstBalancer) HandleSubConnStateChange(sc balancer.SubConn, s connectivity.State) { +func (b *pickfirstBalancer) UpdateSubConnState(sc balancer.SubConn, s balancer.SubConnState) { if grpclog.V(2) { grpclog.Infof("pickfirstBalancer: HandleSubConnStateChange: %p, %v", sc, s) } @@ -83,18 +117,28 @@ func (b *pickfirstBalancer) HandleSubConnStateChange(sc balancer.SubConn, s conn } return } - if s == connectivity.Shutdown { + b.state = s.ConnectivityState + if s.ConnectivityState == connectivity.Shutdown { b.sc = nil return } - switch s { + switch s.ConnectivityState { case connectivity.Ready, connectivity.Idle: - b.cc.UpdateBalancerState(s, &picker{sc: sc}) + b.cc.UpdateState(balancer.State{ConnectivityState: s.ConnectivityState, Picker: &picker{result: balancer.PickResult{SubConn: sc}}}) case connectivity.Connecting: - b.cc.UpdateBalancerState(s, &picker{err: balancer.ErrNoSubConnAvailable}) + b.cc.UpdateState(balancer.State{ConnectivityState: s.ConnectivityState, Picker: &picker{err: balancer.ErrNoSubConnAvailable}}) case connectivity.TransientFailure: - b.cc.UpdateBalancerState(s, &picker{err: balancer.ErrTransientFailure}) + err := balancer.ErrTransientFailure + // TODO: this can be unconditional after the V1 API is removed, as + // SubConnState will always contain a connection error. + if s.ConnectionError != nil { + err = balancer.TransientFailureError(s.ConnectionError) + } + b.cc.UpdateState(balancer.State{ + ConnectivityState: s.ConnectivityState, + Picker: &picker{err: err}, + }) } } @@ -102,15 +146,12 @@ func (b *pickfirstBalancer) Close() { } type picker struct { - err error - sc balancer.SubConn + result balancer.PickResult + err error } -func (p *picker) Pick(ctx context.Context, opts balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error) { - if p.err != nil { - return nil, nil, p.err - } - return p.sc, nil, nil +func (p *picker) Pick(info balancer.PickInfo) (balancer.PickResult, error) { + return p.result, p.err } func init() { diff --git a/vendor/google.golang.org/grpc/proxy_test.go b/vendor/google.golang.org/grpc/proxy_test.go index 42b668bd08c..c9604be6235 100644 --- a/vendor/google.golang.org/grpc/proxy_test.go +++ b/vendor/google.golang.org/grpc/proxy_test.go @@ -119,16 +119,16 @@ func testHTTPConnect(t *testing.T, proxyURLModify func(*url.URL) *url.URL, proxy msg := []byte{4, 3, 5, 2} recvBuf := make([]byte, len(msg)) - done := make(chan struct{}) + done := make(chan error) go func() { in, err := blis.Accept() if err != nil { - t.Errorf("failed to accept: %v", err) + done <- err return } defer in.Close() in.Read(recvBuf) - close(done) + done <- nil }() // Overwrite the function in the test and restore them in defer. @@ -154,7 +154,9 @@ func testHTTPConnect(t *testing.T, proxyURLModify func(*url.URL) *url.URL, proxy // Send msg on the connection. c.Write(msg) - <-done + if err := <-done; err != nil { + t.Fatalf("failed to accept: %v", err) + } // Check received msg. if string(recvBuf) != string(msg) { diff --git a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go index ae5aa7dbe57..0a12ad2232b 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go @@ -3,13 +3,14 @@ package grpc_reflection_v1alpha -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -21,7 +22,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // The message sent by the client when calling ServerReflectionInfo method. type ServerReflectionRequest struct { @@ -46,16 +47,17 @@ func (m *ServerReflectionRequest) Reset() { *m = ServerReflectionRequest func (m *ServerReflectionRequest) String() string { return proto.CompactTextString(m) } func (*ServerReflectionRequest) ProtoMessage() {} func (*ServerReflectionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_reflection_178bd1e101bf8b63, []int{0} + return fileDescriptor_42a8ac412db3cb03, []int{0} } + func (m *ServerReflectionRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ServerReflectionRequest.Unmarshal(m, b) } func (m *ServerReflectionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ServerReflectionRequest.Marshal(b, m, deterministic) } -func (dst *ServerReflectionRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServerReflectionRequest.Merge(dst, src) +func (m *ServerReflectionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerReflectionRequest.Merge(m, src) } func (m *ServerReflectionRequest) XXX_Size() int { return xxx_messageInfo_ServerReflectionRequest.Size(m) @@ -149,9 +151,9 @@ func (m *ServerReflectionRequest) GetListServices() string { return "" } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*ServerReflectionRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _ServerReflectionRequest_OneofMarshaler, _ServerReflectionRequest_OneofUnmarshaler, _ServerReflectionRequest_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ServerReflectionRequest) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*ServerReflectionRequest_FileByFilename)(nil), (*ServerReflectionRequest_FileContainingSymbol)(nil), (*ServerReflectionRequest_FileContainingExtension)(nil), @@ -160,110 +162,6 @@ func (*ServerReflectionRequest) XXX_OneofFuncs() (func(msg proto.Message, b *pro } } -func _ServerReflectionRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*ServerReflectionRequest) - // message_request - switch x := m.MessageRequest.(type) { - case *ServerReflectionRequest_FileByFilename: - b.EncodeVarint(3<<3 | proto.WireBytes) - b.EncodeStringBytes(x.FileByFilename) - case *ServerReflectionRequest_FileContainingSymbol: - b.EncodeVarint(4<<3 | proto.WireBytes) - b.EncodeStringBytes(x.FileContainingSymbol) - case *ServerReflectionRequest_FileContainingExtension: - b.EncodeVarint(5<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.FileContainingExtension); err != nil { - return err - } - case *ServerReflectionRequest_AllExtensionNumbersOfType: - b.EncodeVarint(6<<3 | proto.WireBytes) - b.EncodeStringBytes(x.AllExtensionNumbersOfType) - case *ServerReflectionRequest_ListServices: - b.EncodeVarint(7<<3 | proto.WireBytes) - b.EncodeStringBytes(x.ListServices) - case nil: - default: - return fmt.Errorf("ServerReflectionRequest.MessageRequest has unexpected type %T", x) - } - return nil -} - -func _ServerReflectionRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*ServerReflectionRequest) - switch tag { - case 3: // message_request.file_by_filename - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.MessageRequest = &ServerReflectionRequest_FileByFilename{x} - return true, err - case 4: // message_request.file_containing_symbol - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.MessageRequest = &ServerReflectionRequest_FileContainingSymbol{x} - return true, err - case 5: // message_request.file_containing_extension - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ExtensionRequest) - err := b.DecodeMessage(msg) - m.MessageRequest = &ServerReflectionRequest_FileContainingExtension{msg} - return true, err - case 6: // message_request.all_extension_numbers_of_type - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.MessageRequest = &ServerReflectionRequest_AllExtensionNumbersOfType{x} - return true, err - case 7: // message_request.list_services - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.MessageRequest = &ServerReflectionRequest_ListServices{x} - return true, err - default: - return false, nil - } -} - -func _ServerReflectionRequest_OneofSizer(msg proto.Message) (n int) { - m := msg.(*ServerReflectionRequest) - // message_request - switch x := m.MessageRequest.(type) { - case *ServerReflectionRequest_FileByFilename: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.FileByFilename))) - n += len(x.FileByFilename) - case *ServerReflectionRequest_FileContainingSymbol: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.FileContainingSymbol))) - n += len(x.FileContainingSymbol) - case *ServerReflectionRequest_FileContainingExtension: - s := proto.Size(x.FileContainingExtension) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *ServerReflectionRequest_AllExtensionNumbersOfType: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.AllExtensionNumbersOfType))) - n += len(x.AllExtensionNumbersOfType) - case *ServerReflectionRequest_ListServices: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.ListServices))) - n += len(x.ListServices) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - // The type name and extension number sent by the client when requesting // file_containing_extension. type ExtensionRequest struct { @@ -279,16 +177,17 @@ func (m *ExtensionRequest) Reset() { *m = ExtensionRequest{} } func (m *ExtensionRequest) String() string { return proto.CompactTextString(m) } func (*ExtensionRequest) ProtoMessage() {} func (*ExtensionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_reflection_178bd1e101bf8b63, []int{1} + return fileDescriptor_42a8ac412db3cb03, []int{1} } + func (m *ExtensionRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ExtensionRequest.Unmarshal(m, b) } func (m *ExtensionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ExtensionRequest.Marshal(b, m, deterministic) } -func (dst *ExtensionRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExtensionRequest.Merge(dst, src) +func (m *ExtensionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExtensionRequest.Merge(m, src) } func (m *ExtensionRequest) XXX_Size() int { return xxx_messageInfo_ExtensionRequest.Size(m) @@ -335,16 +234,17 @@ func (m *ServerReflectionResponse) Reset() { *m = ServerReflectionRespon func (m *ServerReflectionResponse) String() string { return proto.CompactTextString(m) } func (*ServerReflectionResponse) ProtoMessage() {} func (*ServerReflectionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_reflection_178bd1e101bf8b63, []int{2} + return fileDescriptor_42a8ac412db3cb03, []int{2} } + func (m *ServerReflectionResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ServerReflectionResponse.Unmarshal(m, b) } func (m *ServerReflectionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ServerReflectionResponse.Marshal(b, m, deterministic) } -func (dst *ServerReflectionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServerReflectionResponse.Merge(dst, src) +func (m *ServerReflectionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServerReflectionResponse.Merge(m, src) } func (m *ServerReflectionResponse) XXX_Size() int { return xxx_messageInfo_ServerReflectionResponse.Size(m) @@ -433,9 +333,9 @@ func (m *ServerReflectionResponse) GetErrorResponse() *ErrorResponse { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*ServerReflectionResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _ServerReflectionResponse_OneofMarshaler, _ServerReflectionResponse_OneofUnmarshaler, _ServerReflectionResponse_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ServerReflectionResponse) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*ServerReflectionResponse_FileDescriptorResponse)(nil), (*ServerReflectionResponse_AllExtensionNumbersResponse)(nil), (*ServerReflectionResponse_ListServicesResponse)(nil), @@ -443,108 +343,6 @@ func (*ServerReflectionResponse) XXX_OneofFuncs() (func(msg proto.Message, b *pr } } -func _ServerReflectionResponse_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*ServerReflectionResponse) - // message_response - switch x := m.MessageResponse.(type) { - case *ServerReflectionResponse_FileDescriptorResponse: - b.EncodeVarint(4<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.FileDescriptorResponse); err != nil { - return err - } - case *ServerReflectionResponse_AllExtensionNumbersResponse: - b.EncodeVarint(5<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.AllExtensionNumbersResponse); err != nil { - return err - } - case *ServerReflectionResponse_ListServicesResponse: - b.EncodeVarint(6<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ListServicesResponse); err != nil { - return err - } - case *ServerReflectionResponse_ErrorResponse: - b.EncodeVarint(7<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ErrorResponse); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("ServerReflectionResponse.MessageResponse has unexpected type %T", x) - } - return nil -} - -func _ServerReflectionResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*ServerReflectionResponse) - switch tag { - case 4: // message_response.file_descriptor_response - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(FileDescriptorResponse) - err := b.DecodeMessage(msg) - m.MessageResponse = &ServerReflectionResponse_FileDescriptorResponse{msg} - return true, err - case 5: // message_response.all_extension_numbers_response - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ExtensionNumberResponse) - err := b.DecodeMessage(msg) - m.MessageResponse = &ServerReflectionResponse_AllExtensionNumbersResponse{msg} - return true, err - case 6: // message_response.list_services_response - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ListServiceResponse) - err := b.DecodeMessage(msg) - m.MessageResponse = &ServerReflectionResponse_ListServicesResponse{msg} - return true, err - case 7: // message_response.error_response - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ErrorResponse) - err := b.DecodeMessage(msg) - m.MessageResponse = &ServerReflectionResponse_ErrorResponse{msg} - return true, err - default: - return false, nil - } -} - -func _ServerReflectionResponse_OneofSizer(msg proto.Message) (n int) { - m := msg.(*ServerReflectionResponse) - // message_response - switch x := m.MessageResponse.(type) { - case *ServerReflectionResponse_FileDescriptorResponse: - s := proto.Size(x.FileDescriptorResponse) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *ServerReflectionResponse_AllExtensionNumbersResponse: - s := proto.Size(x.AllExtensionNumbersResponse) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *ServerReflectionResponse_ListServicesResponse: - s := proto.Size(x.ListServicesResponse) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *ServerReflectionResponse_ErrorResponse: - s := proto.Size(x.ErrorResponse) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - // Serialized FileDescriptorProto messages sent by the server answering // a file_by_filename, file_containing_symbol, or file_containing_extension // request. @@ -562,16 +360,17 @@ func (m *FileDescriptorResponse) Reset() { *m = FileDescriptorResponse{} func (m *FileDescriptorResponse) String() string { return proto.CompactTextString(m) } func (*FileDescriptorResponse) ProtoMessage() {} func (*FileDescriptorResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_reflection_178bd1e101bf8b63, []int{3} + return fileDescriptor_42a8ac412db3cb03, []int{3} } + func (m *FileDescriptorResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FileDescriptorResponse.Unmarshal(m, b) } func (m *FileDescriptorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_FileDescriptorResponse.Marshal(b, m, deterministic) } -func (dst *FileDescriptorResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_FileDescriptorResponse.Merge(dst, src) +func (m *FileDescriptorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileDescriptorResponse.Merge(m, src) } func (m *FileDescriptorResponse) XXX_Size() int { return xxx_messageInfo_FileDescriptorResponse.Size(m) @@ -605,16 +404,17 @@ func (m *ExtensionNumberResponse) Reset() { *m = ExtensionNumberResponse func (m *ExtensionNumberResponse) String() string { return proto.CompactTextString(m) } func (*ExtensionNumberResponse) ProtoMessage() {} func (*ExtensionNumberResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_reflection_178bd1e101bf8b63, []int{4} + return fileDescriptor_42a8ac412db3cb03, []int{4} } + func (m *ExtensionNumberResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ExtensionNumberResponse.Unmarshal(m, b) } func (m *ExtensionNumberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ExtensionNumberResponse.Marshal(b, m, deterministic) } -func (dst *ExtensionNumberResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExtensionNumberResponse.Merge(dst, src) +func (m *ExtensionNumberResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExtensionNumberResponse.Merge(m, src) } func (m *ExtensionNumberResponse) XXX_Size() int { return xxx_messageInfo_ExtensionNumberResponse.Size(m) @@ -653,16 +453,17 @@ func (m *ListServiceResponse) Reset() { *m = ListServiceResponse{} } func (m *ListServiceResponse) String() string { return proto.CompactTextString(m) } func (*ListServiceResponse) ProtoMessage() {} func (*ListServiceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_reflection_178bd1e101bf8b63, []int{5} + return fileDescriptor_42a8ac412db3cb03, []int{5} } + func (m *ListServiceResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ListServiceResponse.Unmarshal(m, b) } func (m *ListServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ListServiceResponse.Marshal(b, m, deterministic) } -func (dst *ListServiceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListServiceResponse.Merge(dst, src) +func (m *ListServiceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListServiceResponse.Merge(m, src) } func (m *ListServiceResponse) XXX_Size() int { return xxx_messageInfo_ListServiceResponse.Size(m) @@ -695,16 +496,17 @@ func (m *ServiceResponse) Reset() { *m = ServiceResponse{} } func (m *ServiceResponse) String() string { return proto.CompactTextString(m) } func (*ServiceResponse) ProtoMessage() {} func (*ServiceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_reflection_178bd1e101bf8b63, []int{6} + return fileDescriptor_42a8ac412db3cb03, []int{6} } + func (m *ServiceResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ServiceResponse.Unmarshal(m, b) } func (m *ServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ServiceResponse.Marshal(b, m, deterministic) } -func (dst *ServiceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServiceResponse.Merge(dst, src) +func (m *ServiceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceResponse.Merge(m, src) } func (m *ServiceResponse) XXX_Size() int { return xxx_messageInfo_ServiceResponse.Size(m) @@ -736,16 +538,17 @@ func (m *ErrorResponse) Reset() { *m = ErrorResponse{} } func (m *ErrorResponse) String() string { return proto.CompactTextString(m) } func (*ErrorResponse) ProtoMessage() {} func (*ErrorResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_reflection_178bd1e101bf8b63, []int{7} + return fileDescriptor_42a8ac412db3cb03, []int{7} } + func (m *ErrorResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ErrorResponse.Unmarshal(m, b) } func (m *ErrorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ErrorResponse.Marshal(b, m, deterministic) } -func (dst *ErrorResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ErrorResponse.Merge(dst, src) +func (m *ErrorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ErrorResponse.Merge(m, src) } func (m *ErrorResponse) XXX_Size() int { return xxx_messageInfo_ErrorResponse.Size(m) @@ -781,6 +584,55 @@ func init() { proto.RegisterType((*ErrorResponse)(nil), "grpc.reflection.v1alpha.ErrorResponse") } +func init() { + proto.RegisterFile("grpc_reflection_v1alpha/reflection.proto", fileDescriptor_42a8ac412db3cb03) +} + +var fileDescriptor_42a8ac412db3cb03 = []byte{ + // 656 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x51, 0x73, 0xd2, 0x40, + 0x10, 0x6e, 0x5a, 0x68, 0x87, 0x85, 0x02, 0x5e, 0x2b, 0xa4, 0x3a, 0x75, 0x98, 0x68, 0x35, 0x75, + 0x1c, 0xda, 0xe2, 0x8c, 0x3f, 0x80, 0xaa, 0x83, 0x33, 0xb5, 0x75, 0x0e, 0x5f, 0x1c, 0x1f, 0x6e, + 0x02, 0x2c, 0x34, 0x1a, 0x72, 0xf1, 0x2e, 0x45, 0x79, 0xf2, 0x47, 0xf8, 0xa3, 0xfc, 0x4b, 0x3e, + 0x3a, 0x77, 0x09, 0x21, 0xa4, 0x44, 0xa7, 0x4f, 0x30, 0xdf, 0xee, 0xde, 0xb7, 0xbb, 0xdf, 0xb7, + 0x01, 0x7b, 0x22, 0x82, 0x21, 0x13, 0x38, 0xf6, 0x70, 0x18, 0xba, 0xdc, 0x67, 0xb3, 0x33, 0xc7, + 0x0b, 0xae, 0x9d, 0x93, 0x25, 0xd4, 0x0e, 0x04, 0x0f, 0x39, 0x69, 0xaa, 0xcc, 0x76, 0x0a, 0x8e, + 0x33, 0xad, 0x3f, 0x9b, 0xd0, 0xec, 0xa3, 0x98, 0xa1, 0xa0, 0x49, 0x90, 0xe2, 0xb7, 0x1b, 0x94, + 0x21, 0x21, 0x50, 0xb8, 0xe6, 0x32, 0x34, 0x8d, 0x96, 0x61, 0x97, 0xa8, 0xfe, 0x4f, 0x9e, 0x43, + 0x7d, 0xec, 0x7a, 0xc8, 0x06, 0x73, 0xa6, 0x7e, 0x7d, 0x67, 0x8a, 0xe6, 0x96, 0x8a, 0xf7, 0x36, + 0x68, 0x55, 0x21, 0xdd, 0xf9, 0xdb, 0x18, 0x27, 0xaf, 0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7d, 0x59, 0x7f, 0x03, 0x5b, 0xeb, 0x6e, 0xe0, 0x13, 0xec, 0xad, + 0xd9, 0x26, 0xe9, 0xc2, 0x4e, 0x2c, 0x8b, 0x6e, 0xb4, 0xdc, 0xb1, 0xff, 0xe9, 0xea, 0x54, 0x29, + 0x5d, 0x14, 0x5a, 0x47, 0x50, 0xcb, 0x3e, 0x4b, 0xa0, 0x90, 0x6a, 0x5a, 0xff, 0xb7, 0xfa, 0xb0, + 0xbb, 0xb2, 0x71, 0x75, 0x79, 0x91, 0x62, 0x43, 0x3e, 0x8a, 0x52, 0x8b, 0xb4, 0xa4, 0x91, 0x73, + 0x3e, 0x42, 0xf2, 0x18, 0x22, 0x41, 0x58, 0xac, 0x82, 0x3e, 0xbb, 0x12, 0xad, 0x68, 0xf0, 0x7d, + 0x84, 0x75, 0x7e, 0x19, 0x50, 0xcf, 0x9e, 0x1b, 0xf9, 0x09, 0xfb, 0x59, 0xec, 0x9d, 0x3f, 0xe6, + 0xe4, 0xce, 0x17, 0xfb, 0xe0, 0xec, 0x0e, 0x15, 0xd1, 0x54, 0xb6, 0x71, 0x6a, 0x0c, 0xb6, 0xb5, + 0xf4, 0x2f, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x85, 0x02, 0x09, 0x9d, 0x9f, 0x06, 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -844,6 +696,14 @@ type ServerReflectionServer interface { ServerReflectionInfo(ServerReflection_ServerReflectionInfoServer) error } +// UnimplementedServerReflectionServer can be embedded to have forward compatible implementations. +type UnimplementedServerReflectionServer struct { +} + +func (*UnimplementedServerReflectionServer) ServerReflectionInfo(srv ServerReflection_ServerReflectionInfoServer) error { + return status.Errorf(codes.Unimplemented, "method ServerReflectionInfo not implemented") +} + func RegisterServerReflectionServer(s *grpc.Server, srv ServerReflectionServer) { s.RegisterService(&_ServerReflection_serviceDesc, srv) } @@ -888,52 +748,3 @@ var _ServerReflection_serviceDesc = grpc.ServiceDesc{ }, Metadata: "grpc_reflection_v1alpha/reflection.proto", } - -func init() { - proto.RegisterFile("grpc_reflection_v1alpha/reflection.proto", fileDescriptor_reflection_178bd1e101bf8b63) -} - -var fileDescriptor_reflection_178bd1e101bf8b63 = []byte{ - // 656 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x51, 0x73, 0xd2, 0x40, - 0x10, 0x6e, 0x5a, 0x68, 0x87, 0x85, 0x02, 0x5e, 0x2b, 0xa4, 0x3a, 0x75, 0x98, 0x68, 0x35, 0x75, - 0x1c, 0xda, 0xe2, 0x8c, 0x3f, 0x80, 0xaa, 0x83, 0x33, 0xb5, 0x75, 0x0e, 0x5f, 0x1c, 0x1f, 0x6e, - 0x02, 0x2c, 0x34, 0x1a, 0x72, 0xf1, 0x2e, 0x45, 0x79, 0xf2, 0x47, 0xf8, 0xa3, 0xfc, 0x4b, 0x3e, - 0x3a, 0x77, 0x09, 0x21, 0xa4, 0x44, 0xa7, 0x4f, 0x30, 0xdf, 0xee, 0xde, 0xb7, 0xbb, 0xdf, 0xb7, - 0x01, 0x7b, 0x22, 0x82, 0x21, 0x13, 0x38, 0xf6, 0x70, 0x18, 0xba, 0xdc, 0x67, 0xb3, 0x33, 0xc7, - 0x0b, 0xae, 0x9d, 0x93, 0x25, 0xd4, 0x0e, 0x04, 0x0f, 0x39, 0x69, 0xaa, 0xcc, 0x76, 0x0a, 0x8e, - 0x33, 0xad, 0x3f, 0x9b, 0xd0, 0xec, 0xa3, 0x98, 0xa1, 0xa0, 0x49, 0x90, 0xe2, 0xb7, 0x1b, 0x94, - 0x21, 0x21, 0x50, 0xb8, 0xe6, 0x32, 0x34, 0x8d, 0x96, 0x61, 0x97, 0xa8, 0xfe, 0x4f, 0x9e, 0x43, - 0x7d, 0xec, 0x7a, 0xc8, 0x06, 0x73, 0xa6, 0x7e, 0x7d, 0x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70, 0x24, 0xea, 0x03, 0x60, 0xfa, 0x1b, 0x13, 0x39, 0xb3, 0xa2, - 0x50, 0xe5, 0xff, 0x4b, 0xf5, 0x7d, 0x59, 0x7f, 0x03, 0x5b, 0xeb, 0x6e, 0xe0, 0x13, 0xec, 0xad, - 0xd9, 0x26, 0xe9, 0xc2, 0x4e, 0x2c, 0x8b, 0x6e, 0xb4, 0xdc, 0xb1, 0xff, 0xe9, 0xea, 0x54, 0x29, - 0x5d, 0x14, 0x5a, 0x47, 0x50, 0xcb, 0x3e, 0x4b, 0xa0, 0x90, 0x6a, 0x5a, 0xff, 0xb7, 0xfa, 0xb0, - 0xbb, 0xb2, 0x71, 0x75, 0x79, 0x91, 0x62, 0x43, 0x3e, 0x8a, 0x52, 0x8b, 0xb4, 0xa4, 0x91, 0x73, - 0x3e, 0x42, 0xf2, 0x18, 0x22, 0x41, 0x58, 0xac, 0x82, 0x3e, 0xbb, 0x12, 0xad, 0x68, 0xf0, 0x7d, - 0x84, 0x75, 0x7e, 0x19, 0x50, 0xcf, 0x9e, 0x1b, 0xf9, 0x09, 0xfb, 0x59, 0xec, 0x9d, 0x3f, 0xe6, - 0xe4, 0xce, 0x17, 0xfb, 0xe0, 0xec, 0x0e, 0x15, 0xd1, 0x54, 0xb6, 0x71, 0x6a, 0x0c, 0xb6, 0xb5, - 0xf4, 0x2f, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x85, 0x02, 0x09, 0x9d, 0x9f, 0x06, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2.pb.go index 4a95d9beb13..319ea0deaea 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2.pb.go @@ -3,9 +3,11 @@ package grpc_testing -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -16,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type ToBeExtended struct { Foo *int32 `protobuf:"varint,1,req,name=foo" json:"foo,omitempty"` @@ -30,7 +32,7 @@ func (m *ToBeExtended) Reset() { *m = ToBeExtended{} } func (m *ToBeExtended) String() string { return proto.CompactTextString(m) } func (*ToBeExtended) ProtoMessage() {} func (*ToBeExtended) Descriptor() ([]byte, []int) { - return fileDescriptor_proto2_b16f7a513d0acdc0, []int{0} + return fileDescriptor_1f509089572db8e7, []int{0} } var extRange_ToBeExtended = []proto.ExtensionRange{ @@ -40,14 +42,15 @@ var extRange_ToBeExtended = []proto.ExtensionRange{ func (*ToBeExtended) ExtensionRangeArray() []proto.ExtensionRange { return extRange_ToBeExtended } + func (m *ToBeExtended) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ToBeExtended.Unmarshal(m, b) } func (m *ToBeExtended) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ToBeExtended.Marshal(b, m, deterministic) } -func (dst *ToBeExtended) XXX_Merge(src proto.Message) { - xxx_messageInfo_ToBeExtended.Merge(dst, src) +func (m *ToBeExtended) XXX_Merge(src proto.Message) { + xxx_messageInfo_ToBeExtended.Merge(m, src) } func (m *ToBeExtended) XXX_Size() int { return xxx_messageInfo_ToBeExtended.Size(m) @@ -69,9 +72,9 @@ func init() { proto.RegisterType((*ToBeExtended)(nil), "grpc.testing.ToBeExtended") } -func init() { proto.RegisterFile("proto2.proto", fileDescriptor_proto2_b16f7a513d0acdc0) } +func init() { proto.RegisterFile("proto2.proto", fileDescriptor_1f509089572db8e7) } -var fileDescriptor_proto2_b16f7a513d0acdc0 = []byte{ +var fileDescriptor_1f509089572db8e7 = []byte{ // 86 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x28, 0xca, 0x2f, 0xc9, 0x37, 0xd2, 0x03, 0x53, 0x42, 0x3c, 0xe9, 0x45, 0x05, 0xc9, 0x7a, 0x25, 0xa9, 0xc5, 0x25, diff --git a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext.pb.go index 25baa1a00d2..f2bfe5f3793 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext.pb.go @@ -3,9 +3,11 @@ package grpc_testing -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -16,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type Extension struct { Whatzit *int32 `protobuf:"varint,1,opt,name=whatzit" json:"whatzit,omitempty"` @@ -29,16 +31,17 @@ func (m *Extension) Reset() { *m = Extension{} } func (m *Extension) String() string { return proto.CompactTextString(m) } func (*Extension) ProtoMessage() {} func (*Extension) Descriptor() ([]byte, []int) { - return fileDescriptor_proto2_ext_4437118420d604f2, []int{0} + return fileDescriptor_85b2817ade17959b, []int{0} } + func (m *Extension) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Extension.Unmarshal(m, b) } func (m *Extension) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Extension.Marshal(b, m, deterministic) } -func (dst *Extension) XXX_Merge(src proto.Message) { - xxx_messageInfo_Extension.Merge(dst, src) +func (m *Extension) XXX_Merge(src proto.Message) { + xxx_messageInfo_Extension.Merge(m, src) } func (m *Extension) XXX_Size() int { return xxx_messageInfo_Extension.Size(m) @@ -90,9 +93,9 @@ func init() { proto.RegisterExtension(E_Baz) } -func init() { proto.RegisterFile("proto2_ext.proto", fileDescriptor_proto2_ext_4437118420d604f2) } +func init() { proto.RegisterFile("proto2_ext.proto", fileDescriptor_85b2817ade17959b) } -var fileDescriptor_proto2_ext_4437118420d604f2 = []byte{ +var fileDescriptor_85b2817ade17959b = []byte{ // 179 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x37, 0x8a, 0x4f, 0xad, 0x28, 0xd1, 0x03, 0x33, 0x85, 0x78, 0xd2, 0x8b, 0x0a, 0x92, 0xf5, diff --git a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext2.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext2.pb.go index 869a6baf8f5..6601cfc44b1 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext2.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_testing/proto2_ext2.pb.go @@ -3,9 +3,11 @@ package grpc_testing -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -16,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type AnotherExtension struct { Whatchamacallit *int32 `protobuf:"varint,1,opt,name=whatchamacallit" json:"whatchamacallit,omitempty"` @@ -29,16 +31,17 @@ func (m *AnotherExtension) Reset() { *m = AnotherExtension{} } func (m *AnotherExtension) String() string { return proto.CompactTextString(m) } func (*AnotherExtension) ProtoMessage() {} func (*AnotherExtension) Descriptor() ([]byte, []int) { - return fileDescriptor_proto2_ext2_039d342873655470, []int{0} + return fileDescriptor_21d110045b8a354c, []int{0} } + func (m *AnotherExtension) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AnotherExtension.Unmarshal(m, b) } func (m *AnotherExtension) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_AnotherExtension.Marshal(b, m, deterministic) } -func (dst *AnotherExtension) XXX_Merge(src proto.Message) { - xxx_messageInfo_AnotherExtension.Merge(dst, src) +func (m *AnotherExtension) XXX_Merge(src proto.Message) { + xxx_messageInfo_AnotherExtension.Merge(m, src) } func (m *AnotherExtension) XXX_Size() int { return xxx_messageInfo_AnotherExtension.Size(m) @@ -80,9 +83,9 @@ func init() { proto.RegisterExtension(E_Nitz) } -func init() { proto.RegisterFile("proto2_ext2.proto", fileDescriptor_proto2_ext2_039d342873655470) } +func init() { proto.RegisterFile("proto2_ext2.proto", fileDescriptor_21d110045b8a354c) } -var fileDescriptor_proto2_ext2_039d342873655470 = []byte{ +var fileDescriptor_21d110045b8a354c = []byte{ // 165 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2c, 0x28, 0xca, 0x2f, 0xc9, 0x37, 0x8a, 0x4f, 0xad, 0x28, 0x31, 0xd2, 0x03, 0xb3, 0x85, 0x78, 0xd2, 0x8b, 0x0a, 0x92, diff --git a/vendor/google.golang.org/grpc/reflection/grpc_testing/test.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_testing/test.pb.go index 2566a49f9ac..b37f0c2c927 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_testing/test.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_testing/test.pb.go @@ -3,13 +3,14 @@ package grpc_testing -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -21,7 +22,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type SearchResponse struct { Results []*SearchResponse_Result `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` @@ -34,16 +35,17 @@ func (m *SearchResponse) Reset() { *m = SearchResponse{} } func (m *SearchResponse) String() string { return proto.CompactTextString(m) } func (*SearchResponse) ProtoMessage() {} func (*SearchResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_test_a0c753075da50dd4, []int{0} + return fileDescriptor_c161fcfdc0c3ff1e, []int{0} } + func (m *SearchResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchResponse.Unmarshal(m, b) } func (m *SearchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SearchResponse.Marshal(b, m, deterministic) } -func (dst *SearchResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SearchResponse.Merge(dst, src) +func (m *SearchResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchResponse.Merge(m, src) } func (m *SearchResponse) XXX_Size() int { return xxx_messageInfo_SearchResponse.Size(m) @@ -74,16 +76,17 @@ func (m *SearchResponse_Result) Reset() { *m = SearchResponse_Result{} } func (m *SearchResponse_Result) String() string { return proto.CompactTextString(m) } func (*SearchResponse_Result) ProtoMessage() {} func (*SearchResponse_Result) Descriptor() ([]byte, []int) { - return fileDescriptor_test_a0c753075da50dd4, []int{0, 0} + return fileDescriptor_c161fcfdc0c3ff1e, []int{0, 0} } + func (m *SearchResponse_Result) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchResponse_Result.Unmarshal(m, b) } func (m *SearchResponse_Result) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SearchResponse_Result.Marshal(b, m, deterministic) } -func (dst *SearchResponse_Result) XXX_Merge(src proto.Message) { - xxx_messageInfo_SearchResponse_Result.Merge(dst, src) +func (m *SearchResponse_Result) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchResponse_Result.Merge(m, src) } func (m *SearchResponse_Result) XXX_Size() int { return xxx_messageInfo_SearchResponse_Result.Size(m) @@ -126,16 +129,17 @@ func (m *SearchRequest) Reset() { *m = SearchRequest{} } func (m *SearchRequest) String() string { return proto.CompactTextString(m) } func (*SearchRequest) ProtoMessage() {} func (*SearchRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_test_a0c753075da50dd4, []int{1} + return fileDescriptor_c161fcfdc0c3ff1e, []int{1} } + func (m *SearchRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SearchRequest.Unmarshal(m, b) } func (m *SearchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SearchRequest.Marshal(b, m, deterministic) } -func (dst *SearchRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SearchRequest.Merge(dst, src) +func (m *SearchRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchRequest.Merge(m, src) } func (m *SearchRequest) XXX_Size() int { return xxx_messageInfo_SearchRequest.Size(m) @@ -159,6 +163,27 @@ func init() { proto.RegisterType((*SearchRequest)(nil), "grpc.testing.SearchRequest") } +func init() { proto.RegisterFile("test.proto", fileDescriptor_c161fcfdc0c3ff1e) } + +var fileDescriptor_c161fcfdc0c3ff1e = []byte{ + // 231 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 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x17, 0x7f, 0xfd, 0x0d, 0x1f, 0xe0, 0xa4, 0x52, 0xa6, 0xed, 0xb3, 0xef, 0x9a, 0x7f, + 0xdb, 0x4a, 0x73, 0x6d, 0x1e, 0xd3, 0x79, 0x09, 0x37, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x20, + 0xd6, 0x09, 0xb8, 0x92, 0x01, 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -229,6 +254,17 @@ type SearchServiceServer interface { StreamingSearch(SearchService_StreamingSearchServer) error } +// UnimplementedSearchServiceServer can be embedded to have forward compatible implementations. +type UnimplementedSearchServiceServer struct { +} + +func (*UnimplementedSearchServiceServer) Search(ctx context.Context, req *SearchRequest) (*SearchResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Search not implemented") +} +func (*UnimplementedSearchServiceServer) StreamingSearch(srv SearchService_StreamingSearchServer) error { + return status.Errorf(codes.Unimplemented, "method StreamingSearch not implemented") +} + func RegisterSearchServiceServer(s *grpc.Server, srv SearchServiceServer) { s.RegisterService(&_SearchService_serviceDesc, srv) } @@ -296,24 +332,3 @@ var _SearchService_serviceDesc = grpc.ServiceDesc{ }, Metadata: "test.proto", } - -func init() { proto.RegisterFile("test.proto", fileDescriptor_test_a0c753075da50dd4) } - -var fileDescriptor_test_a0c753075da50dd4 = []byte{ - // 231 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x91, 0xbd, 0x4a, 0xc5, 0x40, - 0x10, 0x85, 0x59, 0x83, 0xd1, 0x3b, 0xfe, 0x32, 0x58, 0x84, 0x68, 0x11, 0xae, 0x08, 0xa9, 0x16, - 0xb9, 0xd6, 0x56, 0xb6, 0x16, 0xb2, 0x79, 0x82, 0x6b, 0x18, 0xe2, 0x42, 0x4c, 0x36, 0x33, 0x13, - 0xc1, 0x87, 0xb1, 0xf5, 0x39, 0x25, 0x59, 0x23, 0x0a, 0x62, 0x63, 0xb7, 0xe7, 0xe3, 0xcc, 0xb7, - 0xbb, 0x0c, 0x80, 0x92, 0xa8, 0x0d, 0xdc, 0x6b, 0x8f, 0x87, 0x0d, 0x87, 0xda, 0x4e, 0xc0, 0x77, - 0xcd, 0xfa, 0xcd, 0xc0, 0x71, 0x45, 0x5b, 0xae, 0x9f, 0x1c, 0x49, 0xe8, 0x3b, 0x21, 0xbc, 0x85, - 0x3d, 0x26, 0x19, 0x5b, 0x95, 0xcc, 0x14, 0x49, 0x79, 0xb0, 0xb9, 0xb4, 0xdf, 0x47, 0xec, 0xcf, - 0xba, 0x75, 0x73, 0xd7, 0x2d, 0x33, 0xf9, 0x3d, 0xa4, 0x11, 0xe1, 0x29, 0x24, 0x23, 0xb7, 0x99, - 0x29, 0x4c, 0xb9, 0x72, 0xd3, 0x11, 0xcf, 0x60, 0x57, 0xbd, 0xb6, 0x94, 0xed, 0xcc, 0x2c, 0x06, - 0xcc, 0x61, 0x5f, 0x3a, 0x1f, 0x02, 0xa9, 0x64, 0x49, 0x91, 0x94, 0x2b, 0xf7, 0x95, 0xd7, 0x57, - 0x70, 0xb4, 0xdc, 0x37, 0x8c, 0x24, 0x3a, 0x29, 0x86, 0x91, 0xf8, 0xf5, 0x53, 0x1b, 0xc3, 0xe6, - 0xdd, 0x2c, 0xbd, 0x8a, 0xf8, 0xc5, 0xd7, 0x84, 0x77, 0x90, 0x46, 0x80, 0xe7, 0xbf, 0x3f, 0x7f, - 0xd6, 0xe5, 0x17, 0x7f, 0xfd, 0x0d, 0x1f, 0xe0, 0xa4, 0x52, 0xa6, 0xed, 0xb3, 0xef, 0x9a, 0x7f, - 0xdb, 0x4a, 0x73, 0x6d, 0x1e, 0xd3, 0x79, 0x09, 0x37, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x20, - 0xd6, 0x09, 0xb8, 0x92, 0x01, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/reflection/grpc_testingv3/README.md b/vendor/google.golang.org/grpc/reflection/grpc_testingv3/README.md new file mode 100644 index 00000000000..83d58756a44 --- /dev/null +++ b/vendor/google.golang.org/grpc/reflection/grpc_testingv3/README.md @@ -0,0 +1,3 @@ +The pb.go is genenated with an older version of codegen, to test reflection behavior with `grpc.SupportPackageIsVersion3`. DO NOT REGENERATE! + +pb.go is manually edited to replace `"golang.org/x/net/context"` with `"context"`. diff --git a/vendor/google.golang.org/grpc/reflection/grpc_testingv3/testv3.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_testingv3/testv3.pb.go index 767efddf599..d7a69e546ea 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_testingv3/testv3.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_testingv3/testv3.pb.go @@ -19,7 +19,8 @@ import fmt "fmt" import math "math" import ( - context "golang.org/x/net/context" + context "context" + grpc "google.golang.org/grpc" ) diff --git a/vendor/google.golang.org/grpc/reflection/serverreflection_test.go b/vendor/google.golang.org/grpc/reflection/serverreflection_test.go index ed31780ed00..cc1cd41bb47 100644 --- a/vendor/google.golang.org/grpc/reflection/serverreflection_test.go +++ b/vendor/google.golang.org/grpc/reflection/serverreflection_test.go @@ -162,7 +162,9 @@ func TestAllExtensionNumbersForType(t *testing.T) { // Do end2end tests. -type server struct{} +type server struct { + pb.UnimplementedSearchServiceServer +} func (s *server) Search(ctx context.Context, in *pb.SearchRequest) (*pb.SearchResponse, error) { return &pb.SearchResponse{}, nil diff --git a/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go b/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go index 297492e87af..14aa6f20ae0 100644 --- a/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go +++ b/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go @@ -18,440 +18,19 @@ // Package dns implements a dns resolver to be installed as the default resolver // in grpc. +// +// Deprecated: this package is imported by grpc and should not need to be +// imported directly by users. package dns import ( - "context" - "encoding/json" - "errors" - "fmt" - "net" - "os" - "strconv" - "strings" - "sync" - "time" - - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/internal/backoff" - "google.golang.org/grpc/internal/grpcrand" + "google.golang.org/grpc/internal/resolver/dns" "google.golang.org/grpc/resolver" ) -func init() { - resolver.Register(NewBuilder()) -} - -const ( - defaultPort = "443" - defaultFreq = time.Minute * 30 - defaultDNSSvrPort = "53" - golang = "GO" - // txtPrefix is the prefix string to be prepended to the host name for txt record lookup. - txtPrefix = "_grpc_config." - // In DNS, service config is encoded in a TXT record via the mechanism - // described in RFC-1464 using the attribute name grpc_config. - txtAttribute = "grpc_config=" -) - -var ( - errMissingAddr = errors.New("dns resolver: missing address") - - // Addresses ending with a colon that is supposed to be the separator - // between host and port is not allowed. E.g. "::" is a valid address as - // it is an IPv6 address (host only) and "[::]:" is invalid as it ends with - // a colon as the host and port separator - errEndsWithColon = errors.New("dns resolver: missing port after port-separator colon") -) - -var ( - defaultResolver netResolver = net.DefaultResolver - // To prevent excessive re-resolution, we enforce a rate limit on DNS - // resolution requests. - minDNSResRate = 30 * time.Second -) - -var customAuthorityDialler = func(authority string) func(ctx context.Context, network, address string) (net.Conn, error) { - return func(ctx context.Context, network, address string) (net.Conn, error) { - var dialer net.Dialer - return dialer.DialContext(ctx, network, authority) - } -} - -var customAuthorityResolver = func(authority string) (netResolver, error) { - host, port, err := parseTarget(authority, defaultDNSSvrPort) - if err != nil { - return nil, err - } - - authorityWithPort := net.JoinHostPort(host, port) - - return &net.Resolver{ - PreferGo: true, - Dial: customAuthorityDialler(authorityWithPort), - }, nil -} - // NewBuilder creates a dnsBuilder which is used to factory DNS resolvers. +// +// Deprecated: import grpc and use resolver.Get("dns") instead. func NewBuilder() resolver.Builder { - return &dnsBuilder{minFreq: defaultFreq} -} - -type dnsBuilder struct { - // minimum frequency of polling the DNS server. - minFreq time.Duration -} - -// Build creates and starts a DNS resolver that watches the name resolution of the target. -func (b *dnsBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOption) (resolver.Resolver, error) { - host, port, err := parseTarget(target.Endpoint, defaultPort) - if err != nil { - return nil, err - } - - // IP address. - if net.ParseIP(host) != nil { - host, _ = formatIP(host) - addr := []resolver.Address{{Addr: host + ":" + port}} - i := &ipResolver{ - cc: cc, - ip: addr, - rn: make(chan struct{}, 1), - q: make(chan struct{}), - } - cc.NewAddress(addr) - go i.watcher() - return i, nil - } - - // DNS address (non-IP). - ctx, cancel := context.WithCancel(context.Background()) - d := &dnsResolver{ - freq: b.minFreq, - backoff: backoff.Exponential{MaxDelay: b.minFreq}, - host: host, - port: port, - ctx: ctx, - cancel: cancel, - cc: cc, - t: time.NewTimer(0), - rn: make(chan struct{}, 1), - disableServiceConfig: opts.DisableServiceConfig, - } - - if target.Authority == "" { - d.resolver = defaultResolver - } else { - d.resolver, err = customAuthorityResolver(target.Authority) - if err != nil { - return nil, err - } - } - - d.wg.Add(1) - go d.watcher() - return d, nil -} - -// Scheme returns the naming scheme of this resolver builder, which is "dns". -func (b *dnsBuilder) Scheme() string { - return "dns" -} - -type netResolver interface { - LookupHost(ctx context.Context, host string) (addrs []string, err error) - LookupSRV(ctx context.Context, service, proto, name string) (cname string, addrs []*net.SRV, err error) - LookupTXT(ctx context.Context, name string) (txts []string, err error) -} - -// ipResolver watches for the name resolution update for an IP address. -type ipResolver struct { - cc resolver.ClientConn - ip []resolver.Address - // rn channel is used by ResolveNow() to force an immediate resolution of the target. - rn chan struct{} - q chan struct{} -} - -// ResolveNow resend the address it stores, no resolution is needed. -func (i *ipResolver) ResolveNow(opt resolver.ResolveNowOption) { - select { - case i.rn <- struct{}{}: - default: - } -} - -// Close closes the ipResolver. -func (i *ipResolver) Close() { - close(i.q) -} - -func (i *ipResolver) watcher() { - for { - select { - case <-i.rn: - i.cc.NewAddress(i.ip) - case <-i.q: - return - } - } -} - -// dnsResolver watches for the name resolution update for a non-IP target. -type dnsResolver struct { - freq time.Duration - backoff backoff.Exponential - retryCount int - host string - port string - resolver netResolver - ctx context.Context - cancel context.CancelFunc - cc resolver.ClientConn - // rn channel is used by ResolveNow() to force an immediate resolution of the target. - rn chan struct{} - t *time.Timer - // wg is used to enforce Close() to return after the watcher() goroutine has finished. - // Otherwise, data race will be possible. [Race Example] in dns_resolver_test we - // replace the real lookup functions with mocked ones to facilitate testing. - // If Close() doesn't wait for watcher() goroutine finishes, race detector sometimes - // will warns lookup (READ the lookup function pointers) inside watcher() goroutine - // has data race with replaceNetFunc (WRITE the lookup function pointers). - wg sync.WaitGroup - disableServiceConfig bool -} - -// ResolveNow invoke an immediate resolution of the target that this dnsResolver watches. -func (d *dnsResolver) ResolveNow(opt resolver.ResolveNowOption) { - select { - case d.rn <- struct{}{}: - default: - } -} - -// Close closes the dnsResolver. -func (d *dnsResolver) Close() { - d.cancel() - d.wg.Wait() - d.t.Stop() -} - -func (d *dnsResolver) watcher() { - defer d.wg.Done() - for { - select { - case <-d.ctx.Done(): - return - case <-d.t.C: - case <-d.rn: - if !d.t.Stop() { - // Before resetting a timer, it should be stopped to prevent racing with - // reads on it's channel. - <-d.t.C - } - } - - result, sc := d.lookup() - // Next lookup should happen within an interval defined by d.freq. It may be - // more often due to exponential retry on empty address list. - if len(result) == 0 { - d.retryCount++ - d.t.Reset(d.backoff.Backoff(d.retryCount)) - } else { - d.retryCount = 0 - d.t.Reset(d.freq) - } - d.cc.NewServiceConfig(sc) - d.cc.NewAddress(result) - - // Sleep to prevent excessive re-resolutions. Incoming resolution requests - // will be queued in d.rn. - t := time.NewTimer(minDNSResRate) - select { - case <-t.C: - case <-d.ctx.Done(): - t.Stop() - return - } - } -} - -func (d *dnsResolver) lookupSRV() []resolver.Address { - var newAddrs []resolver.Address - _, srvs, err := d.resolver.LookupSRV(d.ctx, "grpclb", "tcp", d.host) - if err != nil { - grpclog.Infof("grpc: failed dns SRV record lookup due to %v.\n", err) - return nil - } - for _, s := range srvs { - lbAddrs, err := d.resolver.LookupHost(d.ctx, s.Target) - if err != nil { - grpclog.Infof("grpc: failed load balancer address dns lookup due to %v.\n", err) - continue - } - for _, a := range lbAddrs { - a, ok := formatIP(a) - if !ok { - grpclog.Errorf("grpc: failed IP parsing due to %v.\n", err) - continue - } - addr := a + ":" + strconv.Itoa(int(s.Port)) - newAddrs = append(newAddrs, resolver.Address{Addr: addr, Type: resolver.GRPCLB, ServerName: s.Target}) - } - } - return newAddrs -} - -func (d *dnsResolver) lookupTXT() string { - ss, err := d.resolver.LookupTXT(d.ctx, txtPrefix+d.host) - if err != nil { - grpclog.Infof("grpc: failed dns TXT record lookup due to %v.\n", err) - return "" - } - var res string - for _, s := range ss { - res += s - } - - // TXT record must have "grpc_config=" attribute in order to be used as service config. - if !strings.HasPrefix(res, txtAttribute) { - grpclog.Warningf("grpc: TXT record %v missing %v attribute", res, txtAttribute) - return "" - } - return strings.TrimPrefix(res, txtAttribute) -} - -func (d *dnsResolver) lookupHost() []resolver.Address { - var newAddrs []resolver.Address - addrs, err := d.resolver.LookupHost(d.ctx, d.host) - if err != nil { - grpclog.Warningf("grpc: failed dns A record lookup due to %v.\n", err) - return nil - } - for _, a := range addrs { - a, ok := formatIP(a) - if !ok { - grpclog.Errorf("grpc: failed IP parsing due to %v.\n", err) - continue - } - addr := a + ":" + d.port - newAddrs = append(newAddrs, resolver.Address{Addr: addr}) - } - return newAddrs -} - -func (d *dnsResolver) lookup() ([]resolver.Address, string) { - newAddrs := d.lookupSRV() - // Support fallback to non-balancer address. - newAddrs = append(newAddrs, d.lookupHost()...) - if d.disableServiceConfig { - return newAddrs, "" - } - sc := d.lookupTXT() - return newAddrs, canaryingSC(sc) -} - -// formatIP returns ok = false if addr is not a valid textual representation of an IP address. -// If addr is an IPv4 address, return the addr and ok = true. -// If addr is an IPv6 address, return the addr enclosed in square brackets and ok = true. -func formatIP(addr string) (addrIP string, ok bool) { - ip := net.ParseIP(addr) - if ip == nil { - return "", false - } - if ip.To4() != nil { - return addr, true - } - return "[" + addr + "]", true -} - -// parseTarget takes the user input target string and default port, returns formatted host and port info. -// If target doesn't specify a port, set the port to be the defaultPort. -// If target is in IPv6 format and host-name is enclosed in square brackets, brackets -// are stripped when setting the host. -// examples: -// target: "www.google.com" defaultPort: "443" returns host: "www.google.com", port: "443" -// target: "ipv4-host:80" defaultPort: "443" returns host: "ipv4-host", port: "80" -// target: "[ipv6-host]" defaultPort: "443" returns host: "ipv6-host", port: "443" -// target: ":80" defaultPort: "443" returns host: "localhost", port: "80" -func parseTarget(target, defaultPort string) (host, port string, err error) { - if target == "" { - return "", "", errMissingAddr - } - if ip := net.ParseIP(target); ip != nil { - // target is an IPv4 or IPv6(without brackets) address - return target, defaultPort, nil - } - if host, port, err = net.SplitHostPort(target); err == nil { - if port == "" { - // If the port field is empty (target ends with colon), e.g. "[::1]:", this is an error. - return "", "", errEndsWithColon - } - // target has port, i.e ipv4-host:port, [ipv6-host]:port, host-name:port - if host == "" { - // Keep consistent with net.Dial(): If the host is empty, as in ":80", the local system is assumed. - host = "localhost" - } - return host, port, nil - } - if host, port, err = net.SplitHostPort(target + ":" + defaultPort); err == nil { - // target doesn't have port - return host, port, nil - } - return "", "", fmt.Errorf("invalid target address %v, error info: %v", target, err) -} - -type rawChoice struct { - ClientLanguage *[]string `json:"clientLanguage,omitempty"` - Percentage *int `json:"percentage,omitempty"` - ClientHostName *[]string `json:"clientHostName,omitempty"` - ServiceConfig *json.RawMessage `json:"serviceConfig,omitempty"` -} - -func containsString(a *[]string, b string) bool { - if a == nil { - return true - } - for _, c := range *a { - if c == b { - return true - } - } - return false -} - -func chosenByPercentage(a *int) bool { - if a == nil { - return true - } - return grpcrand.Intn(100)+1 <= *a -} - -func canaryingSC(js string) string { - if js == "" { - return "" - } - var rcs []rawChoice - err := json.Unmarshal([]byte(js), &rcs) - if err != nil { - grpclog.Warningf("grpc: failed to parse service config json string due to %v.\n", err) - return "" - } - cliHostname, err := os.Hostname() - if err != nil { - grpclog.Warningf("grpc: failed to get client hostname due to %v.\n", err) - return "" - } - var sc string - for _, c := range rcs { - if !containsString(c.ClientLanguage, golang) || - !chosenByPercentage(c.Percentage) || - !containsString(c.ClientHostName, cliHostname) || - c.ServiceConfig == nil { - continue - } - sc = string(*c.ServiceConfig) - break - } - return sc + return dns.NewBuilder() } diff --git a/vendor/google.golang.org/grpc/resolver/manual/manual.go b/vendor/google.golang.org/grpc/resolver/manual/manual.go index 85a4abe61b2..e141f96a62d 100644 --- a/vendor/google.golang.org/grpc/resolver/manual/manual.go +++ b/vendor/google.golang.org/grpc/resolver/manual/manual.go @@ -30,17 +30,22 @@ import ( // NewBuilderWithScheme creates a new test resolver builder with the given scheme. func NewBuilderWithScheme(scheme string) *Resolver { return &Resolver{ - scheme: scheme, + ResolveNowCallback: func(resolver.ResolveNowOptions) {}, + scheme: scheme, } } // Resolver is also a resolver builder. // It's build() function always returns itself. type Resolver struct { - scheme string + // ResolveNowCallback is called when the ResolveNow method is called on the + // resolver. Must not be nil. Must not be changed after the resolver may + // be built. + ResolveNowCallback func(resolver.ResolveNowOptions) + scheme string // Fields actually belong to the resolver. - cc resolver.ClientConn + CC resolver.ClientConn bootstrapState *resolver.State } @@ -51,8 +56,8 @@ func (r *Resolver) InitialState(s resolver.State) { } // Build returns itself for Resolver, because it's both a builder and a resolver. -func (r *Resolver) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOption) (resolver.Resolver, error) { - r.cc = cc +func (r *Resolver) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) { + r.CC = cc if r.bootstrapState != nil { r.UpdateState(*r.bootstrapState) } @@ -65,14 +70,16 @@ func (r *Resolver) Scheme() string { } // ResolveNow is a noop for Resolver. -func (*Resolver) ResolveNow(o resolver.ResolveNowOption) {} +func (r *Resolver) ResolveNow(o resolver.ResolveNowOptions) { + r.ResolveNowCallback(o) +} // Close is a noop for Resolver. func (*Resolver) Close() {} -// UpdateState calls cc.UpdateState. +// UpdateState calls CC.UpdateState. func (r *Resolver) UpdateState(s resolver.State) { - r.cc.UpdateState(s) + r.CC.UpdateState(s) } // GenerateAndRegisterManualResolver generates a random scheme and a Resolver diff --git a/vendor/google.golang.org/grpc/resolver/passthrough/passthrough.go b/vendor/google.golang.org/grpc/resolver/passthrough/passthrough.go index 893d5d12cb0..c8a0c3daa17 100644 --- a/vendor/google.golang.org/grpc/resolver/passthrough/passthrough.go +++ b/vendor/google.golang.org/grpc/resolver/passthrough/passthrough.go @@ -18,40 +18,9 @@ // Package passthrough implements a pass-through resolver. It sends the target // name without scheme back to gRPC as resolved address. +// +// Deprecated: this package is imported by grpc and should not need to be +// imported directly by users. package passthrough -import "google.golang.org/grpc/resolver" - -const scheme = "passthrough" - -type passthroughBuilder struct{} - -func (*passthroughBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOption) (resolver.Resolver, error) { - r := &passthroughResolver{ - target: target, - cc: cc, - } - r.start() - return r, nil -} - -func (*passthroughBuilder) Scheme() string { - return scheme -} - -type passthroughResolver struct { - target resolver.Target - cc resolver.ClientConn -} - -func (r *passthroughResolver) start() { - r.cc.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: r.target.Endpoint}}}) -} - -func (*passthroughResolver) ResolveNow(o resolver.ResolveNowOption) {} - -func (*passthroughResolver) Close() {} - -func init() { - resolver.Register(&passthroughBuilder{}) -} +import _ "google.golang.org/grpc/internal/resolver/passthrough" // import for side effects after package was moved diff --git a/vendor/google.golang.org/grpc/resolver/resolver.go b/vendor/google.golang.org/grpc/resolver/resolver.go index e83da346a5c..03567d7be74 100644 --- a/vendor/google.golang.org/grpc/resolver/resolver.go +++ b/vendor/google.golang.org/grpc/resolver/resolver.go @@ -21,6 +21,11 @@ package resolver import ( + "context" + "net" + + "google.golang.org/grpc/attributes" + "google.golang.org/grpc/credentials" "google.golang.org/grpc/serviceconfig" ) @@ -69,12 +74,18 @@ func GetDefaultScheme() string { } // AddressType indicates the address type returned by name resolution. +// +// Deprecated: use Attributes in Address instead. type AddressType uint8 const ( // Backend indicates the address is for a backend server. + // + // Deprecated: use Attributes in Address instead. Backend AddressType = iota // GRPCLB indicates the address is for a grpclb load balancer. + // + // Deprecated: use Attributes in Address instead. GRPCLB ) @@ -83,33 +94,80 @@ const ( type Address struct { // Addr is the server address on which a connection will be established. Addr string - // Type is the type of this address. - Type AddressType + // ServerName is the name of this address. + // If non-empty, the ServerName is used as the transport certification authority for + // the address, instead of the hostname from the Dial target string. In most cases, + // this should not be set. // - // e.g. if Type is GRPCLB, ServerName should be the name of the remote load + // If Type is GRPCLB, ServerName should be the name of the remote load // balancer, not the name of the backend. + // + // WARNING: ServerName must only be populated with trusted values. It + // is insecure to populate it with data from untrusted inputs since untrusted + // values could be used to bypass the authority checks performed by TLS. ServerName string + + // Attributes contains arbitrary data about this address intended for + // consumption by the load balancing policy. + Attributes *attributes.Attributes + + // Type is the type of this address. + // + // Deprecated: use Attributes instead. + Type AddressType + // Metadata is the information associated with Addr, which may be used // to make load balancing decision. + // + // Deprecated: use Attributes instead. Metadata interface{} } -// BuildOption includes additional information for the builder to create +// BuildOption is a type alias of BuildOptions for legacy reasons. +// +// Deprecated: use BuildOptions instead. +type BuildOption = BuildOptions + +// BuildOptions includes additional information for the builder to create // the resolver. -type BuildOption struct { - // DisableServiceConfig indicates whether resolver should fetch service config data. +type BuildOptions struct { + // DisableServiceConfig indicates whether a resolver implementation should + // fetch service config data. DisableServiceConfig bool + // DialCreds is the transport credentials used by the ClientConn for + // communicating with the target gRPC service (set via + // WithTransportCredentials). In cases where a name resolution service + // requires the same credentials, the resolver may use this field. In most + // cases though, it is not appropriate, and this field may be ignored. + DialCreds credentials.TransportCredentials + // CredsBundle is the credentials bundle used by the ClientConn for + // communicating with the target gRPC service (set via + // WithCredentialsBundle). In cases where a name resolution service + // requires the same credentials, the resolver may use this field. In most + // cases though, it is not appropriate, and this field may be ignored. + CredsBundle credentials.Bundle + // Dialer is the custom dialer used by the ClientConn for dialling the + // target gRPC service (set via WithDialer). In cases where a name + // resolution service requires the same dialer, the resolver may use this + // field. In most cases though, it is not appropriate, and this field may + // be ignored. + Dialer func(context.Context, string) (net.Conn, error) } // State contains the current Resolver state relevant to the ClientConn. type State struct { - Addresses []Address // Resolved addresses for the target - // ServiceConfig is the parsed service config; obtained from - // serviceconfig.Parse. - ServiceConfig serviceconfig.Config + // Addresses is the latest set of resolved addresses for the target. + Addresses []Address + + // ServiceConfig contains the result from parsing the latest service + // config. If it is nil, it indicates no service config is present or the + // resolver does not provide service configs. + ServiceConfig *serviceconfig.ParseResult - // TODO: add Err error + // Attributes contains arbitrary data about the resolver intended for + // consumption by the load balancing policy. + Attributes *attributes.Attributes } // ClientConn contains the callbacks for resolver to notify any updates @@ -122,6 +180,10 @@ type State struct { type ClientConn interface { // UpdateState updates the state of the ClientConn appropriately. UpdateState(State) + // ReportError notifies the ClientConn that the Resolver encountered an + // error. The ClientConn will notify the load balancer and begin calling + // ResolveNow on the Resolver with exponential backoff. + ReportError(error) // NewAddress is called by resolver to notify ClientConn a new list // of resolved addresses. // The address list should be the complete list of resolved addresses. @@ -133,6 +195,9 @@ type ClientConn interface { // // Deprecated: Use UpdateState instead. NewServiceConfig(serviceConfig string) + // ParseServiceConfig parses the provided service config and returns an + // object that provides the parsed config. + ParseServiceConfig(serviceConfigJSON string) *serviceconfig.ParseResult } // Target represents a target for gRPC, as specified in: @@ -164,14 +229,19 @@ type Builder interface { // // gRPC dial calls Build synchronously, and fails if the returned error is // not nil. - Build(target Target, cc ClientConn, opts BuildOption) (Resolver, error) + Build(target Target, cc ClientConn, opts BuildOptions) (Resolver, error) // Scheme returns the scheme supported by this resolver. // Scheme is defined at https://github.com/grpc/grpc/blob/master/doc/naming.md. Scheme() string } -// ResolveNowOption includes additional information for ResolveNow. -type ResolveNowOption struct{} +// ResolveNowOption is a type alias of ResolveNowOptions for legacy reasons. +// +// Deprecated: use ResolveNowOptions instead. +type ResolveNowOption = ResolveNowOptions + +// ResolveNowOptions includes additional information for ResolveNow. +type ResolveNowOptions struct{} // Resolver watches for the updates on the specified target. // Updates include address updates and service config updates. @@ -180,7 +250,7 @@ type Resolver interface { // again. It's just a hint, resolver can ignore this if it's not necessary. // // It could be called multiple times concurrently. - ResolveNow(ResolveNowOption) + ResolveNow(ResolveNowOptions) // Close closes the resolver. Close() } diff --git a/vendor/google.golang.org/grpc/resolver_conn_wrapper.go b/vendor/google.golang.org/grpc/resolver_conn_wrapper.go index 6934905b0f6..89ba9fa3e09 100644 --- a/vendor/google.golang.org/grpc/resolver_conn_wrapper.go +++ b/vendor/google.golang.org/grpc/resolver_conn_wrapper.go @@ -21,22 +21,29 @@ package grpc import ( "fmt" "strings" - "sync/atomic" + "sync" + "time" + "google.golang.org/grpc/balancer" + "google.golang.org/grpc/credentials" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal/channelz" + "google.golang.org/grpc/internal/grpcsync" "google.golang.org/grpc/resolver" + "google.golang.org/grpc/serviceconfig" ) // ccResolverWrapper is a wrapper on top of cc for resolvers. // It implements resolver.ClientConnection interface. type ccResolverWrapper struct { - cc *ClientConn - resolver resolver.Resolver - addrCh chan []resolver.Address - scCh chan string - done uint32 // accessed atomically; set to 1 when closed. - curState resolver.State + cc *ClientConn + resolverMu sync.Mutex + resolver resolver.Resolver + done *grpcsync.Event + curState resolver.State + + pollingMu sync.Mutex + polling chan struct{} } // split2 returns the values from strings.SplitN(s, sep, 2). @@ -67,12 +74,9 @@ func parseTarget(target string) (ret resolver.Target) { return ret } -// newCCResolverWrapper parses cc.target for scheme and gets the resolver -// builder for this scheme and builds the resolver. The monitoring goroutine -// for it is not started yet and can be created by calling start(). -// -// If withResolverBuilder dial option is set, the specified resolver will be -// used instead. +// newCCResolverWrapper uses the resolver.Builder stored in the ClientConn to +// build a Resolver and returns a ccResolverWrapper object which wraps the +// newly built resolver. func newCCResolverWrapper(cc *ClientConn) (*ccResolverWrapper, error) { rb := cc.dopts.resolverBuilder if rb == nil { @@ -80,47 +84,122 @@ func newCCResolverWrapper(cc *ClientConn) (*ccResolverWrapper, error) { } ccr := &ccResolverWrapper{ - cc: cc, - addrCh: make(chan []resolver.Address, 1), - scCh: make(chan string, 1), + cc: cc, + done: grpcsync.NewEvent(), + } + + var credsClone credentials.TransportCredentials + if creds := cc.dopts.copts.TransportCredentials; creds != nil { + credsClone = creds.Clone() + } + rbo := resolver.BuildOptions{ + DisableServiceConfig: cc.dopts.disableServiceConfig, + DialCreds: credsClone, + CredsBundle: cc.dopts.copts.CredsBundle, + Dialer: cc.dopts.copts.Dialer, } var err error - ccr.resolver, err = rb.Build(cc.parsedTarget, ccr, resolver.BuildOption{DisableServiceConfig: cc.dopts.disableServiceConfig}) + // We need to hold the lock here while we assign to the ccr.resolver field + // to guard against a data race caused by the following code path, + // rb.Build-->ccr.ReportError-->ccr.poll-->ccr.resolveNow, would end up + // accessing ccr.resolver which is being assigned here. + ccr.resolverMu.Lock() + defer ccr.resolverMu.Unlock() + ccr.resolver, err = rb.Build(cc.parsedTarget, ccr, rbo) if err != nil { return nil, err } return ccr, nil } -func (ccr *ccResolverWrapper) resolveNow(o resolver.ResolveNowOption) { - ccr.resolver.ResolveNow(o) +func (ccr *ccResolverWrapper) resolveNow(o resolver.ResolveNowOptions) { + ccr.resolverMu.Lock() + if !ccr.done.HasFired() { + ccr.resolver.ResolveNow(o) + } + ccr.resolverMu.Unlock() } func (ccr *ccResolverWrapper) close() { + ccr.resolverMu.Lock() ccr.resolver.Close() - atomic.StoreUint32(&ccr.done, 1) + ccr.done.Fire() + ccr.resolverMu.Unlock() } -func (ccr *ccResolverWrapper) isDone() bool { - return atomic.LoadUint32(&ccr.done) == 1 +// poll begins or ends asynchronous polling of the resolver based on whether +// err is ErrBadResolverState. +func (ccr *ccResolverWrapper) poll(err error) { + ccr.pollingMu.Lock() + defer ccr.pollingMu.Unlock() + if err != balancer.ErrBadResolverState { + // stop polling + if ccr.polling != nil { + close(ccr.polling) + ccr.polling = nil + } + return + } + if ccr.polling != nil { + // already polling + return + } + p := make(chan struct{}) + ccr.polling = p + go func() { + for i := 0; ; i++ { + ccr.resolveNow(resolver.ResolveNowOptions{}) + t := time.NewTimer(ccr.cc.dopts.resolveNowBackoff(i)) + select { + case <-p: + t.Stop() + return + case <-ccr.done.Done(): + // Resolver has been closed. + t.Stop() + return + case <-t.C: + select { + case <-p: + return + default: + } + // Timer expired; re-resolve. + } + } + }() } func (ccr *ccResolverWrapper) UpdateState(s resolver.State) { - if ccr.isDone() { + if ccr.done.HasFired() { return } grpclog.Infof("ccResolverWrapper: sending update to cc: %v", s) if channelz.IsOn() { ccr.addChannelzTraceEvent(s) } - ccr.cc.updateResolverState(s) ccr.curState = s + ccr.poll(ccr.cc.updateResolverState(ccr.curState, nil)) +} + +func (ccr *ccResolverWrapper) ReportError(err error) { + if ccr.done.HasFired() { + return + } + grpclog.Warningf("ccResolverWrapper: reporting error to cc: %v", err) + if channelz.IsOn() { + channelz.AddTraceEvent(ccr.cc.channelzID, &channelz.TraceEventDesc{ + Desc: fmt.Sprintf("Resolver reported error: %v", err), + Severity: channelz.CtWarning, + }) + } + ccr.poll(ccr.cc.updateResolverState(resolver.State{}, err)) } // NewAddress is called by the resolver implementation to send addresses to gRPC. func (ccr *ccResolverWrapper) NewAddress(addrs []resolver.Address) { - if ccr.isDone() { + if ccr.done.HasFired() { return } grpclog.Infof("ccResolverWrapper: sending new addresses to cc: %v", addrs) @@ -128,31 +207,53 @@ func (ccr *ccResolverWrapper) NewAddress(addrs []resolver.Address) { ccr.addChannelzTraceEvent(resolver.State{Addresses: addrs, ServiceConfig: ccr.curState.ServiceConfig}) } ccr.curState.Addresses = addrs - ccr.cc.updateResolverState(ccr.curState) + ccr.poll(ccr.cc.updateResolverState(ccr.curState, nil)) } // NewServiceConfig is called by the resolver implementation to send service // configs to gRPC. func (ccr *ccResolverWrapper) NewServiceConfig(sc string) { - if ccr.isDone() { + if ccr.done.HasFired() { return } grpclog.Infof("ccResolverWrapper: got new service config: %v", sc) - c, err := parseServiceConfig(sc) - if err != nil { + if ccr.cc.dopts.disableServiceConfig { + grpclog.Infof("Service config lookups disabled; ignoring config") + return + } + scpr := parseServiceConfig(sc) + if scpr.Err != nil { + grpclog.Warningf("ccResolverWrapper: error parsing service config: %v", scpr.Err) + if channelz.IsOn() { + channelz.AddTraceEvent(ccr.cc.channelzID, &channelz.TraceEventDesc{ + Desc: fmt.Sprintf("Error parsing service config: %v", scpr.Err), + Severity: channelz.CtWarning, + }) + } + ccr.poll(balancer.ErrBadResolverState) return } if channelz.IsOn() { - ccr.addChannelzTraceEvent(resolver.State{Addresses: ccr.curState.Addresses, ServiceConfig: c}) + ccr.addChannelzTraceEvent(resolver.State{Addresses: ccr.curState.Addresses, ServiceConfig: scpr}) } - ccr.curState.ServiceConfig = c - ccr.cc.updateResolverState(ccr.curState) + ccr.curState.ServiceConfig = scpr + ccr.poll(ccr.cc.updateResolverState(ccr.curState, nil)) +} + +func (ccr *ccResolverWrapper) ParseServiceConfig(scJSON string) *serviceconfig.ParseResult { + return parseServiceConfig(scJSON) } func (ccr *ccResolverWrapper) addChannelzTraceEvent(s resolver.State) { var updates []string - oldSC, oldOK := ccr.curState.ServiceConfig.(*ServiceConfig) - newSC, newOK := s.ServiceConfig.(*ServiceConfig) + var oldSC, newSC *ServiceConfig + var oldOK, newOK bool + if ccr.curState.ServiceConfig != nil { + oldSC, oldOK = ccr.curState.ServiceConfig.Config.(*ServiceConfig) + } + if s.ServiceConfig != nil { + newSC, newOK = s.ServiceConfig.Config.(*ServiceConfig) + } if oldOK != newOK || (oldOK && newOK && oldSC.rawJSONString != newSC.rawJSONString) { updates = append(updates, "service config updated") } diff --git a/vendor/google.golang.org/grpc/resolver_conn_wrapper_test.go b/vendor/google.golang.org/grpc/resolver_conn_wrapper_test.go index 4a16d7a88c9..bf9c3c293ff 100644 --- a/vendor/google.golang.org/grpc/resolver_conn_wrapper_test.go +++ b/vendor/google.golang.org/grpc/resolver_conn_wrapper_test.go @@ -19,12 +19,20 @@ package grpc import ( + "context" + "errors" "fmt" "net" + "strings" "testing" "time" + "google.golang.org/grpc/balancer" + "google.golang.org/grpc/codes" "google.golang.org/grpc/resolver" + "google.golang.org/grpc/resolver/manual" + "google.golang.org/grpc/serviceconfig" + "google.golang.org/grpc/status" ) func (s) TestParseTarget(t *testing.T) { @@ -114,3 +122,148 @@ func (s) TestDialParseTargetUnknownScheme(t *testing.T) { } } } + +func testResolverErrorPolling(t *testing.T, badUpdate func(*manual.Resolver), goodUpdate func(*manual.Resolver), dopts ...DialOption) { + boIter := make(chan int) + resolverBackoff := func(v int) time.Duration { + boIter <- v + return 0 + } + + r, rcleanup := manual.GenerateAndRegisterManualResolver() + defer rcleanup() + rn := make(chan struct{}) + defer func() { close(rn) }() + r.ResolveNowCallback = func(resolver.ResolveNowOptions) { rn <- struct{}{} } + + defaultDialOptions := []DialOption{ + WithInsecure(), + withResolveNowBackoff(resolverBackoff), + } + cc, err := Dial(r.Scheme()+":///test.server", append(defaultDialOptions, dopts...)...) + if err != nil { + t.Fatalf("Dial(_, _) = _, %v; want _, nil", err) + } + defer cc.Close() + badUpdate(r) + + panicAfter := time.AfterFunc(5*time.Second, func() { panic("timed out polling resolver") }) + defer panicAfter.Stop() + + // Ensure ResolveNow is called, then Backoff with the right parameter, several times + for i := 0; i < 7; i++ { + <-rn + if v := <-boIter; v != i { + t.Errorf("Backoff call %v uses value %v", i, v) + } + } + + // UpdateState will block if ResolveNow is being called (which blocks on + // rn), so call it in a goroutine. + goodUpdate(r) + + // Wait awhile to ensure ResolveNow and Backoff stop being called when the + // state is OK (i.e. polling was cancelled). + for { + t := time.NewTimer(50 * time.Millisecond) + select { + case <-rn: + // ClientConn is still calling ResolveNow + <-boIter + time.Sleep(5 * time.Millisecond) + continue + case <-t.C: + // ClientConn stopped calling ResolveNow; success + } + break + } +} + +const happyBalancerName = "happy balancer" + +func init() { + // Register a balancer that never returns an error from + // UpdateClientConnState, and doesn't do anything else either. + fb := &funcBalancer{ + updateClientConnState: func(s balancer.ClientConnState) error { + return nil + }, + } + balancer.Register(&funcBalancerBuilder{name: happyBalancerName, instance: fb}) +} + +// TestResolverErrorPolling injects resolver errors and verifies ResolveNow is +// called with the appropriate backoff strategy being consulted between +// ResolveNow calls. +func (s) TestResolverErrorPolling(t *testing.T) { + testResolverErrorPolling(t, func(r *manual.Resolver) { + r.CC.ReportError(errors.New("res err")) + }, func(r *manual.Resolver) { + // UpdateState will block if ResolveNow is being called (which blocks on + // rn), so call it in a goroutine. + go r.CC.UpdateState(resolver.State{}) + }, + WithDefaultServiceConfig(fmt.Sprintf(`{ "loadBalancingConfig": [{"%v": {}}] }`, happyBalancerName))) +} + +// TestServiceConfigErrorPolling injects a service config error and verifies +// ResolveNow is called with the appropriate backoff strategy being consulted +// between ResolveNow calls. +func (s) TestServiceConfigErrorPolling(t *testing.T) { + testResolverErrorPolling(t, func(r *manual.Resolver) { + badsc := r.CC.ParseServiceConfig("bad config") + r.UpdateState(resolver.State{ServiceConfig: badsc}) + }, func(r *manual.Resolver) { + // UpdateState will block if ResolveNow is being called (which blocks on + // rn), so call it in a goroutine. + go r.CC.UpdateState(resolver.State{}) + }, + WithDefaultServiceConfig(fmt.Sprintf(`{ "loadBalancingConfig": [{"%v": {}}] }`, happyBalancerName))) +} + +// TestResolverErrorInBuild makes the resolver.Builder call into the ClientConn +// during the Build call. We use two separate mutexes in the code which make +// sure there is no data race in this code path, and also that there is no +// deadlock. +func (s) TestResolverErrorInBuild(t *testing.T) { + r, rcleanup := manual.GenerateAndRegisterManualResolver() + defer rcleanup() + r.InitialState(resolver.State{ServiceConfig: &serviceconfig.ParseResult{Err: errors.New("resolver build err")}}) + + cc, err := Dial(r.Scheme()+":///test.server", WithInsecure()) + if err != nil { + t.Fatalf("Dial(_, _) = _, %v; want _, nil", err) + } + defer cc.Close() + + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + var dummy int + const wantMsg = "error parsing service config" + const wantCode = codes.Unavailable + if err := cc.Invoke(ctx, "/foo/bar", &dummy, &dummy); status.Code(err) != wantCode || !strings.Contains(status.Convert(err).Message(), wantMsg) { + t.Fatalf("cc.Invoke(_, _, _, _) = %v; want status.Code()==%v, status.Message() contains %q", err, wantCode, wantMsg) + } +} + +func (s) TestServiceConfigErrorRPC(t *testing.T) { + r, rcleanup := manual.GenerateAndRegisterManualResolver() + defer rcleanup() + + cc, err := Dial(r.Scheme()+":///test.server", WithInsecure()) + if err != nil { + t.Fatalf("Dial(_, _) = _, %v; want _, nil", err) + } + defer cc.Close() + badsc := r.CC.ParseServiceConfig("bad config") + r.UpdateState(resolver.State{ServiceConfig: badsc}) + + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + var dummy int + const wantMsg = "error parsing service config" + const wantCode = codes.Unavailable + if err := cc.Invoke(ctx, "/foo/bar", &dummy, &dummy); status.Code(err) != wantCode || !strings.Contains(status.Convert(err).Message(), wantMsg) { + t.Fatalf("cc.Invoke(_, _, _, _) = %v; want status.Code()==%v, status.Message() contains %q", err, wantCode, wantMsg) + } +} diff --git a/vendor/google.golang.org/grpc/rpc_util.go b/vendor/google.golang.org/grpc/rpc_util.go index 088c3f1b252..edaba795750 100644 --- a/vendor/google.golang.org/grpc/rpc_util.go +++ b/vendor/google.golang.org/grpc/rpc_util.go @@ -648,35 +648,58 @@ func recvAndDecompress(p *parser, s *transport.Stream, dc Decompressor, maxRecei return nil, st.Err() } + var size int if pf == compressionMade { // To match legacy behavior, if the decompressor is set by WithDecompressor or RPCDecompressor, // use this decompressor as the default. if dc != nil { d, err = dc.Do(bytes.NewReader(d)) - if err != nil { - return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message %v", err) - } + size = len(d) } else { - dcReader, err := compressor.Decompress(bytes.NewReader(d)) - if err != nil { - return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message %v", err) - } - // Read from LimitReader with limit max+1. So if the underlying - // reader is over limit, the result will be bigger than max. - d, err = ioutil.ReadAll(io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1)) - if err != nil { - return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message %v", err) - } + d, size, err = decompress(compressor, d, maxReceiveMessageSize) } + if err != nil { + return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message %v", err) + } + } else { + size = len(d) } - if len(d) > maxReceiveMessageSize { + if size > maxReceiveMessageSize { // TODO: Revisit the error code. Currently keep it consistent with java // implementation. - return nil, status.Errorf(codes.ResourceExhausted, "grpc: received message larger than max (%d vs. %d)", len(d), maxReceiveMessageSize) + return nil, status.Errorf(codes.ResourceExhausted, "grpc: received message larger than max (%d vs. %d)", size, maxReceiveMessageSize) } return d, nil } +// Using compressor, decompress d, returning data and size. +// Optionally, if data will be over maxReceiveMessageSize, just return the size. +func decompress(compressor encoding.Compressor, d []byte, maxReceiveMessageSize int) ([]byte, int, error) { + dcReader, err := compressor.Decompress(bytes.NewReader(d)) + if err != nil { + return nil, 0, err + } + if sizer, ok := compressor.(interface { + DecompressedSize(compressedBytes []byte) int + }); ok { + if size := sizer.DecompressedSize(d); size >= 0 { + if size > maxReceiveMessageSize { + return nil, size, nil + } + // size is used as an estimate to size the buffer, but we + // will read more data if available. + // +MinRead so ReadFrom will not reallocate if size is correct. + buf := bytes.NewBuffer(make([]byte, 0, size+bytes.MinRead)) + bytesRead, err := buf.ReadFrom(io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1)) + return buf.Bytes(), int(bytesRead), err + } + } + // Read from LimitReader with limit max+1. So if the underlying + // reader is over limit, the result will be bigger than max. + d, err = ioutil.ReadAll(io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1)) + return d, len(d), err +} + // For the two compressor parameters, both should not be set, but if they are, // dc takes precedence over compressor. // TODO(dfawley): wrap the old compressor/decompressor using the new API? diff --git a/vendor/google.golang.org/grpc/server.go b/vendor/google.golang.org/grpc/server.go index f064b73e555..0d75cb109a0 100644 --- a/vendor/google.golang.org/grpc/server.go +++ b/vendor/google.golang.org/grpc/server.go @@ -130,6 +130,7 @@ type serverOptions struct { readBufferSize int connectionTimeout time.Duration maxHeaderListSize *uint32 + headerTableSize *uint32 } var defaultServerOptions = serverOptions{ @@ -343,8 +344,8 @@ func StatsHandler(h stats.Handler) ServerOption { // unknown service handler. The provided method is a bidi-streaming RPC service // handler that will be invoked instead of returning the "unimplemented" gRPC // error whenever a request is received for an unregistered service or method. -// The handling function has full access to the Context of the request and the -// stream, and the invocation bypasses interceptors. +// The handling function and stream interceptor (if set) have full access to +// the ServerStream, including its Context. func UnknownServiceHandler(streamHandler StreamHandler) ServerOption { return newFuncServerOption(func(o *serverOptions) { o.unknownStreamDesc = &StreamDesc{ @@ -377,6 +378,16 @@ func MaxHeaderListSize(s uint32) ServerOption { }) } +// HeaderTableSize returns a ServerOption that sets the size of dynamic +// header table for stream. +// +// This API is EXPERIMENTAL. +func HeaderTableSize(s uint32) ServerOption { + return newFuncServerOption(func(o *serverOptions) { + o.headerTableSize = &s + }) +} + // NewServer creates a gRPC server which has no service registered and has not // started to accept requests yet. func NewServer(opt ...ServerOption) *Server { @@ -686,6 +697,7 @@ func (s *Server) newHTTP2Transport(c net.Conn, authInfo credentials.AuthInfo) tr ReadBufferSize: s.opts.readBufferSize, ChannelzParentID: s.channelzID, MaxHeaderListSize: s.opts.maxHeaderListSize, + HeaderTableSize: s.opts.headerTableSize, } st, err := transport.NewServerTransport("http2", c, config) if err != nil { @@ -853,41 +865,58 @@ func (s *Server) sendResponse(t transport.ServerTransport, stream *transport.Str } func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.Stream, srv *service, md *MethodDesc, trInfo *traceInfo) (err error) { - if channelz.IsOn() { - s.incrCallsStarted() - defer func() { - if err != nil && err != io.EOF { - s.incrCallsFailed() - } else { - s.incrCallsSucceeded() - } - }() - } sh := s.opts.statsHandler - if sh != nil { - beginTime := time.Now() - begin := &stats.Begin{ - BeginTime: beginTime, + if sh != nil || trInfo != nil || channelz.IsOn() { + if channelz.IsOn() { + s.incrCallsStarted() } - sh.HandleRPC(stream.Context(), begin) - defer func() { - end := &stats.End{ + var statsBegin *stats.Begin + if sh != nil { + beginTime := time.Now() + statsBegin = &stats.Begin{ BeginTime: beginTime, - EndTime: time.Now(), - } - if err != nil && err != io.EOF { - end.Error = toRPCErr(err) } - sh.HandleRPC(stream.Context(), end) - }() - } - if trInfo != nil { - defer trInfo.tr.Finish() - trInfo.tr.LazyLog(&trInfo.firstLine, false) + sh.HandleRPC(stream.Context(), statsBegin) + } + if trInfo != nil { + trInfo.tr.LazyLog(&trInfo.firstLine, false) + } + // The deferred error handling for tracing, stats handler and channelz are + // combined into one function to reduce stack usage -- a defer takes ~56-64 + // bytes on the stack, so overflowing the stack will require a stack + // re-allocation, which is expensive. + // + // To maintain behavior similar to separate deferred statements, statements + // should be executed in the reverse order. That is, tracing first, stats + // handler second, and channelz last. Note that panics *within* defers will + // lead to different behavior, but that's an acceptable compromise; that + // would be undefined behavior territory anyway. defer func() { - if err != nil && err != io.EOF { - trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) - trInfo.tr.SetError() + if trInfo != nil { + if err != nil && err != io.EOF { + trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) + trInfo.tr.SetError() + } + trInfo.tr.Finish() + } + + if sh != nil { + end := &stats.End{ + BeginTime: statsBegin.BeginTime, + EndTime: time.Now(), + } + if err != nil && err != io.EOF { + end.Error = toRPCErr(err) + } + sh.HandleRPC(stream.Context(), end) + } + + if channelz.IsOn() { + if err != nil && err != io.EOF { + s.incrCallsFailed() + } else { + s.incrCallsSucceeded() + } } }() } @@ -1087,31 +1116,15 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transport.Stream, srv *service, sd *StreamDesc, trInfo *traceInfo) (err error) { if channelz.IsOn() { s.incrCallsStarted() - defer func() { - if err != nil && err != io.EOF { - s.incrCallsFailed() - } else { - s.incrCallsSucceeded() - } - }() } sh := s.opts.statsHandler + var statsBegin *stats.Begin if sh != nil { beginTime := time.Now() - begin := &stats.Begin{ + statsBegin = &stats.Begin{ BeginTime: beginTime, } - sh.HandleRPC(stream.Context(), begin) - defer func() { - end := &stats.End{ - BeginTime: beginTime, - EndTime: time.Now(), - } - if err != nil && err != io.EOF { - end.Error = toRPCErr(err) - } - sh.HandleRPC(stream.Context(), end) - }() + sh.HandleRPC(stream.Context(), statsBegin) } ctx := NewContextWithServerTransportStream(stream.Context(), stream) ss := &serverStream{ @@ -1126,6 +1139,41 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp statsHandler: sh, } + if sh != nil || trInfo != nil || channelz.IsOn() { + // See comment in processUnaryRPC on defers. + defer func() { + if trInfo != nil { + ss.mu.Lock() + if err != nil && err != io.EOF { + ss.trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) + ss.trInfo.tr.SetError() + } + ss.trInfo.tr.Finish() + ss.trInfo.tr = nil + ss.mu.Unlock() + } + + if sh != nil { + end := &stats.End{ + BeginTime: statsBegin.BeginTime, + EndTime: time.Now(), + } + if err != nil && err != io.EOF { + end.Error = toRPCErr(err) + } + sh.HandleRPC(stream.Context(), end) + } + + if channelz.IsOn() { + if err != nil && err != io.EOF { + s.incrCallsFailed() + } else { + s.incrCallsSucceeded() + } + } + }() + } + ss.binlog = binarylog.GetMethodLogger(stream.Method()) if ss.binlog != nil { md, _ := metadata.FromIncomingContext(ctx) @@ -1179,16 +1227,6 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp if trInfo != nil { trInfo.tr.LazyLog(&trInfo.firstLine, false) - defer func() { - ss.mu.Lock() - if err != nil && err != io.EOF { - ss.trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) - ss.trInfo.tr.SetError() - } - ss.trInfo.tr.Finish() - ss.trInfo.tr = nil - ss.mu.Unlock() - }() } var appErr error var server interface{} diff --git a/vendor/google.golang.org/grpc/service_config.go b/vendor/google.golang.org/grpc/service_config.go index d0787f1e2a1..4f8836d48f6 100644 --- a/vendor/google.golang.org/grpc/service_config.go +++ b/vendor/google.golang.org/grpc/service_config.go @@ -261,20 +261,17 @@ type jsonSC struct { } func init() { - internal.ParseServiceConfig = func(sc string) (interface{}, error) { - return parseServiceConfig(sc) - } + internal.ParseServiceConfigForTesting = parseServiceConfig } - -func parseServiceConfig(js string) (*ServiceConfig, error) { +func parseServiceConfig(js string) *serviceconfig.ParseResult { if len(js) == 0 { - return nil, fmt.Errorf("no JSON service config provided") + return &serviceconfig.ParseResult{Err: fmt.Errorf("no JSON service config provided")} } var rsc jsonSC err := json.Unmarshal([]byte(js), &rsc) if err != nil { grpclog.Warningf("grpc: parseServiceConfig error unmarshaling %s due to %v", js, err) - return nil, err + return &serviceconfig.ParseResult{Err: err} } sc := ServiceConfig{ LB: rsc.LoadBalancingPolicy, @@ -288,7 +285,7 @@ func parseServiceConfig(js string) (*ServiceConfig, error) { if len(lbcfg) != 1 { err := fmt.Errorf("invalid loadBalancingConfig: entry %v does not contain exactly 1 policy/config pair: %q", i, lbcfg) grpclog.Warningf(err.Error()) - return nil, err + return &serviceconfig.ParseResult{Err: err} } var name string var jsonCfg json.RawMessage @@ -303,17 +300,25 @@ func parseServiceConfig(js string) (*ServiceConfig, error) { var err error sc.lbConfig.cfg, err = parser.ParseConfig(jsonCfg) if err != nil { - return nil, fmt.Errorf("error parsing loadBalancingConfig for policy %q: %v", name, err) + return &serviceconfig.ParseResult{Err: fmt.Errorf("error parsing loadBalancingConfig for policy %q: %v", name, err)} } } else if string(jsonCfg) != "{}" { grpclog.Warningf("non-empty balancer configuration %q, but balancer does not implement ParseConfig", string(jsonCfg)) } break } + if sc.lbConfig == nil { + // We had a loadBalancingConfig field but did not encounter a + // supported policy. The config is considered invalid in this + // case. + err := fmt.Errorf("invalid loadBalancingConfig: no supported policies found") + grpclog.Warningf(err.Error()) + return &serviceconfig.ParseResult{Err: err} + } } if rsc.MethodConfig == nil { - return &sc, nil + return &serviceconfig.ParseResult{Config: &sc} } for _, m := range *rsc.MethodConfig { if m.Name == nil { @@ -322,7 +327,7 @@ func parseServiceConfig(js string) (*ServiceConfig, error) { d, err := parseDuration(m.Timeout) if err != nil { grpclog.Warningf("grpc: parseServiceConfig error unmarshaling %s due to %v", js, err) - return nil, err + return &serviceconfig.ParseResult{Err: err} } mc := MethodConfig{ @@ -331,7 +336,7 @@ func parseServiceConfig(js string) (*ServiceConfig, error) { } if mc.retryPolicy, err = convertRetryPolicy(m.RetryPolicy); err != nil { grpclog.Warningf("grpc: parseServiceConfig error unmarshaling %s due to %v", js, err) - return nil, err + return &serviceconfig.ParseResult{Err: err} } if m.MaxRequestMessageBytes != nil { if *m.MaxRequestMessageBytes > int64(maxInt) { @@ -356,13 +361,13 @@ func parseServiceConfig(js string) (*ServiceConfig, error) { if sc.retryThrottling != nil { if mt := sc.retryThrottling.MaxTokens; mt <= 0 || mt > 1000 { - return nil, fmt.Errorf("invalid retry throttling config: maxTokens (%v) out of range (0, 1000]", mt) + return &serviceconfig.ParseResult{Err: fmt.Errorf("invalid retry throttling config: maxTokens (%v) out of range (0, 1000]", mt)} } if tr := sc.retryThrottling.TokenRatio; tr <= 0 { - return nil, fmt.Errorf("invalid retry throttling config: tokenRatio (%v) may not be negative", tr) + return &serviceconfig.ParseResult{Err: fmt.Errorf("invalid retry throttling config: tokenRatio (%v) may not be negative", tr)} } } - return &sc, nil + return &serviceconfig.ParseResult{Config: &sc} } func convertRetryPolicy(jrp *jsonRetryPolicy) (p *retryPolicy, err error) { diff --git a/vendor/google.golang.org/grpc/service_config_test.go b/vendor/google.golang.org/grpc/service_config_test.go index 754374bfcc6..ec9f56db2c7 100644 --- a/vendor/google.golang.org/grpc/service_config_test.go +++ b/vendor/google.golang.org/grpc/service_config_test.go @@ -37,13 +37,16 @@ type parseTestCase struct { } func runParseTests(t *testing.T, testCases []parseTestCase) { + t.Helper() for _, c := range testCases { - sc, err := parseServiceConfig(c.scjs) + scpr := parseServiceConfig(c.scjs) + var sc *ServiceConfig + sc, _ = scpr.Config.(*ServiceConfig) if !c.wantErr { c.wantSC.rawJSONString = c.scjs } - if c.wantErr != (err != nil) || !reflect.DeepEqual(sc, c.wantSC) { - t.Fatalf("parseServiceConfig(%s) = %+v, %v, want %+v, %v", c.scjs, sc, err, c.wantSC, c.wantErr) + if c.wantErr != (scpr.Err != nil) || !reflect.DeepEqual(sc, c.wantSC) { + t.Fatalf("parseServiceConfig(%s) = %+v, %v, want %+v, %v", c.scjs, sc, scpr.Err, c.wantSC, c.wantErr) } } } @@ -92,6 +95,23 @@ func (s) TestParseLBConfig(t *testing.T) { runParseTests(t, testcases) } +func (s) TestParseNoLBConfigSupported(t *testing.T) { + // We have a loadBalancingConfig field but will not encounter a supported + // policy. The config will be considered invalid in this case. + testcases := []parseTestCase{ + { + scjs: `{ + "loadBalancingConfig": [{"not_a_balancer1": {} }, {"not_a_balancer2": {}}] +}`, + wantErr: true, + }, { + scjs: `{"loadBalancingConfig": []}`, + wantErr: true, + }, + } + runParseTests(t, testcases) +} + func (s) TestParseLoadBalancer(t *testing.T) { testcases := []parseTestCase{ { diff --git a/vendor/google.golang.org/grpc/serviceconfig/serviceconfig.go b/vendor/google.golang.org/grpc/serviceconfig/serviceconfig.go index 53b27875a1a..187c304421c 100644 --- a/vendor/google.golang.org/grpc/serviceconfig/serviceconfig.go +++ b/vendor/google.golang.org/grpc/serviceconfig/serviceconfig.go @@ -22,27 +22,20 @@ // This package is EXPERIMENTAL. package serviceconfig -import ( - "google.golang.org/grpc/internal" -) - // Config represents an opaque data structure holding a service config. type Config interface { - isConfig() + isServiceConfig() } // LoadBalancingConfig represents an opaque data structure holding a load -// balancer config. +// balancing config. type LoadBalancingConfig interface { isLoadBalancingConfig() } -// Parse parses the JSON service config provided into an internal form or -// returns an error if the config is invalid. -func Parse(ServiceConfigJSON string) (Config, error) { - c, err := internal.ParseServiceConfig(ServiceConfigJSON) - if err != nil { - return nil, err - } - return c.(Config), err +// ParseResult contains a service config or an error. Exactly one must be +// non-nil. +type ParseResult struct { + Config Config + Err error } diff --git a/vendor/google.golang.org/grpc/stats/grpc_testing/test.pb.go b/vendor/google.golang.org/grpc/stats/grpc_testing/test.pb.go index 9db10f81583..6b85379875a 100644 --- a/vendor/google.golang.org/grpc/stats/grpc_testing/test.pb.go +++ b/vendor/google.golang.org/grpc/stats/grpc_testing/test.pb.go @@ -3,13 +3,14 @@ package grpc_testing -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -21,7 +22,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type SimpleRequest struct { Id int32 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` @@ -34,16 +35,17 @@ func (m *SimpleRequest) Reset() { *m = SimpleRequest{} } func (m *SimpleRequest) String() string { return proto.CompactTextString(m) } func (*SimpleRequest) ProtoMessage() {} func (*SimpleRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_test_dd7ffeaa75513a0a, []int{0} + return fileDescriptor_e1cda82041fed8bf, []int{0} } + func (m *SimpleRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SimpleRequest.Unmarshal(m, b) } func (m *SimpleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SimpleRequest.Marshal(b, m, deterministic) } -func (dst *SimpleRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SimpleRequest.Merge(dst, src) +func (m *SimpleRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleRequest.Merge(m, src) } func (m *SimpleRequest) XXX_Size() int { return xxx_messageInfo_SimpleRequest.Size(m) @@ -72,16 +74,17 @@ func (m *SimpleResponse) Reset() { *m = SimpleResponse{} } func (m *SimpleResponse) String() string { return proto.CompactTextString(m) } func (*SimpleResponse) ProtoMessage() {} func (*SimpleResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_test_dd7ffeaa75513a0a, []int{1} + return fileDescriptor_e1cda82041fed8bf, []int{1} } + func (m *SimpleResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SimpleResponse.Unmarshal(m, b) } func (m *SimpleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SimpleResponse.Marshal(b, m, deterministic) } -func (dst *SimpleResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SimpleResponse.Merge(dst, src) +func (m *SimpleResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleResponse.Merge(m, src) } func (m *SimpleResponse) XXX_Size() int { return xxx_messageInfo_SimpleResponse.Size(m) @@ -104,6 +107,25 @@ func init() { proto.RegisterType((*SimpleResponse)(nil), "grpc.testing.SimpleResponse") } +func init() { proto.RegisterFile("grpc_testing/test.proto", fileDescriptor_e1cda82041fed8bf) } + +var fileDescriptor_e1cda82041fed8bf = []byte{ + // 202 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0x2f, 0x2a, 0x48, + 0x8e, 0x2f, 0x49, 0x2d, 0x2e, 0xc9, 0xcc, 0x4b, 0xd7, 0x07, 0xd1, 0x7a, 0x05, 0x45, 0xf9, 0x25, + 0xf9, 0x42, 0x3c, 0x20, 0x09, 0x3d, 0xa8, 0x84, 0x92, 0x3c, 0x17, 0x6f, 0x70, 0x66, 0x6e, 0x41, + 0x4e, 0x6a, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x89, 0x10, 0x1f, 0x17, 0x53, 0x66, 0x8a, 0x04, + 0x93, 0x02, 0xa3, 0x06, 0x6b, 0x10, 0x53, 0x66, 0x8a, 0x92, 0x02, 0x17, 0x1f, 0x4c, 0x41, 0x71, + 0x41, 0x7e, 0x5e, 0x71, 0x2a, 0x54, 0x05, 0x33, 0x4c, 0x85, 0xd1, 0x09, 0x26, 0x2e, 0xee, 0x90, + 0xd4, 0xe2, 0x92, 0xe0, 0xd4, 0xa2, 0xb2, 0xcc, 0xe4, 0x54, 0x21, 0x37, 0x2e, 0xce, 0xd0, 0xbc, + 0xc4, 0xa2, 0x4a, 0xe7, 0xc4, 0x9c, 0x1c, 0x21, 0x69, 0x3d, 0x64, 0xeb, 0xf4, 0x50, 0xec, 0x92, + 0x92, 0xc1, 0x2e, 0x09, 0xb5, 0xc7, 0x9f, 0x8b, 0xcf, 0xad, 0x34, 0x27, 0xc7, 0xa5, 0xb4, 0x20, + 0x27, 0xb5, 0x82, 0x42, 0xc3, 0x34, 0x18, 0x0d, 0x18, 0x85, 0xfc, 0xb9, 0x04, 0x9c, 0x73, 0x32, + 0x53, 0xf3, 0x4a, 0x82, 0x4b, 0x8a, 0x52, 0x13, 0x73, 0x29, 0x36, 0x12, 0x64, 0x20, 0xc8, 0xd3, + 0xa9, 0x45, 0x54, 0x31, 0xd0, 0x80, 0x31, 0x89, 0x0d, 0x1c, 0x45, 0xc6, 0x80, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x4c, 0x43, 0x27, 0x67, 0xbd, 0x01, 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -258,6 +280,23 @@ type TestServiceServer interface { ServerStreamCall(*SimpleRequest, TestService_ServerStreamCallServer) error } +// UnimplementedTestServiceServer can be embedded to have forward compatible implementations. +type UnimplementedTestServiceServer struct { +} + +func (*UnimplementedTestServiceServer) UnaryCall(ctx context.Context, req *SimpleRequest) (*SimpleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnaryCall not implemented") +} +func (*UnimplementedTestServiceServer) FullDuplexCall(srv TestService_FullDuplexCallServer) error { + return status.Errorf(codes.Unimplemented, "method FullDuplexCall not implemented") +} +func (*UnimplementedTestServiceServer) ClientStreamCall(srv TestService_ClientStreamCallServer) error { + return status.Errorf(codes.Unimplemented, "method ClientStreamCall not implemented") +} +func (*UnimplementedTestServiceServer) ServerStreamCall(req *SimpleRequest, srv TestService_ServerStreamCallServer) error { + return status.Errorf(codes.Unimplemented, "method ServerStreamCall not implemented") +} + func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer) { s.RegisterService(&_TestService_serviceDesc, srv) } @@ -382,22 +421,3 @@ var _TestService_serviceDesc = grpc.ServiceDesc{ }, Metadata: "grpc_testing/test.proto", } - -func init() { proto.RegisterFile("grpc_testing/test.proto", fileDescriptor_test_dd7ffeaa75513a0a) } - -var fileDescriptor_test_dd7ffeaa75513a0a = []byte{ - // 202 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0x2f, 0x2a, 0x48, - 0x8e, 0x2f, 0x49, 0x2d, 0x2e, 0xc9, 0xcc, 0x4b, 0xd7, 0x07, 0xd1, 0x7a, 0x05, 0x45, 0xf9, 0x25, - 0xf9, 0x42, 0x3c, 0x20, 0x09, 0x3d, 0xa8, 0x84, 0x92, 0x3c, 0x17, 0x6f, 0x70, 0x66, 0x6e, 0x41, - 0x4e, 0x6a, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x89, 0x10, 0x1f, 0x17, 0x53, 0x66, 0x8a, 0x04, - 0x93, 0x02, 0xa3, 0x06, 0x6b, 0x10, 0x53, 0x66, 0x8a, 0x92, 0x02, 0x17, 0x1f, 0x4c, 0x41, 0x71, - 0x41, 0x7e, 0x5e, 0x71, 0x2a, 0x54, 0x05, 0x33, 0x4c, 0x85, 0xd1, 0x09, 0x26, 0x2e, 0xee, 0x90, - 0xd4, 0xe2, 0x92, 0xe0, 0xd4, 0xa2, 0xb2, 0xcc, 0xe4, 0x54, 0x21, 0x37, 0x2e, 0xce, 0xd0, 0xbc, - 0xc4, 0xa2, 0x4a, 0xe7, 0xc4, 0x9c, 0x1c, 0x21, 0x69, 0x3d, 0x64, 0xeb, 0xf4, 0x50, 0xec, 0x92, - 0x92, 0xc1, 0x2e, 0x09, 0xb5, 0xc7, 0x9f, 0x8b, 0xcf, 0xad, 0x34, 0x27, 0xc7, 0xa5, 0xb4, 0x20, - 0x27, 0xb5, 0x82, 0x42, 0xc3, 0x34, 0x18, 0x0d, 0x18, 0x85, 0xfc, 0xb9, 0x04, 0x9c, 0x73, 0x32, - 0x53, 0xf3, 0x4a, 0x82, 0x4b, 0x8a, 0x52, 0x13, 0x73, 0x29, 0x36, 0x12, 0x64, 0x20, 0xc8, 0xd3, - 0xa9, 0x45, 0x54, 0x31, 0xd0, 0x80, 0x31, 0x89, 0x0d, 0x1c, 0x45, 0xc6, 0x80, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x4c, 0x43, 0x27, 0x67, 0xbd, 0x01, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/stats/stats.go b/vendor/google.golang.org/grpc/stats/stats.go index f3f593c8443..9e22c393f16 100644 --- a/vendor/google.golang.org/grpc/stats/stats.go +++ b/vendor/google.golang.org/grpc/stats/stats.go @@ -91,6 +91,8 @@ type InHeader struct { LocalAddr net.Addr // Compression is the compression algorithm used for the RPC. Compression string + // Header contains the header metadata received. + Header metadata.MD } // IsClient indicates if the stats information is from client side. @@ -104,6 +106,9 @@ type InTrailer struct { Client bool // WireLength is the wire length of trailer. WireLength int + // Trailer contains the trailer metadata received from the server. This + // field is only valid if this InTrailer is from the client side. + Trailer metadata.MD } // IsClient indicates if the stats information is from client side. @@ -146,6 +151,8 @@ type OutHeader struct { LocalAddr net.Addr // Compression is the compression algorithm used for the RPC. Compression string + // Header contains the header metadata sent. + Header metadata.MD } // IsClient indicates if this stats information is from client side. @@ -159,6 +166,9 @@ type OutTrailer struct { Client bool // WireLength is the wire length of trailer. WireLength int + // Trailer contains the trailer metadata sent to the client. This + // field is only valid if this OutTrailer is from the server side. + Trailer metadata.MD } // IsClient indicates if this stats information is from client side. @@ -176,6 +186,7 @@ type End struct { EndTime time.Time // Trailer contains the trailer metadata received from the server. This // field is only valid if this End is from the client side. + // Deprecated: use Trailer in InTrailer instead. Trailer metadata.MD // Error is the error the RPC ended with. It is an error generated from // status.Status and can be converted back to status.Status using diff --git a/vendor/google.golang.org/grpc/stats/stats_test.go b/vendor/google.golang.org/grpc/stats/stats_test.go index 98829035b71..30248c05830 100644 --- a/vendor/google.golang.org/grpc/stats/stats_test.go +++ b/vendor/google.golang.org/grpc/stats/stats_test.go @@ -44,12 +44,17 @@ type connCtxKey struct{} type rpcCtxKey struct{} var ( - // For headers: + // For headers sent to server: testMetadata = metadata.MD{ "key1": []string{"value1"}, "key2": []string{"value2"}, } - // For trailers: + // For headers sent from server: + testHeaderMetadata = metadata.MD{ + "hkey1": []string{"headerValue1"}, + "hkey2": []string{"headerValue2"}, + } + // For trailers sent from server: testTrailerMetadata = metadata.MD{ "tkey1": []string{"trailerValue1"}, "tkey2": []string{"trailerValue2"}, @@ -58,17 +63,16 @@ var ( errorID int32 = 32202 ) -type testServer struct{} +type testServer struct { + testpb.UnimplementedTestServiceServer +} func (s *testServer) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { - md, ok := metadata.FromIncomingContext(ctx) - if ok { - if err := grpc.SendHeader(ctx, md); err != nil { - return nil, status.Errorf(status.Code(err), "grpc.SendHeader(_, %v) = %v, want ", md, err) - } - if err := grpc.SetTrailer(ctx, testTrailerMetadata); err != nil { - return nil, status.Errorf(status.Code(err), "grpc.SetTrailer(_, %v) = %v, want ", testTrailerMetadata, err) - } + if err := grpc.SendHeader(ctx, testHeaderMetadata); err != nil { + return nil, status.Errorf(status.Code(err), "grpc.SendHeader(_, %v) = %v, want ", testHeaderMetadata, err) + } + if err := grpc.SetTrailer(ctx, testTrailerMetadata); err != nil { + return nil, status.Errorf(status.Code(err), "grpc.SetTrailer(_, %v) = %v, want ", testTrailerMetadata, err) } if in.Id == errorID { @@ -79,13 +83,10 @@ func (s *testServer) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (* } func (s *testServer) FullDuplexCall(stream testpb.TestService_FullDuplexCallServer) error { - md, ok := metadata.FromIncomingContext(stream.Context()) - if ok { - if err := stream.SendHeader(md); err != nil { - return status.Errorf(status.Code(err), "%v.SendHeader(%v) = %v, want %v", stream, md, err, nil) - } - stream.SetTrailer(testTrailerMetadata) + if err := stream.SendHeader(testHeaderMetadata); err != nil { + return status.Errorf(status.Code(err), "%v.SendHeader(%v) = %v, want %v", stream, testHeaderMetadata, err, nil) } + stream.SetTrailer(testTrailerMetadata) for { in, err := stream.Recv() if err == io.EOF { @@ -107,13 +108,10 @@ func (s *testServer) FullDuplexCall(stream testpb.TestService_FullDuplexCallServ } func (s *testServer) ClientStreamCall(stream testpb.TestService_ClientStreamCallServer) error { - md, ok := metadata.FromIncomingContext(stream.Context()) - if ok { - if err := stream.SendHeader(md); err != nil { - return status.Errorf(status.Code(err), "%v.SendHeader(%v) = %v, want %v", stream, md, err, nil) - } - stream.SetTrailer(testTrailerMetadata) + if err := stream.SendHeader(testHeaderMetadata); err != nil { + return status.Errorf(status.Code(err), "%v.SendHeader(%v) = %v, want %v", stream, testHeaderMetadata, err, nil) } + stream.SetTrailer(testTrailerMetadata) for { in, err := stream.Recv() if err == io.EOF { @@ -131,13 +129,10 @@ func (s *testServer) ClientStreamCall(stream testpb.TestService_ClientStreamCall } func (s *testServer) ServerStreamCall(in *testpb.SimpleRequest, stream testpb.TestService_ServerStreamCallServer) error { - md, ok := metadata.FromIncomingContext(stream.Context()) - if ok { - if err := stream.SendHeader(md); err != nil { - return status.Errorf(status.Code(err), "%v.SendHeader(%v) = %v, want %v", stream, md, err, nil) - } - stream.SetTrailer(testTrailerMetadata) + if err := stream.SendHeader(testHeaderMetadata); err != nil { + return status.Errorf(status.Code(err), "%v.SendHeader(%v) = %v, want %v", stream, testHeaderMetadata, err, nil) } + stream.SetTrailer(testTrailerMetadata) if in.Id == errorID { return fmt.Errorf("got error id: %v", in.Id) @@ -273,7 +268,6 @@ func (te *test) doUnaryCall(c *rpcConfig) (*testpb.SimpleRequest, *testpb.Simple req = &testpb.SimpleRequest{Id: errorID} } ctx := metadata.NewOutgoingContext(context.Background(), testMetadata) - resp, err = tc.UnaryCall(ctx, req, grpc.WaitForReady(!c.failfast)) return req, resp, err } @@ -402,8 +396,8 @@ const ( outPayload outHeader // TODO: test outTrailer ? - connbegin - connend + connBegin + connEnd ) func checkBegin(t *testing.T, d *gotData, e *expectedData) { @@ -438,7 +432,15 @@ func checkInHeader(t *testing.T, d *gotData, e *expectedData) { if d.ctx == nil { t.Fatalf("d.ctx = nil, want ") } - if !d.client { + if d.client { + // additional headers might be injected so instead of testing equality, test that all the + // expected headers keys have the expected header values. + for key := range testHeaderMetadata { + if !reflect.DeepEqual(st.Header.Get(key), testHeaderMetadata.Get(key)) { + t.Fatalf("st.Header[%s] = %v, want %v", key, st.Header.Get(key), testHeaderMetadata.Get(key)) + } + } + } else { if st.FullMethod != e.method { t.Fatalf("st.FullMethod = %s, want %v", st.FullMethod, e.method) } @@ -448,6 +450,13 @@ func checkInHeader(t *testing.T, d *gotData, e *expectedData) { if st.Compression != e.compression { t.Fatalf("st.Compression = %v, want %v", st.Compression, e.compression) } + // additional headers might be injected so instead of testing equality, test that all the + // expected headers keys have the expected header values. + for key := range testMetadata { + if !reflect.DeepEqual(st.Header.Get(key), testMetadata.Get(key)) { + t.Fatalf("st.Header[%s] = %v, want %v", key, st.Header.Get(key), testMetadata.Get(key)) + } + } if connInfo, ok := d.ctx.Value(connCtxKey{}).(*stats.ConnTagInfo); ok { if connInfo.RemoteAddr != st.RemoteAddr { @@ -525,13 +534,20 @@ func checkInPayload(t *testing.T, d *gotData, e *expectedData) { func checkInTrailer(t *testing.T, d *gotData, e *expectedData) { var ( ok bool + st *stats.InTrailer ) - if _, ok = d.s.(*stats.InTrailer); !ok { + if st, ok = d.s.(*stats.InTrailer); !ok { t.Fatalf("got %T, want InTrailer", d.s) } if d.ctx == nil { t.Fatalf("d.ctx = nil, want ") } + if !st.Client { + t.Fatalf("st IsClient = false, want true") + } + if !reflect.DeepEqual(st.Trailer, testTrailerMetadata) { + t.Fatalf("st.Trailer = %v, want %v", st.Trailer, testTrailerMetadata) + } } func checkOutHeader(t *testing.T, d *gotData, e *expectedData) { @@ -555,6 +571,13 @@ func checkOutHeader(t *testing.T, d *gotData, e *expectedData) { if st.Compression != e.compression { t.Fatalf("st.Compression = %v, want %v", st.Compression, e.compression) } + // additional headers might be injected so instead of testing equality, test that all the + // expected headers keys have the expected header values. + for key := range testMetadata { + if !reflect.DeepEqual(st.Header.Get(key), testMetadata.Get(key)) { + t.Fatalf("st.Header[%s] = %v, want %v", key, st.Header.Get(key), testMetadata.Get(key)) + } + } if rpcInfo, ok := d.ctx.Value(rpcCtxKey{}).(*stats.RPCTagInfo); ok { if rpcInfo.FullMethodName != st.FullMethod { @@ -563,6 +586,14 @@ func checkOutHeader(t *testing.T, d *gotData, e *expectedData) { } else { t.Fatalf("got context %v, want one with rpcCtxKey", d.ctx) } + } else { + // additional headers might be injected so instead of testing equality, test that all the + // expected headers keys have the expected header values. + for key := range testHeaderMetadata { + if !reflect.DeepEqual(st.Header.Get(key), testHeaderMetadata.Get(key)) { + t.Fatalf("st.Header[%s] = %v, want %v", key, st.Header.Get(key), testHeaderMetadata.Get(key)) + } + } } } @@ -633,6 +664,9 @@ func checkOutTrailer(t *testing.T, d *gotData, e *expectedData) { if st.Client { t.Fatalf("st IsClient = true, want false") } + if !reflect.DeepEqual(st.Trailer, testTrailerMetadata) { + t.Fatalf("st.Trailer = %v, want %v", st.Trailer, testTrailerMetadata) + } } func checkEnd(t *testing.T, d *gotData, e *expectedData) { @@ -1038,17 +1072,17 @@ func checkClientStats(t *testing.T, got []*gotData, expect *expectedData, checkF checkFuncs[end].f(t, s, expect) checkFuncs[end].c-- case *stats.ConnBegin: - if checkFuncs[connbegin].c <= 0 { + if checkFuncs[connBegin].c <= 0 { t.Fatalf("unexpected stats: %T", s.s) } - checkFuncs[connbegin].f(t, s, expect) - checkFuncs[connbegin].c-- + checkFuncs[connBegin].f(t, s, expect) + checkFuncs[connBegin].c-- case *stats.ConnEnd: - if checkFuncs[connend].c <= 0 { + if checkFuncs[connEnd].c <= 0 { t.Fatalf("unexpected stats: %T", s.s) } - checkFuncs[connend].f(t, s, expect) - checkFuncs[connend].c-- + checkFuncs[connEnd].f(t, s, expect) + checkFuncs[connEnd].c-- default: t.Fatalf("unexpected stats: %T", s.s) } diff --git a/vendor/google.golang.org/grpc/status/status_test.go b/vendor/google.golang.org/grpc/status/status_test.go index b7db2d3d809..a1932aa6803 100644 --- a/vendor/google.golang.org/grpc/status/status_test.go +++ b/vendor/google.golang.org/grpc/status/status_test.go @@ -22,13 +22,13 @@ import ( "context" "errors" "fmt" - "reflect" "testing" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" apb "github.com/golang/protobuf/ptypes/any" dpb "github.com/golang/protobuf/ptypes/duration" + "github.com/google/go-cmp/cmp" cpb "google.golang.org/genproto/googleapis/rpc/code" epb "google.golang.org/genproto/googleapis/rpc/errdetails" spb "google.golang.org/genproto/googleapis/rpc/status" @@ -318,12 +318,16 @@ func TestStatus_ErrorDetails_Fail(t *testing.T) { } for _, tc := range tests { got := tc.s.Details() - if !reflect.DeepEqual(got, tc.i) { + if !cmp.Equal(got, tc.i, cmp.Comparer(proto.Equal), cmp.Comparer(equalError)) { t.Errorf("(%v).Details() = %+v, want %+v", str(tc.s), got, tc.i) } } } +func equalError(x, y error) bool { + return x == y || (x != nil && y != nil && x.Error() == y.Error()) +} + func str(s *Status) string { if s == nil { return "nil" diff --git a/vendor/google.golang.org/grpc/stream.go b/vendor/google.golang.org/grpc/stream.go index 134a624a15d..bb99940e36f 100644 --- a/vendor/google.golang.org/grpc/stream.go +++ b/vendor/google.golang.org/grpc/stream.go @@ -488,7 +488,7 @@ func (cs *clientStream) shouldRetry(err error) error { pushback := 0 hasPushback := false if cs.attempt.s != nil { - if to, toErr := cs.attempt.s.TrailersOnly(); toErr != nil || !to { + if !cs.attempt.s.TrailersOnly() { return err } diff --git a/vendor/google.golang.org/grpc/stress/client/main.go b/vendor/google.golang.org/grpc/stress/client/main.go index d9115c943ad..40aa99fec72 100644 --- a/vendor/google.golang.org/grpc/stress/client/main.go +++ b/vendor/google.golang.org/grpc/stress/client/main.go @@ -53,7 +53,7 @@ var ( useTLS = flag.Bool("use_tls", false, "Connection uses TLS if true, else plain TCP") testCA = flag.Bool("use_test_ca", false, "Whether to replace platform root CAs with test CA as the CA root") tlsServerName = flag.String("server_host_override", "foo.test.google.fr", "The server name use to verify the hostname returned by TLS handshake if it is not empty. Otherwise, --server_host is used.") - caFile = flag.String("ca_file", "", "The file containning the CA root cert file") + caFile = flag.String("ca_file", "", "The file containing the CA root cert file") ) // testCaseWithWeight contains the test case type and its weight. diff --git a/vendor/google.golang.org/grpc/stress/grpc_testing/metrics.pb.go b/vendor/google.golang.org/grpc/stress/grpc_testing/metrics.pb.go index 0a8ad44f036..05bfabb18d4 100644 --- a/vendor/google.golang.org/grpc/stress/grpc_testing/metrics.pb.go +++ b/vendor/google.golang.org/grpc/stress/grpc_testing/metrics.pb.go @@ -3,13 +3,14 @@ package grpc_testing -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -21,7 +22,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // Response message containing the gauge name and value type GaugeResponse struct { @@ -40,16 +41,17 @@ func (m *GaugeResponse) Reset() { *m = GaugeResponse{} } func (m *GaugeResponse) String() string { return proto.CompactTextString(m) } func (*GaugeResponse) ProtoMessage() {} func (*GaugeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_metrics_c9a45afc44ac5637, []int{0} + return fileDescriptor_6039342a2ba47b72, []int{0} } + func (m *GaugeResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GaugeResponse.Unmarshal(m, b) } func (m *GaugeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GaugeResponse.Marshal(b, m, deterministic) } -func (dst *GaugeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GaugeResponse.Merge(dst, src) +func (m *GaugeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GaugeResponse.Merge(m, src) } func (m *GaugeResponse) XXX_Size() int { return xxx_messageInfo_GaugeResponse.Size(m) @@ -117,85 +119,15 @@ func (m *GaugeResponse) GetStringValue() string { return "" } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*GaugeResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _GaugeResponse_OneofMarshaler, _GaugeResponse_OneofUnmarshaler, _GaugeResponse_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*GaugeResponse) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*GaugeResponse_LongValue)(nil), (*GaugeResponse_DoubleValue)(nil), (*GaugeResponse_StringValue)(nil), } } -func _GaugeResponse_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*GaugeResponse) - // value - switch x := m.Value.(type) { - case *GaugeResponse_LongValue: - b.EncodeVarint(2<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.LongValue)) - case *GaugeResponse_DoubleValue: - b.EncodeVarint(3<<3 | proto.WireFixed64) - b.EncodeFixed64(math.Float64bits(x.DoubleValue)) - case *GaugeResponse_StringValue: - b.EncodeVarint(4<<3 | proto.WireBytes) - b.EncodeStringBytes(x.StringValue) - case nil: - default: - return fmt.Errorf("GaugeResponse.Value has unexpected type %T", x) - } - return nil -} - -func _GaugeResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*GaugeResponse) - switch tag { - case 2: // value.long_value - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Value = &GaugeResponse_LongValue{int64(x)} - return true, err - case 3: // value.double_value - if wire != proto.WireFixed64 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed64() - m.Value = &GaugeResponse_DoubleValue{math.Float64frombits(x)} - return true, err - case 4: // value.string_value - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Value = &GaugeResponse_StringValue{x} - return true, err - default: - return false, nil - } -} - -func _GaugeResponse_OneofSizer(msg proto.Message) (n int) { - m := msg.(*GaugeResponse) - // value - switch x := m.Value.(type) { - case *GaugeResponse_LongValue: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.LongValue)) - case *GaugeResponse_DoubleValue: - n += 1 // tag and wire - n += 8 - case *GaugeResponse_StringValue: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.StringValue))) - n += len(x.StringValue) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - // Request message containing the gauge name type GaugeRequest struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` @@ -208,16 +140,17 @@ func (m *GaugeRequest) Reset() { *m = GaugeRequest{} } func (m *GaugeRequest) String() string { return proto.CompactTextString(m) } func (*GaugeRequest) ProtoMessage() {} func (*GaugeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_metrics_c9a45afc44ac5637, []int{1} + return fileDescriptor_6039342a2ba47b72, []int{1} } + func (m *GaugeRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GaugeRequest.Unmarshal(m, b) } func (m *GaugeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GaugeRequest.Marshal(b, m, deterministic) } -func (dst *GaugeRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GaugeRequest.Merge(dst, src) +func (m *GaugeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GaugeRequest.Merge(m, src) } func (m *GaugeRequest) XXX_Size() int { return xxx_messageInfo_GaugeRequest.Size(m) @@ -245,16 +178,17 @@ func (m *EmptyMessage) Reset() { *m = EmptyMessage{} } func (m *EmptyMessage) String() string { return proto.CompactTextString(m) } func (*EmptyMessage) ProtoMessage() {} func (*EmptyMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_metrics_c9a45afc44ac5637, []int{2} + return fileDescriptor_6039342a2ba47b72, []int{2} } + func (m *EmptyMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EmptyMessage.Unmarshal(m, b) } func (m *EmptyMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_EmptyMessage.Marshal(b, m, deterministic) } -func (dst *EmptyMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_EmptyMessage.Merge(dst, src) +func (m *EmptyMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_EmptyMessage.Merge(m, src) } func (m *EmptyMessage) XXX_Size() int { return xxx_messageInfo_EmptyMessage.Size(m) @@ -271,6 +205,28 @@ func init() { proto.RegisterType((*EmptyMessage)(nil), "grpc.testing.EmptyMessage") } +func init() { proto.RegisterFile("metrics.proto", fileDescriptor_6039342a2ba47b72) } + +var fileDescriptor_6039342a2ba47b72 = []byte{ + // 256 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x3f, 0x4f, 0xc3, 0x30, + 0x10, 0xc5, 0x6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0xaa, 0x17, 0x90, 0x19, 0xf2, 0x83, 0x31, + 0xc1, 0x8c, 0xd4, 0x32, 0x1d, 0xf6, 0x4f, 0x87, 0xd7, 0x97, 0x57, 0x87, 0xb3, 0x83, 0x7f, 0xb9, + 0x15, 0xea, 0x09, 0x2e, 0x32, 0xe4, 0x40, 0xff, 0xda, 0x0c, 0x93, 0x1e, 0xb5, 0xd9, 0x9c, 0x85, + 0x2d, 0xdc, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x5e, 0x7d, 0xb2, 0xc9, 0x96, 0x01, 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -348,6 +304,17 @@ type MetricsServiceServer interface { GetGauge(context.Context, *GaugeRequest) (*GaugeResponse, error) } +// UnimplementedMetricsServiceServer can be embedded to have forward compatible implementations. +type UnimplementedMetricsServiceServer struct { +} + +func (*UnimplementedMetricsServiceServer) GetAllGauges(req *EmptyMessage, srv MetricsService_GetAllGaugesServer) error { + return status.Errorf(codes.Unimplemented, "method GetAllGauges not implemented") +} +func (*UnimplementedMetricsServiceServer) GetGauge(ctx context.Context, req *GaugeRequest) (*GaugeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetGauge not implemented") +} + func RegisterMetricsServiceServer(s *grpc.Server, srv MetricsServiceServer) { s.RegisterService(&_MetricsService_serviceDesc, srv) } @@ -409,25 +376,3 @@ var _MetricsService_serviceDesc = grpc.ServiceDesc{ }, Metadata: "metrics.proto", } - -func init() { proto.RegisterFile("metrics.proto", fileDescriptor_metrics_c9a45afc44ac5637) } - -var fileDescriptor_metrics_c9a45afc44ac5637 = []byte{ - // 256 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x3f, 0x4f, 0xc3, 0x30, - 0x10, 0xc5, 0x6b, 0x5a, 0xfe, 0xf4, 0x70, 0x3b, 0x78, 0xaa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1, 0x8c, 0xd4, 0x32, 0x1d, 0xf6, 0x4f, 0x87, 0xd7, 0x97, 0x57, 0x87, 0xb3, 0x83, 0x7f, 0xb9, - 0x15, 0xea, 0x09, 0x2e, 0x32, 0xe4, 0x40, 0xff, 0xda, 0x0c, 0x93, 0x1e, 0xb5, 0xd9, 0x9c, 0x85, - 0x2d, 0xdc, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x5e, 0x7d, 0xb2, 0xc9, 0x96, 0x01, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/stress/metrics_client/main.go b/vendor/google.golang.org/grpc/stress/metrics_client/main.go index c9a5c8c559f..c59768928a7 100644 --- a/vendor/google.golang.org/grpc/stress/metrics_client/main.go +++ b/vendor/google.golang.org/grpc/stress/metrics_client/main.go @@ -30,14 +30,14 @@ import ( ) var ( - metricsServerAddress = flag.String("metrics_server_address", "", "The metrics server addresses in the fomrat :") + metricsServerAddress = flag.String("metrics_server_address", "", "The metrics server addresses in the format :") totalOnly = flag.Bool("total_only", false, "If true, this prints only the total value of all gauges") ) func printMetrics(client metricspb.MetricsServiceClient, totalOnly bool) { stream, err := client.GetAllGauges(context.Background(), &metricspb.EmptyMessage{}) if err != nil { - grpclog.Fatalf("failed to call GetAllGuages: %v", err) + grpclog.Fatalf("failed to call GetAllGauges: %v", err) } var ( diff --git a/vendor/google.golang.org/grpc/test/balancer_test.go b/vendor/google.golang.org/grpc/test/balancer_test.go index 30c01eb0375..afa9ec1b7ea 100644 --- a/vendor/google.golang.org/grpc/test/balancer_test.go +++ b/vendor/google.golang.org/grpc/test/balancer_test.go @@ -49,7 +49,7 @@ type testBalancer struct { sc balancer.SubConn newSubConnOptions balancer.NewSubConnOptions - pickOptions []balancer.PickOptions + pickInfos []balancer.PickInfo doneInfo []balancer.DoneInfo } @@ -70,7 +70,7 @@ func (b *testBalancer) HandleResolvedAddrs(addrs []resolver.Address, err error) grpclog.Errorf("testBalancer: failed to NewSubConn: %v", err) return } - b.cc.UpdateBalancerState(connectivity.Connecting, &picker{sc: b.sc, bal: b}) + b.cc.UpdateState(balancer.State{ConnectivityState: connectivity.Connecting, Picker: &picker{sc: b.sc, bal: b}}) b.sc.Connect() } } @@ -88,11 +88,11 @@ func (b *testBalancer) HandleSubConnStateChange(sc balancer.SubConn, s connectiv switch s { case connectivity.Ready, connectivity.Idle: - b.cc.UpdateBalancerState(s, &picker{sc: sc, bal: b}) + b.cc.UpdateState(balancer.State{ConnectivityState: s, Picker: &picker{sc: sc, bal: b}}) case connectivity.Connecting: - b.cc.UpdateBalancerState(s, &picker{err: balancer.ErrNoSubConnAvailable, bal: b}) + b.cc.UpdateState(balancer.State{ConnectivityState: s, Picker: &picker{err: balancer.ErrNoSubConnAvailable, bal: b}}) case connectivity.TransientFailure: - b.cc.UpdateBalancerState(s, &picker{err: balancer.ErrTransientFailure, bal: b}) + b.cc.UpdateState(balancer.State{ConnectivityState: s, Picker: &picker{err: balancer.ErrTransientFailure, bal: b}}) } } @@ -105,12 +105,13 @@ type picker struct { bal *testBalancer } -func (p *picker) Pick(ctx context.Context, opts balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error) { +func (p *picker) Pick(info balancer.PickInfo) (balancer.PickResult, error) { if p.err != nil { - return nil, nil, p.err + return balancer.PickResult{}, p.err } - p.bal.pickOptions = append(p.bal.pickOptions, opts) - return p.sc, func(d balancer.DoneInfo) { p.bal.doneInfo = append(p.bal.doneInfo, d) }, nil + info.Ctx = nil // Do not validate context. + p.bal.pickInfos = append(p.bal.pickInfos, info) + return balancer.PickResult{SubConn: p.sc, Done: func(d balancer.DoneInfo) { p.bal.doneInfo = append(p.bal.doneInfo, d) }}, nil } func (s) TestCredsBundleFromBalancer(t *testing.T) { @@ -177,8 +178,8 @@ func testDoneInfo(t *testing.T, e env) { if len(b.doneInfo) < 2 || !reflect.DeepEqual(b.doneInfo[1].Trailer, testTrailerMetadata) { t.Fatalf("b.doneInfo = %v; want b.doneInfo[1].Trailer = %v", b.doneInfo, testTrailerMetadata) } - if len(b.pickOptions) != len(b.doneInfo) { - t.Fatalf("Got %d picks, but %d doneInfo, want equal amount", len(b.pickOptions), len(b.doneInfo)) + if len(b.pickInfos) != len(b.doneInfo) { + t.Fatalf("Got %d picks, but %d doneInfo, want equal amount", len(b.pickInfos), len(b.doneInfo)) } // To test done() is always called, even if it's returned with a non-Ready // SubConn. @@ -194,8 +195,8 @@ func testDoneInfo(t *testing.T, e env) { }() te.srv.Stop() <-finished - if len(b.pickOptions) != len(b.doneInfo) { - t.Fatalf("Got %d picks, %d doneInfo, want equal amount", len(b.pickOptions), len(b.doneInfo)) + if len(b.pickInfos) != len(b.doneInfo) { + t.Fatalf("Got %d picks, %d doneInfo, want equal amount", len(b.pickInfos), len(b.doneInfo)) } } @@ -246,11 +247,11 @@ func testDoneLoads(t *testing.T, e env) { t.Fatalf("TestService/EmptyCall(_, _) = _, %v, want _, %v", err, nil) } - poWant := []balancer.PickOptions{ + piWant := []balancer.PickInfo{ {FullMethodName: "/grpc.testing.TestService/EmptyCall"}, } - if !reflect.DeepEqual(b.pickOptions, poWant) { - t.Fatalf("b.pickOptions = %v; want %v", b.pickOptions, poWant) + if !reflect.DeepEqual(b.pickInfos, piWant) { + t.Fatalf("b.pickInfos = %v; want %v", b.pickInfos, piWant) } if len(b.doneInfo) < 1 { diff --git a/vendor/google.golang.org/grpc/test/bufconn/bufconn.go b/vendor/google.golang.org/grpc/test/bufconn/bufconn.go index 60ae770f54e..168cdb8578d 100644 --- a/vendor/google.golang.org/grpc/test/bufconn/bufconn.go +++ b/vendor/google.golang.org/grpc/test/bufconn/bufconn.go @@ -37,7 +37,16 @@ type Listener struct { done chan struct{} } +// Implementation of net.Error providing timeout +type netErrorTimeout struct { + error +} + +func (e netErrorTimeout) Timeout() bool { return true } +func (e netErrorTimeout) Temporary() bool { return false } + var errClosed = fmt.Errorf("closed") +var errTimeout net.Error = netErrorTimeout{error: fmt.Errorf("i/o timeout")} // Listen returns a Listener that can only be contacted by its own Dialers and // creates buffered connections between the two. @@ -104,6 +113,13 @@ type pipe struct { wwait sync.Cond rwait sync.Cond + // Indicate that a write/read timeout has occurred + wtimedout bool + rtimedout bool + + wtimer *time.Timer + rtimer *time.Timer + closed bool writeClosed bool } @@ -112,6 +128,9 @@ func newPipe(sz int) *pipe { p := &pipe{buf: make([]byte, 0, sz)} p.wwait.L = &p.mu p.rwait.L = &p.mu + + p.wtimer = time.AfterFunc(0, func() {}) + p.rtimer = time.AfterFunc(0, func() {}) return p } @@ -137,6 +156,10 @@ func (p *pipe) Read(b []byte) (n int, err error) { if p.writeClosed { return 0, io.EOF } + if p.rtimedout { + return 0, errTimeout + } + p.rwait.Wait() } wasFull := p.full() @@ -171,6 +194,10 @@ func (p *pipe) Write(b []byte) (n int, err error) { if !p.full() { break } + if p.wtimedout { + return 0, errTimeout + } + p.wwait.Wait() } wasEmpty := p.empty() @@ -232,11 +259,48 @@ func (c *conn) Close() error { return err2 } -func (*conn) LocalAddr() net.Addr { return addr{} } -func (*conn) RemoteAddr() net.Addr { return addr{} } -func (c *conn) SetDeadline(t time.Time) error { return fmt.Errorf("unsupported") } -func (c *conn) SetReadDeadline(t time.Time) error { return fmt.Errorf("unsupported") } -func (c *conn) SetWriteDeadline(t time.Time) error { return fmt.Errorf("unsupported") } +func (c *conn) SetDeadline(t time.Time) error { + c.SetReadDeadline(t) + c.SetWriteDeadline(t) + return nil +} + +func (c *conn) SetReadDeadline(t time.Time) error { + p := c.Reader.(*pipe) + p.mu.Lock() + defer p.mu.Unlock() + p.rtimer.Stop() + p.rtimedout = false + if !t.IsZero() { + p.rtimer = time.AfterFunc(time.Until(t), func() { + p.mu.Lock() + defer p.mu.Unlock() + p.rtimedout = true + p.rwait.Broadcast() + }) + } + return nil +} + +func (c *conn) SetWriteDeadline(t time.Time) error { + p := c.Writer.(*pipe) + p.mu.Lock() + defer p.mu.Unlock() + p.wtimer.Stop() + p.wtimedout = false + if !t.IsZero() { + p.wtimer = time.AfterFunc(time.Until(t), func() { + p.mu.Lock() + defer p.mu.Unlock() + p.wtimedout = true + p.wwait.Broadcast() + }) + } + return nil +} + +func (*conn) LocalAddr() net.Addr { return addr{} } +func (*conn) RemoteAddr() net.Addr { return addr{} } type addr struct{} diff --git a/vendor/google.golang.org/grpc/test/bufconn/bufconn_test.go b/vendor/google.golang.org/grpc/test/bufconn/bufconn_test.go index 65b4caa087b..ea1e8c99405 100644 --- a/vendor/google.golang.org/grpc/test/bufconn/bufconn_test.go +++ b/vendor/google.golang.org/grpc/test/bufconn/bufconn_test.go @@ -96,7 +96,7 @@ func TestConn(t *testing.T) { func TestConnCloseWithData(t *testing.T) { lis := Listen(7) - errChan := make(chan error) + errChan := make(chan error, 1) var lisConn net.Conn go func() { var err error @@ -197,3 +197,122 @@ func TestCloseWhileAccepting(t *testing.T) { t.Fatalf("c, err = %v, %v; want nil, %v", c, err, errClosed) } } + +func TestDeadline(t *testing.T) { + sig := make(chan error, 2) + blockingWrite := func(conn net.Conn) { + _, err := conn.Write([]byte("0123456789")) + sig <- err + } + + blockingRead := func(conn net.Conn) { + _, err := conn.Read(make([]byte, 10)) + sig <- err + } + + p1, p2 := newPipe(5), newPipe(5) + c1, c2 := &conn{p1, p1}, &conn{p2, p2} + defer c1.Close() + defer c2.Close() + + // Test with deadline + c1.SetWriteDeadline(time.Now()) + + go blockingWrite(c1) + select { + case <-time.After(100 * time.Millisecond): + t.Fatalf("Write timeout timed out, c = %v", c1) + case err := <-sig: + if netErr, ok := err.(net.Error); ok { + if !netErr.Timeout() { + t.Fatalf("Write returned unexpected error, c = %v, err = %v", c1, netErr) + } + } else { + t.Fatalf("Write returned unexpected error, c = %v, err = %v", c1, err) + } + } + + c2.SetReadDeadline(time.Now()) + + go blockingRead(c2) + select { + case <-time.After(100 * time.Millisecond): + t.Fatalf("Read timeout timed out, c = %v", c2) + case err := <-sig: + if netErr, ok := err.(net.Error); ok { + if !netErr.Timeout() { + t.Fatalf("Read returned unexpected error, c = %v, err = %v", c2, netErr) + } + } else { + t.Fatalf("Read returned unexpected error, c = %v, err = %v", c2, err) + } + } + + // Test timing out pending reads/writes + c1.SetWriteDeadline(time.Time{}) + c2.SetReadDeadline(time.Time{}) + + go blockingWrite(c1) + select { + case <-time.After(100 * time.Millisecond): + case err := <-sig: + t.Fatalf("Write returned before timeout, err = %v", err) + } + + c1.SetWriteDeadline(time.Now()) + select { + case <-time.After(100 * time.Millisecond): + t.Fatalf("Write timeout timed out, c = %v", c1) + case err := <-sig: + if netErr, ok := err.(net.Error); ok { + if !netErr.Timeout() { + t.Fatalf("Write returned unexpected error, c = %v, err = %v", c1, netErr) + } + } else { + t.Fatalf("Write returned unexpected error, c = %v, err = %v", c1, err) + } + } + + go blockingRead(c2) + select { + case <-time.After(100 * time.Millisecond): + case err := <-sig: + t.Fatalf("Read returned before timeout, err = %v", err) + } + + c2.SetReadDeadline(time.Now()) + select { + case <-time.After(100 * time.Millisecond): + t.Fatalf("Read timeout timed out, c = %v", c2) + case err := <-sig: + if netErr, ok := err.(net.Error); ok { + if !netErr.Timeout() { + t.Fatalf("Read returned unexpected error, c = %v, err = %v", c2, netErr) + } + } else { + t.Fatalf("Read returned unexpected error, c = %v, err = %v", c2, err) + } + } + + // Test non-blocking read/write + c1, c2 = &conn{p1, p2}, &conn{p2, p1} + + c1.SetWriteDeadline(time.Now().Add(10 * time.Second)) + c2.SetReadDeadline(time.Now().Add(10 * time.Second)) + + // Not blocking here + go blockingWrite(c1) + go blockingRead(c2) + + // Read response from both routines + for i := 0; i < 2; i++ { + select { + case <-time.After(100 * time.Millisecond): + t.Fatalf("Read/Write timed out, c1 = %v, c2 = %v", c1, c2) + case err := <-sig: + if err != nil { + t.Fatalf("Read/Write failed to complete, c1 = %v, c2 = %v, err = %v", c1, c2, err) + } + } + } +} diff --git a/vendor/google.golang.org/grpc/test/channelz_test.go b/vendor/google.golang.org/grpc/test/channelz_test.go index ebbb3e54b9e..45021022529 100644 --- a/vendor/google.golang.org/grpc/test/channelz_test.go +++ b/vendor/google.golang.org/grpc/test/channelz_test.go @@ -230,7 +230,7 @@ func (s) TestCZNestedChannelRegistrationAndDeletion(t *testing.T) { t.Fatal(err) } - r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: "127.0.0.1:0"}}, ServiceConfig: parseCfg(`{"loadBalancingPolicy": "round_robin"}`)}) + r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: "127.0.0.1:0"}}, ServiceConfig: parseCfg(r, `{"loadBalancingPolicy": "round_robin"}`)}) // wait for the shutdown of grpclb balancer if err := verifyResultWithDelay(func() (bool, error) { @@ -846,21 +846,6 @@ func doServerSideInitiatedFailedStreamWithGoAway(tc testpb.TestServiceClient, t } } -// this func is to be used to test client side counting of failed streams. -func doServerSideInitiatedFailedStreamWithClientBreakFlowControl(tc testpb.TestServiceClient, t *testing.T, dw *dialerWrapper) { - stream, err := tc.FullDuplexCall(context.Background()) - if err != nil { - t.Fatalf("TestService/FullDuplexCall(_) = _, %v, want ", err) - } - // sleep here to make sure header frame being sent before the data frame we write directly below. - time.Sleep(10 * time.Millisecond) - payload := make([]byte, 65537) - dw.getRawConnWrapper().writeRawFrame(http2.FrameData, 0, tc.(*testServiceClientWrapper).getCurrentStreamID(), payload) - if _, err := stream.Recv(); err == nil || status.Code(err) != codes.ResourceExhausted { - t.Fatalf("%v.Recv() = %v, want error code: %v", stream, err, codes.ResourceExhausted) - } -} - func doIdleCallToInvokeKeepAlive(tc testpb.TestServiceClient, t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) _, err := tc.FullDuplexCall(ctx) @@ -981,12 +966,35 @@ func (s) TestCZClientAndServerSocketMetricsStreamsCountFlowControlRSTStream(t *t // Avoid overflowing connection level flow control window, which will lead to // transport being closed. te.serverInitialConnWindowSize = 65536 * 2 - te.startServer(&testServer{security: e.security}) + ts := &funcServer{fullDuplexCall: func(stream testpb.TestService_FullDuplexCallServer) error { + stream.Send(&testpb.StreamingOutputCallResponse{}) + <-stream.Context().Done() + return status.Errorf(codes.DeadlineExceeded, "deadline exceeded or cancelled") + }} + te.startServer(ts) defer te.tearDown() cc, dw := te.clientConnWithConnControl() tc := &testServiceClientWrapper{TestServiceClient: testpb.NewTestServiceClient(cc)} - doServerSideInitiatedFailedStreamWithClientBreakFlowControl(tc, t, dw) + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + stream, err := tc.FullDuplexCall(ctx) + if err != nil { + t.Fatalf("TestService/FullDuplexCall(_) = _, %v, want ", err) + } + if _, err := stream.Recv(); err != nil { + t.Fatalf("stream.Recv() = %v, want nil", err) + } + go func() { + payload := make([]byte, 16384) + for i := 0; i < 6; i++ { + dw.getRawConnWrapper().writeRawFrame(http2.FrameData, 0, tc.getCurrentStreamID(), payload) + } + }() + if _, err := stream.Recv(); status.Code(err) != codes.ResourceExhausted { + t.Fatalf("stream.Recv() = %v, want error code: %v", err, codes.ResourceExhausted) + } + cancel() + if err := verifyResultWithDelay(func() (bool, error) { tchan, _ := channelz.GetTopChannels(0, 0) if len(tchan) != 1 { @@ -1265,11 +1273,23 @@ func (s) TestCZServerSocketMetricsKeepAlive(t *testing.T) { defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv te := newTest(t, e) - te.customServerOptions = append(te.customServerOptions, grpc.KeepaliveParams(keepalive.ServerParameters{Time: time.Second, Timeout: 500 * time.Millisecond})) + // We setup the server keepalive parameters to send one keepalive every + // second, and verify that the actual number of keepalives is very close to + // the number of seconds elapsed in the test. We had a bug wherein the + // server was sending one keepalive every [Time+Timeout] instead of every + // [Time] period, and since Timeout is configured to a low value here, we + // should be able to verify that the fix works with the above mentioned + // logic. + kpOption := grpc.KeepaliveParams(keepalive.ServerParameters{ + Time: time.Second, + Timeout: 100 * time.Millisecond, + }) + te.customServerOptions = append(te.customServerOptions, kpOption) te.startServer(&testServer{security: e.security}) defer te.tearDown() cc := te.clientConn() tc := testpb.NewTestServiceClient(cc) + start := time.Now() doIdleCallToInvokeKeepAlive(tc, t) if err := verifyResultWithDelay(func() (bool, error) { @@ -1281,8 +1301,9 @@ func (s) TestCZServerSocketMetricsKeepAlive(t *testing.T) { if len(ns) != 1 { return false, fmt.Errorf("there should be one server normal socket, not %d", len(ns)) } - if ns[0].SocketData.KeepAlivesSent != 2 { // doIdleCallToInvokeKeepAlive func is set up to send 2 KeepAlives. - return false, fmt.Errorf("there should be 2 KeepAlives sent, not %d", ns[0].SocketData.KeepAlivesSent) + wantKeepalivesCount := int64(time.Since(start).Seconds()) - 1 + if gotKeepalivesCount := ns[0].SocketData.KeepAlivesSent; gotKeepalivesCount != wantKeepalivesCount { + return false, fmt.Errorf("got keepalivesCount: %v, want keepalivesCount: %v", gotKeepalivesCount, wantKeepalivesCount) } return true, nil }); err != nil { @@ -1415,7 +1436,7 @@ func (s) TestCZChannelTraceCreationDeletion(t *testing.T) { t.Fatal(err) } - r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: "127.0.0.1:0"}}, ServiceConfig: parseCfg(`{"loadBalancingPolicy": "round_robin"}`)}) + r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: "127.0.0.1:0"}}, ServiceConfig: parseCfg(r, `{"loadBalancingPolicy": "round_robin"}`)}) // wait for the shutdown of grpclb balancer if err := verifyResultWithDelay(func() (bool, error) { @@ -1559,7 +1580,7 @@ func (s) TestCZChannelAddressResolutionChange(t *testing.T) { }); err != nil { t.Fatal(err) } - r.UpdateState(resolver.State{Addresses: addrs, ServiceConfig: parseCfg(`{"loadBalancingPolicy": "round_robin"}`)}) + r.UpdateState(resolver.State{Addresses: addrs, ServiceConfig: parseCfg(r, `{"loadBalancingPolicy": "round_robin"}`)}) if err := verifyResultWithDelay(func() (bool, error) { cm := channelz.GetChannel(cid) @@ -1576,7 +1597,7 @@ func (s) TestCZChannelAddressResolutionChange(t *testing.T) { t.Fatal(err) } - newSC := parseCfg(`{ + newSC := parseCfg(r, `{ "methodConfig": [ { "name": [ @@ -1874,7 +1895,7 @@ func (s) TestCZTraceOverwriteChannelDeletion(t *testing.T) { t.Fatal(err) } - r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: "127.0.0.1:0"}}, ServiceConfig: parseCfg(`{"loadBalancingPolicy": "round_robin"}`)}) + r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: "127.0.0.1:0"}}, ServiceConfig: parseCfg(r, `{"loadBalancingPolicy": "round_robin"}`)}) // wait for the shutdown of grpclb balancer if err := verifyResultWithDelay(func() (bool, error) { diff --git a/vendor/google.golang.org/grpc/test/codec_perf/perf.pb.go b/vendor/google.golang.org/grpc/test/codec_perf/perf.pb.go index 6bcbc3fda00..43737fdd667 100644 --- a/vendor/google.golang.org/grpc/test/codec_perf/perf.pb.go +++ b/vendor/google.golang.org/grpc/test/codec_perf/perf.pb.go @@ -3,9 +3,11 @@ package codec_perf -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -16,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // Buffer is a message that contains a body of bytes that is used to exercise // encoding and decoding overheads. @@ -31,16 +33,17 @@ func (m *Buffer) Reset() { *m = Buffer{} } func (m *Buffer) String() string { return proto.CompactTextString(m) } func (*Buffer) ProtoMessage() {} func (*Buffer) Descriptor() ([]byte, []int) { - return fileDescriptor_perf_6cc81a33b24d08e7, []int{0} + return fileDescriptor_afad72ea7772fe3a, []int{0} } + func (m *Buffer) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Buffer.Unmarshal(m, b) } func (m *Buffer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Buffer.Marshal(b, m, deterministic) } -func (dst *Buffer) XXX_Merge(src proto.Message) { - xxx_messageInfo_Buffer.Merge(dst, src) +func (m *Buffer) XXX_Merge(src proto.Message) { + xxx_messageInfo_Buffer.Merge(m, src) } func (m *Buffer) XXX_Size() int { return xxx_messageInfo_Buffer.Size(m) @@ -62,9 +65,9 @@ func init() { proto.RegisterType((*Buffer)(nil), "codec.perf.Buffer") } -func init() { proto.RegisterFile("codec_perf/perf.proto", fileDescriptor_perf_6cc81a33b24d08e7) } +func init() { proto.RegisterFile("codec_perf/perf.proto", fileDescriptor_afad72ea7772fe3a) } -var fileDescriptor_perf_6cc81a33b24d08e7 = []byte{ +var fileDescriptor_afad72ea7772fe3a = []byte{ // 83 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4d, 0xce, 0x4f, 0x49, 0x4d, 0x8e, 0x2f, 0x48, 0x2d, 0x4a, 0xd3, 0x07, 0x11, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, diff --git a/vendor/google.golang.org/grpc/test/context_canceled_test.go b/vendor/google.golang.org/grpc/test/context_canceled_test.go index 9715b5c203e..781f63f0c04 100644 --- a/vendor/google.golang.org/grpc/test/context_canceled_test.go +++ b/vendor/google.golang.org/grpc/test/context_canceled_test.go @@ -139,13 +139,12 @@ func (s) TestCancelWhileRecvingWithCompression(t *testing.T) { for i := 0; i < 10; i++ { ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) - defer cancel() s, err := ss.client.FullDuplexCall(ctx, grpc.UseCompressor(gzip.Name)) if err != nil { t.Fatalf("failed to start bidi streaming RPC: %v", err) } // Cancel the stream while receiving to trigger the internal error. - time.AfterFunc(time.Millisecond*10, cancel) + time.AfterFunc(time.Millisecond, cancel) for { _, err := s.Recv() if err != nil { diff --git a/vendor/google.golang.org/grpc/test/end2end_test.go b/vendor/google.golang.org/grpc/test/end2end_test.go index 7a90a6acef6..f9491739bb2 100644 --- a/vendor/google.golang.org/grpc/test/end2end_test.go +++ b/vendor/google.golang.org/grpc/test/end2end_test.go @@ -24,6 +24,7 @@ package test import ( "bufio" "bytes" + "compress/gzip" "context" "crypto/tls" "errors" @@ -69,7 +70,6 @@ import ( "google.golang.org/grpc/peer" "google.golang.org/grpc/resolver" "google.golang.org/grpc/resolver/manual" - _ "google.golang.org/grpc/resolver/passthrough" "google.golang.org/grpc/serviceconfig" "google.golang.org/grpc/stats" "google.golang.org/grpc/status" @@ -78,6 +78,8 @@ import ( "google.golang.org/grpc/testdata" ) +const defaultHealthService = "grpc.health.v1.Health" + func init() { channelz.TurnOn() } @@ -149,6 +151,8 @@ var ( var raceMode bool // set by race.go in race mode type testServer struct { + testpb.UnimplementedTestServiceServer + security string // indicate the authentication protocol used by this server. earlyFail bool // whether to error out the execution of a service handler prematurely. setAndSendHeader bool // whether to call setHeader and sendHeader. @@ -738,6 +742,15 @@ func (te *test) startServers(ts testpb.TestServiceServer, num int) { } } +// setHealthServingStatus is a helper function to set the health status. +func (te *test) setHealthServingStatus(service string, status healthpb.HealthCheckResponse_ServingStatus) { + hs, ok := te.hSrv.(*health.Server) + if !ok { + panic(fmt.Sprintf("SetServingStatus(%v, %v) called for health server of type %T", service, status, hs)) + } + hs.SetServingStatus(service, status) +} + type nopCompressor struct { grpc.Compressor } @@ -1461,7 +1474,7 @@ func (s) TestGetMethodConfig(t *testing.T) { addrs := []resolver.Address{{Addr: te.srvAddr}} r.UpdateState(resolver.State{ Addresses: addrs, - ServiceConfig: parseCfg(`{ + ServiceConfig: parseCfg(r, `{ "methodConfig": [ { "name": [ @@ -1500,7 +1513,7 @@ func (s) TestGetMethodConfig(t *testing.T) { t.Fatalf("TestService/EmptyCall(_, _) = _, %v, want _, %s", err, codes.DeadlineExceeded) } - r.UpdateState(resolver.State{Addresses: addrs, ServiceConfig: parseCfg(`{ + r.UpdateState(resolver.State{Addresses: addrs, ServiceConfig: parseCfg(r, `{ "methodConfig": [ { "name": [ @@ -1548,7 +1561,7 @@ func (s) TestServiceConfigWaitForReady(t *testing.T) { addrs := []resolver.Address{{Addr: te.srvAddr}} r.UpdateState(resolver.State{ Addresses: addrs, - ServiceConfig: parseCfg(`{ + ServiceConfig: parseCfg(r, `{ "methodConfig": [ { "name": [ @@ -1590,7 +1603,7 @@ func (s) TestServiceConfigWaitForReady(t *testing.T) { // Case2:Client API set failfast to be false, and service config set wait_for_ready to be true, and the rpc will wait until deadline exceeds. r.UpdateState(resolver.State{ Addresses: addrs, - ServiceConfig: parseCfg(`{ + ServiceConfig: parseCfg(r, `{ "methodConfig": [ { "name": [ @@ -1637,7 +1650,7 @@ func (s) TestServiceConfigTimeout(t *testing.T) { addrs := []resolver.Address{{Addr: te.srvAddr}} r.UpdateState(resolver.State{ Addresses: addrs, - ServiceConfig: parseCfg(`{ + ServiceConfig: parseCfg(r, `{ "methodConfig": [ { "name": [ @@ -1684,7 +1697,7 @@ func (s) TestServiceConfigTimeout(t *testing.T) { // Case2: Client API sets timeout to be 1hr and ServiceConfig sets timeout to be 1ns. Timeout should be 1ns (min of 1ns and 1hr) and the rpc will wait until deadline exceeds. r.UpdateState(resolver.State{ Addresses: addrs, - ServiceConfig: parseCfg(`{ + ServiceConfig: parseCfg(r, `{ "methodConfig": [ { "name": [ @@ -1747,7 +1760,17 @@ func (s) TestServiceConfigMaxMsgSize(t *testing.T) { t.Fatal(err) } - sc := parseCfg(`{ + // Case1: sc set maxReqSize to 2048 (send), maxRespSize to 2048 (recv). + te1 := testServiceConfigSetup(t, e) + defer te1.tearDown() + + te1.resolverScheme = r.Scheme() + te1.nonBlockingDial = true + te1.startServer(&testServer{security: e.security}) + cc1 := te1.clientConn() + + addrs := []resolver.Address{{Addr: te1.srvAddr}} + sc := parseCfg(r, `{ "methodConfig": [ { "name": [ @@ -1765,17 +1788,6 @@ func (s) TestServiceConfigMaxMsgSize(t *testing.T) { } ] }`) - - // Case1: sc set maxReqSize to 2048 (send), maxRespSize to 2048 (recv). - te1 := testServiceConfigSetup(t, e) - defer te1.tearDown() - - te1.resolverScheme = r.Scheme() - te1.nonBlockingDial = true - te1.startServer(&testServer{security: e.security}) - cc1 := te1.clientConn() - - addrs := []resolver.Address{{Addr: te1.srvAddr}} r.UpdateState(resolver.State{Addresses: addrs, ServiceConfig: sc}) tc := testpb.NewTestServiceClient(cc1) @@ -2000,7 +2012,7 @@ func (s) TestStreamingRPCWithTimeoutInServiceConfigRecv(t *testing.T) { r.UpdateState(resolver.State{ Addresses: []resolver.Address{{Addr: te.srvAddr}}, - ServiceConfig: parseCfg(`{ + ServiceConfig: parseCfg(r, `{ "methodConfig": [ { "name": [ @@ -2426,62 +2438,107 @@ func testTap(t *testing.T, e env) { } } -func healthCheck(d time.Duration, cc *grpc.ClientConn, serviceName string) (*healthpb.HealthCheckResponse, error) { +// healthCheck is a helper function to make a unary health check RPC and return +// the response. +func healthCheck(d time.Duration, cc *grpc.ClientConn, service string) (*healthpb.HealthCheckResponse, error) { ctx, cancel := context.WithTimeout(context.Background(), d) defer cancel() hc := healthgrpc.NewHealthClient(cc) - req := &healthpb.HealthCheckRequest{ - Service: serviceName, + return hc.Check(ctx, &healthpb.HealthCheckRequest{Service: service}) +} + +// verifyHealthCheckStatus is a helper function to verify that the current +// health status of the service matches the one passed in 'wantStatus'. +func verifyHealthCheckStatus(t *testing.T, d time.Duration, cc *grpc.ClientConn, service string, wantStatus healthpb.HealthCheckResponse_ServingStatus) { + t.Helper() + resp, err := healthCheck(d, cc, service) + if err != nil { + t.Fatalf("Health/Check(_, _) = _, %v, want _, ", err) + } + if resp.Status != wantStatus { + t.Fatalf("Got the serving status %v, want %v", resp.Status, wantStatus) } - return hc.Check(ctx, req) } -func (s) TestHealthCheckOnSuccess(t *testing.T) { +// verifyHealthCheckErrCode is a helper function to verify that a unary health +// check RPC returns an error with a code set to 'wantCode'. +func verifyHealthCheckErrCode(t *testing.T, d time.Duration, cc *grpc.ClientConn, service string, wantCode codes.Code) { + t.Helper() + if _, err := healthCheck(d, cc, service); status.Code(err) != wantCode { + t.Fatalf("Health/Check() got errCode %v, want %v", status.Code(err), wantCode) + } +} + +// newHealthCheckStream is a helper function to start a health check streaming +// RPC, and returns the stream. +func newHealthCheckStream(t *testing.T, cc *grpc.ClientConn, service string) (healthgrpc.Health_WatchClient, context.CancelFunc) { + t.Helper() + ctx, cancel := context.WithCancel(context.Background()) + hc := healthgrpc.NewHealthClient(cc) + stream, err := hc.Watch(ctx, &healthpb.HealthCheckRequest{Service: service}) + if err != nil { + t.Fatalf("hc.Watch(_, %v) failed: %v", service, err) + } + return stream, cancel +} + +// healthWatchChecker is a helper function to verify that the next health +// status returned on the given stream matches the one passed in 'wantStatus'. +func healthWatchChecker(t *testing.T, stream healthgrpc.Health_WatchClient, wantStatus healthpb.HealthCheckResponse_ServingStatus) { + t.Helper() + response, err := stream.Recv() + if err != nil { + t.Fatalf("stream.Recv() failed: %v", err) + } + if response.Status != wantStatus { + t.Fatalf("got servingStatus %v, want %v", response.Status, wantStatus) + } +} + +// TestHealthCheckSuccess invokes the unary Check() RPC on the health server in +// a successful case. +func (s) TestHealthCheckSuccess(t *testing.T) { for _, e := range listTestEnv() { - testHealthCheckOnSuccess(t, e) + testHealthCheckSuccess(t, e) } } -func testHealthCheckOnSuccess(t *testing.T, e env) { +func testHealthCheckSuccess(t *testing.T, e env) { te := newTest(t, e) - hs := health.NewServer() - hs.SetServingStatus("grpc.health.v1.Health", 1) - te.healthServer = hs + te.enableHealthServer = true te.startServer(&testServer{security: e.security}) + te.setHealthServingStatus(defaultHealthService, healthpb.HealthCheckResponse_SERVING) defer te.tearDown() - cc := te.clientConn() - if _, err := healthCheck(1*time.Second, cc, "grpc.health.v1.Health"); err != nil { - t.Fatalf("Health/Check(_, _) = _, %v, want _, ", err) - } + verifyHealthCheckErrCode(t, 1*time.Second, te.clientConn(), defaultHealthService, codes.OK) } -func (s) TestHealthCheckOnFailure(t *testing.T) { +// TestHealthCheckFailure invokes the unary Check() RPC on the health server +// with an expired context and expects the RPC to fail. +func (s) TestHealthCheckFailure(t *testing.T) { for _, e := range listTestEnv() { - testHealthCheckOnFailure(t, e) + testHealthCheckFailure(t, e) } } -func testHealthCheckOnFailure(t *testing.T, e env) { +func testHealthCheckFailure(t *testing.T, e env) { te := newTest(t, e) te.declareLogNoise( "Failed to dial ", "grpc: the client connection is closing; please retry", ) - hs := health.NewServer() - hs.SetServingStatus("grpc.health.v1.HealthCheck", 1) - te.healthServer = hs + te.enableHealthServer = true te.startServer(&testServer{security: e.security}) + te.setHealthServingStatus(defaultHealthService, healthpb.HealthCheckResponse_SERVING) defer te.tearDown() - cc := te.clientConn() - wantErr := status.Error(codes.DeadlineExceeded, "context deadline exceeded") - if _, err := healthCheck(0*time.Second, cc, "grpc.health.v1.Health"); !testutils.StatusErrEqual(err, wantErr) { - t.Fatalf("Health/Check(_, _) = _, %v, want _, error code %s", err, codes.DeadlineExceeded) - } + verifyHealthCheckErrCode(t, 0*time.Second, te.clientConn(), defaultHealthService, codes.DeadlineExceeded) awaitNewConnLogOutput() } +// TestHealthCheckOff makes a unary Check() RPC on the health server where the +// health status of the defaultHealthService is not set, and therefore expects +// an error code 'codes.NotFound'. func (s) TestHealthCheckOff(t *testing.T) { for _, e := range listTestEnv() { // TODO(bradfitz): Temporarily skip this env due to #619. @@ -2494,14 +2551,15 @@ func (s) TestHealthCheckOff(t *testing.T) { func testHealthCheckOff(t *testing.T, e env) { te := newTest(t, e) + te.enableHealthServer = true te.startServer(&testServer{security: e.security}) defer te.tearDown() - want := status.Error(codes.Unimplemented, "unknown service grpc.health.v1.Health") - if _, err := healthCheck(1*time.Second, te.clientConn(), ""); !testutils.StatusErrEqual(err, want) { - t.Fatalf("Health/Check(_, _) = _, %v, want _, %v", err, want) - } + + verifyHealthCheckErrCode(t, 1*time.Second, te.clientConn(), defaultHealthService, codes.NotFound) } +// TestHealthWatchMultipleClients makes a streaming Watch() RPC on the health +// server with multiple clients and expects the same status on both streams. func (s) TestHealthWatchMultipleClients(t *testing.T) { for _, e := range listTestEnv() { testHealthWatchMultipleClients(t, e) @@ -2509,45 +2567,28 @@ func (s) TestHealthWatchMultipleClients(t *testing.T) { } func testHealthWatchMultipleClients(t *testing.T, e env) { - const service = "grpc.health.v1.Health1" - - hs := health.NewServer() - te := newTest(t, e) - te.healthServer = hs + te.enableHealthServer = true te.startServer(&testServer{security: e.security}) defer te.tearDown() cc := te.clientConn() - hc := healthgrpc.NewHealthClient(cc) - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - req := &healthpb.HealthCheckRequest{ - Service: service, - } - - stream1, err := hc.Watch(ctx, req) - if err != nil { - t.Fatalf("error: %v", err) - } - + stream1, cf1 := newHealthCheckStream(t, cc, defaultHealthService) + defer cf1() healthWatchChecker(t, stream1, healthpb.HealthCheckResponse_SERVICE_UNKNOWN) - stream2, err := hc.Watch(ctx, req) - if err != nil { - t.Fatalf("error: %v", err) - } - + stream2, cf2 := newHealthCheckStream(t, cc, defaultHealthService) + defer cf2() healthWatchChecker(t, stream2, healthpb.HealthCheckResponse_SERVICE_UNKNOWN) - hs.SetServingStatus(service, healthpb.HealthCheckResponse_NOT_SERVING) - + te.setHealthServingStatus(defaultHealthService, healthpb.HealthCheckResponse_NOT_SERVING) healthWatchChecker(t, stream1, healthpb.HealthCheckResponse_NOT_SERVING) healthWatchChecker(t, stream2, healthpb.HealthCheckResponse_NOT_SERVING) } +// TestHealthWatchSameStatusmakes a streaming Watch() RPC on the health server +// and makes sure that the health status of the server is as expected after +// multiple calls to SetServingStatus with the same status. func (s) TestHealthWatchSameStatus(t *testing.T) { for _, e := range listTestEnv() { testHealthWatchSameStatus(t, e) @@ -2555,42 +2596,25 @@ func (s) TestHealthWatchSameStatus(t *testing.T) { } func testHealthWatchSameStatus(t *testing.T, e env) { - const service = "grpc.health.v1.Health1" - - hs := health.NewServer() - te := newTest(t, e) - te.healthServer = hs + te.enableHealthServer = true te.startServer(&testServer{security: e.security}) defer te.tearDown() - cc := te.clientConn() - hc := healthgrpc.NewHealthClient(cc) - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - req := &healthpb.HealthCheckRequest{ - Service: service, - } - - stream1, err := hc.Watch(ctx, req) - if err != nil { - t.Fatalf("error: %v", err) - } - - healthWatchChecker(t, stream1, healthpb.HealthCheckResponse_SERVICE_UNKNOWN) - - hs.SetServingStatus(service, healthpb.HealthCheckResponse_SERVING) - - healthWatchChecker(t, stream1, healthpb.HealthCheckResponse_SERVING) - - hs.SetServingStatus(service, healthpb.HealthCheckResponse_SERVING) - hs.SetServingStatus(service, healthpb.HealthCheckResponse_NOT_SERVING) + stream, cf := newHealthCheckStream(t, te.clientConn(), defaultHealthService) + defer cf() - healthWatchChecker(t, stream1, healthpb.HealthCheckResponse_NOT_SERVING) + healthWatchChecker(t, stream, healthpb.HealthCheckResponse_SERVICE_UNKNOWN) + te.setHealthServingStatus(defaultHealthService, healthpb.HealthCheckResponse_SERVING) + healthWatchChecker(t, stream, healthpb.HealthCheckResponse_SERVING) + te.setHealthServingStatus(defaultHealthService, healthpb.HealthCheckResponse_SERVING) + te.setHealthServingStatus(defaultHealthService, healthpb.HealthCheckResponse_NOT_SERVING) + healthWatchChecker(t, stream, healthpb.HealthCheckResponse_NOT_SERVING) } +// TestHealthWatchServiceStatusSetBeforeStartingServer starts a health server +// on which the health status for the defaultService is set before the gRPC +// server is started, and expects the correct health status to be returned. func (s) TestHealthWatchServiceStatusSetBeforeStartingServer(t *testing.T) { for _, e := range listTestEnv() { testHealthWatchSetServiceStatusBeforeStartingServer(t, e) @@ -2598,36 +2622,22 @@ func (s) TestHealthWatchServiceStatusSetBeforeStartingServer(t *testing.T) { } func testHealthWatchSetServiceStatusBeforeStartingServer(t *testing.T, e env) { - const service = "grpc.health.v1.Health1" - hs := health.NewServer() - te := newTest(t, e) te.healthServer = hs - - hs.SetServingStatus(service, healthpb.HealthCheckResponse_SERVING) - + hs.SetServingStatus(defaultHealthService, healthpb.HealthCheckResponse_SERVING) te.startServer(&testServer{security: e.security}) defer te.tearDown() - cc := te.clientConn() - hc := healthgrpc.NewHealthClient(cc) - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - req := &healthpb.HealthCheckRequest{ - Service: service, - } - - stream, err := hc.Watch(ctx, req) - if err != nil { - t.Fatalf("error: %v", err) - } - + stream, cf := newHealthCheckStream(t, te.clientConn(), defaultHealthService) + defer cf() healthWatchChecker(t, stream, healthpb.HealthCheckResponse_SERVING) } +// TestHealthWatchDefaultStatusChange verifies the simple case where the +// service starts off with a SERVICE_UNKNOWN status (because SetServingStatus +// hasn't been called yet) and then moves to SERVING after SetServingStatus is +// called. func (s) TestHealthWatchDefaultStatusChange(t *testing.T) { for _, e := range listTestEnv() { testHealthWatchDefaultStatusChange(t, e) @@ -2635,37 +2645,20 @@ func (s) TestHealthWatchDefaultStatusChange(t *testing.T) { } func testHealthWatchDefaultStatusChange(t *testing.T, e env) { - const service = "grpc.health.v1.Health1" - - hs := health.NewServer() - te := newTest(t, e) - te.healthServer = hs + te.enableHealthServer = true te.startServer(&testServer{security: e.security}) defer te.tearDown() - cc := te.clientConn() - hc := healthgrpc.NewHealthClient(cc) - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - req := &healthpb.HealthCheckRequest{ - Service: service, - } - - stream, err := hc.Watch(ctx, req) - if err != nil { - t.Fatalf("error: %v", err) - } - + stream, cf := newHealthCheckStream(t, te.clientConn(), defaultHealthService) + defer cf() healthWatchChecker(t, stream, healthpb.HealthCheckResponse_SERVICE_UNKNOWN) - - hs.SetServingStatus(service, healthpb.HealthCheckResponse_SERVING) - + te.setHealthServingStatus(defaultHealthService, healthpb.HealthCheckResponse_SERVING) healthWatchChecker(t, stream, healthpb.HealthCheckResponse_SERVING) } +// TestHealthWatchSetServiceStatusBeforeClientCallsWatch verifies the case +// where the health status is set to SERVING before the client calls Watch(). func (s) TestHealthWatchSetServiceStatusBeforeClientCallsWatch(t *testing.T) { for _, e := range listTestEnv() { testHealthWatchSetServiceStatusBeforeClientCallsWatch(t, e) @@ -2673,35 +2666,19 @@ func (s) TestHealthWatchSetServiceStatusBeforeClientCallsWatch(t *testing.T) { } func testHealthWatchSetServiceStatusBeforeClientCallsWatch(t *testing.T, e env) { - const service = "grpc.health.v1.Health1" - - hs := health.NewServer() - te := newTest(t, e) - te.healthServer = hs + te.enableHealthServer = true te.startServer(&testServer{security: e.security}) + te.setHealthServingStatus(defaultHealthService, healthpb.HealthCheckResponse_SERVING) defer te.tearDown() - cc := te.clientConn() - hc := healthgrpc.NewHealthClient(cc) - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - req := &healthpb.HealthCheckRequest{ - Service: service, - } - - hs.SetServingStatus(service, healthpb.HealthCheckResponse_SERVING) - - stream, err := hc.Watch(ctx, req) - if err != nil { - t.Fatalf("error: %v", err) - } - + stream, cf := newHealthCheckStream(t, te.clientConn(), defaultHealthService) + defer cf() healthWatchChecker(t, stream, healthpb.HealthCheckResponse_SERVING) } +// TestHealthWatchOverallServerHealthChange verifies setting the overall status +// of the server by using the empty service name. func (s) TestHealthWatchOverallServerHealthChange(t *testing.T) { for _, e := range listTestEnv() { testHealthWatchOverallServerHealthChange(t, e) @@ -2709,50 +2686,25 @@ func (s) TestHealthWatchOverallServerHealthChange(t *testing.T) { } func testHealthWatchOverallServerHealthChange(t *testing.T, e env) { - const service = "" - - hs := health.NewServer() - te := newTest(t, e) - te.healthServer = hs + te.enableHealthServer = true te.startServer(&testServer{security: e.security}) defer te.tearDown() - cc := te.clientConn() - hc := healthgrpc.NewHealthClient(cc) - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - req := &healthpb.HealthCheckRequest{ - Service: service, - } - - stream, err := hc.Watch(ctx, req) - if err != nil { - t.Fatalf("error: %v", err) - } - + stream, cf := newHealthCheckStream(t, te.clientConn(), "") + defer cf() healthWatchChecker(t, stream, healthpb.HealthCheckResponse_SERVING) - - hs.SetServingStatus(service, healthpb.HealthCheckResponse_NOT_SERVING) - + te.setHealthServingStatus("", healthpb.HealthCheckResponse_NOT_SERVING) healthWatchChecker(t, stream, healthpb.HealthCheckResponse_NOT_SERVING) } -func healthWatchChecker(t *testing.T, stream healthgrpc.Health_WatchClient, expectedServingStatus healthpb.HealthCheckResponse_ServingStatus) { - response, err := stream.Recv() - if err != nil { - t.Fatalf("error on %v.Recv(): %v", stream, err) - } - if response.Status != expectedServingStatus { - t.Fatalf("response.Status is %v (%v expected)", response.Status, expectedServingStatus) - } -} - +// TestUnknownHandler verifies that an expected error is returned (by setting +// the unknownHandler on the server) for a service which is not exposed to the +// client. func (s) TestUnknownHandler(t *testing.T) { - // An example unknownHandler that returns a different code and a different method, making sure that we do not - // expose what methods are implemented to a client that is not authenticated. + // An example unknownHandler that returns a different code and a different + // method, making sure that we do not expose what methods are implemented to + // a client that is not authenticated. unknownHandler := func(srv interface{}, stream grpc.ServerStream) error { return status.Error(codes.Unauthenticated, "user unauthenticated") } @@ -2770,12 +2722,11 @@ func testUnknownHandler(t *testing.T, e env, unknownHandler grpc.StreamHandler) te.unknownHandler = unknownHandler te.startServer(&testServer{security: e.security}) defer te.tearDown() - want := status.Error(codes.Unauthenticated, "user unauthenticated") - if _, err := healthCheck(1*time.Second, te.clientConn(), ""); !testutils.StatusErrEqual(err, want) { - t.Fatalf("Health/Check(_, _) = _, %v, want _, %v", err, want) - } + verifyHealthCheckErrCode(t, 1*time.Second, te.clientConn(), "", codes.Unauthenticated) } +// TestHealthCheckServingStatus makes a streaming Watch() RPC on the health +// server and verifies a bunch of health status transitions. func (s) TestHealthCheckServingStatus(t *testing.T) { for _, e := range listTestEnv() { testHealthCheckServingStatus(t, e) @@ -2784,40 +2735,17 @@ func (s) TestHealthCheckServingStatus(t *testing.T) { func testHealthCheckServingStatus(t *testing.T, e env) { te := newTest(t, e) - hs := health.NewServer() - te.healthServer = hs + te.enableHealthServer = true te.startServer(&testServer{security: e.security}) defer te.tearDown() cc := te.clientConn() - out, err := healthCheck(1*time.Second, cc, "") - if err != nil { - t.Fatalf("Health/Check(_, _) = _, %v, want _, ", err) - } - if out.Status != healthpb.HealthCheckResponse_SERVING { - t.Fatalf("Got the serving status %v, want SERVING", out.Status) - } - wantErr := status.Error(codes.NotFound, "unknown service") - if _, err := healthCheck(1*time.Second, cc, "grpc.health.v1.Health"); !testutils.StatusErrEqual(err, wantErr) { - t.Fatalf("Health/Check(_, _) = _, %v, want _, error code %s", err, codes.NotFound) - } - hs.SetServingStatus("grpc.health.v1.Health", healthpb.HealthCheckResponse_SERVING) - out, err = healthCheck(1*time.Second, cc, "grpc.health.v1.Health") - if err != nil { - t.Fatalf("Health/Check(_, _) = _, %v, want _, ", err) - } - if out.Status != healthpb.HealthCheckResponse_SERVING { - t.Fatalf("Got the serving status %v, want SERVING", out.Status) - } - hs.SetServingStatus("grpc.health.v1.Health", healthpb.HealthCheckResponse_NOT_SERVING) - out, err = healthCheck(1*time.Second, cc, "grpc.health.v1.Health") - if err != nil { - t.Fatalf("Health/Check(_, _) = _, %v, want _, ", err) - } - if out.Status != healthpb.HealthCheckResponse_NOT_SERVING { - t.Fatalf("Got the serving status %v, want NOT_SERVING", out.Status) - } - + verifyHealthCheckStatus(t, 1*time.Second, cc, "", healthpb.HealthCheckResponse_SERVING) + verifyHealthCheckErrCode(t, 1*time.Second, cc, defaultHealthService, codes.NotFound) + te.setHealthServingStatus(defaultHealthService, healthpb.HealthCheckResponse_SERVING) + verifyHealthCheckStatus(t, 1*time.Second, cc, defaultHealthService, healthpb.HealthCheckResponse_SERVING) + te.setHealthServingStatus(defaultHealthService, healthpb.HealthCheckResponse_NOT_SERVING) + verifyHealthCheckStatus(t, 1*time.Second, cc, defaultHealthService, healthpb.HealthCheckResponse_NOT_SERVING) } func (s) TestEmptyUnaryWithUserAgent(t *testing.T) { @@ -3991,11 +3919,15 @@ func testFailedServerStreaming(t *testing.T, e env) { t.Fatalf("%v.StreamingOutputCall(_) = _, %v, want ", tc, err) } wantErr := status.Error(codes.DataLoss, "error for testing: "+failAppUA) - if _, err := stream.Recv(); !reflect.DeepEqual(err, wantErr) { + if _, err := stream.Recv(); !equalError(err, wantErr) { t.Fatalf("%v.Recv() = _, %v, want _, %v", stream, err, wantErr) } } +func equalError(x, y error) bool { + return x == y || (x != nil && y != nil && x.Error() == y.Error()) +} + // concurrentSendServer is a TestServiceServer whose // StreamingOutputCall makes ten serial Send calls, sending payloads // "0".."9", inclusive. TestServerStreamingConcurrent verifies they @@ -4767,7 +4699,7 @@ func testClientResourceExhaustedCancelFullDuplex(t *testing.T, e env) { resp := &testpb.StreamingOutputCallResponse{ Payload: payload, } - ce := make(chan error) + ce := make(chan error, 1) go func() { var err error for { @@ -4968,6 +4900,49 @@ func (s) TestCredsHandshakeAuthority(t *testing.T) { } } +// This test makes sure that the authority client handshake gets is the endpoint +// of the ServerName of the address when it is set. +func (s) TestCredsHandshakeServerNameAuthority(t *testing.T) { + const testAuthority = "test.auth.ori.ty" + const testServerName = "test.server.name" + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + t.Fatalf("Failed to listen: %v", err) + } + cred := &authorityCheckCreds{} + s := grpc.NewServer() + go s.Serve(lis) + defer s.Stop() + + r, rcleanup := manual.GenerateAndRegisterManualResolver() + defer rcleanup() + + cc, err := grpc.Dial(r.Scheme()+":///"+testAuthority, grpc.WithTransportCredentials(cred)) + if err != nil { + t.Fatalf("grpc.Dial(%q) = %v", lis.Addr().String(), err) + } + defer cc.Close() + r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: lis.Addr().String(), ServerName: testServerName}}}) + + ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond) + defer cancel() + for { + s := cc.GetState() + if s == connectivity.Ready { + break + } + if !cc.WaitForStateChange(ctx, s) { + // ctx got timeout or canceled. + t.Fatalf("ClientConn is not ready after 100 ms") + } + } + + if cred.got != testServerName { + t.Fatalf("client creds got authority: %q, want: %q", cred.got, testAuthority) + } +} + type clientFailCreds struct{} func (c *clientFailCreds) ServerHandshake(rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) { @@ -5312,7 +5287,7 @@ func (ss *stubServer) Start(sopts []grpc.ServerOption, dopts ...grpc.DialOption) } func (ss *stubServer) newServiceConfig(sc string) { - ss.r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: ss.addr}}, ServiceConfig: parseCfg(sc)}) + ss.r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: ss.addr}}, ServiceConfig: parseCfg(ss.r, sc)}) } func (ss *stubServer) waitForReady(cc *grpc.ClientConn) error { @@ -7113,7 +7088,7 @@ func (s) TestGoAwayThenClose(t *testing.T) { } s1 := grpc.NewServer() defer s1.Stop() - ts1 := &funcServer{ + ts := &funcServer{ unaryCall: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { return &testpb.SimpleResponse{}, nil }, @@ -7126,7 +7101,7 @@ func (s) TestGoAwayThenClose(t *testing.T) { return err }, } - testpb.RegisterTestServiceServer(s1, ts1) + testpb.RegisterTestServiceServer(s1, ts) go s1.Serve(lis1) conn2Established := grpcsync.NewEvent() @@ -7136,17 +7111,13 @@ func (s) TestGoAwayThenClose(t *testing.T) { } s2 := grpc.NewServer() defer s2.Stop() - ts2 := &funcServer{unaryCall: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { - return &testpb.SimpleResponse{}, nil - }} - testpb.RegisterTestServiceServer(s2, ts2) + testpb.RegisterTestServiceServer(s2, ts) go s2.Serve(lis2) r, rcleanup := manual.GenerateAndRegisterManualResolver() defer rcleanup() r.InitialState(resolver.State{Addresses: []resolver.Address{ {Addr: lis1.Addr().String()}, - {Addr: lis2.Addr().String()}, }}) cc, err := grpc.DialContext(ctx, r.Scheme()+":///", grpc.WithInsecure()) if err != nil { @@ -7163,6 +7134,11 @@ func (s) TestGoAwayThenClose(t *testing.T) { t.Fatalf("FullDuplexCall(_) = _, %v; want _, nil", err) } + r.UpdateState(resolver.State{Addresses: []resolver.Address{ + {Addr: lis1.Addr().String()}, + {Addr: lis2.Addr().String()}, + }}) + // Send GO_AWAY to connection 1. go s1.GracefulStop() @@ -7229,7 +7205,7 @@ func (s) TestRPCWaitsForResolver(t *testing.T) { time.Sleep(time.Second) r.UpdateState(resolver.State{ Addresses: []resolver.Address{{Addr: te.srvAddr}}, - ServiceConfig: parseCfg(`{ + ServiceConfig: parseCfg(r, `{ "methodConfig": [ { "name": [ @@ -7476,10 +7452,127 @@ func doHTTPHeaderTest(t *testing.T, errCode codes.Code, headerFields ...[]string } } -func parseCfg(s string) serviceconfig.Config { - c, err := serviceconfig.Parse(s) +func parseCfg(r *manual.Resolver, s string) *serviceconfig.ParseResult { + g := r.CC.ParseServiceConfig(s) + if g.Err != nil { + panic(fmt.Sprintf("Error parsing config %q: %v", s, g.Err)) + } + return g +} + +type methodTestCreds struct{} + +func (m methodTestCreds) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) { + ri, _ := credentials.RequestInfoFromContext(ctx) + return nil, status.Errorf(codes.Unknown, ri.Method) +} + +func (m methodTestCreds) RequireTransportSecurity() bool { + return false +} + +func (s) TestGRPCMethodAccessibleToCredsViaContextRequestInfo(t *testing.T) { + const wantMethod = "/grpc.testing.TestService/EmptyCall" + ss := &stubServer{} + if err := ss.Start(nil, grpc.WithPerRPCCredentials(methodTestCreds{})); err != nil { + t.Fatalf("Error starting endpoint server: %v", err) + } + defer ss.Stop() + + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) + defer cancel() + + if _, err := ss.client.EmptyCall(ctx, &testpb.Empty{}); status.Convert(err).Message() != wantMethod { + t.Fatalf("ss.client.EmptyCall(_, _) = _, %v; want _, _.Message()=%q", err, wantMethod) + } +} + +func (s) TestClientCancellationPropagatesUnary(t *testing.T) { + wg := &sync.WaitGroup{} + called, done := make(chan struct{}), make(chan struct{}) + ss := &stubServer{ + emptyCall: func(ctx context.Context, _ *testpb.Empty) (*testpb.Empty, error) { + close(called) + <-ctx.Done() + err := ctx.Err() + if err != context.Canceled { + t.Errorf("ctx.Err() = %v; want context.Canceled", err) + } + close(done) + return nil, err + }, + } + if err := ss.Start(nil); err != nil { + t.Fatalf("Error starting endpoint server: %v", err) + } + defer ss.Stop() + + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + + wg.Add(1) + go func() { + if _, err := ss.client.EmptyCall(ctx, &testpb.Empty{}); status.Code(err) != codes.Canceled { + t.Errorf("ss.client.EmptyCall() = _, %v; want _, Code()=codes.Canceled", err) + } + wg.Done() + }() + + select { + case <-called: + case <-time.After(5 * time.Second): + t.Fatalf("failed to perform EmptyCall after 10s") + } + cancel() + select { + case <-done: + case <-time.After(5 * time.Second): + t.Fatalf("server failed to close done chan due to cancellation propagation") + } + wg.Wait() +} + +type badGzipCompressor struct{} + +func (badGzipCompressor) Do(w io.Writer, p []byte) error { + buf := &bytes.Buffer{} + gzw := gzip.NewWriter(buf) + if _, err := gzw.Write(p); err != nil { + return err + } + err := gzw.Close() + bs := buf.Bytes() + if len(bs) >= 6 { + bs[len(bs)-6] ^= 1 // modify checksum at end by 1 byte + } + w.Write(bs) + return err +} + +func (badGzipCompressor) Type() string { + return "gzip" +} + +func (s) TestGzipBadChecksum(t *testing.T) { + ss := &stubServer{ + unaryCall: func(ctx context.Context, _ *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { + return &testpb.SimpleResponse{}, nil + }, + } + if err := ss.Start(nil, grpc.WithCompressor(badGzipCompressor{})); err != nil { + t.Fatalf("Error starting endpoint server: %v", err) + } + defer ss.Stop() + + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + + p, err := newPayload(testpb.PayloadType_COMPRESSABLE, int32(1024)) if err != nil { - panic(fmt.Sprintf("Error parsing config %q: %v", s, err)) + t.Fatalf("Unexpected error from newPayload: %v", err) + } + if _, err := ss.client.UnaryCall(ctx, &testpb.SimpleRequest{Payload: p}); err == nil || + status.Code(err) != codes.Internal || + !strings.Contains(status.Convert(err).Message(), gzip.ErrChecksum.Error()) { + t.Errorf("ss.client.UnaryCall(_) = _, %v\n\twant: _, status(codes.Internal, contains %q)", err, gzip.ErrChecksum) } - return c } diff --git a/vendor/google.golang.org/grpc/test/grpc_testing/test.pb.go b/vendor/google.golang.org/grpc/test/grpc_testing/test.pb.go index 871f7cc98e0..5daa33a2912 100644 --- a/vendor/google.golang.org/grpc/test/grpc_testing/test.pb.go +++ b/vendor/google.golang.org/grpc/test/grpc_testing/test.pb.go @@ -3,13 +3,14 @@ package grpc_testing -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -21,7 +22,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // The type of payload that should be returned. type PayloadType int32 @@ -40,6 +41,7 @@ var PayloadType_name = map[int32]string{ 1: "UNCOMPRESSABLE", 2: "RANDOM", } + var PayloadType_value = map[string]int32{ "COMPRESSABLE": 0, "UNCOMPRESSABLE": 1, @@ -49,8 +51,9 @@ var PayloadType_value = map[string]int32{ func (x PayloadType) String() string { return proto.EnumName(PayloadType_name, int32(x)) } + func (PayloadType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_test_c9f6c5af4267cb88, []int{0} + return fileDescriptor_e1cda82041fed8bf, []int{0} } type Empty struct { @@ -63,16 +66,17 @@ func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} func (*Empty) Descriptor() ([]byte, []int) { - return fileDescriptor_test_c9f6c5af4267cb88, []int{0} + return fileDescriptor_e1cda82041fed8bf, []int{0} } + func (m *Empty) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Empty.Unmarshal(m, b) } func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Empty.Marshal(b, m, deterministic) } -func (dst *Empty) XXX_Merge(src proto.Message) { - xxx_messageInfo_Empty.Merge(dst, src) +func (m *Empty) XXX_Merge(src proto.Message) { + xxx_messageInfo_Empty.Merge(m, src) } func (m *Empty) XXX_Size() int { return xxx_messageInfo_Empty.Size(m) @@ -98,16 +102,17 @@ func (m *Payload) Reset() { *m = Payload{} } func (m *Payload) String() string { return proto.CompactTextString(m) } func (*Payload) ProtoMessage() {} func (*Payload) Descriptor() ([]byte, []int) { - return fileDescriptor_test_c9f6c5af4267cb88, []int{1} + return fileDescriptor_e1cda82041fed8bf, []int{1} } + func (m *Payload) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Payload.Unmarshal(m, b) } func (m *Payload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Payload.Marshal(b, m, deterministic) } -func (dst *Payload) XXX_Merge(src proto.Message) { - xxx_messageInfo_Payload.Merge(dst, src) +func (m *Payload) XXX_Merge(src proto.Message) { + xxx_messageInfo_Payload.Merge(m, src) } func (m *Payload) XXX_Size() int { return xxx_messageInfo_Payload.Size(m) @@ -155,16 +160,17 @@ func (m *SimpleRequest) Reset() { *m = SimpleRequest{} } func (m *SimpleRequest) String() string { return proto.CompactTextString(m) } func (*SimpleRequest) ProtoMessage() {} func (*SimpleRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_test_c9f6c5af4267cb88, []int{2} + return fileDescriptor_e1cda82041fed8bf, []int{2} } + func (m *SimpleRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SimpleRequest.Unmarshal(m, b) } func (m *SimpleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SimpleRequest.Marshal(b, m, deterministic) } -func (dst *SimpleRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SimpleRequest.Merge(dst, src) +func (m *SimpleRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleRequest.Merge(m, src) } func (m *SimpleRequest) XXX_Size() int { return xxx_messageInfo_SimpleRequest.Size(m) @@ -228,16 +234,17 @@ func (m *SimpleResponse) Reset() { *m = SimpleResponse{} } func (m *SimpleResponse) String() string { return proto.CompactTextString(m) } func (*SimpleResponse) ProtoMessage() {} func (*SimpleResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_test_c9f6c5af4267cb88, []int{3} + return fileDescriptor_e1cda82041fed8bf, []int{3} } + func (m *SimpleResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SimpleResponse.Unmarshal(m, b) } func (m *SimpleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SimpleResponse.Marshal(b, m, deterministic) } -func (dst *SimpleResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SimpleResponse.Merge(dst, src) +func (m *SimpleResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SimpleResponse.Merge(m, src) } func (m *SimpleResponse) XXX_Size() int { return xxx_messageInfo_SimpleResponse.Size(m) @@ -282,16 +289,17 @@ func (m *StreamingInputCallRequest) Reset() { *m = StreamingInputCallReq func (m *StreamingInputCallRequest) String() string { return proto.CompactTextString(m) } func (*StreamingInputCallRequest) ProtoMessage() {} func (*StreamingInputCallRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_test_c9f6c5af4267cb88, []int{4} + return fileDescriptor_e1cda82041fed8bf, []int{4} } + func (m *StreamingInputCallRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StreamingInputCallRequest.Unmarshal(m, b) } func (m *StreamingInputCallRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_StreamingInputCallRequest.Marshal(b, m, deterministic) } -func (dst *StreamingInputCallRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamingInputCallRequest.Merge(dst, src) +func (m *StreamingInputCallRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingInputCallRequest.Merge(m, src) } func (m *StreamingInputCallRequest) XXX_Size() int { return xxx_messageInfo_StreamingInputCallRequest.Size(m) @@ -322,16 +330,17 @@ func (m *StreamingInputCallResponse) Reset() { *m = StreamingInputCallRe func (m *StreamingInputCallResponse) String() string { return proto.CompactTextString(m) } func (*StreamingInputCallResponse) ProtoMessage() {} func (*StreamingInputCallResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_test_c9f6c5af4267cb88, []int{5} + return fileDescriptor_e1cda82041fed8bf, []int{5} } + func (m *StreamingInputCallResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StreamingInputCallResponse.Unmarshal(m, b) } func (m *StreamingInputCallResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_StreamingInputCallResponse.Marshal(b, m, deterministic) } -func (dst *StreamingInputCallResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamingInputCallResponse.Merge(dst, src) +func (m *StreamingInputCallResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingInputCallResponse.Merge(m, src) } func (m *StreamingInputCallResponse) XXX_Size() int { return xxx_messageInfo_StreamingInputCallResponse.Size(m) @@ -366,16 +375,17 @@ func (m *ResponseParameters) Reset() { *m = ResponseParameters{} } func (m *ResponseParameters) String() string { return proto.CompactTextString(m) } func (*ResponseParameters) ProtoMessage() {} func (*ResponseParameters) Descriptor() ([]byte, []int) { - return fileDescriptor_test_c9f6c5af4267cb88, []int{6} + return fileDescriptor_e1cda82041fed8bf, []int{6} } + func (m *ResponseParameters) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResponseParameters.Unmarshal(m, b) } func (m *ResponseParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ResponseParameters.Marshal(b, m, deterministic) } -func (dst *ResponseParameters) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseParameters.Merge(dst, src) +func (m *ResponseParameters) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseParameters.Merge(m, src) } func (m *ResponseParameters) XXX_Size() int { return xxx_messageInfo_ResponseParameters.Size(m) @@ -420,16 +430,17 @@ func (m *StreamingOutputCallRequest) Reset() { *m = StreamingOutputCallR func (m *StreamingOutputCallRequest) String() string { return proto.CompactTextString(m) } func (*StreamingOutputCallRequest) ProtoMessage() {} func (*StreamingOutputCallRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_test_c9f6c5af4267cb88, []int{7} + return fileDescriptor_e1cda82041fed8bf, []int{7} } + func (m *StreamingOutputCallRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StreamingOutputCallRequest.Unmarshal(m, b) } func (m *StreamingOutputCallRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_StreamingOutputCallRequest.Marshal(b, m, deterministic) } -func (dst *StreamingOutputCallRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamingOutputCallRequest.Merge(dst, src) +func (m *StreamingOutputCallRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingOutputCallRequest.Merge(m, src) } func (m *StreamingOutputCallRequest) XXX_Size() int { return xxx_messageInfo_StreamingOutputCallRequest.Size(m) @@ -474,16 +485,17 @@ func (m *StreamingOutputCallResponse) Reset() { *m = StreamingOutputCall func (m *StreamingOutputCallResponse) String() string { return proto.CompactTextString(m) } func (*StreamingOutputCallResponse) ProtoMessage() {} func (*StreamingOutputCallResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_test_c9f6c5af4267cb88, []int{8} + return fileDescriptor_e1cda82041fed8bf, []int{8} } + func (m *StreamingOutputCallResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StreamingOutputCallResponse.Unmarshal(m, b) } func (m *StreamingOutputCallResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_StreamingOutputCallResponse.Marshal(b, m, deterministic) } -func (dst *StreamingOutputCallResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_StreamingOutputCallResponse.Merge(dst, src) +func (m *StreamingOutputCallResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamingOutputCallResponse.Merge(m, src) } func (m *StreamingOutputCallResponse) XXX_Size() int { return xxx_messageInfo_StreamingOutputCallResponse.Size(m) @@ -502,6 +514,7 @@ func (m *StreamingOutputCallResponse) GetPayload() *Payload { } func init() { + proto.RegisterEnum("grpc.testing.PayloadType", PayloadType_name, PayloadType_value) proto.RegisterType((*Empty)(nil), "grpc.testing.Empty") proto.RegisterType((*Payload)(nil), "grpc.testing.Payload") proto.RegisterType((*SimpleRequest)(nil), "grpc.testing.SimpleRequest") @@ -511,7 +524,49 @@ func init() { proto.RegisterType((*ResponseParameters)(nil), "grpc.testing.ResponseParameters") proto.RegisterType((*StreamingOutputCallRequest)(nil), "grpc.testing.StreamingOutputCallRequest") proto.RegisterType((*StreamingOutputCallResponse)(nil), "grpc.testing.StreamingOutputCallResponse") - proto.RegisterEnum("grpc.testing.PayloadType", PayloadType_name, PayloadType_value) +} + +func init() { proto.RegisterFile("grpc_testing/test.proto", fileDescriptor_e1cda82041fed8bf) } + +var fileDescriptor_e1cda82041fed8bf = []byte{ + // 587 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0xdb, 0x6e, 0xd3, 0x40, + 0x10, 0x65, 0xdb, 0xf4, 0x36, 0x49, 0xad, 0x68, 0xab, 0xaa, 0xae, 0x8b, 0x84, 0x65, 0x1e, 0x30, + 0x48, 0xa4, 0x28, 0x08, 0x1e, 0x41, 0xa5, 0x17, 0x51, 0x29, 0x4d, 0x82, 0x9d, 0x3c, 0x47, 0xdb, + 0x64, 0x6b, 0x2c, 0x39, 0xf6, 0xb2, 0x5e, 0x57, 0xa4, 0x0f, 0xfc, 0x18, 0x3f, 0xc3, 0x47, 0xf0, + 0x01, 0x68, 0xd7, 0x76, 0xe2, 0x24, 0xae, 0x48, 0x41, 0xf0, 0x14, 0x7b, 0xe6, 0xcc, 0x99, 0x73, + 0x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xd6, 0x6f, 0xcf, + 0xc5, 0x10, 0x06, 0xd8, 0x74, 0x4e, 0xda, 0x67, 0x9d, 0xab, 0xfa, 0x5a, 0xf3, 0x7b, 0x05, 0xaa, + 0x3d, 0x1a, 0x0b, 0x97, 0xf2, 0x5b, 0x7f, 0x48, 0xf1, 0x1b, 0xd8, 0x51, 0x17, 0x88, 0x94, 0x85, + 0xf7, 0xe6, 0xbb, 0xab, 0x84, 0x51, 0x16, 0xc4, 0x17, 0xb0, 0xd3, 0x0f, 0x09, 0x4f, 0xcb, 0x8e, + 0xe6, 0x11, 0x73, 0x17, 0x87, 0xf1, 0xb8, 0x3c, 0x99, 0x7d, 0x80, 0x00, 0xf6, 0x4a, 0xbe, 0x0f, + 0xb6, 0x17, 0x8a, 0xee, 0x5d, 0x12, 0xe3, 0xf9, 0x0a, 0xc8, 0xb4, 0xd7, 0x2b, 0x84, 0x7d, 0xc0, + 0xcb, 0x27, 0x02, 0x3f, 0xbb, 0x87, 0x62, 0xf1, 0x04, 0x1a, 0xf6, 0xef, 0x81, 0x69, 0x2b, 0x5b, + 0xb6, 0xd2, 0x2e, 0x92, 0x20, 0x38, 0x4b, 0x58, 0x40, 0xbf, 0xfe, 0x33, 0x4f, 0x36, 0x52, 0xae, + 0xb4, 0x8f, 0x24, 0xb8, 0xf9, 0x0f, 0xad, 0xae, 0x37, 0xd5, 0x7f, 0xd0, 0xeb, 0x5f, 0x01, 0x00, + 0x00, 0xff, 0xff, 0x07, 0xc7, 0x76, 0x69, 0x9e, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -726,6 +781,29 @@ type TestServiceServer interface { HalfDuplexCall(TestService_HalfDuplexCallServer) error } +// UnimplementedTestServiceServer can be embedded to have forward compatible implementations. +type UnimplementedTestServiceServer struct { +} + +func (*UnimplementedTestServiceServer) EmptyCall(ctx context.Context, req *Empty) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method EmptyCall not implemented") +} +func (*UnimplementedTestServiceServer) UnaryCall(ctx context.Context, req *SimpleRequest) (*SimpleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnaryCall not implemented") +} +func (*UnimplementedTestServiceServer) StreamingOutputCall(req *StreamingOutputCallRequest, srv TestService_StreamingOutputCallServer) error { + return status.Errorf(codes.Unimplemented, "method StreamingOutputCall not implemented") +} +func (*UnimplementedTestServiceServer) StreamingInputCall(srv TestService_StreamingInputCallServer) error { + return status.Errorf(codes.Unimplemented, "method StreamingInputCall not implemented") +} +func (*UnimplementedTestServiceServer) FullDuplexCall(srv TestService_FullDuplexCallServer) error { + return status.Errorf(codes.Unimplemented, "method FullDuplexCall not implemented") +} +func (*UnimplementedTestServiceServer) HalfDuplexCall(srv TestService_HalfDuplexCallServer) error { + return status.Errorf(codes.Unimplemented, "method HalfDuplexCall not implemented") +} + func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer) { s.RegisterService(&_TestService_serviceDesc, srv) } @@ -904,46 +982,3 @@ var _TestService_serviceDesc = grpc.ServiceDesc{ }, Metadata: "grpc_testing/test.proto", } - -func init() { proto.RegisterFile("grpc_testing/test.proto", fileDescriptor_test_c9f6c5af4267cb88) } - -var fileDescriptor_test_c9f6c5af4267cb88 = []byte{ - // 587 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0xdb, 0x6e, 0xd3, 0x40, - 0x10, 0x65, 0xdb, 0xf4, 0x36, 0x49, 0xad, 0x68, 0xab, 0xaa, 0xae, 0x8b, 0x84, 0x65, 0x1e, 0x30, - 0x48, 0xa4, 0x28, 0x08, 0x1e, 0x41, 0xa5, 0x17, 0x51, 0x29, 0x4d, 0x82, 0x9d, 0x3c, 0x47, 0xdb, - 0x64, 0x6b, 0x2c, 0x39, 0xf6, 0xb2, 0x5e, 0x57, 0xa4, 0x0f, 0xfc, 0x18, 0x3f, 0xc3, 0x47, 0xf0, - 0x01, 0x68, 0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 0x9d, - 0xab, 0xae, 0x73, 0xee, 0xba, 0x27, 0x1f, 0x5a, 0xe7, 0xf5, 0x47, 0x18, 0x83, 0xd6, 0x6f, 0xcf, - 0xc5, 0x10, 0x06, 0xd8, 0x74, 0x4e, 0xda, 0x67, 0x9d, 0xab, 0xfa, 0x5a, 0xf3, 0x7b, 0x05, 0xaa, - 0x3d, 0x1a, 0x0b, 0x97, 0xf2, 0x5b, 0x7f, 0x48, 0xf1, 0x1b, 0xd8, 0x51, 0x17, 0x88, 0x94, 0x85, - 0xf7, 0xe6, 0xbb, 0xab, 0x84, 0x51, 0x16, 0xc4, 0x17, 0xb0, 0xd3, 0x0f, 0x09, 0x4f, 0xcb, 0x8e, - 0xe6, 0x11, 0x73, 0x17, 0x87, 0xf1, 0xb8, 0x3c, 0x99, 0x7d, 0x80, 0x00, 0xf6, 0x4a, 0xbe, 0x0f, - 0xb6, 0x17, 0x8a, 0xee, 0x5d, 0x12, 0xe3, 0xf9, 0x0a, 0xc8, 0xb4, 0xd7, 0x2b, 0x84, 0x7d, 0xc0, - 0xcb, 0x27, 0x02, 0x3f, 0xbb, 0x87, 0x62, 0xf1, 0x04, 0x1a, 0xf6, 0xef, 0x81, 0x69, 0x2b, 0x5b, - 0xb6, 0xd2, 0x2e, 0x92, 0x20, 0x38, 0x4b, 0x58, 0x40, 0xbf, 0xfe, 0x33, 0x4f, 0x36, 0x52, 0xae, - 0xb4, 0x8f, 0x24, 0xb8, 0xf9, 0x0f, 0xad, 0xae, 0x37, 0xd5, 0x7f, 0xd0, 0xeb, 0x5f, 0x01, 0x00, - 0x00, 0xff, 0xff, 0x07, 0xc7, 0x76, 0x69, 0x9e, 0x06, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/test/healthcheck_test.go b/vendor/google.golang.org/grpc/test/healthcheck_test.go index cabf1b377f6..1aa9d6b47c2 100644 --- a/vendor/google.golang.org/grpc/test/healthcheck_test.go +++ b/vendor/google.golang.org/grpc/test/healthcheck_test.go @@ -82,6 +82,7 @@ func defaultWatchFunc(s *testHealthServer, in *healthpb.HealthCheckRequest, stre } type testHealthServer struct { + healthpb.UnimplementedHealthServer watchFunc func(s *testHealthServer, in *healthpb.HealthCheckRequest, stream healthgrpc.Health_WatchServer) error mu sync.Mutex status map[string]healthpb.HealthCheckResponse_ServingStatus @@ -114,7 +115,7 @@ func (s *testHealthServer) SetServingStatus(service string, status healthpb.Heal func setupHealthCheckWrapper() (hcEnterChan chan struct{}, hcExitChan chan struct{}, wrapper internal.HealthChecker) { hcEnterChan = make(chan struct{}) hcExitChan = make(chan struct{}) - wrapper = func(ctx context.Context, newStream func(string) (interface{}, error), update func(state connectivity.State), service string) error { + wrapper = func(ctx context.Context, newStream func(string) (interface{}, error), update func(connectivity.State, error), service string) error { close(hcEnterChan) defer close(hcExitChan) return testHealthCheckFunc(ctx, newStream, update, service) @@ -194,7 +195,7 @@ func (s) TestHealthCheckWatchStateChange(t *testing.T) { r.UpdateState(resolver.State{ Addresses: []resolver.Address{{Addr: lis.Addr().String()}}, - ServiceConfig: parseCfg(`{ + ServiceConfig: parseCfg(r, `{ "healthCheckConfig": { "serviceName": "foo" } @@ -262,7 +263,7 @@ func (s) TestHealthCheckHealthServerNotRegistered(t *testing.T) { r.UpdateState(resolver.State{ Addresses: []resolver.Address{{Addr: lis.Addr().String()}}, - ServiceConfig: parseCfg(`{ + ServiceConfig: parseCfg(r, `{ "healthCheckConfig": { "serviceName": "foo" } @@ -306,7 +307,7 @@ func (s) TestHealthCheckWithGoAway(t *testing.T) { tc := testpb.NewTestServiceClient(cc) r.UpdateState(resolver.State{ Addresses: []resolver.Address{{Addr: lis.Addr().String()}}, - ServiceConfig: parseCfg(`{ + ServiceConfig: parseCfg(r, `{ "healthCheckConfig": { "serviceName": "foo" } @@ -398,7 +399,7 @@ func (s) TestHealthCheckWithConnClose(t *testing.T) { r.UpdateState(resolver.State{ Addresses: []resolver.Address{{Addr: lis.Addr().String()}}, - ServiceConfig: parseCfg(`{ + ServiceConfig: parseCfg(r, `{ "healthCheckConfig": { "serviceName": "foo" } @@ -457,7 +458,7 @@ func (s) TestHealthCheckWithAddrConnDrain(t *testing.T) { defer deferFunc() tc := testpb.NewTestServiceClient(cc) - sc := parseCfg(`{ + sc := parseCfg(r, `{ "healthCheckConfig": { "serviceName": "foo" } @@ -552,7 +553,7 @@ func (s) TestHealthCheckWithClientConnClose(t *testing.T) { tc := testpb.NewTestServiceClient(cc) r.UpdateState(resolver.State{ Addresses: []resolver.Address{{Addr: lis.Addr().String()}}, - ServiceConfig: parseCfg(`{ + ServiceConfig: parseCfg(r, `{ "healthCheckConfig": { "serviceName": "foo" } @@ -630,7 +631,7 @@ func (s) TestHealthCheckWithoutSetConnectivityStateCalledAddrConnShutDown(t *tes // The serviceName "delay" is specially handled at server side, where response will not be sent // back to client immediately upon receiving the request (client should receive no response until // test ends). - sc := parseCfg(`{ + sc := parseCfg(r, `{ "healthCheckConfig": { "serviceName": "delay" } @@ -708,7 +709,7 @@ func (s) TestHealthCheckWithoutSetConnectivityStateCalled(t *testing.T) { // test ends). r.UpdateState(resolver.State{ Addresses: []resolver.Address{{Addr: lis.Addr().String()}}, - ServiceConfig: parseCfg(`{ + ServiceConfig: parseCfg(r, `{ "healthCheckConfig": { "serviceName": "delay" } @@ -756,7 +757,7 @@ func testHealthCheckDisableWithDialOption(t *testing.T, addr string) { r.UpdateState(resolver.State{ Addresses: []resolver.Address{{Addr: addr}}, - ServiceConfig: parseCfg(`{ + ServiceConfig: parseCfg(r, `{ "healthCheckConfig": { "serviceName": "foo" } @@ -795,7 +796,7 @@ func testHealthCheckDisableWithBalancer(t *testing.T, addr string) { r.UpdateState(resolver.State{ Addresses: []resolver.Address{{Addr: addr}}, - ServiceConfig: parseCfg(`{ + ServiceConfig: parseCfg(r, `{ "healthCheckConfig": { "serviceName": "foo" } @@ -888,7 +889,7 @@ func (s) TestHealthCheckChannelzCountingCallSuccess(t *testing.T) { r.UpdateState(resolver.State{ Addresses: []resolver.Address{{Addr: lis.Addr().String()}}, - ServiceConfig: parseCfg(`{ + ServiceConfig: parseCfg(r, `{ "healthCheckConfig": { "serviceName": "channelzSuccess" } @@ -944,7 +945,7 @@ func (s) TestHealthCheckChannelzCountingCallFailure(t *testing.T) { r.UpdateState(resolver.State{ Addresses: []resolver.Address{{Addr: lis.Addr().String()}}, - ServiceConfig: parseCfg(`{ + ServiceConfig: parseCfg(r, `{ "healthCheckConfig": { "serviceName": "channelzFailure" } diff --git a/vendor/google.golang.org/grpc/test/retry_test.go b/vendor/google.golang.org/grpc/test/retry_test.go index 0e8fd0e0c44..f0ab380e96b 100644 --- a/vendor/google.golang.org/grpc/test/retry_test.go +++ b/vendor/google.golang.org/grpc/test/retry_test.go @@ -23,7 +23,6 @@ import ( "fmt" "io" "os" - "reflect" "strconv" "strings" "testing" @@ -362,7 +361,7 @@ func (s) TestRetryStreaming(t *testing.T) { res, err := stream.Recv() if res != nil || ((err == nil) != (want == nil)) || - (want != nil && !reflect.DeepEqual(err, want)) { + (want != nil && err.Error() != want.Error()) { return fmt.Errorf("client: Recv() = %v, %v; want , %v", res, err, want) } return nil diff --git a/vendor/google.golang.org/grpc/test/tools/go.mod b/vendor/google.golang.org/grpc/test/tools/go.mod new file mode 100644 index 00000000000..87c5ac99c88 --- /dev/null +++ b/vendor/google.golang.org/grpc/test/tools/go.mod @@ -0,0 +1,12 @@ +module google.golang.org/grpc/test/tools + +go 1.11 + +require ( + github.com/BurntSushi/toml v0.3.1 // indirect + github.com/client9/misspell v0.3.4 + github.com/golang/protobuf v1.3.2 + golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 + golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 + honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc +) diff --git a/vendor/google.golang.org/grpc/test/tools/go.sum b/vendor/google.golang.org/grpc/test/tools/go.sum new file mode 100644 index 00000000000..7b2a8a21a86 --- /dev/null +++ b/vendor/google.golang.org/grpc/test/tools/go.sum @@ -0,0 +1,18 @@ +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 h1:5Beo0mZN8dRzgrMMkDp0jc8YXQKx9DiJ2k1dkvGsn5A= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go index 5411a73a22e..1d3b043ec4b 100644 --- a/vendor/google.golang.org/grpc/version.go +++ b/vendor/google.golang.org/grpc/version.go @@ -19,4 +19,4 @@ package grpc // Version is the current grpc version. -const Version = "1.23.0" +const Version = "1.26.0" diff --git a/vendor/google.golang.org/grpc/vet.sh b/vendor/google.golang.org/grpc/vet.sh index 661e1e1de9b..798921acc85 100755 --- a/vendor/google.golang.org/grpc/vet.sh +++ b/vendor/google.golang.org/grpc/vet.sh @@ -31,12 +31,15 @@ PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}" if [[ "$1" = "-install" ]]; then # Check for module support if go help mod >& /dev/null; then + # Install the pinned versions as defined in module tools. + pushd ./test/tools go install \ golang.org/x/lint/golint \ golang.org/x/tools/cmd/goimports \ honnef.co/go/tools/cmd/staticcheck \ github.com/client9/misspell/cmd/misspell \ github.com/golang/protobuf/protoc-gen-go + popd else # Ye olde `go get` incantation. # Note: this gets the latest version of all tools (vs. the pinned versions @@ -67,18 +70,21 @@ elif [[ "$#" -ne 0 ]]; then fi # - Ensure all source files contain a copyright message. -git ls-files "*.go" | xargs grep -L "\(Copyright [0-9]\{4,\} gRPC authors\)\|DO NOT EDIT" 2>&1 | fail_on_output +(! git grep -L "\(Copyright [0-9]\{4,\} gRPC authors\)\|DO NOT EDIT" -- '*.go') # - Make sure all tests in grpc and grpc/test use leakcheck via Teardown. (! grep 'func Test[^(]' *_test.go) (! grep 'func Test[^(]' test/*.go) +# - Do not import x/net/context. +(! git grep -l 'x/net/context' -- "*.go") + # - Do not import math/rand for real library code. Use internal/grpcrand for # thread safety. -git ls-files "*.go" | xargs grep -l '"math/rand"' 2>&1 | (! grep -v '^examples\|^stress\|grpcrand\|wrr_test') +git grep -l '"math/rand"' -- "*.go" 2>&1 | (! grep -v '^examples\|^stress\|grpcrand\|wrr_test') # - Ensure all ptypes proto packages are renamed when importing. -git ls-files "*.go" | (! xargs grep "\(import \|^\s*\)\"github.com/golang/protobuf/ptypes/") +(! git grep "\(import \|^\s*\)\"github.com/golang/protobuf/ptypes/" -- "*.go") # - Check imports that are illegal in appengine (until Go 1.11). # TODO: Remove when we drop Go 1.10 support @@ -86,10 +92,12 @@ go list -f {{.Dir}} ./... | xargs go run test/go_vet/vet.go # - gofmt, goimports, golint (with exceptions for generated code), go vet. gofmt -s -d -l . 2>&1 | fail_on_output -goimports -l . 2>&1 | (! grep -vE "(_mock|\.pb)\.go:") | fail_on_output +goimports -l . 2>&1 | (! grep -vE "(_mock|\.pb)\.go") golint ./... 2>&1 | (! grep -vE "(_mock|\.pb)\.go:") go vet -all . +misspell -error . + # - Check that generated proto files are up to date. if [[ -z "${VET_SKIP_PROTO}" ]]; then PATH="/home/travis/bin:${PATH}" make proto && \ @@ -105,30 +113,47 @@ if go help mod >& /dev/null; then fi # - Collection of static analysis checks -# TODO(dfawley): don't use deprecated functions in examples. -staticcheck -go 1.9 -checks 'inherit,-ST1015' -ignore ' -google.golang.org/grpc/balancer.go:SA1019 -google.golang.org/grpc/balancer/grpclb/grpclb_remote_balancer.go:SA1019 -google.golang.org/grpc/balancer/roundrobin/roundrobin_test.go:SA1019 -google.golang.org/grpc/xds/internal/balancer/edsbalancer/balancergroup.go:SA1019 -google.golang.org/grpc/xds/internal/balancer/xds.go:SA1019 -google.golang.org/grpc/xds/internal/balancer/xds_client.go:SA1019 -google.golang.org/grpc/balancer_conn_wrappers.go:SA1019 -google.golang.org/grpc/balancer_test.go:SA1019 -google.golang.org/grpc/benchmark/benchmain/main.go:SA1019 -google.golang.org/grpc/benchmark/worker/benchmark_client.go:SA1019 -google.golang.org/grpc/clientconn.go:S1024 -google.golang.org/grpc/clientconn_state_transition_test.go:SA1019 -google.golang.org/grpc/clientconn_test.go:SA1019 -google.golang.org/grpc/examples/features/debugging/client/main.go:SA1019 -google.golang.org/grpc/examples/features/load_balancing/client/main.go:SA1019 -google.golang.org/grpc/internal/transport/handler_server.go:SA1019 -google.golang.org/grpc/internal/transport/handler_server_test.go:SA1019 -google.golang.org/grpc/resolver/dns/dns_resolver.go:SA1019 -google.golang.org/grpc/stats/stats_test.go:SA1019 -google.golang.org/grpc/test/balancer_test.go:SA1019 -google.golang.org/grpc/test/channelz_test.go:SA1019 -google.golang.org/grpc/test/end2end_test.go:SA1019 -google.golang.org/grpc/test/healthcheck_test.go:SA1019 -' ./... -misspell -error . +# +# TODO(dfawley): don't use deprecated functions in examples or first-party +# plugins. +SC_OUT="$(mktemp)" +staticcheck -go 1.9 -checks 'inherit,-ST1015' ./... > "${SC_OUT}" || true +# Error if anything other than deprecation warnings are printed. +(! grep -v "is deprecated:.*SA1019" "${SC_OUT}") +# Only ignore the following deprecated types/fields/functions. +(! grep -Fv '.HandleResolvedAddrs +.HandleSubConnStateChange +.HeaderMap +.NewAddress +.NewServiceConfig +.Metadata is deprecated: use Attributes +.Type is deprecated: use Attributes +.UpdateBalancerState +balancer.Picker +grpc.CallCustomCodec +grpc.Code +grpc.Compressor +grpc.Decompressor +grpc.MaxMsgSize +grpc.MethodConfig +grpc.NewGZIPCompressor +grpc.NewGZIPDecompressor +grpc.RPCCompressor +grpc.RPCDecompressor +grpc.RoundRobin +grpc.ServiceConfig +grpc.WithBalancer +grpc.WithBalancerName +grpc.WithCompressor +grpc.WithDecompressor +grpc.WithDialer +grpc.WithMaxMsgSize +grpc.WithServiceConfig +grpc.WithTimeout +http.CloseNotifier +naming.Resolver +naming.Update +naming.Watcher +resolver.Backend +resolver.GRPCLB' "${SC_OUT}" +) diff --git a/vendor/google.golang.org/grpc/xds/experimental/xds_experimental.go b/vendor/google.golang.org/grpc/xds/experimental/xds_experimental.go index 7477ea3d94c..806ed407da1 100644 --- a/vendor/google.golang.org/grpc/xds/experimental/xds_experimental.go +++ b/vendor/google.golang.org/grpc/xds/experimental/xds_experimental.go @@ -23,10 +23,8 @@ package experimental import ( - "google.golang.org/grpc/balancer" - xdsbalancer "google.golang.org/grpc/xds/internal/balancer" + _ "google.golang.org/grpc/xds/internal/balancer" // Register the xds_balancer + _ "google.golang.org/grpc/xds/internal/balancer/cdsbalancer" // Register the cds balancer + _ "google.golang.org/grpc/xds/internal/resolver" // Register the xds_resolver + _ "google.golang.org/grpc/xds/internal/resolver/old" // Register the old xds_resolver ) - -func init() { - balancer.Register(xdsbalancer.NewBalancerBuilder()) -} diff --git a/vendor/google.golang.org/grpc/xds/internal/balancer/cdsbalancer/cdsbalancer.go b/vendor/google.golang.org/grpc/xds/internal/balancer/cdsbalancer/cdsbalancer.go new file mode 100644 index 00000000000..bc05345df8e --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/balancer/cdsbalancer/cdsbalancer.go @@ -0,0 +1,350 @@ +/* + * 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. + */ + +// Package cdsbalancer implements a balancer to handle CDS responses. +package cdsbalancer + +import ( + "encoding/json" + "errors" + "fmt" + "sync" + + "google.golang.org/grpc/attributes" + "google.golang.org/grpc/balancer" + "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal/buffer" + "google.golang.org/grpc/resolver" + "google.golang.org/grpc/serviceconfig" + + xdsinternal "google.golang.org/grpc/xds/internal" + xdsbalancer "google.golang.org/grpc/xds/internal/balancer" + xdsclient "google.golang.org/grpc/xds/internal/client" +) + +const ( + cdsName = "experimental_cds" + edsName = "experimental_eds" +) + +var ( + errBalancerClosed = errors.New("cdsBalancer is closed") + + // newEDSBalancer is a helper function to build a new edsBalancer and will be + // overridden in unittests. + newEDSBalancer = func(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.V2Balancer { + builder := balancer.Get(edsName) + if builder == nil { + grpclog.Errorf("xds: no balancer builder with name %v", edsName) + return nil + } + // We directly pass the parent clientConn to the + // underlying edsBalancer because the cdsBalancer does + // not deal with subConns. + return builder.Build(cc, opts).(balancer.V2Balancer) + } +) + +func init() { + balancer.Register(cdsBB{}) +} + +// cdsBB (short for cdsBalancerBuilder) implements the balancer.Builder +// interface to help build a cdsBalancer. +// It also implements the balancer.ConfigParser interface to help parse the +// JSON service config, to be passed to the cdsBalancer. +type cdsBB struct{} + +// Build creates a new CDS balancer with the ClientConn. +func (cdsBB) Build(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.Balancer { + b := &cdsBalancer{ + cc: cc, + bOpts: opts, + updateCh: buffer.NewUnbounded(), + } + go b.run() + return b +} + +// Name returns the name of balancers built by this builder. +func (cdsBB) Name() string { + return cdsName +} + +// lbConfig represents the loadBalancingConfig section of the service config +// for the cdsBalancer. +type lbConfig struct { + serviceconfig.LoadBalancingConfig + ClusterName string `json:"Cluster"` +} + +// ParseConfig parses the JSON load balancer config provided into an +// internal form or returns an error if the config is invalid. +func (cdsBB) ParseConfig(c json.RawMessage) (serviceconfig.LoadBalancingConfig, error) { + var cfg lbConfig + if err := json.Unmarshal(c, &cfg); err != nil { + return nil, fmt.Errorf("xds: unable to unmarshal lbconfig: %s, error: %v", string(c), err) + } + return &cfg, nil +} + +// xdsClientInterface contains methods from xdsClient.Client which are used by +// the cdsBalancer. This will be faked out in unittests. +type xdsClientInterface interface { + WatchCluster(string, func(xdsclient.CDSUpdate, error)) func() + Close() +} + +// ccUpdate wraps a clientConn update received from gRPC (pushed from the +// xdsResolver). A valid clusterName causes the cdsBalancer to register a CDS +// watcher with the xdsClient, while a non-nil error causes it to cancel the +// existing watch and propagate the error to the underlying edsBalancer. +type ccUpdate struct { + client xdsClientInterface + clusterName string + err error +} + +// scUpdate wraps a subConn update received from gRPC. This is directly passed +// on to the edsBalancer. +type scUpdate struct { + subConn balancer.SubConn + state balancer.SubConnState +} + +// watchUpdate wraps the information received from a registered CDS watcher. A +// non-nil error is propagated to the underlying edsBalancer. A valid update +// results in creating a new edsBalancer (if one doesn't already exist) and +// pushing the update to it. +type watchUpdate struct { + cds xdsclient.CDSUpdate + err error +} + +// closeUpdate is an empty struct used to notify the run() goroutine that a +// Close has been called on the balancer. +type closeUpdate struct{} + +// cdsBalancer implements a CDS based LB policy. It instantiates an EDS based +// LB policy to further resolve the serviceName received from CDS, into +// localities and endpoints. Implements the balancer.Balancer interface which +// is exposed to gRPC and implements the balancer.ClientConn interface which is +// exposed to the edsBalancer. +type cdsBalancer struct { + cc balancer.ClientConn + bOpts balancer.BuildOptions + updateCh *buffer.Unbounded + client xdsClientInterface + cancelWatch func() + edsLB balancer.V2Balancer + clusterToWatch string + + // The only thing protected by this mutex is the closed boolean. This is + // checked by all methods before acting on updates. + mu sync.Mutex + closed bool +} + +// run is a long-running goroutine which handles all updates from gRPC. All +// methods which are invoked directly by gRPC or xdsClient simply push an +// update onto a channel which is read and acted upon right here. +// +// 1. Good clientConn updates lead to registration of a CDS watch. Updates with +// error lead to cancellation of existing watch and propagation of the same +// error to the edsBalancer. +// 2. SubConn updates are passthrough and are simply handed over to the +// underlying edsBalancer. +// 3. Watch API updates lead to clientConn updates being invoked on the +// underlying edsBalancer. +// 4. Close results in cancellation of the CDS watch and closing of the +// underlying edsBalancer and is the only way to exit this goroutine. +func (b *cdsBalancer) run() { + for { + u := <-b.updateCh.Get() + b.updateCh.Load() + switch update := u.(type) { + case *ccUpdate: + // We first handle errors, if any, and then proceed with handling + // the update, only if the status quo has changed. + if err := update.err; err != nil { + // TODO: Should we cancel the watch only on specific errors? + if b.cancelWatch != nil { + b.cancelWatch() + } + if b.edsLB != nil { + b.edsLB.ResolverError(err) + } + } + if b.client == update.client && b.clusterToWatch == update.clusterName { + break + } + if update.client != nil { + // Since the cdsBalancer doesn't own the xdsClient object, we + // don't have to bother about closing the old client here, but + // we still need to cancel the watch on the old client. + if b.cancelWatch != nil { + b.cancelWatch() + } + b.client = update.client + } + if update.clusterName != "" { + b.cancelWatch = b.client.WatchCluster(update.clusterName, b.handleClusterUpdate) + b.clusterToWatch = update.clusterName + } + case *scUpdate: + if b.edsLB == nil { + grpclog.Errorf("xds: received scUpdate {%+v} with no edsBalancer", update) + break + } + b.edsLB.UpdateSubConnState(update.subConn, update.state) + case *watchUpdate: + if err := update.err; err != nil { + if b.edsLB != nil { + b.edsLB.ResolverError(err) + } + break + } + + // The first good update from the watch API leads to the + // instantiation of an edsBalancer. Further updates/errors are + // propagated to the existing edsBalancer. + if b.edsLB == nil { + b.edsLB = newEDSBalancer(b.cc, b.bOpts) + if b.edsLB == nil { + grpclog.Error("xds: failed to build edsBalancer") + break + } + } + lbCfg := &xdsbalancer.XDSConfig{EDSServiceName: update.cds.ServiceName} + if update.cds.EnableLRS { + // An empty string here indicates that the edsBalancer + // should use the same xDS server for load reporting as + // it does for EDS requests/responses. + lbCfg.LrsLoadReportingServerName = new(string) + + } + ccState := balancer.ClientConnState{ + ResolverState: resolver.State{Attributes: attributes.New(xdsinternal.XDSClientID, b.client)}, + BalancerConfig: lbCfg, + } + if err := b.edsLB.UpdateClientConnState(ccState); err != nil { + grpclog.Errorf("xds: edsBalancer.UpdateClientConnState(%+v) returned error: %v", ccState, err) + } + case *closeUpdate: + if b.cancelWatch != nil { + b.cancelWatch() + b.cancelWatch = nil + } + if b.edsLB != nil { + b.edsLB.Close() + b.edsLB = nil + } + // This is the *ONLY* point of return from this function. + return + } + } +} + +// handleClusterUpdate is the CDS watch API callback. It simply pushes the +// received information on to the update channel for run() to pick it up. +func (b *cdsBalancer) handleClusterUpdate(cu xdsclient.CDSUpdate, err error) { + if b.isClosed() { + grpclog.Warningf("xds: received cluster update {%+v} after cdsBalancer was closed", cu) + return + } + b.updateCh.Put(&watchUpdate{cds: cu, err: err}) +} + +// UpdateClientConnState receives the serviceConfig (which contains the +// clusterName to watch for in CDS) and the xdsClient object from the +// xdsResolver. +func (b *cdsBalancer) UpdateClientConnState(state balancer.ClientConnState) error { + if b.isClosed() { + grpclog.Warningf("xds: received ClientConnState {%+v} after cdsBalancer was closed", state) + return errBalancerClosed + } + + // The errors checked here should ideally never happen because the + // ServiceConfig in this case is prepared by the xdsResolver and is not + // something that is received on the wire. + lbCfg, ok := state.BalancerConfig.(*lbConfig) + if !ok { + grpclog.Warningf("xds: unexpected LoadBalancingConfig type: %T", state.BalancerConfig) + return balancer.ErrBadResolverState + } + if lbCfg.ClusterName == "" { + grpclog.Warning("xds: no clusterName found in LoadBalancingConfig: %+v", lbCfg) + return balancer.ErrBadResolverState + } + client := state.ResolverState.Attributes.Value(xdsinternal.XDSClientID) + if client == nil { + grpclog.Warning("xds: no xdsClient found in resolver state attributes") + return balancer.ErrBadResolverState + } + newClient, ok := client.(xdsClientInterface) + if !ok { + grpclog.Warningf("xds: unexpected xdsClient type: %T", client) + return balancer.ErrBadResolverState + } + b.updateCh.Put(&ccUpdate{client: newClient, clusterName: lbCfg.ClusterName}) + return nil +} + +// ResolverError handles errors reported by the xdsResolver. +// +// TODO: Make it possible to differentiate between connection errors and +// resource not found errors. +func (b *cdsBalancer) ResolverError(err error) { + if b.isClosed() { + grpclog.Warningf("xds: received resolver error {%v} after cdsBalancer was closed", err) + return + } + + b.updateCh.Put(&ccUpdate{err: err}) +} + +// UpdateSubConnState handles subConn updates from gRPC. +func (b *cdsBalancer) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState) { + if b.isClosed() { + grpclog.Warningf("xds: received subConn update {%v, %v} after cdsBalancer was closed", sc, state) + return + } + b.updateCh.Put(&scUpdate{subConn: sc, state: state}) +} + +// Close closes the cdsBalancer and the underlying edsBalancer. +func (b *cdsBalancer) Close() { + b.mu.Lock() + b.closed = true + b.mu.Unlock() + b.updateCh.Put(&closeUpdate{}) +} + +func (b *cdsBalancer) isClosed() bool { + b.mu.Lock() + closed := b.closed + b.mu.Unlock() + return closed +} + +func (b *cdsBalancer) HandleSubConnStateChange(sc balancer.SubConn, state connectivity.State) { + grpclog.Error("UpdateSubConnState should be called instead of HandleSubConnStateChange") +} + +func (b *cdsBalancer) HandleResolvedAddrs(addrs []resolver.Address, err error) { + grpclog.Error("UpdateClientConnState should be called instead of HandleResolvedAddrs") +} diff --git a/vendor/google.golang.org/grpc/xds/internal/balancer/cdsbalancer/cdsbalancer_test.go b/vendor/google.golang.org/grpc/xds/internal/balancer/cdsbalancer/cdsbalancer_test.go new file mode 100644 index 00000000000..2d5a82222c4 --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/balancer/cdsbalancer/cdsbalancer_test.go @@ -0,0 +1,556 @@ +/* + * 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. + */ + +package cdsbalancer + +import ( + "encoding/json" + "errors" + "fmt" + "reflect" + "testing" + "time" + + "google.golang.org/grpc/attributes" + "google.golang.org/grpc/balancer" + "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/internal" + "google.golang.org/grpc/resolver" + "google.golang.org/grpc/serviceconfig" + xdsinternal "google.golang.org/grpc/xds/internal" + xdsbalancer "google.golang.org/grpc/xds/internal/balancer" + xdsclient "google.golang.org/grpc/xds/internal/client" +) + +const ( + clusterName = "cluster1" + serviceName = "service1" + defaultTestTimeout = 2 * time.Second +) + +type testClientConn struct { + balancer.ClientConn +} + +// testXDSClient is fake implementation of the xdsClientInterface. It contains +// a bunch of channels to signal different events to the test. +type testXDSClient struct { + // watchCb is the watch API callback registered by the cdsBalancer. Used to + // pass different CDS updates to the balancer, from the test. + watchCb func(xdsclient.CDSUpdate, error) + // clusterCh is a channel used to signal the cluster name for which the + // watch API call was invoked on this client. + clusterCh chan string + // cancelWatchCh is a channel used to signal the cancellation of the + // registered watch API. + cancelWatchCh chan struct{} +} + +func newTestXDSClient() *testXDSClient { + return &testXDSClient{ + clusterCh: make(chan string, 1), + cancelWatchCh: make(chan struct{}, 1), + } +} +func (tc *testXDSClient) WatchCluster(clusterName string, callback func(xdsclient.CDSUpdate, error)) func() { + tc.watchCb = callback + tc.clusterCh <- clusterName + return tc.cancelWatch +} + +func (tc *testXDSClient) Close() {} + +func (tc *testXDSClient) cancelWatch() { + tc.cancelWatchCh <- struct{}{} +} + +// waitForWatch verifies if the testXDSClient receives a CDS watch API with the +// provided clusterName within a reasonable amount of time. +func (tc *testXDSClient) waitForWatch(wantCluster string) error { + timer := time.NewTimer(defaultTestTimeout) + select { + case <-timer.C: + return errors.New("Timeout when expecting CDS watch call") + case gotCluster := <-tc.clusterCh: + timer.Stop() + if gotCluster != wantCluster { + return fmt.Errorf("WatchCluster called with clusterName: %s, want %s", gotCluster, wantCluster) + } + return nil + } +} + +// waitForCancelWatch verifies if the CDS watch API is cancelled within a +// reasonable amount of time. +func (tc *testXDSClient) waitForCancelWatch() error { + timer := time.NewTimer(defaultTestTimeout) + select { + case <-timer.C: + return errors.New("Timeout when expecting CDS watch call to be cancelled") + case <-tc.cancelWatchCh: + timer.Stop() + return nil + } +} + +// cdsWatchInfo wraps the update and the error sent in a CDS watch callback. +type cdsWatchInfo struct { + update xdsclient.CDSUpdate + err error +} + +// invokeWatchCb invokes the CDS watch callback registered by the cdsBalancer +// and waits for appropriate state to be pushed to the provided edsBalancer. +func (tc *testXDSClient) invokeWatchCb(cdsW cdsWatchInfo, wantCCS balancer.ClientConnState, edsB *testEDSBalancer) error { + tc.watchCb(cdsW.update, cdsW.err) + if cdsW.err != nil { + return edsB.waitForResolverError(cdsW.err) + } + return edsB.waitForClientConnUpdate(wantCCS) +} + +// testEDSBalancer is a fake edsBalancer used to verify different actions from +// the cdsBalancer. It contains a bunch of channels to signal different events +// to the test. +type testEDSBalancer struct { + // ccsCh is a channel used to signal the receipt of a ClientConn update. + ccsCh chan balancer.ClientConnState + // scStateCh is a channel used to signal the receipt of a SubConn update. + scStateCh chan subConnWithState + // resolverErrCh is a channel used to signal a resolver error. + resolverErrCh chan error + // closeCh is a channel used to signal the closing of this balancer. + closeCh chan struct{} +} + +type subConnWithState struct { + sc balancer.SubConn + state balancer.SubConnState +} + +func newTestEDSBalancer() *testEDSBalancer { + return &testEDSBalancer{ + ccsCh: make(chan balancer.ClientConnState, 1), + scStateCh: make(chan subConnWithState, 1), + resolverErrCh: make(chan error, 1), + closeCh: make(chan struct{}, 1), + } +} + +func (tb *testEDSBalancer) UpdateClientConnState(ccs balancer.ClientConnState) error { + tb.ccsCh <- ccs + return nil +} + +func (tb *testEDSBalancer) ResolverError(err error) { + tb.resolverErrCh <- err +} + +func (tb *testEDSBalancer) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState) { + tb.scStateCh <- subConnWithState{sc: sc, state: state} +} + +func (tb *testEDSBalancer) Close() { + tb.closeCh <- struct{}{} +} + +// waitForClientConnUpdate verifies if the testEDSBalancer receives the +// provided ClientConnState within a reasonable amount of time. +func (tb *testEDSBalancer) waitForClientConnUpdate(wantCCS balancer.ClientConnState) error { + timer := time.NewTimer(defaultTestTimeout) + select { + case <-timer.C: + return errors.New("Timeout when expecting ClientConn update on EDS balancer") + case gotCCS := <-tb.ccsCh: + timer.Stop() + if !reflect.DeepEqual(gotCCS, wantCCS) { + return fmt.Errorf("received ClientConnState: %+v, want %+v", gotCCS, wantCCS) + } + return nil + } +} + +// waitForSubConnUpdate verifies if the testEDSBalancer receives the provided +// SubConn update within a reasonable amount of time. +func (tb *testEDSBalancer) waitForSubConnUpdate(wantSCS subConnWithState) error { + timer := time.NewTimer(defaultTestTimeout) + select { + case <-timer.C: + return errors.New("Timeout when expecting SubConn update on EDS balancer") + case gotSCS := <-tb.scStateCh: + timer.Stop() + if !reflect.DeepEqual(gotSCS, wantSCS) { + return fmt.Errorf("received SubConnState: %+v, want %+v", gotSCS, wantSCS) + } + return nil + } +} + +// waitForResolverError verifies if the testEDSBalancer receives the +// provided resolver error within a reasonable amount of time. +func (tb *testEDSBalancer) waitForResolverError(wantErr error) error { + timer := time.NewTimer(defaultTestTimeout) + select { + case <-timer.C: + return errors.New("Timeout when expecting a resolver error") + case gotErr := <-tb.resolverErrCh: + timer.Stop() + if gotErr != wantErr { + return fmt.Errorf("received resolver error: %v, want %v", gotErr, wantErr) + } + return nil + } +} + +// waitForClose verifies that the edsBalancer is closed with a reasonable +// amount of time. +func (tb *testEDSBalancer) waitForClose() error { + timer := time.NewTimer(defaultTestTimeout) + select { + case <-timer.C: + return errors.New("Timeout when expecting a close") + case <-tb.closeCh: + timer.Stop() + return nil + } +} + +// cdsCCS is a helper function to construct a good update passed from the +// xdsResolver to the cdsBalancer. +func cdsCCS(cluster string, xdsClient interface{}) balancer.ClientConnState { + const cdsLBConfig = `{ + "loadBalancingConfig":[ + { + "experimental_cds":{ + "Cluster": %s + } + } + ] + }` + jsonSC := fmt.Sprintf(cdsLBConfig, cluster) + return balancer.ClientConnState{ + ResolverState: resolver.State{ + ServiceConfig: internal.ParseServiceConfigForTesting.(func(string) *serviceconfig.ParseResult)(jsonSC), + Attributes: attributes.New(xdsinternal.XDSClientID, xdsClient), + }, + BalancerConfig: &lbConfig{ClusterName: clusterName}, + } +} + +// edsCCS is a helper function to construct a good update passed from the +// cdsBalancer to the edsBalancer. +func edsCCS(service string, enableLRS bool, xdsClient interface{}) balancer.ClientConnState { + lbCfg := &xdsbalancer.XDSConfig{EDSServiceName: service} + if enableLRS { + lbCfg.LrsLoadReportingServerName = new(string) + } + return balancer.ClientConnState{ + ResolverState: resolver.State{Attributes: attributes.New(xdsinternal.XDSClientID, xdsClient)}, + BalancerConfig: lbCfg, + } +} + +// setup creates a cdsBalancer and an edsBalancer (and overrides the +// newEDSBalancer function to return it), and also returns a cleanup function. +func setup() (*cdsBalancer, *testEDSBalancer, func()) { + builder := cdsBB{} + tcc := &testClientConn{} + cdsB := builder.Build(tcc, balancer.BuildOptions{}).(balancer.V2Balancer) + + edsB := newTestEDSBalancer() + oldEDSBalancerBuilder := newEDSBalancer + newEDSBalancer = func(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.V2Balancer { + return edsB + } + + return cdsB.(*cdsBalancer), edsB, func() { + newEDSBalancer = oldEDSBalancerBuilder + } +} + +// setupWithWatch does everything that setup does, and also pushes a ClientConn +// update to the cdsBalancer and waits for a CDS watch call to be registered. +func setupWithWatch(t *testing.T) (*testXDSClient, *cdsBalancer, *testEDSBalancer, func()) { + t.Helper() + + xdsC := newTestXDSClient() + cdsB, edsB, cancel := setup() + if err := cdsB.UpdateClientConnState(cdsCCS(clusterName, xdsC)); err != nil { + t.Fatalf("cdsBalancer.UpdateClientConnState failed with error: %v", err) + } + if err := xdsC.waitForWatch(clusterName); err != nil { + t.Fatal(err) + } + return xdsC, cdsB, edsB, cancel +} + +// TestUpdateClientConnState invokes the UpdateClientConnState method on the +// cdsBalancer with different inputs and verifies that the CDS watch API on the +// provided xdsClient is invoked appropriately. +func TestUpdateClientConnState(t *testing.T) { + xdsC := newTestXDSClient() + + tests := []struct { + name string + ccs balancer.ClientConnState + wantErr error + wantCluster string + }{ + { + name: "bad-lbCfg-type", + ccs: balancer.ClientConnState{BalancerConfig: nil}, + wantErr: balancer.ErrBadResolverState, + }, + { + name: "empty-cluster-in-lbCfg", + ccs: balancer.ClientConnState{BalancerConfig: &lbConfig{ClusterName: ""}}, + wantErr: balancer.ErrBadResolverState, + }, + { + name: "no-xdsClient-in-attributes", + ccs: balancer.ClientConnState{ + ResolverState: resolver.State{ + Attributes: attributes.New("key", "value"), + }, + BalancerConfig: &lbConfig{ClusterName: clusterName}, + }, + wantErr: balancer.ErrBadResolverState, + }, + { + name: "bad-xdsClient-in-attributes", + ccs: balancer.ClientConnState{ + ResolverState: resolver.State{ + Attributes: attributes.New(xdsinternal.XDSClientID, "value"), + }, + BalancerConfig: &lbConfig{ClusterName: clusterName}, + }, + wantErr: balancer.ErrBadResolverState, + }, + { + name: "happy-good-case", + ccs: cdsCCS(clusterName, xdsC), + wantCluster: clusterName, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + cdsB, _, cancel := setup() + defer func() { + cancel() + cdsB.Close() + }() + + if err := cdsB.UpdateClientConnState(test.ccs); err != test.wantErr { + t.Fatalf("cdsBalancer.UpdateClientConnState failed with error: %v", err) + } + if test.wantErr != nil { + // When we wanted an error and got it, we should return early. + return + } + if err := xdsC.waitForWatch(test.wantCluster); err != nil { + t.Fatal(err) + } + }) + } +} + +// TestUpdateClientConnStateAfterClose invokes the UpdateClientConnState method +// on the cdsBalancer after close and verifies that it returns an error. +func TestUpdateClientConnStateAfterClose(t *testing.T) { + cdsB, _, cancel := setup() + defer cancel() + cdsB.Close() + + if err := cdsB.UpdateClientConnState(cdsCCS(clusterName, newTestXDSClient())); err != errBalancerClosed { + t.Fatalf("UpdateClientConnState() after close returned %v, want %v", err, errBalancerClosed) + } +} + +// TestUpdateClientConnStateWithSameState verifies that a ClientConnState +// update with the same cluster and xdsClient does not cause the cdsBalancer to +// create a new watch. +func TestUpdateClientConnStateWithSameState(t *testing.T) { + xdsC, cdsB, _, cancel := setupWithWatch(t) + defer func() { + cancel() + cdsB.Close() + }() + + if err := cdsB.UpdateClientConnState(cdsCCS(clusterName, xdsC)); err != nil { + t.Fatalf("cdsBalancer.UpdateClientConnState failed with error: %v", err) + } + if err := xdsC.waitForWatch(clusterName); err == nil { + t.Fatal("Waiting for WatchCluster() should have timed out, but returned with nil error") + } +} + +// TestHandleClusterUpdate invokes the registered CDS watch callback with +// different updates and verifies that the expect ClientConnState is propagated +// to the edsBalancer. +func TestHandleClusterUpdate(t *testing.T) { + xdsC, cdsB, edsB, cancel := setupWithWatch(t) + defer func() { + cancel() + cdsB.Close() + }() + + tests := []struct { + name string + cdsUpdate xdsclient.CDSUpdate + updateErr error + wantCCS balancer.ClientConnState + }{ + { + name: "happy-case-with-lrs", + cdsUpdate: xdsclient.CDSUpdate{ServiceName: serviceName, EnableLRS: true}, + wantCCS: edsCCS(serviceName, true, xdsC), + }, + { + name: "happy-case-without-lrs", + cdsUpdate: xdsclient.CDSUpdate{ServiceName: serviceName}, + wantCCS: edsCCS(serviceName, false, xdsC), + }, + { + name: "cdsWatch-returns-error", + updateErr: errors.New("cdsUpdate error"), + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + if err := xdsC.invokeWatchCb(cdsWatchInfo{test.cdsUpdate, test.updateErr}, test.wantCCS, edsB); err != nil { + t.Fatal(err) + } + }) + } +} + +// TestResolverError verifies that an existing watch is cancelled when a +// resolver error is received by the cdsBalancer, and also that the same error +// is propagated to the edsBalancer. +func TestResolverError(t *testing.T) { + xdsC, cdsB, edsB, cancel := setupWithWatch(t) + defer func() { + cancel() + cdsB.Close() + }() + + cdsUpdate := xdsclient.CDSUpdate{ServiceName: serviceName} + wantCCS := edsCCS(serviceName, false, xdsC) + if err := xdsC.invokeWatchCb(cdsWatchInfo{cdsUpdate, nil}, wantCCS, edsB); err != nil { + t.Fatal(err) + } + + rErr := errors.New("cdsBalancer resolver error") + cdsB.ResolverError(rErr) + if err := xdsC.waitForCancelWatch(); err != nil { + t.Fatal(err) + } + if err := edsB.waitForResolverError(rErr); err != nil { + t.Fatal(err) + } +} + +// TestUpdateSubConnState pushes a SubConn update to the cdsBalancer and +// verifies that the update is propagated to the edsBalancer. +func TestUpdateSubConnState(t *testing.T) { + xdsC, cdsB, edsB, cancel := setupWithWatch(t) + defer func() { + cancel() + cdsB.Close() + }() + + cdsUpdate := xdsclient.CDSUpdate{ServiceName: serviceName} + wantCCS := edsCCS(serviceName, false, xdsC) + if err := xdsC.invokeWatchCb(cdsWatchInfo{cdsUpdate, nil}, wantCCS, edsB); err != nil { + t.Fatal(err) + } + + var sc balancer.SubConn + state := balancer.SubConnState{ConnectivityState: connectivity.Ready} + cdsB.UpdateSubConnState(sc, state) + if err := edsB.waitForSubConnUpdate(subConnWithState{sc: sc, state: state}); err != nil { + t.Fatal(err) + } +} + +// TestClose calls Close() on the cdsBalancer, and verifies that the underlying +// edsBalancer is also closed. +func TestClose(t *testing.T) { + xdsC, cdsB, edsB, cancel := setupWithWatch(t) + defer cancel() + + cdsUpdate := xdsclient.CDSUpdate{ServiceName: serviceName} + wantCCS := edsCCS(serviceName, false, xdsC) + if err := xdsC.invokeWatchCb(cdsWatchInfo{cdsUpdate, nil}, wantCCS, edsB); err != nil { + t.Fatal(err) + } + + cdsB.Close() + if err := xdsC.waitForCancelWatch(); err != nil { + t.Fatal(err) + } + if err := edsB.waitForClose(); err != nil { + t.Fatal(err) + } +} + +// TestParseConfig exercises the config parsing functionality in the cds +// balancer builder. +func TestParseConfig(t *testing.T) { + bb := cdsBB{} + if gotName := bb.Name(); gotName != cdsName { + t.Fatalf("cdsBB.Name() = %v, want %v", gotName, cdsName) + } + + tests := []struct { + name string + input json.RawMessage + wantCfg serviceconfig.LoadBalancingConfig + wantErr bool + }{ + { + name: "good-lb-config", + input: json.RawMessage(`{"Cluster": "cluster1"}`), + wantCfg: &lbConfig{ClusterName: clusterName}, + }, + { + name: "unknown-fields-in-lb-config", + input: json.RawMessage(`{"Unknown": "foobar"}`), + wantCfg: &lbConfig{ClusterName: ""}, + }, + { + name: "empty-lb-config", + input: json.RawMessage(""), + wantErr: true, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + gotCfg, gotErr := bb.ParseConfig(test.input) + if (gotErr != nil) != test.wantErr { + t.Fatalf("bb.ParseConfig(%v) = %v, wantErr %v", string(test.input), gotErr, test.wantErr) + } + if !test.wantErr { + if !reflect.DeepEqual(gotCfg, test.wantCfg) { + t.Fatalf("bb.ParseConfig(%v) = %v, want %v", string(test.input), gotCfg, test.wantCfg) + } + } + }) + } +} diff --git a/vendor/google.golang.org/grpc/xds/internal/balancer/config.go b/vendor/google.golang.org/grpc/xds/internal/balancer/config.go new file mode 100644 index 00000000000..8343179326b --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/balancer/config.go @@ -0,0 +1,117 @@ +/* + * + * 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. + */ + +package balancer + +import ( + "encoding/json" + "fmt" + + "google.golang.org/grpc/balancer" + "google.golang.org/grpc/serviceconfig" +) + +// XDSConfig represents the loadBalancingConfig section of the service config +// for xDS balancers. +type XDSConfig struct { + serviceconfig.LoadBalancingConfig + // BalancerName represents the load balancer to use. + BalancerName string + // ChildPolicy represents the load balancing config for the child + // policy. + ChildPolicy *loadBalancingConfig + // FallBackPolicy represents the load balancing config for the + // fallback. + FallBackPolicy *loadBalancingConfig + // Name to use in EDS query. If not present, defaults to the server + // name from the target URI. + EDSServiceName string + // LRS server to send load reports to. If not present, load reporting + // will be disabled. If set to the empty string, load reporting will + // be sent to the same server that we obtained CDS data from. + LrsLoadReportingServerName *string +} + +// xdsConfigJSON is the intermediate unmarshal result of XDSConfig. ChildPolicy +// and Fallbackspolicy are post-processed, and for each, the first installed +// policy is kept. +type xdsConfigJSON struct { + BalancerName string + ChildPolicy []*loadBalancingConfig + FallbackPolicy []*loadBalancingConfig + EDSServiceName string + LRSLoadReportingServerName *string +} + +// UnmarshalJSON parses the JSON-encoded byte slice in data and stores it in l. +// When unmarshalling, we iterate through the childPolicy/fallbackPolicy lists +// and select the first LB policy which has been registered. +func (l *XDSConfig) UnmarshalJSON(data []byte) error { + var configJSON xdsConfigJSON + if err := json.Unmarshal(data, &configJSON); err != nil { + return err + } + + l.BalancerName = configJSON.BalancerName + l.EDSServiceName = configJSON.EDSServiceName + l.LrsLoadReportingServerName = configJSON.LRSLoadReportingServerName + + for _, lbcfg := range configJSON.ChildPolicy { + if balancer.Get(lbcfg.Name) != nil { + l.ChildPolicy = lbcfg + break + } + } + + for _, lbcfg := range configJSON.FallbackPolicy { + if balancer.Get(lbcfg.Name) != nil { + l.FallBackPolicy = lbcfg + break + } + } + return nil +} + +// MarshalJSON returns a JSON encoding of l. +func (l *XDSConfig) MarshalJSON() ([]byte, error) { + return nil, fmt.Errorf("XDSConfig.MarshalJSON() is unimplemented") +} + +// loadBalancingConfig represents a single load balancing config, +// stored in JSON format. +type loadBalancingConfig struct { + Name string + Config json.RawMessage +} + +// MarshalJSON returns a JSON encoding of l. +func (l *loadBalancingConfig) MarshalJSON() ([]byte, error) { + return nil, fmt.Errorf("loadBalancingConfig.MarshalJSON() is unimplemented") +} + +// UnmarshalJSON parses the JSON-encoded byte slice in data and stores it in l. +func (l *loadBalancingConfig) UnmarshalJSON(data []byte) error { + var cfg map[string]json.RawMessage + if err := json.Unmarshal(data, &cfg); err != nil { + return err + } + for name, config := range cfg { + l.Name = name + l.Config = config + } + return nil +} diff --git a/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/balancergroup.go b/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/balancergroup.go index 5b1392eca51..fc10f3d3412 100644 --- a/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/balancergroup.go +++ b/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/balancergroup.go @@ -17,23 +17,136 @@ package edsbalancer import ( - "context" + "fmt" "sync" + "time" "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/base" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal/cache" "google.golang.org/grpc/internal/wrr" "google.golang.org/grpc/resolver" "google.golang.org/grpc/xds/internal" "google.golang.org/grpc/xds/internal/balancer/lrs" - orcapb "google.golang.org/grpc/xds/internal/proto/udpa/data/orca/v1/orca_load_report" + orcapb "google.golang.org/grpc/xds/internal/proto/udpa/data/orca/v1" ) +// subBalancerWithConfig is used to keep the configurations that will be used to start +// the underlying balancer. It can be called to start/stop the underlying +// balancer. +// +// When the config changes, it will pass the update to the underlying balancer +// if it exists. +// +// TODO: rename to subBalanceWrapper (and move to a separate file?) +type subBalancerWithConfig struct { + // subBalancerWithConfig is passed to the sub-balancer as a ClientConn + // wrapper, only to keep the state and picker. When sub-balancer is + // restarted while in cache, the picker needs to be resent. + // + // It also contains the sub-balancer ID, so the parent balancer group can + // keep track of SubConn/pickers and the sub-balancers they belong to. Some + // of the actions are forwarded to the parent ClientConn with no change. + // Some are forward to balancer group with the sub-balancer ID. + balancer.ClientConn + id internal.Locality + group *balancerGroup + + mu sync.Mutex + state balancer.State + + // The static part of sub-balancer. Keeps balancerBuilders and addresses. + // To be used when restarting sub-balancer. + builder balancer.Builder + addrs []resolver.Address + // The dynamic part of sub-balancer. Only used when balancer group is + // started. Gets cleared when sub-balancer is closed. + balancer balancer.Balancer +} + +func (sbc *subBalancerWithConfig) UpdateBalancerState(state connectivity.State, picker balancer.Picker) { + grpclog.Fatalln("not implemented") +} + +// UpdateState overrides balancer.ClientConn, to keep state and picker. +func (sbc *subBalancerWithConfig) UpdateState(state balancer.State) { + sbc.mu.Lock() + sbc.state = state + sbc.group.updateBalancerState(sbc.id, state) + sbc.mu.Unlock() +} + +// NewSubConn overrides balancer.ClientConn, so balancer group can keep track of +// the relation between subconns and sub-balancers. +func (sbc *subBalancerWithConfig) NewSubConn(addrs []resolver.Address, opts balancer.NewSubConnOptions) (balancer.SubConn, error) { + return sbc.group.newSubConn(sbc, addrs, opts) +} + +func (sbc *subBalancerWithConfig) updateBalancerStateWithCachedPicker() { + sbc.mu.Lock() + if sbc.state.Picker != nil { + sbc.group.updateBalancerState(sbc.id, sbc.state) + } + sbc.mu.Unlock() +} + +func (sbc *subBalancerWithConfig) startBalancer() { + b := sbc.builder.Build(sbc, balancer.BuildOptions{}) + sbc.balancer = b + if ub, ok := b.(balancer.V2Balancer); ok { + ub.UpdateClientConnState(balancer.ClientConnState{ResolverState: resolver.State{Addresses: sbc.addrs}}) + } else { + b.HandleResolvedAddrs(sbc.addrs, nil) + } +} + +func (sbc *subBalancerWithConfig) handleSubConnStateChange(sc balancer.SubConn, state connectivity.State) { + b := sbc.balancer + if b == nil { + // This sub-balancer was closed. This can happen when EDS removes a + // locality. The balancer for this locality was already closed, and the + // SubConns are being deleted. But SubConn state change can still + // happen. + return + } + if ub, ok := b.(balancer.V2Balancer); ok { + ub.UpdateSubConnState(sc, balancer.SubConnState{ConnectivityState: state}) + } else { + b.HandleSubConnStateChange(sc, state) + } +} + +func (sbc *subBalancerWithConfig) updateAddrs(addrs []resolver.Address) { + sbc.addrs = addrs + b := sbc.balancer + if b == nil { + // This sub-balancer was closed. This should never happen because + // sub-balancers are closed when the locality is removed from EDS, or + // the balancer group is closed. There should be no further address + // updates when either of this happened. + // + // This will be a common case with priority support, because a + // sub-balancer (and the whole balancer group) could be closed because + // it's the lower priority, but it can still get address updates. + return + } + if ub, ok := b.(balancer.V2Balancer); ok { + ub.UpdateClientConnState(balancer.ClientConnState{ResolverState: resolver.State{Addresses: addrs}}) + } else { + b.HandleResolvedAddrs(addrs, nil) + } +} + +func (sbc *subBalancerWithConfig) stopBalancer() { + sbc.balancer.Close() + sbc.balancer = nil +} + type pickerState struct { weight uint32 - picker balancer.Picker + picker balancer.V2Picker state connectivity.State } @@ -56,29 +169,92 @@ type pickerState struct { // - sub-pickers are grouped into a group-picker // - aggregated connectivity state is the overall state of all pickers. // - resolveNow +// +// Sub-balancers are only built when the balancer group is started. If the +// balancer group is closed, the sub-balancers are also closed. And it's +// guaranteed that no updates will be sent to parent ClientConn from a closed +// balancer group. type balancerGroup struct { - cc balancer.ClientConn - - mu sync.Mutex - idToBalancer map[internal.Locality]balancer.Balancer - scToID map[balancer.SubConn]internal.Locality - loadStore lrs.Store + cc balancer.ClientConn + loadStore lrs.Store - pickerMu sync.Mutex - // All balancer IDs exist as keys in this map. If an ID is not in map, it's - // either removed or never added. + // outgoingMu guards all operations in the direction: + // ClientConn-->Sub-balancer. Including start, stop, resolver updates and + // SubConn state changes. + // + // The corresponding boolean outgoingStarted is used to stop further updates + // to sub-balancers after they are closed. + outgoingMu sync.Mutex + outgoingStarted bool + idToBalancerConfig map[internal.Locality]*subBalancerWithConfig + // Cache for sub-balancers when they are removed. + balancerCache *cache.TimeoutCache + + // incomingMu and pickerMu are to make sure this balancer group doesn't send + // updates to cc after it's closed. + // + // We don't share the mutex to avoid deadlocks (e.g. a call to sub-balancer + // may call back to balancer group inline. It causes deaclock if they + // require the same mutex). + // + // We should never need to hold multiple locks at the same time in this + // struct. The case where two locks are held can only happen when the + // underlying balancer calls back into balancer group inline. So there's an + // implicit lock acquisition order that outgoingMu is locked before either + // incomingMu or pickerMu. + + // incomingMu guards all operations in the direction: + // Sub-balancer-->ClientConn. Including NewSubConn, RemoveSubConn, and + // updatePicker. It also guards the map from SubConn to balancer ID, so + // handleSubConnStateChange needs to hold it shortly to find the + // sub-balancer to forward the update. + // + // The corresponding boolean incomingStarted is used to stop further updates + // from sub-balancers after they are closed. + incomingMu sync.Mutex + incomingStarted bool // This boolean only guards calls back to ClientConn. + scToSubBalancer map[balancer.SubConn]*subBalancerWithConfig + // All balancer IDs exist as keys in this map, even if balancer group is not + // started. + // + // If an ID is not in map, it's either removed or never added. idToPickerState map[internal.Locality]*pickerState } +// defaultSubBalancerCloseTimeout is defined as a variable instead of const for +// testing. +// +// TODO: make it a parameter for newBalancerGroup(). +var defaultSubBalancerCloseTimeout = 15 * time.Minute + func newBalancerGroup(cc balancer.ClientConn, loadStore lrs.Store) *balancerGroup { return &balancerGroup{ - cc: cc, + cc: cc, + loadStore: loadStore, + + idToBalancerConfig: make(map[internal.Locality]*subBalancerWithConfig), + balancerCache: cache.NewTimeoutCache(defaultSubBalancerCloseTimeout), + scToSubBalancer: make(map[balancer.SubConn]*subBalancerWithConfig), + idToPickerState: make(map[internal.Locality]*pickerState), + } +} + +func (bg *balancerGroup) start() { + bg.incomingMu.Lock() + bg.incomingStarted = true + bg.incomingMu.Unlock() + + bg.outgoingMu.Lock() + if bg.outgoingStarted { + bg.outgoingMu.Unlock() + return + } - scToID: make(map[balancer.SubConn]internal.Locality), - idToBalancer: make(map[internal.Locality]balancer.Balancer), - idToPickerState: make(map[internal.Locality]*pickerState), - loadStore: loadStore, + for _, config := range bg.idToBalancerConfig { + config.startBalancer() } + bg.outgoingStarted = true + bg.outgoingMu.Unlock() } // add adds a balancer built by builder to the group, with given id and weight. @@ -89,23 +265,10 @@ func (bg *balancerGroup) add(id internal.Locality, weight uint32, builder balanc grpclog.Errorf("balancerGroup.add called with weight 0, locality: %v. Locality is not added to balancer group", id) return } - bg.mu.Lock() - if _, ok := bg.idToBalancer[id]; ok { - bg.mu.Unlock() - grpclog.Warningf("balancer group: adding a balancer with existing ID: %s", id) - return - } - bg.mu.Unlock() - bgcc := &balancerGroupCC{ - id: id, - group: bg, - } - b := builder.Build(bgcc, balancer.BuildOptions{}) - bg.mu.Lock() - bg.idToBalancer[id] = b - bg.mu.Unlock() - bg.pickerMu.Lock() + // First, add things to the picker map. Do this even if incomingStarted is + // false, because the data is static. + bg.incomingMu.Lock() bg.idToPickerState[id] = &pickerState{ weight: weight, // Start everything in IDLE. It's doesn't affect the overall state @@ -113,36 +276,115 @@ func (bg *balancerGroup) add(id internal.Locality, weight uint32, builder balanc // READY, 1 READY results in overall READY). state: connectivity.Idle, } - bg.pickerMu.Unlock() + bg.incomingMu.Unlock() + + // Store data in static map, and then check to see if bg is started. + bg.outgoingMu.Lock() + var sbc *subBalancerWithConfig + // If outgoingStarted is true, search in the cache. Otherwise, cache is + // guaranteed to be empty, searching is unnecessary. + if bg.outgoingStarted { + if old, ok := bg.balancerCache.Remove(id); ok { + sbc, _ = old.(*subBalancerWithConfig) + if sbc != nil && sbc.builder != builder { + // If the sub-balancer in cache was built with a different + // balancer builder, don't use it, cleanup this old-balancer, + // and behave as sub-balancer is not found in cache. + // + // NOTE that this will also drop the cached addresses for this + // sub-balancer, which seems to be reasonable. + sbc.stopBalancer() + // cleanupSubConns must be done before the new balancer starts, + // otherwise new SubConns created by the new balancer might be + // removed by mistake. + bg.cleanupSubConns(sbc) + sbc = nil + } + } + } + if sbc == nil { + sbc = &subBalancerWithConfig{ + ClientConn: bg.cc, + id: id, + group: bg, + builder: builder, + } + if bg.outgoingStarted { + // Only start the balancer if bg is started. Otherwise, we only keep the + // static data. + sbc.startBalancer() + } + } else { + // When brining back a sub-balancer from cache, re-send the cached + // picker and state. + sbc.updateBalancerStateWithCachedPicker() + } + bg.idToBalancerConfig[id] = sbc + bg.outgoingMu.Unlock() } -// remove removes the balancer with id from the group, and closes the balancer. +// remove removes the balancer with id from the group. +// +// But doesn't close the balancer. The balancer is kept in a cache, and will be +// closed after timeout. Cleanup work (closing sub-balancer and removing +// subconns) will be done after timeout. // // It also removes the picker generated from this balancer from the picker // group. It always results in a picker update. func (bg *balancerGroup) remove(id internal.Locality) { - bg.mu.Lock() - // Close balancer. - if b, ok := bg.idToBalancer[id]; ok { - b.Close() - delete(bg.idToBalancer, id) - } - // Remove SubConns. - for sc, bid := range bg.scToID { - if bid == id { - bg.cc.RemoveSubConn(sc) - delete(bg.scToID, sc) + bg.outgoingMu.Lock() + if sbToRemove, ok := bg.idToBalancerConfig[id]; ok { + if bg.outgoingStarted { + bg.balancerCache.Add(id, sbToRemove, func() { + // After timeout, when sub-balancer is removed from cache, need + // to close the underlying sub-balancer, and remove all its + // subconns. + bg.outgoingMu.Lock() + if bg.outgoingStarted { + sbToRemove.stopBalancer() + } + bg.outgoingMu.Unlock() + bg.cleanupSubConns(sbToRemove) + }) } + delete(bg.idToBalancerConfig, id) + } else { + grpclog.Infof("balancer group: trying to remove a non-existing locality from balancer group: %v", id) } - bg.mu.Unlock() + bg.outgoingMu.Unlock() - bg.pickerMu.Lock() + bg.incomingMu.Lock() // Remove id and picker from picker map. This also results in future updates // for this ID to be ignored. delete(bg.idToPickerState, id) - // Update state and picker to reflect the changes. - bg.cc.UpdateBalancerState(buildPickerAndState(bg.idToPickerState)) - bg.pickerMu.Unlock() + if bg.incomingStarted { + // Normally picker update is triggered by SubConn state change. But we + // want to update state and picker to reflect the changes, too. Because + // we don't want `ClientConn` to pick this sub-balancer anymore. + bg.cc.UpdateState(buildPickerAndState(bg.idToPickerState)) + } + bg.incomingMu.Unlock() +} + +// bg.remove(id) doesn't do cleanup for the sub-balancer. This function does +// cleanup after the timeout. +func (bg *balancerGroup) cleanupSubConns(config *subBalancerWithConfig) { + bg.incomingMu.Lock() + // Remove SubConns. This is only done after the balancer is + // actually closed. + // + // NOTE: if NewSubConn is called by this (closed) balancer later, the + // SubConn will be leaked. This shouldn't happen if the balancer + // implementation is correct. To make sure this never happens, we need to + // add another layer (balancer manager) between balancer group and the + // sub-balancers. + for sc, b := range bg.scToSubBalancer { + if b == config { + bg.cc.RemoveSubConn(sc) + delete(bg.scToSubBalancer, sc) + } + } + bg.incomingMu.Unlock() } // changeWeight changes the weight of the balancer. @@ -157,8 +399,8 @@ func (bg *balancerGroup) changeWeight(id internal.Locality, newWeight uint32) { grpclog.Errorf("balancerGroup.changeWeight called with newWeight 0. Weight is not changed") return } - bg.pickerMu.Lock() - defer bg.pickerMu.Unlock() + bg.incomingMu.Lock() + defer bg.incomingMu.Unlock() pState, ok := bg.idToPickerState[id] if !ok { return @@ -167,8 +409,12 @@ func (bg *balancerGroup) changeWeight(id internal.Locality, newWeight uint32) { return } pState.weight = newWeight - // Update state and picker to reflect the changes. - bg.cc.UpdateBalancerState(buildPickerAndState(bg.idToPickerState)) + if bg.incomingStarted { + // Normally picker update is triggered by SubConn state change. But we + // want to update state and picker to reflect the changes, too. Because + // `ClientConn` should do pick with the new weights now. + bg.cc.UpdateState(buildPickerAndState(bg.idToPickerState)) + } } // Following are actions from the parent grpc.ClientConn, forward to sub-balancers. @@ -176,41 +422,30 @@ func (bg *balancerGroup) changeWeight(id internal.Locality, newWeight uint32) { // SubConn state change: find the corresponding balancer and then forward. func (bg *balancerGroup) handleSubConnStateChange(sc balancer.SubConn, state connectivity.State) { grpclog.Infof("balancer group: handle subconn state change: %p, %v", sc, state) - bg.mu.Lock() - var b balancer.Balancer - if id, ok := bg.scToID[sc]; ok { - if state == connectivity.Shutdown { - // Only delete sc from the map when state changed to Shutdown. - delete(bg.scToID, sc) - } - b = bg.idToBalancer[id] - } - bg.mu.Unlock() - if b == nil { - grpclog.Infof("balancer group: balancer not found for sc state change") + bg.incomingMu.Lock() + config, ok := bg.scToSubBalancer[sc] + if !ok { + bg.incomingMu.Unlock() return } - if ub, ok := b.(balancer.V2Balancer); ok { - ub.UpdateSubConnState(sc, balancer.SubConnState{ConnectivityState: state}) - } else { - b.HandleSubConnStateChange(sc, state) + if state == connectivity.Shutdown { + // Only delete sc from the map when state changed to Shutdown. + delete(bg.scToSubBalancer, sc) } + bg.incomingMu.Unlock() + + bg.outgoingMu.Lock() + config.handleSubConnStateChange(sc, state) + bg.outgoingMu.Unlock() } // Address change: forward to balancer. func (bg *balancerGroup) handleResolvedAddrs(id internal.Locality, addrs []resolver.Address) { - bg.mu.Lock() - b, ok := bg.idToBalancer[id] - bg.mu.Unlock() - if !ok { - grpclog.Infof("balancer group: balancer with id %q not found", id) - return - } - if ub, ok := b.(balancer.V2Balancer); ok { - ub.UpdateClientConnState(balancer.ClientConnState{ResolverState: resolver.State{Addresses: addrs}}) - } else { - b.HandleResolvedAddrs(addrs, nil) + bg.outgoingMu.Lock() + if config, ok := bg.idToBalancerConfig[id]; ok { + config.updateAddrs(addrs) } + bg.outgoingMu.Unlock() } // TODO: handleServiceConfig() @@ -227,48 +462,80 @@ func (bg *balancerGroup) handleResolvedAddrs(id internal.Locality, addrs []resol // from map. Delete sc from the map only when state changes to Shutdown. Since // it's just forwarding the action, there's no need for a removeSubConn() // wrapper function. -func (bg *balancerGroup) newSubConn(id internal.Locality, addrs []resolver.Address, opts balancer.NewSubConnOptions) (balancer.SubConn, error) { +func (bg *balancerGroup) newSubConn(config *subBalancerWithConfig, addrs []resolver.Address, opts balancer.NewSubConnOptions) (balancer.SubConn, error) { + // NOTE: if balancer with id was already removed, this should also return + // error. But since we call balancer.stopBalancer when removing the balancer, this + // shouldn't happen. + bg.incomingMu.Lock() + if !bg.incomingStarted { + bg.incomingMu.Unlock() + return nil, fmt.Errorf("NewSubConn is called after balancer group is closed") + } sc, err := bg.cc.NewSubConn(addrs, opts) if err != nil { + bg.incomingMu.Unlock() return nil, err } - bg.mu.Lock() - bg.scToID[sc] = id - bg.mu.Unlock() + bg.scToSubBalancer[sc] = config + bg.incomingMu.Unlock() return sc, nil } // updateBalancerState: create an aggregated picker and an aggregated // connectivity state, then forward to ClientConn. -func (bg *balancerGroup) updateBalancerState(id internal.Locality, state connectivity.State, picker balancer.Picker) { - grpclog.Infof("balancer group: update balancer state: %v, %v, %p", id, state, picker) - bg.pickerMu.Lock() - defer bg.pickerMu.Unlock() +func (bg *balancerGroup) updateBalancerState(id internal.Locality, state balancer.State) { + grpclog.Infof("balancer group: update balancer state: %v, %v", id, state) + + bg.incomingMu.Lock() + defer bg.incomingMu.Unlock() pickerSt, ok := bg.idToPickerState[id] if !ok { // All state starts in IDLE. If ID is not in map, it's either removed, // or never existed. - grpclog.Infof("balancer group: pickerState not found when update picker/state") + grpclog.Warningf("balancer group: pickerState for %v not found when update picker/state", id) return } - pickerSt.picker = newLoadReportPicker(picker, id, bg.loadStore) - pickerSt.state = state - bg.cc.UpdateBalancerState(buildPickerAndState(bg.idToPickerState)) + pickerSt.picker = newLoadReportPicker(state.Picker, id, bg.loadStore) + pickerSt.state = state.ConnectivityState + if bg.incomingStarted { + bg.cc.UpdateState(buildPickerAndState(bg.idToPickerState)) + } } func (bg *balancerGroup) close() { - bg.mu.Lock() - for _, b := range bg.idToBalancer { - b.Close() + bg.incomingMu.Lock() + if bg.incomingStarted { + bg.incomingStarted = false + + for _, pState := range bg.idToPickerState { + // Reset everything to IDLE but keep the entry in map (to keep the + // weight). + pState.picker = nil + pState.state = connectivity.Idle + } + + // Also remove all SubConns. + for sc := range bg.scToSubBalancer { + bg.cc.RemoveSubConn(sc) + delete(bg.scToSubBalancer, sc) + } } - // Also remove all SubConns. - for sc := range bg.scToID { - bg.cc.RemoveSubConn(sc) + bg.incomingMu.Unlock() + + bg.outgoingMu.Lock() + if bg.outgoingStarted { + bg.outgoingStarted = false + for _, config := range bg.idToBalancerConfig { + config.stopBalancer() + } } - bg.mu.Unlock() + bg.outgoingMu.Unlock() + // Clear(true) runs clear function to close sub-balancers in cache. It + // must be called out of outgoing mutex. + bg.balancerCache.Clear(true) } -func buildPickerAndState(m map[internal.Locality]*pickerState) (connectivity.State, balancer.Picker) { +func buildPickerAndState(m map[internal.Locality]*pickerState) balancer.State { var readyN, connectingN int readyPickerWithWeights := make([]pickerState, 0, len(m)) for _, ps := range m { @@ -290,9 +557,9 @@ func buildPickerAndState(m map[internal.Locality]*pickerState) (connectivity.Sta aggregatedState = connectivity.TransientFailure } if aggregatedState == connectivity.TransientFailure { - return aggregatedState, base.NewErrPicker(balancer.ErrTransientFailure) + return balancer.State{aggregatedState, base.NewErrPickerV2(balancer.ErrTransientFailure)} } - return aggregatedState, newPickerGroup(readyPickerWithWeights) + return balancer.State{aggregatedState, newPickerGroup(readyPickerWithWeights)} } // RandomWRR constructor, to be modified in tests. @@ -322,12 +589,12 @@ func newPickerGroup(readyPickerWithWeights []pickerState) *pickerGroup { } } -func (pg *pickerGroup) Pick(ctx context.Context, opts balancer.PickOptions) (conn balancer.SubConn, done func(balancer.DoneInfo), err error) { +func (pg *pickerGroup) Pick(info balancer.PickInfo) (balancer.PickResult, error) { if pg.length <= 0 { - return nil, nil, balancer.ErrNoSubConnAvailable + return balancer.PickResult{}, balancer.ErrNoSubConnAvailable } - p := pg.w.Next().(balancer.Picker) - return p.Pick(ctx, opts) + p := pg.w.Next().(balancer.V2Picker) + return p.Pick(info) } const ( @@ -336,26 +603,26 @@ const ( ) type loadReportPicker struct { - balancer.Picker + p balancer.V2Picker id internal.Locality loadStore lrs.Store } -func newLoadReportPicker(p balancer.Picker, id internal.Locality, loadStore lrs.Store) *loadReportPicker { +func newLoadReportPicker(p balancer.V2Picker, id internal.Locality, loadStore lrs.Store) *loadReportPicker { return &loadReportPicker{ - Picker: p, + p: p, id: id, loadStore: loadStore, } } -func (lrp *loadReportPicker) Pick(ctx context.Context, opts balancer.PickOptions) (conn balancer.SubConn, done func(balancer.DoneInfo), err error) { - conn, done, err = lrp.Picker.Pick(ctx, opts) +func (lrp *loadReportPicker) Pick(info balancer.PickInfo) (balancer.PickResult, error) { + res, err := lrp.p.Pick(info) if lrp.loadStore != nil && err == nil { lrp.loadStore.CallStarted(lrp.id) - td := done - done = func(info balancer.DoneInfo) { + td := res.Done + res.Done = func(info balancer.DoneInfo) { lrp.loadStore.CallFinished(lrp.id, info.Err) if load, ok := info.ServerLoad.(*orcapb.OrcaLoadReport); ok { lrp.loadStore.CallServerLoad(lrp.id, serverLoadCPUName, load.CpuUtilization) @@ -372,32 +639,5 @@ func (lrp *loadReportPicker) Pick(ctx context.Context, opts balancer.PickOptions } } } - return -} - -// balancerGroupCC implements the balancer.ClientConn API and get passed to each -// sub-balancer. It contains the sub-balancer ID, so the parent balancer can -// keep track of SubConn/pickers and the sub-balancers they belong to. -// -// Some of the actions are forwarded to the parent ClientConn with no change. -// Some are forward to balancer group with the sub-balancer ID. -type balancerGroupCC struct { - id internal.Locality - group *balancerGroup -} - -func (bgcc *balancerGroupCC) NewSubConn(addrs []resolver.Address, opts balancer.NewSubConnOptions) (balancer.SubConn, error) { - return bgcc.group.newSubConn(bgcc.id, addrs, opts) -} -func (bgcc *balancerGroupCC) RemoveSubConn(sc balancer.SubConn) { - bgcc.group.cc.RemoveSubConn(sc) -} -func (bgcc *balancerGroupCC) UpdateBalancerState(state connectivity.State, picker balancer.Picker) { - bgcc.group.updateBalancerState(bgcc.id, state, picker) -} -func (bgcc *balancerGroupCC) ResolveNow(opt resolver.ResolveNowOption) { - bgcc.group.cc.ResolveNow(opt) -} -func (bgcc *balancerGroupCC) Target() string { - return bgcc.group.cc.Target() + return res, err } diff --git a/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/balancergroup_test.go b/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/balancergroup_test.go index 748eb0b64a4..d64296b8f0c 100644 --- a/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/balancergroup_test.go +++ b/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/balancergroup_test.go @@ -17,28 +17,49 @@ package edsbalancer import ( - "context" + "fmt" "reflect" "testing" + "time" "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/roundrobin" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/resolver" "google.golang.org/grpc/xds/internal" - orcapb "google.golang.org/grpc/xds/internal/proto/udpa/data/orca/v1/orca_load_report" + orcapb "google.golang.org/grpc/xds/internal/proto/udpa/data/orca/v1" ) var ( rrBuilder = balancer.Get(roundrobin.Name) testBalancerIDs = []internal.Locality{{Region: "b1"}, {Region: "b2"}, {Region: "b3"}} - testBackendAddrs = []resolver.Address{{Addr: "1.1.1.1:1"}, {Addr: "2.2.2.2:2"}, {Addr: "3.3.3.3:3"}, {Addr: "4.4.4.4:4"}} + testBackendAddrs []resolver.Address ) +const testBackendAddrsCount = 12 + +func init() { + for i := 0; i < testBackendAddrsCount; i++ { + testBackendAddrs = append(testBackendAddrs, resolver.Address{Addr: fmt.Sprintf("%d.%d.%d.%d:%d", i, i, i, i, i)}) + } + + // Disable caching for all tests. It will be re-enabled in caching specific + // tests. + defaultSubBalancerCloseTimeout = time.Millisecond +} + +func subConnFromPicker(p balancer.V2Picker) func() balancer.SubConn { + return func() balancer.SubConn { + scst, _ := p.Pick(balancer.PickInfo{}) + return scst.SubConn + } +} + // 1 balancer, 1 backend -> 2 backends -> 1 backend. func TestBalancerGroup_OneRR_AddRemoveBackend(t *testing.T) { cc := newTestClientConn(t) bg := newBalancerGroup(cc, nil) + bg.start() // Add one balancer to group. bg.add(testBalancerIDs[0], 1, rrBuilder) @@ -53,9 +74,9 @@ func TestBalancerGroup_OneRR_AddRemoveBackend(t *testing.T) { // Test pick with one backend. p1 := <-cc.newPickerCh for i := 0; i < 5; i++ { - gotSC, _, _ := p1.Pick(context.Background(), balancer.PickOptions{}) - if !reflect.DeepEqual(gotSC, sc1) { - t.Fatalf("picker.Pick, got %v, want %v", gotSC, sc1) + gotSCSt, _ := p1.Pick(balancer.PickInfo{}) + if !reflect.DeepEqual(gotSCSt.SubConn, sc1) { + t.Fatalf("picker.Pick, got %v, want SubConn=%v", gotSCSt, sc1) } } @@ -69,10 +90,7 @@ func TestBalancerGroup_OneRR_AddRemoveBackend(t *testing.T) { // Test roundrobin pick. p2 := <-cc.newPickerCh want := []balancer.SubConn{sc1, sc2} - if err := isRoundRobin(want, func() balancer.SubConn { - sc, _, _ := p2.Pick(context.Background(), balancer.PickOptions{}) - return sc - }); err != nil { + if err := isRoundRobin(want, subConnFromPicker(p2)); err != nil { t.Fatalf("want %v, got %v", want, err) } @@ -87,9 +105,9 @@ func TestBalancerGroup_OneRR_AddRemoveBackend(t *testing.T) { // Test pick with only the second subconn. p3 := <-cc.newPickerCh for i := 0; i < 5; i++ { - gotSC, _, _ := p3.Pick(context.Background(), balancer.PickOptions{}) - if !reflect.DeepEqual(gotSC, sc2) { - t.Fatalf("picker.Pick, got %v, want %v", gotSC, sc2) + gotSC, _ := p3.Pick(balancer.PickInfo{}) + if !reflect.DeepEqual(gotSC.SubConn, sc2) { + t.Fatalf("picker.Pick, got %v, want SubConn=%v", gotSC, sc2) } } } @@ -98,6 +116,7 @@ func TestBalancerGroup_OneRR_AddRemoveBackend(t *testing.T) { func TestBalancerGroup_TwoRR_OneBackend(t *testing.T) { cc := newTestClientConn(t) bg := newBalancerGroup(cc, nil) + bg.start() // Add two balancers to group and send one resolved address to both // balancers. @@ -118,10 +137,7 @@ func TestBalancerGroup_TwoRR_OneBackend(t *testing.T) { // Test roundrobin on the last picker. p1 := <-cc.newPickerCh want := []balancer.SubConn{sc1, sc2} - if err := isRoundRobin(want, func() balancer.SubConn { - sc, _, _ := p1.Pick(context.Background(), balancer.PickOptions{}) - return sc - }); err != nil { + if err := isRoundRobin(want, subConnFromPicker(p1)); err != nil { t.Fatalf("want %v, got %v", want, err) } } @@ -130,6 +146,7 @@ func TestBalancerGroup_TwoRR_OneBackend(t *testing.T) { func TestBalancerGroup_TwoRR_MoreBackends(t *testing.T) { cc := newTestClientConn(t) bg := newBalancerGroup(cc, nil) + bg.start() // Add two balancers to group and send one resolved address to both // balancers. @@ -156,10 +173,7 @@ func TestBalancerGroup_TwoRR_MoreBackends(t *testing.T) { // Test roundrobin on the last picker. p1 := <-cc.newPickerCh want := []balancer.SubConn{sc1, sc2, sc3, sc4} - if err := isRoundRobin(want, func() balancer.SubConn { - sc, _, _ := p1.Pick(context.Background(), balancer.PickOptions{}) - return sc - }); err != nil { + if err := isRoundRobin(want, subConnFromPicker(p1)); err != nil { t.Fatalf("want %v, got %v", want, err) } @@ -169,10 +183,7 @@ func TestBalancerGroup_TwoRR_MoreBackends(t *testing.T) { // Expect two sc1's in the result, because balancer1 will be picked twice, // but there's only one sc in it. want = []balancer.SubConn{sc1, sc1, sc3, sc4} - if err := isRoundRobin(want, func() balancer.SubConn { - sc, _, _ := p2.Pick(context.Background(), balancer.PickOptions{}) - return sc - }); err != nil { + if err := isRoundRobin(want, subConnFromPicker(p2)); err != nil { t.Fatalf("want %v, got %v", want, err) } @@ -185,10 +196,7 @@ func TestBalancerGroup_TwoRR_MoreBackends(t *testing.T) { bg.handleSubConnStateChange(scToRemove, connectivity.Shutdown) p3 := <-cc.newPickerCh want = []balancer.SubConn{sc1, sc4} - if err := isRoundRobin(want, func() balancer.SubConn { - sc, _, _ := p3.Pick(context.Background(), balancer.PickOptions{}) - return sc - }); err != nil { + if err := isRoundRobin(want, subConnFromPicker(p3)); err != nil { t.Fatalf("want %v, got %v", want, err) } @@ -196,10 +204,7 @@ func TestBalancerGroup_TwoRR_MoreBackends(t *testing.T) { bg.handleSubConnStateChange(sc1, connectivity.TransientFailure) p4 := <-cc.newPickerCh want = []balancer.SubConn{sc4} - if err := isRoundRobin(want, func() balancer.SubConn { - sc, _, _ := p4.Pick(context.Background(), balancer.PickOptions{}) - return sc - }); err != nil { + if err := isRoundRobin(want, subConnFromPicker(p4)); err != nil { t.Fatalf("want %v, got %v", want, err) } @@ -207,7 +212,7 @@ func TestBalancerGroup_TwoRR_MoreBackends(t *testing.T) { bg.handleSubConnStateChange(sc4, connectivity.Connecting) p5 := <-cc.newPickerCh for i := 0; i < 5; i++ { - if _, _, err := p5.Pick(context.Background(), balancer.PickOptions{}); err != balancer.ErrNoSubConnAvailable { + if _, err := p5.Pick(balancer.PickInfo{}); err != balancer.ErrNoSubConnAvailable { t.Fatalf("want pick error %v, got %v", balancer.ErrNoSubConnAvailable, err) } } @@ -216,7 +221,7 @@ func TestBalancerGroup_TwoRR_MoreBackends(t *testing.T) { bg.handleSubConnStateChange(sc4, connectivity.TransientFailure) p6 := <-cc.newPickerCh for i := 0; i < 5; i++ { - if _, _, err := p6.Pick(context.Background(), balancer.PickOptions{}); err != balancer.ErrTransientFailure { + if _, err := p6.Pick(balancer.PickInfo{}); err != balancer.ErrTransientFailure { t.Fatalf("want pick error %v, got %v", balancer.ErrTransientFailure, err) } } @@ -226,6 +231,7 @@ func TestBalancerGroup_TwoRR_MoreBackends(t *testing.T) { func TestBalancerGroup_TwoRR_DifferentWeight_MoreBackends(t *testing.T) { cc := newTestClientConn(t) bg := newBalancerGroup(cc, nil) + bg.start() // Add two balancers to group and send two resolved addresses to both // balancers. @@ -252,10 +258,7 @@ func TestBalancerGroup_TwoRR_DifferentWeight_MoreBackends(t *testing.T) { // Test roundrobin on the last picker. p1 := <-cc.newPickerCh want := []balancer.SubConn{sc1, sc1, sc2, sc2, sc3, sc4} - if err := isRoundRobin(want, func() balancer.SubConn { - sc, _, _ := p1.Pick(context.Background(), balancer.PickOptions{}) - return sc - }); err != nil { + if err := isRoundRobin(want, subConnFromPicker(p1)); err != nil { t.Fatalf("want %v, got %v", want, err) } } @@ -264,6 +267,7 @@ func TestBalancerGroup_TwoRR_DifferentWeight_MoreBackends(t *testing.T) { func TestBalancerGroup_ThreeRR_RemoveBalancer(t *testing.T) { cc := newTestClientConn(t) bg := newBalancerGroup(cc, nil) + bg.start() // Add three balancers to group and send one resolved address to both // balancers. @@ -289,10 +293,7 @@ func TestBalancerGroup_ThreeRR_RemoveBalancer(t *testing.T) { p1 := <-cc.newPickerCh want := []balancer.SubConn{sc1, sc2, sc3} - if err := isRoundRobin(want, func() balancer.SubConn { - sc, _, _ := p1.Pick(context.Background(), balancer.PickOptions{}) - return sc - }); err != nil { + if err := isRoundRobin(want, subConnFromPicker(p1)); err != nil { t.Fatalf("want %v, got %v", want, err) } @@ -304,10 +305,7 @@ func TestBalancerGroup_ThreeRR_RemoveBalancer(t *testing.T) { } p2 := <-cc.newPickerCh want = []balancer.SubConn{sc1, sc3} - if err := isRoundRobin(want, func() balancer.SubConn { - sc, _, _ := p2.Pick(context.Background(), balancer.PickOptions{}) - return sc - }); err != nil { + if err := isRoundRobin(want, subConnFromPicker(p2)); err != nil { t.Fatalf("want %v, got %v", want, err) } @@ -321,7 +319,7 @@ func TestBalancerGroup_ThreeRR_RemoveBalancer(t *testing.T) { } p3 := <-cc.newPickerCh for i := 0; i < 5; i++ { - if _, _, err := p3.Pick(context.Background(), balancer.PickOptions{}); err != balancer.ErrTransientFailure { + if _, err := p3.Pick(balancer.PickInfo{}); err != balancer.ErrTransientFailure { t.Fatalf("want pick error %v, got %v", balancer.ErrTransientFailure, err) } } @@ -331,6 +329,7 @@ func TestBalancerGroup_ThreeRR_RemoveBalancer(t *testing.T) { func TestBalancerGroup_TwoRR_ChangeWeight_MoreBackends(t *testing.T) { cc := newTestClientConn(t) bg := newBalancerGroup(cc, nil) + bg.start() // Add two balancers to group and send two resolved addresses to both // balancers. @@ -357,10 +356,7 @@ func TestBalancerGroup_TwoRR_ChangeWeight_MoreBackends(t *testing.T) { // Test roundrobin on the last picker. p1 := <-cc.newPickerCh want := []balancer.SubConn{sc1, sc1, sc2, sc2, sc3, sc4} - if err := isRoundRobin(want, func() balancer.SubConn { - sc, _, _ := p1.Pick(context.Background(), balancer.PickOptions{}) - return sc - }); err != nil { + if err := isRoundRobin(want, subConnFromPicker(p1)); err != nil { t.Fatalf("want %v, got %v", want, err) } @@ -369,10 +365,7 @@ func TestBalancerGroup_TwoRR_ChangeWeight_MoreBackends(t *testing.T) { // Test roundrobin with new weight. p2 := <-cc.newPickerCh want = []balancer.SubConn{sc1, sc1, sc1, sc2, sc2, sc2, sc3, sc4} - if err := isRoundRobin(want, func() balancer.SubConn { - sc, _, _ := p2.Pick(context.Background(), balancer.PickOptions{}) - return sc - }); err != nil { + if err := isRoundRobin(want, subConnFromPicker(p2)); err != nil { t.Fatalf("want %v, got %v", want, err) } } @@ -382,6 +375,7 @@ func TestBalancerGroup_LoadReport(t *testing.T) { cc := newTestClientConn(t) bg := newBalancerGroup(cc, testLoadStore) + bg.start() backendToBalancerID := make(map[balancer.SubConn]internal.Locality) @@ -419,11 +413,11 @@ func TestBalancerGroup_LoadReport(t *testing.T) { wantCost []testServerLoad ) for i := 0; i < 10; i++ { - sc, done, _ := p1.Pick(context.Background(), balancer.PickOptions{}) - locality := backendToBalancerID[sc] + scst, _ := p1.Pick(balancer.PickInfo{}) + locality := backendToBalancerID[scst.SubConn] wantStart = append(wantStart, locality) - if done != nil && sc != sc1 { - done(balancer.DoneInfo{ + if scst.Done != nil && scst.SubConn != sc1 { + scst.Done(balancer.DoneInfo{ ServerLoad: &orcapb.OrcaLoadReport{ CpuUtilization: 10, MemUtilization: 5, @@ -450,3 +444,353 @@ func TestBalancerGroup_LoadReport(t *testing.T) { t.Fatalf("want cost: %v, got: %v", testLoadStore.callsCost, wantCost) } } + +// Create a new balancer group, add balancer and backends, but not start. +// - b1, weight 2, backends [0,1] +// - b2, weight 1, backends [2,3] +// Start the balancer group and check behavior. +// +// Close the balancer group, call add/remove/change weight/change address. +// - b2, weight 3, backends [0,3] +// - b3, weight 1, backends [1,2] +// Start the balancer group again and check for behavior. +func TestBalancerGroup_start_close(t *testing.T) { + cc := newTestClientConn(t) + bg := newBalancerGroup(cc, nil) + + // Add two balancers to group and send two resolved addresses to both + // balancers. + bg.add(testBalancerIDs[0], 2, rrBuilder) + bg.handleResolvedAddrs(testBalancerIDs[0], testBackendAddrs[0:2]) + bg.add(testBalancerIDs[1], 1, rrBuilder) + bg.handleResolvedAddrs(testBalancerIDs[1], testBackendAddrs[2:4]) + + bg.start() + + m1 := make(map[resolver.Address]balancer.SubConn) + for i := 0; i < 4; i++ { + addrs := <-cc.newSubConnAddrsCh + sc := <-cc.newSubConnCh + m1[addrs[0]] = sc + bg.handleSubConnStateChange(sc, connectivity.Connecting) + bg.handleSubConnStateChange(sc, connectivity.Ready) + } + + // Test roundrobin on the last picker. + p1 := <-cc.newPickerCh + want := []balancer.SubConn{ + m1[testBackendAddrs[0]], m1[testBackendAddrs[0]], + m1[testBackendAddrs[1]], m1[testBackendAddrs[1]], + m1[testBackendAddrs[2]], m1[testBackendAddrs[3]], + } + if err := isRoundRobin(want, subConnFromPicker(p1)); err != nil { + t.Fatalf("want %v, got %v", want, err) + } + + bg.close() + for i := 0; i < 4; i++ { + bg.handleSubConnStateChange(<-cc.removeSubConnCh, connectivity.Shutdown) + } + + // Add b3, weight 1, backends [1,2]. + bg.add(testBalancerIDs[2], 1, rrBuilder) + bg.handleResolvedAddrs(testBalancerIDs[2], testBackendAddrs[1:3]) + + // Remove b1. + bg.remove(testBalancerIDs[0]) + + // Update b2 to weight 3, backends [0,3]. + bg.changeWeight(testBalancerIDs[1], 3) + bg.handleResolvedAddrs(testBalancerIDs[1], append([]resolver.Address(nil), testBackendAddrs[0], testBackendAddrs[3])) + + bg.start() + + m2 := make(map[resolver.Address]balancer.SubConn) + for i := 0; i < 4; i++ { + addrs := <-cc.newSubConnAddrsCh + sc := <-cc.newSubConnCh + m2[addrs[0]] = sc + bg.handleSubConnStateChange(sc, connectivity.Connecting) + bg.handleSubConnStateChange(sc, connectivity.Ready) + } + + // Test roundrobin on the last picker. + p2 := <-cc.newPickerCh + want = []balancer.SubConn{ + m2[testBackendAddrs[0]], m2[testBackendAddrs[0]], m2[testBackendAddrs[0]], + m2[testBackendAddrs[3]], m2[testBackendAddrs[3]], m2[testBackendAddrs[3]], + m2[testBackendAddrs[1]], m2[testBackendAddrs[2]], + } + if err := isRoundRobin(want, subConnFromPicker(p2)); err != nil { + t.Fatalf("want %v, got %v", want, err) + } +} + +// Test that balancer group start() doesn't deadlock if the balancer calls back +// into balancer group inline when it gets an update. +// +// The potential deadlock can happen if we +// - hold a lock and send updates to balancer (e.g. update resolved addresses) +// - the balancer calls back (NewSubConn or update picker) in line +// The callback will try to hold hte same lock again, which will cause a +// deadlock. +// +// This test starts the balancer group with a test balancer, will updates picker +// whenever it gets an address update. It's expected that start() doesn't block +// because of deadlock. +func TestBalancerGroup_start_close_deadlock(t *testing.T) { + cc := newTestClientConn(t) + bg := newBalancerGroup(cc, nil) + + bg.add(testBalancerIDs[0], 2, &testConstBalancerBuilder{}) + bg.handleResolvedAddrs(testBalancerIDs[0], testBackendAddrs[0:2]) + bg.add(testBalancerIDs[1], 1, &testConstBalancerBuilder{}) + bg.handleResolvedAddrs(testBalancerIDs[1], testBackendAddrs[2:4]) + + bg.start() +} + +func replaceDefaultSubBalancerCloseTimeout(n time.Duration) func() { + old := defaultSubBalancerCloseTimeout + defaultSubBalancerCloseTimeout = n + return func() { defaultSubBalancerCloseTimeout = old } +} + +// initBalancerGroupForCachingTest creates a balancer group, and initialize it +// to be ready for caching tests. +// +// Two rr balancers are added to bg, each with 2 ready subConns. A sub-balancer +// is removed later, so the balancer group returned has one sub-balancer in its +// own map, and one sub-balancer in cache. +func initBalancerGroupForCachingTest(t *testing.T) (*balancerGroup, *testClientConn, map[resolver.Address]balancer.SubConn) { + cc := newTestClientConn(t) + bg := newBalancerGroup(cc, nil) + + // Add two balancers to group and send two resolved addresses to both + // balancers. + bg.add(testBalancerIDs[0], 2, rrBuilder) + bg.handleResolvedAddrs(testBalancerIDs[0], testBackendAddrs[0:2]) + bg.add(testBalancerIDs[1], 1, rrBuilder) + bg.handleResolvedAddrs(testBalancerIDs[1], testBackendAddrs[2:4]) + + bg.start() + + m1 := make(map[resolver.Address]balancer.SubConn) + for i := 0; i < 4; i++ { + addrs := <-cc.newSubConnAddrsCh + sc := <-cc.newSubConnCh + m1[addrs[0]] = sc + bg.handleSubConnStateChange(sc, connectivity.Connecting) + bg.handleSubConnStateChange(sc, connectivity.Ready) + } + + // Test roundrobin on the last picker. + p1 := <-cc.newPickerCh + want := []balancer.SubConn{ + m1[testBackendAddrs[0]], m1[testBackendAddrs[0]], + m1[testBackendAddrs[1]], m1[testBackendAddrs[1]], + m1[testBackendAddrs[2]], m1[testBackendAddrs[3]], + } + if err := isRoundRobin(want, subConnFromPicker(p1)); err != nil { + t.Fatalf("want %v, got %v", want, err) + } + + bg.remove(testBalancerIDs[1]) + // Don't wait for SubConns to be removed after close, because they are only + // removed after close timeout. + for i := 0; i < 10; i++ { + select { + case <-cc.removeSubConnCh: + t.Fatalf("Got request to remove subconn, want no remove subconn (because subconns were still in cache)") + default: + } + time.Sleep(time.Millisecond) + } + // Test roundrobin on the with only sub-balancer0. + p2 := <-cc.newPickerCh + want = []balancer.SubConn{ + m1[testBackendAddrs[0]], m1[testBackendAddrs[1]], + } + if err := isRoundRobin(want, subConnFromPicker(p2)); err != nil { + t.Fatalf("want %v, got %v", want, err) + } + + return bg, cc, m1 +} + +// Test that if a sub-balancer is removed, and re-added within close timeout, +// the subConns won't be re-created. +func TestBalancerGroup_locality_caching(t *testing.T) { + defer replaceDefaultSubBalancerCloseTimeout(10 * time.Second)() + bg, cc, addrToSC := initBalancerGroupForCachingTest(t) + + // Turn down subconn for addr2, shouldn't get picker update because + // sub-balancer1 was removed. + bg.handleSubConnStateChange(addrToSC[testBackendAddrs[2]], connectivity.TransientFailure) + for i := 0; i < 10; i++ { + select { + case <-cc.newPickerCh: + t.Fatalf("Got new picker, want no new picker (because the sub-balancer was removed)") + default: + } + time.Sleep(time.Millisecond) + } + + // Sleep, but sleep less then close timeout. + time.Sleep(time.Millisecond * 100) + + // Re-add sub-balancer-1, because subconns were in cache, no new subconns + // should be created. But a new picker will still be generated, with subconn + // states update to date. + bg.add(testBalancerIDs[1], 1, rrBuilder) + + p3 := <-cc.newPickerCh + want := []balancer.SubConn{ + addrToSC[testBackendAddrs[0]], addrToSC[testBackendAddrs[0]], + addrToSC[testBackendAddrs[1]], addrToSC[testBackendAddrs[1]], + // addr2 is down, b2 only has addr3 in READY state. + addrToSC[testBackendAddrs[3]], addrToSC[testBackendAddrs[3]], + } + if err := isRoundRobin(want, subConnFromPicker(p3)); err != nil { + t.Fatalf("want %v, got %v", want, err) + } + + for i := 0; i < 10; i++ { + select { + case <-cc.newSubConnAddrsCh: + t.Fatalf("Got new subconn, want no new subconn (because subconns were still in cache)") + default: + } + time.Sleep(time.Millisecond * 10) + } +} + +// Sub-balancers are put in cache when they are removed. If balancer group is +// closed within close timeout, all subconns should still be rmeoved +// immediately. +func TestBalancerGroup_locality_caching_close_group(t *testing.T) { + defer replaceDefaultSubBalancerCloseTimeout(10 * time.Second)() + bg, cc, addrToSC := initBalancerGroupForCachingTest(t) + + bg.close() + // The balancer group is closed. The subconns should be removed immediately. + removeTimeout := time.After(time.Millisecond * 500) + scToRemove := map[balancer.SubConn]int{ + addrToSC[testBackendAddrs[0]]: 1, + addrToSC[testBackendAddrs[1]]: 1, + addrToSC[testBackendAddrs[2]]: 1, + addrToSC[testBackendAddrs[3]]: 1, + } + for i := 0; i < len(scToRemove); i++ { + select { + case sc := <-cc.removeSubConnCh: + c := scToRemove[sc] + if c == 0 { + t.Fatalf("Got removeSubConn for %v when there's %d remove expected", sc, c) + } + scToRemove[sc] = c - 1 + case <-removeTimeout: + t.Fatalf("timeout waiting for subConns (from balancer in cache) to be removed") + } + } +} + +// Sub-balancers in cache will be closed if not re-added within timeout, and +// subConns will be removed. +func TestBalancerGroup_locality_caching_not_readd_within_timeout(t *testing.T) { + defer replaceDefaultSubBalancerCloseTimeout(time.Second)() + _, cc, addrToSC := initBalancerGroupForCachingTest(t) + + // The sub-balancer is not re-added withtin timeout. The subconns should be + // removed. + removeTimeout := time.After(defaultSubBalancerCloseTimeout) + scToRemove := map[balancer.SubConn]int{ + addrToSC[testBackendAddrs[2]]: 1, + addrToSC[testBackendAddrs[3]]: 1, + } + for i := 0; i < len(scToRemove); i++ { + select { + case sc := <-cc.removeSubConnCh: + c := scToRemove[sc] + if c == 0 { + t.Fatalf("Got removeSubConn for %v when there's %d remove expected", sc, c) + } + scToRemove[sc] = c - 1 + case <-removeTimeout: + t.Fatalf("timeout waiting for subConns (from balancer in cache) to be removed") + } + } +} + +// Wrap the rr builder, so it behaves the same, but has a different pointer. +type noopBalancerBuilderWrapper struct { + balancer.Builder +} + +// After removing a sub-balancer, re-add with same ID, but different balancer +// builder. Old subconns should be removed, and new subconns should be created. +func TestBalancerGroup_locality_caching_readd_with_different_builder(t *testing.T) { + defer replaceDefaultSubBalancerCloseTimeout(10 * time.Second)() + bg, cc, addrToSC := initBalancerGroupForCachingTest(t) + + // Re-add sub-balancer-1, but with a different balancer builder. The + // sub-balancer was still in cache, but cann't be reused. This should cause + // old sub-balancer's subconns to be removed immediately, and new subconns + // to be created. + bg.add(testBalancerIDs[1], 1, &noopBalancerBuilderWrapper{rrBuilder}) + + // The cached sub-balancer should be closed, and the subconns should be + // removed immediately. + removeTimeout := time.After(time.Millisecond * 500) + scToRemove := map[balancer.SubConn]int{ + addrToSC[testBackendAddrs[2]]: 1, + addrToSC[testBackendAddrs[3]]: 1, + } + for i := 0; i < len(scToRemove); i++ { + select { + case sc := <-cc.removeSubConnCh: + c := scToRemove[sc] + if c == 0 { + t.Fatalf("Got removeSubConn for %v when there's %d remove expected", sc, c) + } + scToRemove[sc] = c - 1 + case <-removeTimeout: + t.Fatalf("timeout waiting for subConns (from balancer in cache) to be removed") + } + } + + bg.handleResolvedAddrs(testBalancerIDs[1], testBackendAddrs[4:6]) + + newSCTimeout := time.After(time.Millisecond * 500) + scToAdd := map[resolver.Address]int{ + testBackendAddrs[4]: 1, + testBackendAddrs[5]: 1, + } + for i := 0; i < len(scToAdd); i++ { + select { + case addr := <-cc.newSubConnAddrsCh: + c := scToAdd[addr[0]] + if c == 0 { + t.Fatalf("Got newSubConn for %v when there's %d new expected", addr, c) + } + scToAdd[addr[0]] = c - 1 + sc := <-cc.newSubConnCh + addrToSC[addr[0]] = sc + bg.handleSubConnStateChange(sc, connectivity.Connecting) + bg.handleSubConnStateChange(sc, connectivity.Ready) + case <-newSCTimeout: + t.Fatalf("timeout waiting for subConns (from new sub-balancer) to be newed") + } + } + + // Test roundrobin on the new picker. + p3 := <-cc.newPickerCh + want := []balancer.SubConn{ + addrToSC[testBackendAddrs[0]], addrToSC[testBackendAddrs[0]], + addrToSC[testBackendAddrs[1]], addrToSC[testBackendAddrs[1]], + addrToSC[testBackendAddrs[4]], addrToSC[testBackendAddrs[5]], + } + if err := isRoundRobin(want, subConnFromPicker(p3)); err != nil { + t.Fatalf("want %v, got %v", want, err) + } +} diff --git a/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/edsbalancer.go b/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/edsbalancer.go index 0038830d4aa..0d75d3bac5e 100644 --- a/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/edsbalancer.go +++ b/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/edsbalancer.go @@ -18,12 +18,10 @@ package edsbalancer import ( - "context" "encoding/json" - "net" "reflect" - "strconv" "sync" + "time" "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/roundrobin" @@ -35,16 +33,24 @@ import ( "google.golang.org/grpc/status" "google.golang.org/grpc/xds/internal" "google.golang.org/grpc/xds/internal/balancer/lrs" - edspb "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/eds" - endpointpb "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/endpoint/endpoint" - percentpb "google.golang.org/grpc/xds/internal/proto/envoy/type/percent" + xdsclient "google.golang.org/grpc/xds/internal/client" ) +// TODO: make this a environment variable? +var defaultPriorityInitTimeout = 10 * time.Second + type localityConfig struct { weight uint32 addrs []resolver.Address } +// balancerGroupWithConfig contains the localities with the same priority. It +// manages all localities using a balancerGroup. +type balancerGroupWithConfig struct { + bg *balancerGroup + configs map[internal.Locality]*localityConfig +} + // EDSBalancer does load balancing based on the EDS responses. Note that it // doesn't implement the balancer interface. It's intended to be used by a high // level balancer implementation. @@ -52,27 +58,47 @@ type localityConfig struct { // The localities are picked as weighted round robin. A configurable child // policy is used to manage endpoints in each locality. type EDSBalancer struct { - balancer.ClientConn + cc balancer.ClientConn + + subBalancerBuilder balancer.Builder + loadStore lrs.Store + priorityToLocalities map[priorityType]*balancerGroupWithConfig + + // There's no need to hold any mutexes at the same time. The order to take + // mutex should be: priorityMu > subConnMu, but this is implicit via + // balancers (starting balancer with next priority while holding priorityMu, + // and the balancer may create new SubConn). + + priorityMu sync.Mutex + // priorities are pointers, and will be nil when EDS returns empty result. + priorityInUse priorityType + priorityLowest priorityType + priorityToState map[priorityType]*balancer.State + // The timer to give a priority 10 seconds to connect. And if the priority + // doesn't go into Ready/Failure, start the next priority. + // + // One timer is enough because there can be at most one priority in init + // state. + priorityInitTimer *time.Timer - bg *balancerGroup - subBalancerBuilder balancer.Builder - lidToConfig map[internal.Locality]*localityConfig - loadStore lrs.Store + subConnMu sync.Mutex + subConnToPriority map[balancer.SubConn]priorityType - pickerMu sync.Mutex - drops []*dropper - innerPicker balancer.Picker // The picker without drop support. - innerState connectivity.State // The state of the picker. + pickerMu sync.Mutex + drops []*dropper + innerState balancer.State // The state of the picker without drop support. } // NewXDSBalancer create a new EDSBalancer. func NewXDSBalancer(cc balancer.ClientConn, loadStore lrs.Store) *EDSBalancer { xdsB := &EDSBalancer{ - ClientConn: cc, + cc: cc, subBalancerBuilder: balancer.Get(roundrobin.Name), - lidToConfig: make(map[internal.Locality]*localityConfig), - loadStore: loadStore, + priorityToLocalities: make(map[priorityType]*balancerGroupWithConfig), + priorityToState: make(map[priorityType]*balancer.State), + subConnToPriority: make(map[balancer.SubConn]priorityType), + loadStore: loadStore, } // Don't start balancer group here. Start it when handling the first EDS // response. Otherwise the balancer group will be started with round-robin, @@ -87,61 +113,43 @@ func NewXDSBalancer(cc balancer.ClientConn, loadStore lrs.Store) *EDSBalancer { // // HandleChildPolicy and HandleEDSResponse must be called by the same goroutine. func (xdsB *EDSBalancer) HandleChildPolicy(name string, config json.RawMessage) { - // name could come from cdsResp.GetLbPolicy().String(). LbPolicy.String() - // are all UPPER_CASE with underscore. - // - // No conversion is needed here because balancer package converts all names - // into lower_case before registering/looking up. - xdsB.updateSubBalancerName(name) - // TODO: (eds) send balancer config to the new child balancers. -} - -func (xdsB *EDSBalancer) updateSubBalancerName(subBalancerName string) { - if xdsB.subBalancerBuilder.Name() == subBalancerName { + if xdsB.subBalancerBuilder.Name() == name { return } - newSubBalancerBuilder := balancer.Get(subBalancerName) + newSubBalancerBuilder := balancer.Get(name) if newSubBalancerBuilder == nil { - grpclog.Infof("EDSBalancer: failed to find balancer with name %q, keep using %q", subBalancerName, xdsB.subBalancerBuilder.Name()) + grpclog.Infof("EDSBalancer: failed to find balancer with name %q, keep using %q", name, xdsB.subBalancerBuilder.Name()) return } xdsB.subBalancerBuilder = newSubBalancerBuilder - if xdsB.bg != nil { - // xdsB.bg == nil until the first EDS response is handled. There's no - // need to update balancer group before that. - for id, config := range xdsB.lidToConfig { + for _, bgwc := range xdsB.priorityToLocalities { + if bgwc == nil { + continue + } + for id, config := range bgwc.configs { // TODO: (eds) add support to balancer group to support smoothly // switching sub-balancers (keep old balancer around until new // balancer becomes ready). - xdsB.bg.remove(id) - xdsB.bg.add(id, config.weight, xdsB.subBalancerBuilder) - xdsB.bg.handleResolvedAddrs(id, config.addrs) + bgwc.bg.remove(id) + bgwc.bg.add(id, config.weight, xdsB.subBalancerBuilder) + bgwc.bg.handleResolvedAddrs(id, config.addrs) } } } // updateDrops compares new drop policies with the old. If they are different, // it updates the drop policies and send ClientConn an updated picker. -func (xdsB *EDSBalancer) updateDrops(dropPolicies []*edspb.ClusterLoadAssignment_Policy_DropOverload) { +func (xdsB *EDSBalancer) updateDrops(dropPolicies []xdsclient.OverloadDropConfig) { var ( newDrops []*dropper dropsChanged bool ) for i, dropPolicy := range dropPolicies { - percentage := dropPolicy.GetDropPercentage() var ( - numerator = percentage.GetNumerator() - denominator uint32 + numerator = dropPolicy.Numerator + denominator = dropPolicy.Denominator ) - switch percentage.GetDenominator() { - case percentpb.FractionalPercent_HUNDRED: - denominator = 100 - case percentpb.FractionalPercent_TEN_THOUSAND: - denominator = 10000 - case percentpb.FractionalPercent_MILLION: - denominator = 1000000 - } - newDrops = append(newDrops, newDropper(numerator, denominator, dropPolicy.GetCategory())) + newDrops = append(newDrops, newDropper(numerator, denominator, dropPolicy.Category)) // The following reading xdsB.drops doesn't need mutex because it can only // be updated by the code following. @@ -159,9 +167,12 @@ func (xdsB *EDSBalancer) updateDrops(dropPolicies []*edspb.ClusterLoadAssignment if dropsChanged { xdsB.pickerMu.Lock() xdsB.drops = newDrops - if xdsB.innerPicker != nil { + if xdsB.innerState.Picker != nil { // Update picker with old inner picker, new drops. - xdsB.ClientConn.UpdateBalancerState(xdsB.innerState, newDropPicker(xdsB.innerPicker, newDrops, xdsB.loadStore)) + xdsB.cc.UpdateState(balancer.State{ + ConnectivityState: xdsB.innerState.ConnectivityState, + Picker: newDropPicker(xdsB.innerState.Picker, newDrops, xdsB.loadStore)}, + ) } xdsB.pickerMu.Unlock() } @@ -170,14 +181,8 @@ func (xdsB *EDSBalancer) updateDrops(dropPolicies []*edspb.ClusterLoadAssignment // HandleEDSResponse handles the EDS response and creates/deletes localities and // SubConns. It also handles drops. // -// HandleCDSResponse and HandleEDSResponse must be called by the same goroutine. -func (xdsB *EDSBalancer) HandleEDSResponse(edsResp *edspb.ClusterLoadAssignment) { - // Create balancer group if it's never created (this is the first EDS - // response). - if xdsB.bg == nil { - xdsB.bg = newBalancerGroup(xdsB, xdsB.loadStore) - } - +// HandleChildPolicy and HandleEDSResponse must be called by the same goroutine. +func (xdsB *EDSBalancer) HandleEDSResponse(edsResp *xdsclient.EDSUpdate) { // TODO: Unhandled fields from EDS response: // - edsResp.GetPolicy().GetOverprovisioningFactor() // - locality.GetPriority() @@ -187,7 +192,7 @@ func (xdsB *EDSBalancer) HandleEDSResponse(edsResp *edspb.ClusterLoadAssignment) // - socketAddress.GetNamedPort(), socketAddress.GetResolverName() // - resolve endpoint's name with another resolver - xdsB.updateDrops(edsResp.GetPolicy().GetDropOverloads()) + xdsB.updateDrops(edsResp.Drops) // Filter out all localities with weight 0. // @@ -198,59 +203,107 @@ func (xdsB *EDSBalancer) HandleEDSResponse(edsResp *edspb.ClusterLoadAssignment) // // In the future, we should look at the config in CDS response and decide // whether locality weight matters. - newEndpoints := make([]*endpointpb.LocalityLbEndpoints, 0, len(edsResp.Endpoints)) - for _, locality := range edsResp.Endpoints { - if locality.GetLoadBalancingWeight().GetValue() == 0 { + newLocalitiesWithPriority := make(map[priorityType][]xdsclient.Locality) + for _, locality := range edsResp.Localities { + if locality.Weight == 0 { continue } - newEndpoints = append(newEndpoints, locality) + priority := newPriorityType(locality.Priority) + newLocalitiesWithPriority[priority] = append(newLocalitiesWithPriority[priority], locality) } - // newLocalitiesSet contains all names of localitis in the new EDS response. - // It's used to delete localities that are removed in the new EDS response. - newLocalitiesSet := make(map[internal.Locality]struct{}) - for _, locality := range newEndpoints { - // One balancer for each locality. + var ( + priorityLowest priorityType + priorityChanged bool + ) - l := locality.GetLocality() - if l == nil { - grpclog.Warningf("xds: received LocalityLbEndpoints with Locality") - continue + for priority, newLocalities := range newLocalitiesWithPriority { + if !priorityLowest.isSet() || priorityLowest.higherThan(priority) { + priorityLowest = priority } - lid := internal.Locality{ - Region: l.Region, - Zone: l.Zone, - SubZone: l.SubZone, + + bgwc, ok := xdsB.priorityToLocalities[priority] + if !ok { + // Create balancer group if it's never created (this is the first + // time this priority is received). We don't start it here. It may + // be started when necessary (e.g. when higher is down, or if it's a + // new lowest priority). + bgwc = &balancerGroupWithConfig{ + bg: newBalancerGroup( + xdsB.ccWrapperWithPriority(priority), xdsB.loadStore, + ), + configs: make(map[internal.Locality]*localityConfig), + } + xdsB.priorityToLocalities[priority] = bgwc + priorityChanged = true + } + xdsB.handleEDSResponsePerPriority(bgwc, newLocalities) + } + xdsB.priorityLowest = priorityLowest + + // Delete priorities that are removed in the latest response, and also close + // the balancer group. + for p, bgwc := range xdsB.priorityToLocalities { + if _, ok := newLocalitiesWithPriority[p]; !ok { + delete(xdsB.priorityToLocalities, p) + bgwc.bg.close() + delete(xdsB.priorityToState, p) + priorityChanged = true } + } + + // If priority was added/removed, it may affect the balancer group to use. + // E.g. priorityInUse was removed, or all priorities are down, and a new + // lower priority was added. + if priorityChanged { + xdsB.handlePriorityChange() + } +} + +func (xdsB *EDSBalancer) handleEDSResponsePerPriority(bgwc *balancerGroupWithConfig, newLocalities []xdsclient.Locality) { + // newLocalitiesSet contains all names of localities in the new EDS response + // for the same priority. It's used to delete localities that are removed in + // the new EDS response. + newLocalitiesSet := make(map[internal.Locality]struct{}) + for _, locality := range newLocalities { + // One balancer for each locality. + + lid := locality.ID newLocalitiesSet[lid] = struct{}{} - newWeight := locality.GetLoadBalancingWeight().GetValue() + newWeight := locality.Weight var newAddrs []resolver.Address - for _, lbEndpoint := range locality.GetLbEndpoints() { - socketAddress := lbEndpoint.GetEndpoint().GetAddress().GetSocketAddress() + for _, lbEndpoint := range locality.Endpoints { + // Filter out all "unhealthy" endpoints (unknown and + // healthy are both considered to be healthy: + // https://www.envoyproxy.io/docs/envoy/latest/api-v2/api/v2/core/health_check.proto#envoy-api-enum-core-healthstatus). + if lbEndpoint.HealthStatus != xdsclient.EndpointHealthStatusHealthy && + lbEndpoint.HealthStatus != xdsclient.EndpointHealthStatusUnknown { + continue + } + address := resolver.Address{ - Addr: net.JoinHostPort(socketAddress.GetAddress(), strconv.Itoa(int(socketAddress.GetPortValue()))), + Addr: lbEndpoint.Address, } - if xdsB.subBalancerBuilder.Name() == weightedroundrobin.Name && - lbEndpoint.GetLoadBalancingWeight().GetValue() != 0 { + if xdsB.subBalancerBuilder.Name() == weightedroundrobin.Name && lbEndpoint.Weight != 0 { address.Metadata = &weightedroundrobin.AddrInfo{ - Weight: lbEndpoint.GetLoadBalancingWeight().GetValue(), + Weight: lbEndpoint.Weight, } } newAddrs = append(newAddrs, address) } var weightChanged, addrsChanged bool - config, ok := xdsB.lidToConfig[lid] + config, ok := bgwc.configs[lid] if !ok { // A new balancer, add it to balancer group and balancer map. - xdsB.bg.add(lid, newWeight, xdsB.subBalancerBuilder) + bgwc.bg.add(lid, newWeight, xdsB.subBalancerBuilder) config = &localityConfig{ weight: newWeight, } - xdsB.lidToConfig[lid] = config + bgwc.configs[lid] = config - // weightChanged is false for new locality, because there's no need to - // update weight in bg. + // weightChanged is false for new locality, because there's no need + // to update weight in bg. addrsChanged = true } else { // Compare weight and addrs. @@ -264,54 +317,116 @@ func (xdsB *EDSBalancer) HandleEDSResponse(edsResp *edspb.ClusterLoadAssignment) if weightChanged { config.weight = newWeight - xdsB.bg.changeWeight(lid, newWeight) + bgwc.bg.changeWeight(lid, newWeight) } if addrsChanged { config.addrs = newAddrs - xdsB.bg.handleResolvedAddrs(lid, newAddrs) + bgwc.bg.handleResolvedAddrs(lid, newAddrs) } } // Delete localities that are removed in the latest response. - for lid := range xdsB.lidToConfig { + for lid := range bgwc.configs { if _, ok := newLocalitiesSet[lid]; !ok { - xdsB.bg.remove(lid) - delete(xdsB.lidToConfig, lid) + bgwc.bg.remove(lid) + delete(bgwc.configs, lid) } } } // HandleSubConnStateChange handles the state change and update pickers accordingly. func (xdsB *EDSBalancer) HandleSubConnStateChange(sc balancer.SubConn, s connectivity.State) { - xdsB.bg.handleSubConnStateChange(sc, s) + xdsB.subConnMu.Lock() + var bgwc *balancerGroupWithConfig + if p, ok := xdsB.subConnToPriority[sc]; ok { + if s == connectivity.Shutdown { + // Only delete sc from the map when state changed to Shutdown. + delete(xdsB.subConnToPriority, sc) + } + bgwc = xdsB.priorityToLocalities[p] + } + xdsB.subConnMu.Unlock() + if bgwc == nil { + grpclog.Infof("EDSBalancer: priority not found for sc state change") + return + } + if bg := bgwc.bg; bg != nil { + bg.handleSubConnStateChange(sc, s) + } } -// UpdateBalancerState overrides balancer.ClientConn to wrap the picker in a -// dropPicker. -func (xdsB *EDSBalancer) UpdateBalancerState(s connectivity.State, p balancer.Picker) { - xdsB.pickerMu.Lock() - defer xdsB.pickerMu.Unlock() - xdsB.innerPicker = p - xdsB.innerState = s - // Don't reset drops when it's a state change. - xdsB.ClientConn.UpdateBalancerState(s, newDropPicker(p, xdsB.drops, xdsB.loadStore)) +// updateState first handles priority, and then wraps picker in a drop picker +// before forwarding the update. +func (xdsB *EDSBalancer) updateState(priority priorityType, s balancer.State) { + _, ok := xdsB.priorityToLocalities[priority] + if !ok { + grpclog.Infof("eds: received picker update from unknown priority") + return + } + + if xdsB.handlePriorityWithNewState(priority, s) { + xdsB.pickerMu.Lock() + defer xdsB.pickerMu.Unlock() + xdsB.innerState = s + // Don't reset drops when it's a state change. + xdsB.cc.UpdateState(balancer.State{ConnectivityState: s.ConnectivityState, Picker: newDropPicker(s.Picker, xdsB.drops, xdsB.loadStore)}) + } +} + +func (xdsB *EDSBalancer) ccWrapperWithPriority(priority priorityType) *edsBalancerWrapperCC { + return &edsBalancerWrapperCC{ + ClientConn: xdsB.cc, + priority: priority, + parent: xdsB, + } +} + +// edsBalancerWrapperCC implements the balancer.ClientConn API and get passed to +// each balancer group. It contains the locality priority. +type edsBalancerWrapperCC struct { + balancer.ClientConn + priority priorityType + parent *EDSBalancer +} + +func (ebwcc *edsBalancerWrapperCC) NewSubConn(addrs []resolver.Address, opts balancer.NewSubConnOptions) (balancer.SubConn, error) { + return ebwcc.parent.newSubConn(ebwcc.priority, addrs, opts) +} +func (ebwcc *edsBalancerWrapperCC) UpdateBalancerState(state connectivity.State, picker balancer.Picker) { + grpclog.Fatalln("not implemented") +} +func (ebwcc *edsBalancerWrapperCC) UpdateState(state balancer.State) { + ebwcc.parent.updateState(ebwcc.priority, state) +} + +func (xdsB *EDSBalancer) newSubConn(priority priorityType, addrs []resolver.Address, opts balancer.NewSubConnOptions) (balancer.SubConn, error) { + sc, err := xdsB.cc.NewSubConn(addrs, opts) + if err != nil { + return nil, err + } + xdsB.subConnMu.Lock() + xdsB.subConnToPriority[sc] = priority + xdsB.subConnMu.Unlock() + return sc, nil } // Close closes the balancer. func (xdsB *EDSBalancer) Close() { - if xdsB.bg != nil { - xdsB.bg.close() + for _, bgwc := range xdsB.priorityToLocalities { + if bg := bgwc.bg; bg != nil { + bg.close() + } } } type dropPicker struct { drops []*dropper - p balancer.Picker + p balancer.V2Picker loadStore lrs.Store } -func newDropPicker(p balancer.Picker, drops []*dropper, loadStore lrs.Store) *dropPicker { +func newDropPicker(p balancer.V2Picker, drops []*dropper, loadStore lrs.Store) *dropPicker { return &dropPicker{ drops: drops, p: p, @@ -319,7 +434,7 @@ func newDropPicker(p balancer.Picker, drops []*dropper, loadStore lrs.Store) *dr } } -func (d *dropPicker) Pick(ctx context.Context, opts balancer.PickOptions) (conn balancer.SubConn, done func(balancer.DoneInfo), err error) { +func (d *dropPicker) Pick(info balancer.PickInfo) (balancer.PickResult, error) { var ( drop bool category string @@ -335,9 +450,9 @@ func (d *dropPicker) Pick(ctx context.Context, opts balancer.PickOptions) (conn if d.loadStore != nil { d.loadStore.CallDropped(category) } - return nil, nil, status.Errorf(codes.Unavailable, "RPC is dropped") + return balancer.PickResult{}, status.Errorf(codes.Unavailable, "RPC is dropped") } // TODO: (eds) don't drop unless the inner picker is READY. Similar to // https://github.com/grpc/grpc-go/issues/2622. - return d.p.Pick(ctx, opts) + return d.p.Pick(info) } diff --git a/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/edsbalancer_test.go b/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/edsbalancer_test.go index 347fe6d7e00..0e30f7512fe 100644 --- a/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/edsbalancer_test.go +++ b/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/edsbalancer_test.go @@ -17,98 +17,34 @@ package edsbalancer import ( - "context" "fmt" - "net" "reflect" - "strconv" + "sort" "testing" + "time" - typespb "github.com/golang/protobuf/ptypes/wrappers" + corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" + "github.com/google/go-cmp/cmp" "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/roundrobin" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/resolver" "google.golang.org/grpc/xds/internal" - addresspb "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/address" - basepb "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/base" - edspb "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/eds" - endpointpb "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/endpoint/endpoint" - percentpb "google.golang.org/grpc/xds/internal/proto/envoy/type/percent" + xdsclient "google.golang.org/grpc/xds/internal/client" ) var ( testClusterNames = []string{"test-cluster-1", "test-cluster-2"} testSubZones = []string{"I", "II", "III", "IV"} - testEndpointAddrs = []string{"1.1.1.1:1", "2.2.2.2:2", "3.3.3.3:3", "4.4.4.4:4"} + testEndpointAddrs []string ) -type clusterLoadAssignmentBuilder struct { - v *edspb.ClusterLoadAssignment -} - -func newClusterLoadAssignmentBuilder(clusterName string, dropPercents []uint32) *clusterLoadAssignmentBuilder { - var drops []*edspb.ClusterLoadAssignment_Policy_DropOverload - for i, d := range dropPercents { - drops = append(drops, &edspb.ClusterLoadAssignment_Policy_DropOverload{ - Category: fmt.Sprintf("test-drop-%d", i), - DropPercentage: &percentpb.FractionalPercent{ - Numerator: d, - Denominator: percentpb.FractionalPercent_HUNDRED, - }, - }) - } - - return &clusterLoadAssignmentBuilder{ - v: &edspb.ClusterLoadAssignment{ - ClusterName: clusterName, - Policy: &edspb.ClusterLoadAssignment_Policy{ - DropOverloads: drops, - }, - }, +func init() { + for i := 0; i < testBackendAddrsCount; i++ { + testEndpointAddrs = append(testEndpointAddrs, fmt.Sprintf("%d.%d.%d.%d:%d", i, i, i, i, i)) } } -func (clab *clusterLoadAssignmentBuilder) addLocality(subzone string, weight uint32, addrsWithPort []string) { - var lbEndPoints []*endpointpb.LbEndpoint - for _, a := range addrsWithPort { - host, portStr, err := net.SplitHostPort(a) - if err != nil { - panic("failed to split " + a) - } - port, err := strconv.Atoi(portStr) - if err != nil { - panic("failed to atoi " + portStr) - } - - lbEndPoints = append(lbEndPoints, &endpointpb.LbEndpoint{ - HostIdentifier: &endpointpb.LbEndpoint_Endpoint{ - Endpoint: &endpointpb.Endpoint{ - Address: &addresspb.Address{ - Address: &addresspb.Address_SocketAddress{ - SocketAddress: &addresspb.SocketAddress{ - Protocol: addresspb.SocketAddress_TCP, - Address: host, - PortSpecifier: &addresspb.SocketAddress_PortValue{ - PortValue: uint32(port)}}}}}}}, - ) - } - - clab.v.Endpoints = append(clab.v.Endpoints, &endpointpb.LocalityLbEndpoints{ - Locality: &basepb.Locality{ - Region: "", - Zone: "", - SubZone: subzone, - }, - LbEndpoints: lbEndPoints, - LoadBalancingWeight: &typespb.UInt32Value{Value: weight}, - }) -} - -func (clab *clusterLoadAssignmentBuilder) build() *edspb.ClusterLoadAssignment { - return clab.v -} - // One locality // - add backend // - remove backend @@ -119,9 +55,9 @@ func TestEDS_OneLocality(t *testing.T) { edsb := NewXDSBalancer(cc, nil) // One locality with one backend. - clab1 := newClusterLoadAssignmentBuilder(testClusterNames[0], nil) - clab1.addLocality(testSubZones[0], 1, testEndpointAddrs[:1]) - edsb.HandleEDSResponse(clab1.build()) + clab1 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab1.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:1], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab1.Build())) sc1 := <-cc.newSubConnCh edsb.HandleSubConnStateChange(sc1, connectivity.Connecting) @@ -130,16 +66,16 @@ func TestEDS_OneLocality(t *testing.T) { // Pick with only the first backend. p1 := <-cc.newPickerCh for i := 0; i < 5; i++ { - gotSC, _, _ := p1.Pick(context.Background(), balancer.PickOptions{}) - if !reflect.DeepEqual(gotSC, sc1) { - t.Fatalf("picker.Pick, got %v, want %v", gotSC, sc1) + gotSCSt, _ := p1.Pick(balancer.PickInfo{}) + if !reflect.DeepEqual(gotSCSt.SubConn, sc1) { + t.Fatalf("picker.Pick, got %v, want SubConn=%v", gotSCSt, sc1) } } // The same locality, add one more backend. - clab2 := newClusterLoadAssignmentBuilder(testClusterNames[0], nil) - clab2.addLocality(testSubZones[0], 1, testEndpointAddrs[:2]) - edsb.HandleEDSResponse(clab2.build()) + clab2 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab2.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:2], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab2.Build())) sc2 := <-cc.newSubConnCh edsb.HandleSubConnStateChange(sc2, connectivity.Connecting) @@ -148,17 +84,14 @@ func TestEDS_OneLocality(t *testing.T) { // Test roundrobin with two subconns. p2 := <-cc.newPickerCh want := []balancer.SubConn{sc1, sc2} - if err := isRoundRobin(want, func() balancer.SubConn { - sc, _, _ := p2.Pick(context.Background(), balancer.PickOptions{}) - return sc - }); err != nil { + if err := isRoundRobin(want, subConnFromPicker(p2)); err != nil { t.Fatalf("want %v, got %v", want, err) } // The same locality, delete first backend. - clab3 := newClusterLoadAssignmentBuilder(testClusterNames[0], nil) - clab3.addLocality(testSubZones[0], 1, testEndpointAddrs[1:2]) - edsb.HandleEDSResponse(clab3.build()) + clab3 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab3.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[1:2], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab3.Build())) scToRemove := <-cc.removeSubConnCh if !reflect.DeepEqual(scToRemove, sc1) { @@ -169,16 +102,16 @@ func TestEDS_OneLocality(t *testing.T) { // Test pick with only the second subconn. p3 := <-cc.newPickerCh for i := 0; i < 5; i++ { - gotSC, _, _ := p3.Pick(context.Background(), balancer.PickOptions{}) - if !reflect.DeepEqual(gotSC, sc2) { - t.Fatalf("picker.Pick, got %v, want %v", gotSC, sc2) + gotSCSt, _ := p3.Pick(balancer.PickInfo{}) + if !reflect.DeepEqual(gotSCSt.SubConn, sc2) { + t.Fatalf("picker.Pick, got %v, want SubConn=%v", gotSCSt, sc2) } } // The same locality, replace backend. - clab4 := newClusterLoadAssignmentBuilder(testClusterNames[0], nil) - clab4.addLocality(testSubZones[0], 1, testEndpointAddrs[2:3]) - edsb.HandleEDSResponse(clab4.build()) + clab4 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab4.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[2:3], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab4.Build())) sc3 := <-cc.newSubConnCh edsb.HandleSubConnStateChange(sc3, connectivity.Connecting) @@ -192,21 +125,21 @@ func TestEDS_OneLocality(t *testing.T) { // Test pick with only the third subconn. p4 := <-cc.newPickerCh for i := 0; i < 5; i++ { - gotSC, _, _ := p4.Pick(context.Background(), balancer.PickOptions{}) - if !reflect.DeepEqual(gotSC, sc3) { - t.Fatalf("picker.Pick, got %v, want %v", gotSC, sc3) + gotSCSt, _ := p4.Pick(balancer.PickInfo{}) + if !reflect.DeepEqual(gotSCSt.SubConn, sc3) { + t.Fatalf("picker.Pick, got %v, want SubConn=%v", gotSCSt, sc3) } } // The same locality, different drop rate, dropping 50%. - clab5 := newClusterLoadAssignmentBuilder(testClusterNames[0], []uint32{50}) - clab5.addLocality(testSubZones[0], 1, testEndpointAddrs[2:3]) - edsb.HandleEDSResponse(clab5.build()) + clab5 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], []uint32{50}) + clab5.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[2:3], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab5.Build())) // Picks with drops. p5 := <-cc.newPickerCh for i := 0; i < 100; i++ { - _, _, err := p5.Pick(context.Background(), balancer.PickOptions{}) + _, err := p5.Pick(balancer.PickInfo{}) // TODO: the dropping algorithm needs a design. When the dropping algorithm // is fixed, this test also needs fix. if i < 50 && err == nil { @@ -228,14 +161,18 @@ func TestEDS_TwoLocalities(t *testing.T) { edsb := NewXDSBalancer(cc, nil) // Two localities, each with one backend. - clab1 := newClusterLoadAssignmentBuilder(testClusterNames[0], nil) - clab1.addLocality(testSubZones[0], 1, testEndpointAddrs[:1]) - clab1.addLocality(testSubZones[1], 1, testEndpointAddrs[1:2]) - edsb.HandleEDSResponse(clab1.build()) - + clab1 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab1.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:1], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab1.Build())) sc1 := <-cc.newSubConnCh edsb.HandleSubConnStateChange(sc1, connectivity.Connecting) edsb.HandleSubConnStateChange(sc1, connectivity.Ready) + + // Add the second locality later to make sure sc2 belongs to the second + // locality. Otherwise the test is flaky because of a map is used in EDS to + // keep localities. + clab1.AddLocality(testSubZones[1], 1, 0, testEndpointAddrs[1:2], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab1.Build())) sc2 := <-cc.newSubConnCh edsb.HandleSubConnStateChange(sc2, connectivity.Connecting) edsb.HandleSubConnStateChange(sc2, connectivity.Ready) @@ -243,19 +180,16 @@ func TestEDS_TwoLocalities(t *testing.T) { // Test roundrobin with two subconns. p1 := <-cc.newPickerCh want := []balancer.SubConn{sc1, sc2} - if err := isRoundRobin(want, func() balancer.SubConn { - sc, _, _ := p1.Pick(context.Background(), balancer.PickOptions{}) - return sc - }); err != nil { + if err := isRoundRobin(want, subConnFromPicker(p1)); err != nil { t.Fatalf("want %v, got %v", want, err) } // Add another locality, with one backend. - clab2 := newClusterLoadAssignmentBuilder(testClusterNames[0], nil) - clab2.addLocality(testSubZones[0], 1, testEndpointAddrs[:1]) - clab2.addLocality(testSubZones[1], 1, testEndpointAddrs[1:2]) - clab2.addLocality(testSubZones[2], 1, testEndpointAddrs[2:3]) - edsb.HandleEDSResponse(clab2.build()) + clab2 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab2.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:1], nil) + clab2.AddLocality(testSubZones[1], 1, 0, testEndpointAddrs[1:2], nil) + clab2.AddLocality(testSubZones[2], 1, 0, testEndpointAddrs[2:3], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab2.Build())) sc3 := <-cc.newSubConnCh edsb.HandleSubConnStateChange(sc3, connectivity.Connecting) @@ -264,18 +198,15 @@ func TestEDS_TwoLocalities(t *testing.T) { // Test roundrobin with three subconns. p2 := <-cc.newPickerCh want = []balancer.SubConn{sc1, sc2, sc3} - if err := isRoundRobin(want, func() balancer.SubConn { - sc, _, _ := p2.Pick(context.Background(), balancer.PickOptions{}) - return sc - }); err != nil { + if err := isRoundRobin(want, subConnFromPicker(p2)); err != nil { t.Fatalf("want %v, got %v", want, err) } // Remove first locality. - clab3 := newClusterLoadAssignmentBuilder(testClusterNames[0], nil) - clab3.addLocality(testSubZones[1], 1, testEndpointAddrs[1:2]) - clab3.addLocality(testSubZones[2], 1, testEndpointAddrs[2:3]) - edsb.HandleEDSResponse(clab3.build()) + clab3 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab3.AddLocality(testSubZones[1], 1, 0, testEndpointAddrs[1:2], nil) + clab3.AddLocality(testSubZones[2], 1, 0, testEndpointAddrs[2:3], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab3.Build())) scToRemove := <-cc.removeSubConnCh if !reflect.DeepEqual(scToRemove, sc1) { @@ -286,18 +217,15 @@ func TestEDS_TwoLocalities(t *testing.T) { // Test pick with two subconns (without the first one). p3 := <-cc.newPickerCh want = []balancer.SubConn{sc2, sc3} - if err := isRoundRobin(want, func() balancer.SubConn { - sc, _, _ := p3.Pick(context.Background(), balancer.PickOptions{}) - return sc - }); err != nil { + if err := isRoundRobin(want, subConnFromPicker(p3)); err != nil { t.Fatalf("want %v, got %v", want, err) } // Add a backend to the last locality. - clab4 := newClusterLoadAssignmentBuilder(testClusterNames[0], nil) - clab4.addLocality(testSubZones[1], 1, testEndpointAddrs[1:2]) - clab4.addLocality(testSubZones[2], 1, testEndpointAddrs[2:4]) - edsb.HandleEDSResponse(clab4.build()) + clab4 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab4.AddLocality(testSubZones[1], 1, 0, testEndpointAddrs[1:2], nil) + clab4.AddLocality(testSubZones[2], 1, 0, testEndpointAddrs[2:4], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab4.Build())) sc4 := <-cc.newSubConnCh edsb.HandleSubConnStateChange(sc4, connectivity.Connecting) @@ -309,18 +237,15 @@ func TestEDS_TwoLocalities(t *testing.T) { // Locality-1 contains only sc2, locality-2 contains sc3 and sc4. So expect // two sc2's and sc3, sc4. want = []balancer.SubConn{sc2, sc2, sc3, sc4} - if err := isRoundRobin(want, func() balancer.SubConn { - sc, _, _ := p4.Pick(context.Background(), balancer.PickOptions{}) - return sc - }); err != nil { + if err := isRoundRobin(want, subConnFromPicker(p4)); err != nil { t.Fatalf("want %v, got %v", want, err) } // Change weight of the locality[1]. - clab5 := newClusterLoadAssignmentBuilder(testClusterNames[0], nil) - clab5.addLocality(testSubZones[1], 2, testEndpointAddrs[1:2]) - clab5.addLocality(testSubZones[2], 1, testEndpointAddrs[2:4]) - edsb.HandleEDSResponse(clab5.build()) + clab5 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab5.AddLocality(testSubZones[1], 2, 0, testEndpointAddrs[1:2], nil) + clab5.AddLocality(testSubZones[2], 1, 0, testEndpointAddrs[2:4], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab5.Build())) // Test pick with two subconns different locality weight. p5 := <-cc.newPickerCh @@ -328,28 +253,107 @@ func TestEDS_TwoLocalities(t *testing.T) { // (weight 2 and 1). Locality-1 contains only sc2, locality-2 contains sc3 and // sc4. So expect four sc2's and sc3, sc4. want = []balancer.SubConn{sc2, sc2, sc2, sc2, sc3, sc4} - if err := isRoundRobin(want, func() balancer.SubConn { - sc, _, _ := p5.Pick(context.Background(), balancer.PickOptions{}) - return sc - }); err != nil { + if err := isRoundRobin(want, subConnFromPicker(p5)); err != nil { t.Fatalf("want %v, got %v", want, err) } // Change weight of the locality[1] to 0, it should never be picked. - clab6 := newClusterLoadAssignmentBuilder(testClusterNames[0], nil) - clab6.addLocality(testSubZones[1], 0, testEndpointAddrs[1:2]) - clab6.addLocality(testSubZones[2], 1, testEndpointAddrs[2:4]) - edsb.HandleEDSResponse(clab6.build()) + clab6 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab6.AddLocality(testSubZones[1], 0, 0, testEndpointAddrs[1:2], nil) + clab6.AddLocality(testSubZones[2], 1, 0, testEndpointAddrs[2:4], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab6.Build())) + + // Changing weight of locality[1] to 0 caused it to be removed. It's subconn + // should also be removed. + // + // NOTE: this is because we handle locality with weight 0 same as the + // locality doesn't exist. If this changes in the future, this removeSubConn + // behavior will also change. + scToRemove2 := <-cc.removeSubConnCh + if !reflect.DeepEqual(scToRemove2, sc2) { + t.Fatalf("RemoveSubConn, want %v, got %v", sc2, scToRemove2) + } // Test pick with two subconns different locality weight. p6 := <-cc.newPickerCh // Locality-1 will be not be picked, and locality-2 will be picked. // Locality-2 contains sc3 and sc4. So expect sc3, sc4. want = []balancer.SubConn{sc3, sc4} - if err := isRoundRobin(want, func() balancer.SubConn { - sc, _, _ := p6.Pick(context.Background(), balancer.PickOptions{}) - return sc - }); err != nil { + if err := isRoundRobin(want, subConnFromPicker(p6)); err != nil { + t.Fatalf("want %v, got %v", want, err) + } +} + +// The EDS balancer gets EDS resp with unhealthy endpoints. Test that only +// healthy ones are used. +func TestEDS_EndpointsHealth(t *testing.T) { + cc := newTestClientConn(t) + edsb := NewXDSBalancer(cc, nil) + + // Two localities, each 3 backend, one Healthy, one Unhealthy, one Unknown. + clab1 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab1.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:6], &xdsclient.AddLocalityOptions{ + Health: []corepb.HealthStatus{ + corepb.HealthStatus_HEALTHY, + corepb.HealthStatus_UNHEALTHY, + corepb.HealthStatus_UNKNOWN, + corepb.HealthStatus_DRAINING, + corepb.HealthStatus_TIMEOUT, + corepb.HealthStatus_DEGRADED, + }, + }) + clab1.AddLocality(testSubZones[1], 1, 0, testEndpointAddrs[6:12], &xdsclient.AddLocalityOptions{ + Health: []corepb.HealthStatus{ + corepb.HealthStatus_HEALTHY, + corepb.HealthStatus_UNHEALTHY, + corepb.HealthStatus_UNKNOWN, + corepb.HealthStatus_DRAINING, + corepb.HealthStatus_TIMEOUT, + corepb.HealthStatus_DEGRADED, + }, + }) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab1.Build())) + + var ( + readySCs []balancer.SubConn + newSubConnAddrStrs []string + ) + for i := 0; i < 4; i++ { + addr := <-cc.newSubConnAddrsCh + newSubConnAddrStrs = append(newSubConnAddrStrs, addr[0].Addr) + sc := <-cc.newSubConnCh + edsb.HandleSubConnStateChange(sc, connectivity.Connecting) + edsb.HandleSubConnStateChange(sc, connectivity.Ready) + readySCs = append(readySCs, sc) + } + + wantNewSubConnAddrStrs := []string{ + testEndpointAddrs[0], + testEndpointAddrs[2], + testEndpointAddrs[6], + testEndpointAddrs[8], + } + sortStrTrans := cmp.Transformer("Sort", func(in []string) []string { + out := append([]string(nil), in...) // Copy input to avoid mutating it. + sort.Strings(out) + return out + }) + if !cmp.Equal(newSubConnAddrStrs, wantNewSubConnAddrStrs, sortStrTrans) { + t.Fatalf("want newSubConn with address %v, got %v", wantNewSubConnAddrStrs, newSubConnAddrStrs) + } + + // There should be exactly 4 new SubConns. Check to make sure there's no + // more subconns being created. + select { + case <-cc.newSubConnCh: + t.Fatalf("Got unexpected new subconn") + case <-time.After(time.Microsecond * 100): + } + + // Test roundrobin with the subconns. + p1 := <-cc.newPickerCh + want := readySCs + if err := isRoundRobin(want, subConnFromPicker(p1)); err != nil { t.Fatalf("want %v, got %v", want, err) } } @@ -382,11 +386,14 @@ type testConstBalancer struct { } func (tb *testConstBalancer) HandleSubConnStateChange(sc balancer.SubConn, state connectivity.State) { - tb.cc.UpdateBalancerState(connectivity.Ready, &testConstPicker{err: errTestConstPicker}) + tb.cc.UpdateState(balancer.State{ConnectivityState: connectivity.Ready, Picker: &testConstPicker{err: errTestConstPicker}}) } -func (tb *testConstBalancer) HandleResolvedAddrs([]resolver.Address, error) { - tb.cc.UpdateBalancerState(connectivity.Ready, &testConstPicker{err: errTestConstPicker}) +func (tb *testConstBalancer) HandleResolvedAddrs(a []resolver.Address, err error) { + if len(a) == 0 { + return + } + tb.cc.NewSubConn(a, balancer.NewSubConnOptions{}) } func (*testConstBalancer) Close() { @@ -397,11 +404,11 @@ type testConstPicker struct { sc balancer.SubConn } -func (tcp *testConstPicker) Pick(ctx context.Context, opts balancer.PickOptions) (conn balancer.SubConn, done func(balancer.DoneInfo), err error) { +func (tcp *testConstPicker) Pick(info balancer.PickInfo) (balancer.PickResult, error) { if tcp.err != nil { - return nil, nil, tcp.err + return balancer.PickResult{}, tcp.err } - return tcp.sc, nil, nil + return balancer.PickResult{SubConn: tcp.sc}, nil } // Create XDS balancer, and update sub-balancer before handling eds responses. @@ -415,14 +422,19 @@ func TestEDS_UpdateSubBalancerName(t *testing.T) { edsb.HandleChildPolicy("test-const-balancer", nil) // Two localities, each with one backend. - clab1 := newClusterLoadAssignmentBuilder(testClusterNames[0], nil) - clab1.addLocality(testSubZones[0], 1, testEndpointAddrs[:1]) - clab1.addLocality(testSubZones[1], 1, testEndpointAddrs[1:2]) - edsb.HandleEDSResponse(clab1.build()) + clab1 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab1.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:1], nil) + clab1.AddLocality(testSubZones[1], 1, 0, testEndpointAddrs[1:2], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab1.Build())) + + for i := 0; i < 2; i++ { + sc := <-cc.newSubConnCh + edsb.HandleSubConnStateChange(sc, connectivity.Ready) + } p0 := <-cc.newPickerCh for i := 0; i < 5; i++ { - _, _, err := p0.Pick(context.Background(), balancer.PickOptions{}) + _, err := p0.Pick(balancer.PickInfo{}) if !reflect.DeepEqual(err, errTestConstPicker) { t.Fatalf("picker.Pick, got err %q, want err %q", err, errTestConstPicker) } @@ -431,6 +443,10 @@ func TestEDS_UpdateSubBalancerName(t *testing.T) { t.Logf("update sub-balancer to round-robin") edsb.HandleChildPolicy(roundrobin.Name, nil) + for i := 0; i < 2; i++ { + <-cc.removeSubConnCh + } + sc1 := <-cc.newSubConnCh edsb.HandleSubConnStateChange(sc1, connectivity.Connecting) edsb.HandleSubConnStateChange(sc1, connectivity.Ready) @@ -441,10 +457,7 @@ func TestEDS_UpdateSubBalancerName(t *testing.T) { // Test roundrobin with two subconns. p1 := <-cc.newPickerCh want := []balancer.SubConn{sc1, sc2} - if err := isRoundRobin(want, func() balancer.SubConn { - sc, _, _ := p1.Pick(context.Background(), balancer.PickOptions{}) - return sc - }); err != nil { + if err := isRoundRobin(want, subConnFromPicker(p1)); err != nil { t.Fatalf("want %v, got %v", want, err) } @@ -459,9 +472,14 @@ func TestEDS_UpdateSubBalancerName(t *testing.T) { edsb.HandleSubConnStateChange(scToRemove, connectivity.Shutdown) } + for i := 0; i < 2; i++ { + sc := <-cc.newSubConnCh + edsb.HandleSubConnStateChange(sc, connectivity.Ready) + } + p2 := <-cc.newPickerCh for i := 0; i < 5; i++ { - _, _, err := p2.Pick(context.Background(), balancer.PickOptions{}) + _, err := p2.Pick(balancer.PickInfo{}) if !reflect.DeepEqual(err, errTestConstPicker) { t.Fatalf("picker.Pick, got err %q, want err %q", err, errTestConstPicker) } @@ -470,6 +488,10 @@ func TestEDS_UpdateSubBalancerName(t *testing.T) { t.Logf("update sub-balancer to round-robin") edsb.HandleChildPolicy(roundrobin.Name, nil) + for i := 0; i < 2; i++ { + <-cc.removeSubConnCh + } + sc3 := <-cc.newSubConnCh edsb.HandleSubConnStateChange(sc3, connectivity.Connecting) edsb.HandleSubConnStateChange(sc3, connectivity.Ready) @@ -479,10 +501,7 @@ func TestEDS_UpdateSubBalancerName(t *testing.T) { p3 := <-cc.newPickerCh want = []balancer.SubConn{sc3, sc4} - if err := isRoundRobin(want, func() balancer.SubConn { - sc, _, _ := p3.Pick(context.Background(), balancer.PickOptions{}) - return sc - }); err != nil { + if err := isRoundRobin(want, subConnFromPicker(p3)); err != nil { t.Fatalf("want %v, got %v", want, err) } } @@ -539,7 +558,7 @@ func TestDropPicker(t *testing.T) { } for i := 0; i < pickCount; i++ { - _, _, err := p.Pick(context.Background(), balancer.PickOptions{}) + _, err := p.Pick(balancer.PickInfo{}) if err == nil { scCount++ } @@ -561,17 +580,21 @@ func TestEDS_LoadReport(t *testing.T) { backendToBalancerID := make(map[balancer.SubConn]internal.Locality) // Two localities, each with one backend. - clab1 := newClusterLoadAssignmentBuilder(testClusterNames[0], nil) - clab1.addLocality(testSubZones[0], 1, testEndpointAddrs[:1]) - clab1.addLocality(testSubZones[1], 1, testEndpointAddrs[1:2]) - edsb.HandleEDSResponse(clab1.build()) - + clab1 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab1.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:1], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab1.Build())) sc1 := <-cc.newSubConnCh edsb.HandleSubConnStateChange(sc1, connectivity.Connecting) edsb.HandleSubConnStateChange(sc1, connectivity.Ready) backendToBalancerID[sc1] = internal.Locality{ SubZone: testSubZones[0], } + + // Add the second locality later to make sure sc2 belongs to the second + // locality. Otherwise the test is flaky because of a map is used in EDS to + // keep localities. + clab1.AddLocality(testSubZones[1], 1, 0, testEndpointAddrs[1:2], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab1.Build())) sc2 := <-cc.newSubConnCh edsb.HandleSubConnStateChange(sc2, connectivity.Connecting) edsb.HandleSubConnStateChange(sc2, connectivity.Ready) @@ -587,12 +610,12 @@ func TestEDS_LoadReport(t *testing.T) { ) for i := 0; i < 10; i++ { - sc, done, _ := p1.Pick(context.Background(), balancer.PickOptions{}) - locality := backendToBalancerID[sc] + scst, _ := p1.Pick(balancer.PickInfo{}) + locality := backendToBalancerID[scst.SubConn] wantStart = append(wantStart, locality) - if done != nil && sc != sc1 { - done(balancer.DoneInfo{}) - wantEnd = append(wantEnd, backendToBalancerID[sc]) + if scst.Done != nil && scst.SubConn != sc1 { + scst.Done(balancer.DoneInfo{}) + wantEnd = append(wantEnd, backendToBalancerID[scst.SubConn]) } } diff --git a/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/priority.go b/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/priority.go new file mode 100644 index 00000000000..0ae465527cf --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/priority.go @@ -0,0 +1,325 @@ +/* + * + * 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. + */ + +package edsbalancer + +import ( + "time" + + "google.golang.org/grpc/balancer" + "google.golang.org/grpc/balancer/base" + "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/grpclog" +) + +// handlePriorityChange handles priority after EDS adds/removes a +// priority. +// +// - If all priorities were deleted, unset priorityInUse, and set parent +// ClientConn to TransientFailure +// - If priorityInUse wasn't set, this is either the first EDS resp, or the +// previous EDS resp deleted everything. Set priorityInUse to 0, and start 0. +// - If priorityInUse was deleted, send the picker from the new lowest priority +// to parent ClientConn, and set priorityInUse to the new lowest. +// - If priorityInUse has a non-Ready state, and also there's a priority lower +// than priorityInUse (which means a lower priority was added), set the next +// priority as new priorityInUse, and start the bg. +func (xdsB *EDSBalancer) handlePriorityChange() { + xdsB.priorityMu.Lock() + defer xdsB.priorityMu.Unlock() + + // Everything was removed by EDS. + if !xdsB.priorityLowest.isSet() { + xdsB.priorityInUse = newPriorityTypeUnset() + xdsB.cc.UpdateState(balancer.State{ConnectivityState: connectivity.TransientFailure, Picker: base.NewErrPickerV2(balancer.ErrTransientFailure)}) + return + } + + // priorityInUse wasn't set, use 0. + if !xdsB.priorityInUse.isSet() { + xdsB.startPriority(newPriorityType(0)) + return + } + + // priorityInUse was deleted, use the new lowest. + if _, ok := xdsB.priorityToLocalities[xdsB.priorityInUse]; !ok { + xdsB.priorityInUse = xdsB.priorityLowest + if s, ok := xdsB.priorityToState[xdsB.priorityLowest]; ok { + xdsB.cc.UpdateState(*s) + } else { + // If state for priorityLowest is not found, this means priorityLowest was + // started, but never sent any update. The init timer fired and + // triggered the next priority. The old_priorityInUse (that was just + // deleted EDS) was picked later. + // + // We don't have an old state to send to parent, but we also don't + // want parent to keep using picker from old_priorityInUse. Send an + // update to trigger block picks until a new picker is ready. + xdsB.cc.UpdateState(balancer.State{ConnectivityState: connectivity.Connecting, Picker: base.NewErrPickerV2(balancer.ErrNoSubConnAvailable)}) + } + return + } + + // priorityInUse is not ready, look for next priority, and use if found. + if s, ok := xdsB.priorityToState[xdsB.priorityInUse]; ok && s.ConnectivityState != connectivity.Ready { + pNext := xdsB.priorityInUse.nextLower() + if _, ok := xdsB.priorityToLocalities[pNext]; ok { + xdsB.startPriority(pNext) + } + } +} + +// startPriority sets priorityInUse to p, and starts the balancer group for p. +// It also starts a timer to fall to next priority after timeout. +// +// Caller must hold priorityMu, priority must exist, and xdsB.priorityInUse must +// be non-nil. +func (xdsB *EDSBalancer) startPriority(priority priorityType) { + xdsB.priorityInUse = priority + p := xdsB.priorityToLocalities[priority] + // NOTE: this will eventually send addresses to sub-balancers. If the + // sub-balancer tries to update picker, it will result in a deadlock on + // priorityMu. But it's not an expected behavior for the balancer to + // update picker when handling addresses. + p.bg.start() + // startPriority can be called when + // 1. first EDS resp, start p0 + // 2. a high priority goes Failure, start next + // 3. a high priority init timeout, start next + // + // In all the cases, the existing init timer is either closed, also already + // expired. There's no need to close the old timer. + xdsB.priorityInitTimer = time.AfterFunc(defaultPriorityInitTimeout, func() { + xdsB.priorityMu.Lock() + defer xdsB.priorityMu.Unlock() + if !xdsB.priorityInUse.equal(priority) { + return + } + xdsB.priorityInitTimer = nil + pNext := priority.nextLower() + if _, ok := xdsB.priorityToLocalities[pNext]; ok { + xdsB.startPriority(pNext) + } + }) +} + +// handlePriorityWithNewState start/close priorities based on the connectivity +// state. It returns whether the state should be forwarded to parent ClientConn. +func (xdsB *EDSBalancer) handlePriorityWithNewState(priority priorityType, s balancer.State) bool { + xdsB.priorityMu.Lock() + defer xdsB.priorityMu.Unlock() + + if !xdsB.priorityInUse.isSet() { + grpclog.Infof("eds: received picker update when no priority is in use (EDS returned an empty list)") + return false + } + + if xdsB.priorityInUse.higherThan(priority) { + // Lower priorities should all be closed, this is an unexpected update. + grpclog.Infof("eds: received picker update from priority lower then priorityInUse") + return false + } + + bState, ok := xdsB.priorityToState[priority] + if !ok { + bState = &balancer.State{} + xdsB.priorityToState[priority] = bState + } + oldState := bState.ConnectivityState + *bState = s + + switch s.ConnectivityState { + case connectivity.Ready: + return xdsB.handlePriorityWithNewStateReady(priority) + case connectivity.TransientFailure: + return xdsB.handlePriorityWithNewStateTransientFailure(priority) + case connectivity.Connecting: + return xdsB.handlePriorityWithNewStateConnecting(priority, oldState) + default: + // New state is Idle, should never happen. Don't forward. + return false + } +} + +// handlePriorityWithNewStateReady handles state Ready and decides whether to +// forward update or not. +// +// An update with state Ready: +// - If it's from higher priority: +// - Forward the update +// - Set the priority as priorityInUse +// - Close all priorities lower than this one +// - If it's from priorityInUse: +// - Forward and do nothing else +// +// Caller must make sure priorityInUse is not higher than priority. +// +// Caller must hold priorityMu. +func (xdsB *EDSBalancer) handlePriorityWithNewStateReady(priority priorityType) bool { + // If one priority higher or equal to priorityInUse goes Ready, stop the + // init timer. If update is from higher than priorityInUse, + // priorityInUse will be closed, and the init timer will become useless. + if timer := xdsB.priorityInitTimer; timer != nil { + timer.Stop() + xdsB.priorityInitTimer = nil + } + + if xdsB.priorityInUse.lowerThan(priority) { + xdsB.priorityInUse = priority + for i := priority.nextLower(); !i.lowerThan(xdsB.priorityLowest); i = i.nextLower() { + xdsB.priorityToLocalities[i].bg.close() + } + return true + } + return true +} + +// handlePriorityWithNewStateTransientFailure handles state TransientFailure and +// decides whether to forward update or not. +// +// An update with state Failure: +// - If it's from a higher priority: +// - Do not forward, and do nothing +// - If it's from priorityInUse: +// - If there's no lower: +// - Forward and do nothing else +// - If there's a lower priority: +// - Forward +// - Set lower as priorityInUse +// - Start lower +// +// Caller must make sure priorityInUse is not higher than priority. +// +// Caller must hold priorityMu. +func (xdsB *EDSBalancer) handlePriorityWithNewStateTransientFailure(priority priorityType) bool { + if xdsB.priorityInUse.lowerThan(priority) { + return false + } + // priorityInUse sends a failure. Stop its init timer. + if timer := xdsB.priorityInitTimer; timer != nil { + timer.Stop() + xdsB.priorityInitTimer = nil + } + pNext := priority.nextLower() + if _, okNext := xdsB.priorityToLocalities[pNext]; !okNext { + return true + } + xdsB.startPriority(pNext) + return true +} + +// handlePriorityWithNewStateConnecting handles state Connecting and decides +// whether to forward update or not. +// +// An update with state Connecting: +// - If it's from a higher priority +// - Do nothing +// - If it's from priorityInUse, the behavior depends on previous state. +// +// When new state is Connecting, the behavior depends on previous state. If the +// previous state was Ready, this is a transition out from Ready to Connecting. +// Assuming there are multiple backends in the same priority, this mean we are +// in a bad situation and we should failover to the next priority (Side note: +// the current connectivity state aggregating algorhtim (e.g. round-robin) is +// not handling this right, because if many backends all go from Ready to +// Connecting, the overall situation is more like TransientFailure, not +// Connecting). +// +// If the previous state was Idle, we don't do anything special with failure, +// and simply forward the update. The init timer should be in process, will +// handle failover if it timeouts. If the previous state was TransientFailure, +// we do not forward, because the lower priority is in use. +// +// Caller must make sure priorityInUse is not higher than priority. +// +// Caller must hold priorityMu. +func (xdsB *EDSBalancer) handlePriorityWithNewStateConnecting(priority priorityType, oldState connectivity.State) bool { + if xdsB.priorityInUse.lowerThan(priority) { + return false + } + + switch oldState { + case connectivity.Ready: + pNext := priority.nextLower() + if _, okNext := xdsB.priorityToLocalities[pNext]; !okNext { + return true + } + xdsB.startPriority(pNext) + return true + case connectivity.Idle: + return true + case connectivity.TransientFailure: + return false + default: + // Old state is Connecting or Shutdown. Don't forward. + return false + } +} + +// priorityType represents the priority from EDS response. +// +// 0 is the highest priority. The bigger the number, the lower the priority. +type priorityType struct { + set bool + p uint32 +} + +func newPriorityType(p uint32) priorityType { + return priorityType{ + set: true, + p: p, + } +} + +func newPriorityTypeUnset() priorityType { + return priorityType{} +} + +func (p priorityType) isSet() bool { + return p.set +} + +func (p priorityType) equal(p2 priorityType) bool { + if !p.isSet() || !p2.isSet() { + panic("priority unset") + } + return p == p2 +} + +func (p priorityType) higherThan(p2 priorityType) bool { + if !p.isSet() || !p2.isSet() { + panic("priority unset") + } + return p.p < p2.p +} + +func (p priorityType) lowerThan(p2 priorityType) bool { + if !p.isSet() || !p2.isSet() { + panic("priority unset") + } + return p.p > p2.p +} + +func (p priorityType) nextLower() priorityType { + if !p.isSet() { + panic("priority unset") + } + return priorityType{ + set: true, + p: p.p + 1, + } +} diff --git a/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/priority_test.go b/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/priority_test.go new file mode 100644 index 00000000000..1279d3b16ce --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/balancer/edsbalancer/priority_test.go @@ -0,0 +1,650 @@ +/* + * + * 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. + */ + +package edsbalancer + +import ( + "reflect" + "testing" + "time" + + "google.golang.org/grpc/balancer" + "google.golang.org/grpc/connectivity" + xdsclient "google.golang.org/grpc/xds/internal/client" +) + +// When a high priority is ready, adding/removing lower locality doesn't cause +// changes. +// +// Init 0 and 1; 0 is up, use 0; add 2, use 0; remove 2, use 0. +func TestEDSPriority_HighPriorityReady(t *testing.T) { + cc := newTestClientConn(t) + edsb := NewXDSBalancer(cc, nil) + + // Two localities, with priorities [0, 1], each with one backend. + clab1 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab1.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:1], nil) + clab1.AddLocality(testSubZones[1], 1, 1, testEndpointAddrs[1:2], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab1.Build())) + + addrs1 := <-cc.newSubConnAddrsCh + if got, want := addrs1[0].Addr, testEndpointAddrs[0]; got != want { + t.Fatalf("sc is created with addr %v, want %v", got, want) + } + sc1 := <-cc.newSubConnCh + + // p0 is ready. + edsb.HandleSubConnStateChange(sc1, connectivity.Connecting) + edsb.HandleSubConnStateChange(sc1, connectivity.Ready) + + // Test roundrobin with only p0 subconns. + p1 := <-cc.newPickerCh + want := []balancer.SubConn{sc1} + if err := isRoundRobin(want, subConnFromPicker(p1)); err != nil { + // t.Fatalf("want %v, got %v", want, err) + t.Fatalf("want %v, got %v", want, err) + } + + // Add p2, it shouldn't cause any udpates. + clab2 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab2.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:1], nil) + clab2.AddLocality(testSubZones[1], 1, 1, testEndpointAddrs[1:2], nil) + clab2.AddLocality(testSubZones[2], 1, 2, testEndpointAddrs[2:3], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab2.Build())) + + select { + case <-cc.newPickerCh: + t.Fatalf("got unexpected new picker") + case <-cc.newSubConnCh: + t.Fatalf("got unexpected new SubConn") + case <-cc.removeSubConnCh: + t.Fatalf("got unexpected remove SubConn") + case <-time.After(time.Millisecond * 100): + } + + // Remove p2, no updates. + clab3 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab3.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:1], nil) + clab3.AddLocality(testSubZones[1], 1, 1, testEndpointAddrs[1:2], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab3.Build())) + + select { + case <-cc.newPickerCh: + t.Fatalf("got unexpected new picker") + case <-cc.newSubConnCh: + t.Fatalf("got unexpected new SubConn") + case <-cc.removeSubConnCh: + t.Fatalf("got unexpected remove SubConn") + case <-time.After(time.Millisecond * 100): + } +} + +// Lower priority is used when higher priority is not ready. +// +// Init 0 and 1; 0 is up, use 0; 0 is down, 1 is up, use 1; add 2, use 1; 1 is +// down, use 2; remove 2, use 1. +func TestEDSPriority_SwitchPriority(t *testing.T) { + cc := newTestClientConn(t) + edsb := NewXDSBalancer(cc, nil) + + // Two localities, with priorities [0, 1], each with one backend. + clab1 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab1.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:1], nil) + clab1.AddLocality(testSubZones[1], 1, 1, testEndpointAddrs[1:2], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab1.Build())) + + addrs0 := <-cc.newSubConnAddrsCh + if got, want := addrs0[0].Addr, testEndpointAddrs[0]; got != want { + t.Fatalf("sc is created with addr %v, want %v", got, want) + } + sc0 := <-cc.newSubConnCh + + // p0 is ready. + edsb.HandleSubConnStateChange(sc0, connectivity.Connecting) + edsb.HandleSubConnStateChange(sc0, connectivity.Ready) + + // Test roundrobin with only p0 subconns. + p0 := <-cc.newPickerCh + want := []balancer.SubConn{sc0} + if err := isRoundRobin(want, subConnFromPicker(p0)); err != nil { + // t.Fatalf("want %v, got %v", want, err) + t.Fatalf("want %v, got %v", want, err) + } + + // Turn down 0, 1 is used. + edsb.HandleSubConnStateChange(sc0, connectivity.TransientFailure) + addrs1 := <-cc.newSubConnAddrsCh + if got, want := addrs1[0].Addr, testEndpointAddrs[1]; got != want { + t.Fatalf("sc is created with addr %v, want %v", got, want) + } + sc1 := <-cc.newSubConnCh + edsb.HandleSubConnStateChange(sc1, connectivity.Connecting) + edsb.HandleSubConnStateChange(sc1, connectivity.Ready) + + // Test pick with 1. + p1 := <-cc.newPickerCh + for i := 0; i < 5; i++ { + gotSCSt, _ := p1.Pick(balancer.PickInfo{}) + if !reflect.DeepEqual(gotSCSt.SubConn, sc1) { + t.Fatalf("picker.Pick, got %v, want SubConn=%v", gotSCSt, sc1) + } + } + + // Add p2, it shouldn't cause any udpates. + clab2 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab2.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:1], nil) + clab2.AddLocality(testSubZones[1], 1, 1, testEndpointAddrs[1:2], nil) + clab2.AddLocality(testSubZones[2], 1, 2, testEndpointAddrs[2:3], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab2.Build())) + + select { + case <-cc.newPickerCh: + t.Fatalf("got unexpected new picker") + case <-cc.newSubConnCh: + t.Fatalf("got unexpected new SubConn") + case <-cc.removeSubConnCh: + t.Fatalf("got unexpected remove SubConn") + case <-time.After(time.Millisecond * 100): + } + + // Turn down 1, use 2 + edsb.HandleSubConnStateChange(sc1, connectivity.TransientFailure) + addrs2 := <-cc.newSubConnAddrsCh + if got, want := addrs2[0].Addr, testEndpointAddrs[2]; got != want { + t.Fatalf("sc is created with addr %v, want %v", got, want) + } + sc2 := <-cc.newSubConnCh + edsb.HandleSubConnStateChange(sc2, connectivity.Connecting) + edsb.HandleSubConnStateChange(sc2, connectivity.Ready) + + // Test pick with 2. + p2 := <-cc.newPickerCh + for i := 0; i < 5; i++ { + gotSCSt, _ := p2.Pick(balancer.PickInfo{}) + if !reflect.DeepEqual(gotSCSt.SubConn, sc2) { + t.Fatalf("picker.Pick, got %v, want SubConn=%v", gotSCSt, sc2) + } + } + + // Remove 2, use 1. + clab3 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab3.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:1], nil) + clab3.AddLocality(testSubZones[1], 1, 1, testEndpointAddrs[1:2], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab3.Build())) + + // p2 SubConns are removed. + scToRemove := <-cc.removeSubConnCh + if !reflect.DeepEqual(scToRemove, sc2) { + t.Fatalf("RemoveSubConn, want %v, got %v", sc2, scToRemove) + } + + // Should get an update with 1's old picker, to override 2's old picker. + p3 := <-cc.newPickerCh + for i := 0; i < 5; i++ { + if _, err := p3.Pick(balancer.PickInfo{}); err != balancer.ErrTransientFailure { + t.Fatalf("want pick error %v, got %v", balancer.ErrTransientFailure, err) + } + } +} + +// Add a lower priority while the higher priority is down. +// +// Init 0 and 1; 0 and 1 both down; add 2, use 2. +func TestEDSPriority_HigherDownWhileAddingLower(t *testing.T) { + cc := newTestClientConn(t) + edsb := NewXDSBalancer(cc, nil) + + // Two localities, with different priorities, each with one backend. + clab1 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab1.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:1], nil) + clab1.AddLocality(testSubZones[1], 1, 1, testEndpointAddrs[1:2], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab1.Build())) + + addrs0 := <-cc.newSubConnAddrsCh + if got, want := addrs0[0].Addr, testEndpointAddrs[0]; got != want { + t.Fatalf("sc is created with addr %v, want %v", got, want) + } + sc0 := <-cc.newSubConnCh + + // Turn down 0, 1 is used. + edsb.HandleSubConnStateChange(sc0, connectivity.TransientFailure) + addrs1 := <-cc.newSubConnAddrsCh + if got, want := addrs1[0].Addr, testEndpointAddrs[1]; got != want { + t.Fatalf("sc is created with addr %v, want %v", got, want) + } + sc1 := <-cc.newSubConnCh + // Turn down 1, pick should error. + edsb.HandleSubConnStateChange(sc1, connectivity.TransientFailure) + + // Test pick failure. + pFail := <-cc.newPickerCh + for i := 0; i < 5; i++ { + if _, err := pFail.Pick(balancer.PickInfo{}); err != balancer.ErrTransientFailure { + t.Fatalf("want pick error %v, got %v", balancer.ErrTransientFailure, err) + } + } + + // Add p2, it should create a new SubConn. + clab2 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab2.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:1], nil) + clab2.AddLocality(testSubZones[1], 1, 1, testEndpointAddrs[1:2], nil) + clab2.AddLocality(testSubZones[2], 1, 2, testEndpointAddrs[2:3], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab2.Build())) + + addrs2 := <-cc.newSubConnAddrsCh + if got, want := addrs2[0].Addr, testEndpointAddrs[2]; got != want { + t.Fatalf("sc is created with addr %v, want %v", got, want) + } + sc2 := <-cc.newSubConnCh + edsb.HandleSubConnStateChange(sc2, connectivity.Connecting) + edsb.HandleSubConnStateChange(sc2, connectivity.Ready) + + // Test pick with 2. + p2 := <-cc.newPickerCh + for i := 0; i < 5; i++ { + gotSCSt, _ := p2.Pick(balancer.PickInfo{}) + if !reflect.DeepEqual(gotSCSt.SubConn, sc2) { + t.Fatalf("picker.Pick, got %v, want SubConn=%v", gotSCSt, sc2) + } + } +} + +// When a higher priority becomes available, all lower priorities are closed. +// +// Init 0,1,2; 0 and 1 down, use 2; 0 up, close 1 and 2. +func TestEDSPriority_HigherReadyCloseAllLower(t *testing.T) { + defer time.Sleep(10 * time.Millisecond) + + cc := newTestClientConn(t) + edsb := NewXDSBalancer(cc, nil) + + // Two localities, with priorities [0,1,2], each with one backend. + clab1 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab1.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:1], nil) + clab1.AddLocality(testSubZones[1], 1, 1, testEndpointAddrs[1:2], nil) + clab1.AddLocality(testSubZones[2], 1, 2, testEndpointAddrs[2:3], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab1.Build())) + + addrs0 := <-cc.newSubConnAddrsCh + if got, want := addrs0[0].Addr, testEndpointAddrs[0]; got != want { + t.Fatalf("sc is created with addr %v, want %v", got, want) + } + sc0 := <-cc.newSubConnCh + + // Turn down 0, 1 is used. + edsb.HandleSubConnStateChange(sc0, connectivity.TransientFailure) + addrs1 := <-cc.newSubConnAddrsCh + if got, want := addrs1[0].Addr, testEndpointAddrs[1]; got != want { + t.Fatalf("sc is created with addr %v, want %v", got, want) + } + sc1 := <-cc.newSubConnCh + // Turn down 1, 2 is used. + edsb.HandleSubConnStateChange(sc1, connectivity.TransientFailure) + addrs2 := <-cc.newSubConnAddrsCh + if got, want := addrs2[0].Addr, testEndpointAddrs[2]; got != want { + t.Fatalf("sc is created with addr %v, want %v", got, want) + } + sc2 := <-cc.newSubConnCh + edsb.HandleSubConnStateChange(sc2, connectivity.Connecting) + edsb.HandleSubConnStateChange(sc2, connectivity.Ready) + + // Test pick with 2. + p2 := <-cc.newPickerCh + for i := 0; i < 5; i++ { + gotSCSt, _ := p2.Pick(balancer.PickInfo{}) + if !reflect.DeepEqual(gotSCSt.SubConn, sc2) { + t.Fatalf("picker.Pick, got %v, want SubConn=%v", gotSCSt, sc2) + } + } + + // When 0 becomes ready, 0 should be used, 1 and 2 should all be closed. + edsb.HandleSubConnStateChange(sc0, connectivity.Ready) + + // sc1 and sc2 should be removed. + // + // With localities caching, the lower priorities are closed after a timeout, + // in goroutines. The order is no longer guaranteed. + scToRemove := []balancer.SubConn{<-cc.removeSubConnCh, <-cc.removeSubConnCh} + if !(reflect.DeepEqual(scToRemove[0], sc1) && reflect.DeepEqual(scToRemove[1], sc2)) && + !(reflect.DeepEqual(scToRemove[0], sc2) && reflect.DeepEqual(scToRemove[1], sc1)) { + t.Errorf("RemoveSubConn, want [%v, %v], got %v", sc1, sc2, scToRemove) + } + + // Test pick with 0. + p0 := <-cc.newPickerCh + for i := 0; i < 5; i++ { + gotSCSt, _ := p0.Pick(balancer.PickInfo{}) + if !reflect.DeepEqual(gotSCSt.SubConn, sc0) { + t.Fatalf("picker.Pick, got %v, want SubConn=%v", gotSCSt, sc0) + } + } +} + +// At init, start the next lower priority after timeout if the higher priority +// doesn't get ready. +// +// Init 0,1; 0 is not ready (in connecting), after timeout, use 1. +func TestEDSPriority_InitTimeout(t *testing.T) { + const testPriorityInitTimeout = time.Second + defer func() func() { + old := defaultPriorityInitTimeout + defaultPriorityInitTimeout = testPriorityInitTimeout + return func() { + defaultPriorityInitTimeout = old + } + }()() + + cc := newTestClientConn(t) + edsb := NewXDSBalancer(cc, nil) + + // Two localities, with different priorities, each with one backend. + clab1 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab1.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:1], nil) + clab1.AddLocality(testSubZones[1], 1, 1, testEndpointAddrs[1:2], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab1.Build())) + + addrs0 := <-cc.newSubConnAddrsCh + if got, want := addrs0[0].Addr, testEndpointAddrs[0]; got != want { + t.Fatalf("sc is created with addr %v, want %v", got, want) + } + sc0 := <-cc.newSubConnCh + + // Keep 0 in connecting, 1 will be used after init timeout. + edsb.HandleSubConnStateChange(sc0, connectivity.Connecting) + + // Make sure new SubConn is created before timeout. + select { + case <-time.After(testPriorityInitTimeout * 3 / 4): + case <-cc.newSubConnAddrsCh: + t.Fatalf("Got a new SubConn too early (Within timeout). Expect a new SubConn only after timeout") + } + + addrs1 := <-cc.newSubConnAddrsCh + if got, want := addrs1[0].Addr, testEndpointAddrs[1]; got != want { + t.Fatalf("sc is created with addr %v, want %v", got, want) + } + sc1 := <-cc.newSubConnCh + + edsb.HandleSubConnStateChange(sc1, connectivity.Connecting) + edsb.HandleSubConnStateChange(sc1, connectivity.Ready) + + // Test pick with 1. + p1 := <-cc.newPickerCh + for i := 0; i < 5; i++ { + gotSCSt, _ := p1.Pick(balancer.PickInfo{}) + if !reflect.DeepEqual(gotSCSt.SubConn, sc1) { + t.Fatalf("picker.Pick, got %v, want SubConn=%v", gotSCSt, sc1) + } + } +} + +// Add localities to existing priorities. +// +// - start with 2 locality with p0 and p1 +// - add localities to existing p0 and p1 +func TestEDSPriority_MultipleLocalities(t *testing.T) { + cc := newTestClientConn(t) + edsb := NewXDSBalancer(cc, nil) + + // Two localities, with different priorities, each with one backend. + clab0 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab0.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:1], nil) + clab0.AddLocality(testSubZones[1], 1, 1, testEndpointAddrs[1:2], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab0.Build())) + + addrs0 := <-cc.newSubConnAddrsCh + if got, want := addrs0[0].Addr, testEndpointAddrs[0]; got != want { + t.Fatalf("sc is created with addr %v, want %v", got, want) + } + sc0 := <-cc.newSubConnCh + edsb.HandleSubConnStateChange(sc0, connectivity.Connecting) + edsb.HandleSubConnStateChange(sc0, connectivity.Ready) + + // Test roundrobin with only p0 subconns. + p0 := <-cc.newPickerCh + want := []balancer.SubConn{sc0} + if err := isRoundRobin(want, subConnFromPicker(p0)); err != nil { + // t.Fatalf("want %v, got %v", want, err) + t.Fatalf("want %v, got %v", want, err) + } + + // Turn down p0 subconns, p1 subconns will be created. + edsb.HandleSubConnStateChange(sc0, connectivity.TransientFailure) + + addrs1 := <-cc.newSubConnAddrsCh + if got, want := addrs1[0].Addr, testEndpointAddrs[1]; got != want { + t.Fatalf("sc is created with addr %v, want %v", got, want) + } + sc1 := <-cc.newSubConnCh + edsb.HandleSubConnStateChange(sc1, connectivity.Connecting) + edsb.HandleSubConnStateChange(sc1, connectivity.Ready) + + // Test roundrobin with only p1 subconns. + p1 := <-cc.newPickerCh + want = []balancer.SubConn{sc1} + if err := isRoundRobin(want, subConnFromPicker(p1)); err != nil { + // t.Fatalf("want %v, got %v", want, err) + t.Fatalf("want %v, got %v", want, err) + } + + // Reconnect p0 subconns, p1 subconn will be closed. + edsb.HandleSubConnStateChange(sc0, connectivity.Ready) + + scToRemove := <-cc.removeSubConnCh + if !reflect.DeepEqual(scToRemove, sc1) { + t.Fatalf("RemoveSubConn, want %v, got %v", sc1, scToRemove) + } + + // Test roundrobin with only p0 subconns. + p2 := <-cc.newPickerCh + want = []balancer.SubConn{sc0} + if err := isRoundRobin(want, subConnFromPicker(p2)); err != nil { + t.Fatalf("want %v, got %v", want, err) + } + + // Add two localities, with two priorities, with one backend. + clab1 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab1.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:1], nil) + clab1.AddLocality(testSubZones[1], 1, 1, testEndpointAddrs[1:2], nil) + clab1.AddLocality(testSubZones[2], 1, 0, testEndpointAddrs[2:3], nil) + clab1.AddLocality(testSubZones[3], 1, 1, testEndpointAddrs[3:4], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab1.Build())) + + addrs2 := <-cc.newSubConnAddrsCh + if got, want := addrs2[0].Addr, testEndpointAddrs[2]; got != want { + t.Fatalf("sc is created with addr %v, want %v", got, want) + } + sc2 := <-cc.newSubConnCh + edsb.HandleSubConnStateChange(sc2, connectivity.Connecting) + edsb.HandleSubConnStateChange(sc2, connectivity.Ready) + + // Test roundrobin with only two p0 subconns. + p3 := <-cc.newPickerCh + want = []balancer.SubConn{sc0, sc2} + if err := isRoundRobin(want, subConnFromPicker(p3)); err != nil { + t.Fatalf("want %v, got %v", want, err) + } + + // Turn down p0 subconns, p1 subconns will be created. + edsb.HandleSubConnStateChange(sc0, connectivity.TransientFailure) + edsb.HandleSubConnStateChange(sc2, connectivity.TransientFailure) + + sc3 := <-cc.newSubConnCh + edsb.HandleSubConnStateChange(sc3, connectivity.Connecting) + edsb.HandleSubConnStateChange(sc3, connectivity.Ready) + sc4 := <-cc.newSubConnCh + edsb.HandleSubConnStateChange(sc4, connectivity.Connecting) + edsb.HandleSubConnStateChange(sc4, connectivity.Ready) + + // Test roundrobin with only p1 subconns. + p4 := <-cc.newPickerCh + want = []balancer.SubConn{sc3, sc4} + if err := isRoundRobin(want, subConnFromPicker(p4)); err != nil { + t.Fatalf("want %v, got %v", want, err) + } +} + +// EDS removes all localities, and re-adds them. +func TestEDSPriority_RemovesAllLocalities(t *testing.T) { + const testPriorityInitTimeout = time.Second + defer func() func() { + old := defaultPriorityInitTimeout + defaultPriorityInitTimeout = testPriorityInitTimeout + return func() { + defaultPriorityInitTimeout = old + } + }()() + + cc := newTestClientConn(t) + edsb := NewXDSBalancer(cc, nil) + + // Two localities, with different priorities, each with one backend. + clab0 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab0.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:1], nil) + clab0.AddLocality(testSubZones[1], 1, 1, testEndpointAddrs[1:2], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab0.Build())) + + addrs0 := <-cc.newSubConnAddrsCh + if got, want := addrs0[0].Addr, testEndpointAddrs[0]; got != want { + t.Fatalf("sc is created with addr %v, want %v", got, want) + } + sc0 := <-cc.newSubConnCh + edsb.HandleSubConnStateChange(sc0, connectivity.Connecting) + edsb.HandleSubConnStateChange(sc0, connectivity.Ready) + + // Test roundrobin with only p0 subconns. + p0 := <-cc.newPickerCh + want := []balancer.SubConn{sc0} + if err := isRoundRobin(want, subConnFromPicker(p0)); err != nil { + t.Fatalf("want %v, got %v", want, err) + } + + // Remove all priorities. + clab1 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab1.Build())) + + // p0 subconn should be removed. + scToRemove := <-cc.removeSubConnCh + if !reflect.DeepEqual(scToRemove, sc0) { + t.Fatalf("RemoveSubConn, want %v, got %v", sc0, scToRemove) + } + + // Test pick return TransientFailure. + pFail := <-cc.newPickerCh + for i := 0; i < 5; i++ { + if _, err := pFail.Pick(balancer.PickInfo{}); err != balancer.ErrTransientFailure { + t.Fatalf("want pick error %v, got %v", balancer.ErrTransientFailure, err) + } + } + + // Re-add two localities, with previous priorities, but different backends. + clab2 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab2.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[2:3], nil) + clab2.AddLocality(testSubZones[1], 1, 1, testEndpointAddrs[3:4], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab2.Build())) + + addrs01 := <-cc.newSubConnAddrsCh + if got, want := addrs01[0].Addr, testEndpointAddrs[2]; got != want { + t.Fatalf("sc is created with addr %v, want %v", got, want) + } + sc01 := <-cc.newSubConnCh + + // Don't send any update to p0, so to not override the old state of p0. + // Later, connect to p1 and then remove p1. This will fallback to p0, and + // will send p0's old picker if they are not correctly removed. + + // p1 will be used after priority init timeout. + addrs11 := <-cc.newSubConnAddrsCh + if got, want := addrs11[0].Addr, testEndpointAddrs[3]; got != want { + t.Fatalf("sc is created with addr %v, want %v", got, want) + } + sc11 := <-cc.newSubConnCh + edsb.HandleSubConnStateChange(sc11, connectivity.Connecting) + edsb.HandleSubConnStateChange(sc11, connectivity.Ready) + + // Test roundrobin with only p1 subconns. + p1 := <-cc.newPickerCh + want = []balancer.SubConn{sc11} + if err := isRoundRobin(want, subConnFromPicker(p1)); err != nil { + t.Fatalf("want %v, got %v", want, err) + } + + // Remove p1 from EDS, to fallback to p0. + clab3 := xdsclient.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) + clab3.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[2:3], nil) + edsb.HandleEDSResponse(xdsclient.ParseEDSRespProtoForTesting(clab3.Build())) + + // p1 subconn should be removed. + scToRemove1 := <-cc.removeSubConnCh + if !reflect.DeepEqual(scToRemove1, sc11) { + t.Fatalf("RemoveSubConn, want %v, got %v", sc11, scToRemove1) + } + + // Test pick return TransientFailure. + pFail1 := <-cc.newPickerCh + for i := 0; i < 5; i++ { + if scst, err := pFail1.Pick(balancer.PickInfo{}); err != balancer.ErrNoSubConnAvailable { + t.Fatalf("want pick error _, %v, got %v, _ ,%v", balancer.ErrTransientFailure, scst, err) + } + } + + // Send an ready update for the p0 sc that was received when re-adding + // localities to EDS. + edsb.HandleSubConnStateChange(sc01, connectivity.Connecting) + edsb.HandleSubConnStateChange(sc01, connectivity.Ready) + + // Test roundrobin with only p0 subconns. + p2 := <-cc.newPickerCh + want = []balancer.SubConn{sc01} + if err := isRoundRobin(want, subConnFromPicker(p2)); err != nil { + t.Fatalf("want %v, got %v", want, err) + } + + select { + case <-cc.newPickerCh: + t.Fatalf("got unexpected new picker") + case <-cc.newSubConnCh: + t.Fatalf("got unexpected new SubConn") + case <-cc.removeSubConnCh: + t.Fatalf("got unexpected remove SubConn") + case <-time.After(time.Millisecond * 100): + } +} + +func TestPriorityType(t *testing.T) { + p0 := newPriorityType(0) + p1 := newPriorityType(1) + p2 := newPriorityType(2) + + if !p0.higherThan(p1) || !p0.higherThan(p2) { + t.Errorf("want p0 to be higher than p1 and p2, got p0>p1: %v, p0>p2: %v", !p0.higherThan(p1), !p0.higherThan(p2)) + } + if !p1.lowerThan(p0) || !p1.higherThan(p2) { + t.Errorf("want p1 to be between p0 and p2, got p1p2: %v", !p1.lowerThan(p0), !p1.higherThan(p2)) + } + if !p2.lowerThan(p0) || !p2.lowerThan(p1) { + t.Errorf("want p2 to be lower than p0 and p1, got p2 1s", thirdRetry.Sub(secondRetry)) + if !proto.Equal(req2.Req, expectedReq2) { + t.Fatalf("got EDS request %T, expected: %T, diff: %s", req2.Req, expectedReq, cmp.Diff(req2.Req, expectedReq2, cmp.Comparer(proto.Equal))) } } diff --git a/vendor/google.golang.org/grpc/xds/internal/balancer/xds_client_wrapper.go b/vendor/google.golang.org/grpc/xds/internal/balancer/xds_client_wrapper.go new file mode 100644 index 00000000000..a40f7f54264 --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/balancer/xds_client_wrapper.go @@ -0,0 +1,305 @@ +/* + * + * 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. + * + */ + +package balancer + +import ( + "google.golang.org/grpc" + "google.golang.org/grpc/attributes" + "google.golang.org/grpc/balancer" + "google.golang.org/grpc/grpclog" + xdsinternal "google.golang.org/grpc/xds/internal" + "google.golang.org/grpc/xds/internal/balancer/lrs" + xdsclient "google.golang.org/grpc/xds/internal/client" + "google.golang.org/grpc/xds/internal/client/bootstrap" +) + +// xdsClientInterface contains only the xds_client methods needed by EDS +// balancer. It's defined so we can override xdsclientNew function in tests. +type xdsClientInterface interface { + WatchEDS(clusterName string, edsCb func(*xdsclient.EDSUpdate, error)) (cancel func()) + ReportLoad(server string, clusterName string, loadStore lrs.Store) (cancel func()) + Close() +} + +var ( + xdsclientNew = func(opts xdsclient.Options) (xdsClientInterface, error) { + return xdsclient.New(opts) + } + bootstrapConfigNew = bootstrap.NewConfig +) + +// xdsclientWrapper is responsible for getting the xds client from attributes or +// creating a new xds client, and start watching EDS. The given callbacks will +// be called with EDS updates or errors. +type xdsclientWrapper struct { + newEDSUpdate func(*xdsclient.EDSUpdate) error + loseContact func() + bbo balancer.BuildOptions + loadStore lrs.Store + + balancerName string + // xdsclient could come from attributes, or created with balancerName. + xdsclient xdsClientInterface + + // edsServiceName is the edsServiceName currently being watched, not + // necessary the edsServiceName from service config. + // + // If edsServiceName from service config is an empty, this will be user's + // dial target (because that's what we use to watch EDS). + // + // TODO: remove the empty string related behavior, when we switch to always + // do CDS. + edsServiceName string + cancelEDSWatch func() + loadReportServer *string // LRS is disabled if loadReporterServer is nil. + cancelLoadReport func() +} + +// newXDSClientWrapper creates an empty xds_client wrapper that does nothing. It +// can accept xds_client configs, to new/switch xds_client to use. +// +// The given callbacks won't be called until the underlying xds_client is +// working and sends updates. +func newXDSClientWrapper(newEDSUpdate func(*xdsclient.EDSUpdate) error, loseContact func(), bbo balancer.BuildOptions, loadStore lrs.Store) *xdsclientWrapper { + return &xdsclientWrapper{ + newEDSUpdate: newEDSUpdate, + loseContact: loseContact, + bbo: bbo, + loadStore: loadStore, + } +} + +// replaceXDSClient replaces xdsclient fields to the newClient if they are +// different. If xdsclient is replaced, the balancerName field will also be +// updated to newBalancerName. +// +// If the old xdsclient is replaced, and was created locally (not from +// attributes), it will be closed. +// +// It returns whether xdsclient is replaced. +func (c *xdsclientWrapper) replaceXDSClient(newClient xdsClientInterface, newBalancerName string) bool { + if c.xdsclient == newClient { + return false + } + oldClient := c.xdsclient + oldBalancerName := c.balancerName + c.xdsclient = newClient + c.balancerName = newBalancerName + if oldBalancerName != "" { + // OldBalancerName!="" means if the old client was not from attributes. + oldClient.Close() + } + return true +} + +// updateXDSClient sets xdsclient in wrapper to the correct one based on the +// attributes and service config. +// +// If client is found in attributes, it will be used, but we also need to decide +// whether to close the old client. +// - if old client was created locally (balancerName is not ""), close it and +// replace it +// - if old client was from previous attributes, only replace it, but don't +// close it +// +// If client is not found in attributes, will need to create a new one only if +// the balancerName (from bootstrap file or from service config) changed. +// - if balancer names are the same, do nothing, and return false +// - if balancer names are different, create new one, and return true +func (c *xdsclientWrapper) updateXDSClient(config *XDSConfig, attr *attributes.Attributes) bool { + if attr != nil { + if clientFromAttr, _ := attr.Value(xdsinternal.XDSClientID).(xdsClientInterface); clientFromAttr != nil { + // This will also clear balancerName, to indicate that client is + // from attributes. + return c.replaceXDSClient(clientFromAttr, "") + } + } + + clientConfig := bootstrapConfigNew() + if clientConfig.BalancerName == "" { + clientConfig.BalancerName = config.BalancerName + } + + if c.balancerName == clientConfig.BalancerName { + return false + } + + if clientConfig.Creds == nil { + // TODO: Once we start supporting a mechanism to register credential + // types, a failure to find the credential type mentioned in the + // bootstrap file should result in a failure, and not in using + // credentials from the parent channel (passed through the + // resolver.BuildOptions). + clientConfig.Creds = defaultDialCreds(clientConfig.BalancerName, c.bbo) + } + var dopts []grpc.DialOption + if dialer := c.bbo.Dialer; dialer != nil { + dopts = []grpc.DialOption{grpc.WithContextDialer(dialer)} + } + + newClient, err := xdsclientNew(xdsclient.Options{Config: *clientConfig, DialOpts: dopts}) + if err != nil { + // This should never fail. xdsclientnew does a non-blocking dial, and + // all the config passed in should be validated. + // + // This could leave c.xdsclient as nil if this is the first update. + grpclog.Warningf("eds: failed to create xdsclient, error: %v", err) + return false + } + return c.replaceXDSClient(newClient, clientConfig.BalancerName) +} + +// startEDSWatch starts the EDS watch. Caller can call this when the xds_client +// is updated, or the edsServiceName is updated. +// +// Note that if there's already a watch in progress, it's not explicitly +// canceled. Because for each xds_client, there should be only one EDS watch in +// progress. So a new EDS watch implicitly cancels the previous one. +// +// This usually means load report needs to be restarted, but this function does +// NOT do that. Caller needs to call startLoadReport separately. +func (c *xdsclientWrapper) startEDSWatch(nameToWatch string) { + if c.xdsclient == nil { + grpclog.Warningf("xds: xdsclient is nil when trying to start an EDS watch. This means xdsclient wasn't passed in from the resolver, and xdsclient.New failed") + return + } + + c.edsServiceName = nameToWatch + c.cancelEDSWatch = c.xdsclient.WatchEDS(c.edsServiceName, func(update *xdsclient.EDSUpdate, err error) { + if err != nil { + // TODO: this should trigger a call to `c.loseContact`, when the + // error indicates "lose contact". + return + } + if err := c.newEDSUpdate(update); err != nil { + grpclog.Warningf("xds: processing new EDS update failed due to %v.", err) + } + }) +} + +// startLoadReport starts load reporting. If there's already a load reporting in +// progress, it cancels that. +// +// Caller can cal this when the loadReportServer name changes, but +// edsServiceName doesn't (so we only need to restart load reporting, not EDS +// watch). +func (c *xdsclientWrapper) startLoadReport(edsServiceNameBeingWatched string, loadReportServer *string) { + if c.xdsclient == nil { + grpclog.Warningf("xds: xdsclient is nil when trying to start load reporting. This means xdsclient wasn't passed in from the resolver, and xdsclient.New failed") + return + } + if c.loadStore != nil { + if c.cancelLoadReport != nil { + c.cancelLoadReport() + } + c.loadReportServer = loadReportServer + if c.loadReportServer != nil { + c.cancelLoadReport = c.xdsclient.ReportLoad(*c.loadReportServer, edsServiceNameBeingWatched, c.loadStore) + } + } +} + +// handleUpdate applies the service config and attributes updates to the client, +// including updating the xds_client to use, and updating the EDS name to watch. +func (c *xdsclientWrapper) handleUpdate(config *XDSConfig, attr *attributes.Attributes) { + clientChanged := c.updateXDSClient(config, attr) + + var ( + restartWatchEDS bool + restartLoadReport bool + ) + + // The clusterName to watch should come from CDS response, via service + // config. If it's an empty string, fallback user's dial target. + nameToWatch := config.EDSServiceName + if nameToWatch == "" { + grpclog.Warningf("eds: cluster name to watch is an empty string. Fallback to user's dial target") + nameToWatch = c.bbo.Target.Endpoint + } + + // Need to restart EDS watch when one of the following happens: + // - the xds_client is updated + // - the xds_client didn't change, but the edsServiceName changed + // + // Only need to restart load reporting when: + // - no need to restart EDS, but loadReportServer name changed + if clientChanged || c.edsServiceName != nameToWatch { + restartWatchEDS = true + restartLoadReport = true + } else if !equalStringPointers(c.loadReportServer, config.LrsLoadReportingServerName) { + restartLoadReport = true + } + + if restartWatchEDS { + c.startEDSWatch(nameToWatch) + } + + if restartLoadReport { + c.startLoadReport(nameToWatch, config.LrsLoadReportingServerName) + } +} + +func (c *xdsclientWrapper) close() { + if c.xdsclient != nil && c.balancerName != "" { + // Only close xdsclient if it's not from attributes. + c.xdsclient.Close() + } + + if c.cancelLoadReport != nil { + c.cancelLoadReport() + } + if c.cancelEDSWatch != nil { + c.cancelEDSWatch() + } +} + +// defaultDialCreds builds a DialOption containing the credentials to be used +// while talking to the xDS server (this is done only if the xds bootstrap +// process does not return any credentials to use). If the parent channel +// contains DialCreds, we use it as is. If it contains a CredsBundle, we use +// just the transport credentials from the bundle. If we don't find any +// credentials on the parent channel, we resort to using an insecure channel. +func defaultDialCreds(balancerName string, rbo balancer.BuildOptions) grpc.DialOption { + switch { + case rbo.DialCreds != nil: + if err := rbo.DialCreds.OverrideServerName(balancerName); err != nil { + grpclog.Warningf("xds: failed to override server name in credentials: %v, using Insecure", err) + return grpc.WithInsecure() + } + return grpc.WithTransportCredentials(rbo.DialCreds) + case rbo.CredsBundle != nil: + return grpc.WithTransportCredentials(rbo.CredsBundle.TransportCredentials()) + default: + grpclog.Warning("xds: no credentials available, using Insecure") + return grpc.WithInsecure() + } +} + +// equalStringPointers returns true if +// - a and b are both nil OR +// - *a == *b (and a and b are both non-nil) +func equalStringPointers(a, b *string) bool { + if a == nil && b == nil { + return true + } + if a == nil || b == nil { + return false + } + return *a == *b +} diff --git a/vendor/google.golang.org/grpc/xds/internal/balancer/xds_lrs_test.go b/vendor/google.golang.org/grpc/xds/internal/balancer/xds_lrs_test.go index 6fe852769ad..9c2df72c71b 100644 --- a/vendor/google.golang.org/grpc/xds/internal/balancer/xds_lrs_test.go +++ b/vendor/google.golang.org/grpc/xds/internal/balancer/xds_lrs_test.go @@ -19,137 +19,46 @@ package balancer import ( - "io" - "sync" "testing" - "time" - "github.com/golang/protobuf/proto" - durationpb "github.com/golang/protobuf/ptypes/duration" - structpb "github.com/golang/protobuf/ptypes/struct" - "github.com/google/go-cmp/cmp" + "google.golang.org/grpc/attributes" "google.golang.org/grpc/balancer" - "google.golang.org/grpc/codes" "google.golang.org/grpc/resolver" - "google.golang.org/grpc/status" - "google.golang.org/grpc/xds/internal" - basepb "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/base" - lrsgrpc "google.golang.org/grpc/xds/internal/proto/envoy/service/load_stats/v2/lrs" - lrspb "google.golang.org/grpc/xds/internal/proto/envoy/service/load_stats/v2/lrs" + xdsinternal "google.golang.org/grpc/xds/internal" + "google.golang.org/grpc/xds/internal/testutils/fakexds" ) -type lrsServer struct { - mu sync.Mutex - dropTotal uint64 - drops map[string]uint64 - reportingInterval *durationpb.Duration -} - -func (lrss *lrsServer) StreamLoadStats(stream lrsgrpc.LoadReportingService_StreamLoadStatsServer) error { - req, err := stream.Recv() - if err != nil { - return err - } - if !proto.Equal(req, &lrspb.LoadStatsRequest{ - Node: &basepb.Node{ - Metadata: &structpb.Struct{ - Fields: map[string]*structpb.Value{ - internal.GrpcHostname: { - Kind: &structpb.Value_StringValue{StringValue: testServiceName}, - }, - }, - }, - }, - }) { - return status.Errorf(codes.FailedPrecondition, "unexpected req: %+v", req) - } - if err := stream.Send(&lrspb.LoadStatsResponse{ - Clusters: []string{testServiceName}, - LoadReportingInterval: lrss.reportingInterval, - }); err != nil { - return err - } - - for { - req, err := stream.Recv() - if err != nil { - if err == io.EOF { - return nil - } - return err - } - stats := req.ClusterStats[0] - lrss.mu.Lock() - lrss.dropTotal += stats.TotalDroppedRequests - for _, d := range stats.DroppedRequests { - lrss.drops[d.Category] += d.DroppedCount - } - lrss.mu.Unlock() - } -} - -func (s) TestXdsLoadReporting(t *testing.T) { - originalNewEDSBalancer := newEDSBalancer - newEDSBalancer = newFakeEDSBalancer - defer func() { - newEDSBalancer = originalNewEDSBalancer - }() - - builder := balancer.Get(xdsName) +// TestXDSLoadReporting verifies that the edsBalancer starts the loadReport +// stream when the lbConfig passed to it contains a valid value for the LRS +// server (empty string). +func (s) TestXDSLoadReporting(t *testing.T) { + builder := balancer.Get(edsName) cc := newTestClientConn() - lb, ok := builder.Build(cc, balancer.BuildOptions{Target: resolver.Target{Endpoint: testServiceName}}).(*xdsBalancer) + edsB, ok := builder.Build(cc, balancer.BuildOptions{Target: resolver.Target{Endpoint: testEDSClusterName}}).(*edsBalancer) if !ok { - t.Fatalf("unable to type assert to *xdsBalancer") + t.Fatalf("builder.Build(%s) returned type {%T}, want {*edsBalancer}", edsName, edsB) } - defer lb.Close() - - addr, td, lrss, cleanup := setupServer(t) - defer cleanup() + defer edsB.Close() - const intervalNano = 1000 * 1000 * 50 - lrss.reportingInterval = &durationpb.Duration{ - Seconds: 0, - Nanos: intervalNano, - } + xdsC := fakexds.NewClient() + edsB.UpdateClientConnState(balancer.ClientConnState{ + ResolverState: resolver.State{Attributes: attributes.New(xdsinternal.XDSClientID, xdsC)}, + BalancerConfig: &XDSConfig{LrsLoadReportingServerName: new(string)}, + }) - cfg := &xdsConfig{ - BalancerName: addr, - ChildPolicy: &loadBalancingConfig{Name: fakeBalancerA}, // Set this to skip cds. - } - lb.UpdateClientConnState(balancer.ClientConnState{BalancerConfig: cfg}) - td.sendResp(&response{resp: testEDSRespWithoutEndpoints}) - var ( - i int - edsLB *fakeEDSBalancer - ) - for i = 0; i < 10; i++ { - edsLB = getLatestEdsBalancer() - if edsLB != nil { - break - } - time.Sleep(100 * time.Millisecond) - } - if i == 10 { - t.Fatal("edsBalancer instance has not been created and assigned to lb.xdsLB after 1s") + gotCluster, err := xdsC.WaitForWatchEDS() + if err != nil { + t.Fatalf("xdsClient.WatchEDS failed with error: %v", err) } - - var dropCategories = []string{"drop_for_real", "drop_for_fun"} - drops := map[string]uint64{ - dropCategories[0]: 31, - dropCategories[1]: 41, + if gotCluster != testEDSClusterName { + t.Fatalf("xdsClient.WatchEDS() called with cluster: %v, want %v", gotCluster, testEDSClusterName) } - for c, d := range drops { - for i := 0; i < int(d); i++ { - edsLB.loadStore.CallDropped(c) - time.Sleep(time.Nanosecond * intervalNano / 10) - } + got, err := xdsC.WaitForReportLoad() + if err != nil { + t.Fatalf("xdsClient.ReportLoad failed with error: %v", err) } - time.Sleep(time.Nanosecond * intervalNano * 2) - - lrss.mu.Lock() - defer lrss.mu.Unlock() - if !cmp.Equal(lrss.drops, drops) { - t.Errorf("different: %v %v %v", lrss.drops, drops, cmp.Diff(lrss.drops, drops)) + if got.Server != "" || got.Cluster != testEDSClusterName { + t.Fatalf("xdsClient.ReportLoad called with {%v, %v}: want {\"\", %v}", got.Server, got.Cluster, testEDSClusterName) } } diff --git a/vendor/google.golang.org/grpc/xds/internal/balancer/xds_old.go b/vendor/google.golang.org/grpc/xds/internal/balancer/xds_old.go new file mode 100644 index 00000000000..1d371bd4533 --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/balancer/xds_old.go @@ -0,0 +1,46 @@ +/* + * + * 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. + */ + +package balancer + +import "google.golang.org/grpc/balancer" + +// The old xds balancer implements logic for both CDS and EDS. With the new +// design, CDS is split and moved to a separate balancer, and the xds balancer +// becomes the EDS balancer. +// +// To keep the existing tests working, this file regisger EDS balancer under the +// old xds balancer name. +// +// TODO: delete this file when migration to new workflow (LDS, RDS, CDS, EDS) is +// done. + +const xdsName = "xds_experimental" + +func init() { + balancer.Register(&xdsBalancerBuilder{}) +} + +// xdsBalancerBuilder register edsBalancerBuilder (now with name +// "experimental_eds") under the old name "xds_experimental". +type xdsBalancerBuilder struct { + edsBalancerBuilder +} + +func (b *xdsBalancerBuilder) Name() string { + return xdsName +} diff --git a/vendor/google.golang.org/grpc/xds/internal/balancer/xds_test.go b/vendor/google.golang.org/grpc/xds/internal/balancer/xds_test.go index 85bd56a16d1..2e07ec2fade 100644 --- a/vendor/google.golang.org/grpc/xds/internal/balancer/xds_test.go +++ b/vendor/google.golang.org/grpc/xds/internal/balancer/xds_test.go @@ -19,29 +19,47 @@ package balancer import ( + "bytes" "encoding/json" + "fmt" "reflect" "sync" "testing" "time" - "github.com/golang/protobuf/proto" + corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" + "github.com/golang/protobuf/jsonpb" + wrapperspb "github.com/golang/protobuf/ptypes/wrappers" + "github.com/google/go-cmp/cmp" + "google.golang.org/grpc" "google.golang.org/grpc/balancer" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/internal/grpctest" "google.golang.org/grpc/internal/leakcheck" + scpb "google.golang.org/grpc/internal/proto/grpc_service_config" "google.golang.org/grpc/resolver" + "google.golang.org/grpc/serviceconfig" "google.golang.org/grpc/xds/internal/balancer/lrs" - discoverypb "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/discovery" - edspb "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/eds" + xdsclient "google.golang.org/grpc/xds/internal/client" + "google.golang.org/grpc/xds/internal/client/bootstrap" + "google.golang.org/grpc/xds/internal/testutils" + "google.golang.org/grpc/xds/internal/testutils/fakexds" ) var lbABuilder = &balancerABuilder{} func init() { - balancer.Register(&xdsBalancerBuilder{}) + balancer.Register(&edsBalancerBuilder{}) balancer.Register(lbABuilder) balancer.Register(&balancerBBuilder{}) + + bootstrapConfigNew = func() *bootstrap.Config { + return &bootstrap.Config{ + BalancerName: "", + Creds: grpc.WithInsecure(), + NodeProto: &corepb.Node{}, + } + } } type s struct{} @@ -57,23 +75,19 @@ func Test(t *testing.T) { const ( fakeBalancerA = "fake_balancer_A" fakeBalancerB = "fake_balancer_B" - fakeBalancerC = "fake_balancer_C" ) var ( testBalancerNameFooBar = "foo.bar" - testLBConfigFooBar = &xdsConfig{ + testLBConfigFooBar = &XDSConfig{ BalancerName: testBalancerNameFooBar, - ChildPolicy: &loadBalancingConfig{Name: fakeBalancerA}, + ChildPolicy: &loadBalancingConfig{Name: fakeBalancerB}, FallBackPolicy: &loadBalancingConfig{Name: fakeBalancerA}, + EDSServiceName: testEDSClusterName, } specialAddrForBalancerA = resolver.Address{Addr: "this.is.balancer.A"} specialAddrForBalancerB = resolver.Address{Addr: "this.is.balancer.B"} - - // mu protects the access of latestFakeEdsBalancer - mu sync.Mutex - latestFakeEdsBalancer *fakeEDSBalancer ) type balancerABuilder struct { @@ -83,7 +97,7 @@ type balancerABuilder struct { func (b *balancerABuilder) Build(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.Balancer { b.mu.Lock() - b.lastBalancer = &balancerA{cc: cc, subconnStateChange: make(chan *scStateChange, 10)} + b.lastBalancer = &balancerA{cc: cc, subconnStateChange: testutils.NewChannelWithSize(10)} b.mu.Unlock() return b.lastBalancer } @@ -114,13 +128,18 @@ func (*balancerBBuilder) Name() string { return string(fakeBalancerB) } +// A fake balancer implementation which does two things: +// * Appends a unique address to the list of resolved addresses received before +// attempting to create a SubConn. +// * Makes the received subConn state changes available through a channel, for +// the test to inspect. type balancerA struct { cc balancer.ClientConn - subconnStateChange chan *scStateChange + subconnStateChange *testutils.Channel } func (b *balancerA) HandleSubConnStateChange(sc balancer.SubConn, state connectivity.State) { - b.subconnStateChange <- &scStateChange{sc: sc, state: state} + b.subconnStateChange.Send(&scStateChange{sc: sc, state: state}) } func (b *balancerA) HandleResolvedAddrs(addrs []resolver.Address, err error) { @@ -129,46 +148,55 @@ func (b *balancerA) HandleResolvedAddrs(addrs []resolver.Address, err error) { func (b *balancerA) Close() {} -type balancerB struct { - cc balancer.ClientConn +func (b *balancerA) waitForSubConnStateChange(wantState *scStateChange) error { + return waitForSubConnStateChange(b.subconnStateChange, wantState) } -func (balancerB) HandleSubConnStateChange(sc balancer.SubConn, state connectivity.State) { - panic("implement me") +// A fake balancer implementation which appends a unique address to the list of +// resolved addresses received before attempting to create a SubConn. +type balancerB struct { + cc balancer.ClientConn } func (b *balancerB) HandleResolvedAddrs(addrs []resolver.Address, err error) { _, _ = b.cc.NewSubConn(append(addrs, specialAddrForBalancerB), balancer.NewSubConnOptions{}) } +func (balancerB) HandleSubConnStateChange(sc balancer.SubConn, state connectivity.State) { + panic("implement me") +} func (balancerB) Close() {} func newTestClientConn() *testClientConn { - return &testClientConn{ - newSubConns: make(chan []resolver.Address, 10), - } + return &testClientConn{newSubConns: testutils.NewChannelWithSize(10)} } type testClientConn struct { - newSubConns chan []resolver.Address + newSubConns *testutils.Channel } func (t *testClientConn) NewSubConn(addrs []resolver.Address, opts balancer.NewSubConnOptions) (balancer.SubConn, error) { - t.newSubConns <- addrs + t.newSubConns.Send(addrs) return nil, nil } -func (testClientConn) RemoveSubConn(balancer.SubConn) { -} - -func (testClientConn) UpdateBalancerState(s connectivity.State, p balancer.Picker) { +func (t *testClientConn) waitForNewSubConns(wantAddrs []resolver.Address) error { + val, err := t.newSubConns.Receive() + if err != nil { + return fmt.Errorf("error waiting for subconns: %v", err) + } + gotAddrs := val.([]resolver.Address) + if !reflect.DeepEqual(gotAddrs, wantAddrs) { + return fmt.Errorf("got subconn address %v, want %v", gotAddrs, wantAddrs) + } + return nil } -func (testClientConn) ResolveNow(resolver.ResolveNowOption) {} - -func (testClientConn) Target() string { - return testServiceName -} +func (testClientConn) RemoveSubConn(balancer.SubConn) {} +func (testClientConn) UpdateBalancerState(connectivity.State, balancer.Picker) {} +func (testClientConn) UpdateState(balancer.State) {} +func (testClientConn) ResolveNow(resolver.ResolveNowOptions) {} +func (testClientConn) Target() string { return testServiceName } type scStateChange struct { sc balancer.SubConn @@ -177,528 +205,579 @@ type scStateChange struct { type fakeEDSBalancer struct { cc balancer.ClientConn - edsChan chan *edspb.ClusterLoadAssignment - childPolicy chan *loadBalancingConfig - fallbackPolicy chan *loadBalancingConfig - subconnStateChange chan *scStateChange + childPolicy *testutils.Channel + subconnStateChange *testutils.Channel loadStore lrs.Store } func (f *fakeEDSBalancer) HandleSubConnStateChange(sc balancer.SubConn, state connectivity.State) { - f.subconnStateChange <- &scStateChange{sc: sc, state: state} + f.subconnStateChange.Send(&scStateChange{sc: sc, state: state}) } -func (f *fakeEDSBalancer) Close() { - mu.Lock() - defer mu.Unlock() - latestFakeEdsBalancer = nil +func (f *fakeEDSBalancer) HandleChildPolicy(name string, config json.RawMessage) { + f.childPolicy.Send(&loadBalancingConfig{Name: name, Config: config}) } -func (f *fakeEDSBalancer) HandleEDSResponse(edsResp *edspb.ClusterLoadAssignment) { - f.edsChan <- edsResp +func (f *fakeEDSBalancer) Close() {} +func (f *fakeEDSBalancer) HandleEDSResponse(edsResp *xdsclient.EDSUpdate) {} + +func (f *fakeEDSBalancer) waitForChildPolicy(wantPolicy *loadBalancingConfig) error { + val, err := f.childPolicy.Receive() + if err != nil { + return fmt.Errorf("error waiting for childPolicy: %v", err) + } + gotPolicy := val.(*loadBalancingConfig) + if !reflect.DeepEqual(gotPolicy, wantPolicy) { + return fmt.Errorf("got childPolicy %v, want %v", gotPolicy, wantPolicy) + } + return nil } -func (f *fakeEDSBalancer) HandleChildPolicy(name string, config json.RawMessage) { - f.childPolicy <- &loadBalancingConfig{ - Name: name, - Config: config, +func (f *fakeEDSBalancer) waitForSubConnStateChange(wantState *scStateChange) error { + return waitForSubConnStateChange(f.subconnStateChange, wantState) +} + +func waitForSubConnStateChange(ch *testutils.Channel, wantState *scStateChange) error { + val, err := ch.Receive() + if err != nil { + return fmt.Errorf("error waiting for subconnStateChange: %v", err) } + gotState := val.(*scStateChange) + if !reflect.DeepEqual(gotState, wantState) { + return fmt.Errorf("got subconnStateChange %v, want %v", gotState, wantState) + } + return nil } func newFakeEDSBalancer(cc balancer.ClientConn, loadStore lrs.Store) edsBalancerInterface { - lb := &fakeEDSBalancer{ + return &fakeEDSBalancer{ cc: cc, - edsChan: make(chan *edspb.ClusterLoadAssignment, 10), - childPolicy: make(chan *loadBalancingConfig, 10), - fallbackPolicy: make(chan *loadBalancingConfig, 10), - subconnStateChange: make(chan *scStateChange, 10), + childPolicy: testutils.NewChannelWithSize(10), + subconnStateChange: testutils.NewChannelWithSize(10), loadStore: loadStore, } - mu.Lock() - latestFakeEdsBalancer = lb - mu.Unlock() - return lb -} - -func getLatestEdsBalancer() *fakeEDSBalancer { - mu.Lock() - defer mu.Unlock() - return latestFakeEdsBalancer } type fakeSubConn struct{} -func (*fakeSubConn) UpdateAddresses([]resolver.Address) { - panic("implement me") -} - -func (*fakeSubConn) Connect() { - panic("implement me") -} - -func (s) TestXdsBalanceHandleResolvedAddrs(t *testing.T) { +func (*fakeSubConn) UpdateAddresses([]resolver.Address) { panic("implement me") } +func (*fakeSubConn) Connect() { panic("implement me") } + +// TestXDSFallbackResolvedAddrs verifies that the fallback balancer specified +// in the provided lbconfig is initialized, and that it receives the addresses +// pushed by the resolver. +// +// The test does the following: +// * Builds a new xds balancer. +// * Since there is no xDS server to respond to requests from the xds client +// (created as part of the xds balancer), we expect the fallback policy to +// kick in. +// * Repeatedly pushes new ClientConnState which specifies the same fallback +// policy, but a different set of resolved addresses. +// * The fallback policy is implemented by a fake balancer, which appends a +// unique address to the list of addresses it uses to create the SubConn. +// * We also have a fake ClientConn which verifies that it receives the +// expected address list. +func (s) TestXDSFallbackResolvedAddrs(t *testing.T) { startupTimeout = 500 * time.Millisecond defer func() { startupTimeout = defaultTimeout }() - builder := balancer.Get(xdsName) + builder := balancer.Get(edsName) cc := newTestClientConn() - lb, ok := builder.Build(cc, balancer.BuildOptions{Target: resolver.Target{Endpoint: testServiceName}}).(*xdsBalancer) + edsB, ok := builder.Build(cc, balancer.BuildOptions{Target: resolver.Target{Endpoint: testServiceName}}).(*edsBalancer) if !ok { - t.Fatalf("unable to type assert to *xdsBalancer") + t.Fatalf("builder.Build(%s) returned type {%T}, want {*edsBalancer}", edsName, edsB) } - defer lb.Close() - addrs := []resolver.Address{{Addr: "1.1.1.1:10001"}, {Addr: "2.2.2.2:10002"}, {Addr: "3.3.3.3:10003"}} - for i := 0; i < 3; i++ { - lb.UpdateClientConnState(balancer.ClientConnState{ - ResolverState: resolver.State{Addresses: addrs}, + defer edsB.Close() + + tests := []struct { + resolvedAddrs []resolver.Address + wantAddrs []resolver.Address + }{ + { + resolvedAddrs: []resolver.Address{{Addr: "1.1.1.1:10001"}, {Addr: "2.2.2.2:10002"}}, + wantAddrs: []resolver.Address{{Addr: "1.1.1.1:10001"}, {Addr: "2.2.2.2:10002"}, specialAddrForBalancerA}, + }, + { + resolvedAddrs: []resolver.Address{{Addr: "1.1.1.1:10001"}}, + wantAddrs: []resolver.Address{{Addr: "1.1.1.1:10001"}, specialAddrForBalancerA}, + }, + } + for _, test := range tests { + edsB.UpdateClientConnState(balancer.ClientConnState{ + ResolverState: resolver.State{Addresses: test.resolvedAddrs}, BalancerConfig: testLBConfigFooBar, }) - select { - case nsc := <-cc.newSubConns: - if !reflect.DeepEqual(append(addrs, specialAddrForBalancerA), nsc) { - t.Fatalf("got new subconn address %v, want %v", nsc, append(addrs, specialAddrForBalancerA)) - } - case <-time.After(2 * time.Second): - t.Fatal("timeout when geting new subconn result") + if err := cc.waitForNewSubConns(test.wantAddrs); err != nil { + t.Fatal(err) } - addrs = addrs[:2-i] } } -func (s) TestXdsBalanceHandleBalancerConfigBalancerNameUpdate(t *testing.T) { +// waitForNewXDSClientWithEDSWatch makes sure that a new xdsClient is created +// with the provided name. It also make sure that the newly created client +// registers an eds watcher. +func waitForNewXDSClientWithEDSWatch(t *testing.T, ch *testutils.Channel, wantName string) *fakexds.Client { + t.Helper() + + val, err := ch.Receive() + if err != nil { + t.Fatalf("error when waiting for a new xds client: %v", err) + return nil + } + xdsC := val.(*fakexds.Client) + if xdsC.Name() != wantName { + t.Fatalf("xdsClient created to balancer: %v, want %v", xdsC.Name(), wantName) + return nil + } + _, err = xdsC.WaitForWatchEDS() + if err != nil { + t.Fatalf("xdsClient.WatchEDS failed with error: %v", err) + return nil + } + return xdsC +} + +// waitForNewEDSLB makes sure that a new edsLB is created by the top-level +// edsBalancer. +func waitForNewEDSLB(t *testing.T, ch *testutils.Channel) *fakeEDSBalancer { + t.Helper() + + val, err := ch.Receive() + if err != nil { + t.Fatalf("error when waiting for a new edsLB: %v", err) + return nil + } + return val.(*fakeEDSBalancer) +} + +// setup overrides the functions which are used to create the xdsClient and the +// edsLB, creates fake version of them and makes them available on the provided +// channels. The returned cancel function should be called by the test for +// cleanup. +func setup(edsLBCh *testutils.Channel, xdsClientCh *testutils.Channel) func() { + origNewEDSBalancer := newEDSBalancer + newEDSBalancer = func(cc balancer.ClientConn, loadStore lrs.Store) edsBalancerInterface { + edsLB := newFakeEDSBalancer(cc, loadStore) + defer func() { edsLBCh.Send(edsLB) }() + return edsLB + } + + origXdsClientNew := xdsclientNew + xdsclientNew = func(opts xdsclient.Options) (xdsClientInterface, error) { + xdsC := fakexds.NewClientWithName(opts.Config.BalancerName) + defer func() { xdsClientCh.Send(xdsC) }() + return xdsC, nil + } + return func() { + newEDSBalancer = origNewEDSBalancer + xdsclientNew = origXdsClientNew + } +} + +// setupForFallback performs everything that setup does and in addition +// overrides the fallback startupTimeout to a small value to trigger fallback +// in tests. +func setupForFallback(edsLBCh *testutils.Channel, xdsClientCh *testutils.Channel) func() { + cancel := setup(edsLBCh, xdsClientCh) startupTimeout = 500 * time.Millisecond - originalNewEDSBalancer := newEDSBalancer - newEDSBalancer = newFakeEDSBalancer - defer func() { + return func() { + cancel() startupTimeout = defaultTimeout - newEDSBalancer = originalNewEDSBalancer - }() + } +} - builder := balancer.Get(xdsName) +// TestXDSConfigBalancerNameUpdate verifies different scenarios where the +// balancer name in the lbConfig is updated. +// +// The test does the following: +// * Builds a new xds balancer. +// * Since there is no xDS server to respond to requests from the xds client +// (created as part of the xds balancer), we expect the fallback policy to +// kick in. +// * Repeatedly pushes new ClientConnState which specifies different +// balancerName in the lbConfig. We expect xdsClient objects to created +// whenever the balancerName changes. We also expect a new edsLB to created +// the first time the client receives an edsUpdate. +func (s) TestXDSConfigBalancerNameUpdate(t *testing.T) { + edsLBCh := testutils.NewChannel() + xdsClientCh := testutils.NewChannel() + cancel := setupForFallback(edsLBCh, xdsClientCh) + defer cancel() + + builder := balancer.Get(edsName) cc := newTestClientConn() - lb, ok := builder.Build(cc, balancer.BuildOptions{Target: resolver.Target{Endpoint: testServiceName}}).(*xdsBalancer) + edsB, ok := builder.Build(cc, balancer.BuildOptions{Target: resolver.Target{Endpoint: testEDSClusterName}}).(*edsBalancer) if !ok { - t.Fatalf("unable to type assert to *xdsBalancer") + t.Fatalf("builder.Build(%s) returned type {%T}, want {*edsBalancer}", edsName, edsB) } - defer lb.Close() + defer edsB.Close() + addrs := []resolver.Address{{Addr: "1.1.1.1:10001"}, {Addr: "2.2.2.2:10002"}, {Addr: "3.3.3.3:10003"}} - lb.UpdateClientConnState(balancer.ClientConnState{ + edsB.UpdateClientConnState(balancer.ClientConnState{ ResolverState: resolver.State{Addresses: addrs}, BalancerConfig: testLBConfigFooBar, }) - // verify fallback takes over - select { - case nsc := <-cc.newSubConns: - if !reflect.DeepEqual(append(addrs, specialAddrForBalancerA), nsc) { - t.Fatalf("got new subconn address %v, want %v", nsc, append(addrs, specialAddrForBalancerA)) - } - case <-time.After(2 * time.Second): - t.Fatalf("timeout when geting new subconn result") + waitForNewXDSClientWithEDSWatch(t, xdsClientCh, testBalancerNameFooBar) + // Verify that fallbackLB (fakeBalancerA) takes over, since the xdsClient + // receives no edsUpdate. + if err := cc.waitForNewSubConns(append(addrs, specialAddrForBalancerA)); err != nil { + t.Fatal(err) } - var cleanups []func() - defer func() { - for _, cleanup := range cleanups { - cleanup() - } - }() - // In the first iteration, an eds balancer takes over fallback balancer - // In the second iteration, a new xds client takes over previous one. for i := 0; i < 2; i++ { - addr, td, _, cleanup := setupServer(t) - cleanups = append(cleanups, cleanup) - workingLBConfig := &xdsConfig{ - BalancerName: addr, - ChildPolicy: &loadBalancingConfig{Name: fakeBalancerA}, - FallBackPolicy: &loadBalancingConfig{Name: fakeBalancerA}, - } - lb.UpdateClientConnState(balancer.ClientConnState{ - ResolverState: resolver.State{Addresses: addrs}, - BalancerConfig: workingLBConfig, + balancerName := fmt.Sprintf("balancer-%d", i) + edsB.UpdateClientConnState(balancer.ClientConnState{ + ResolverState: resolver.State{Addresses: addrs}, + BalancerConfig: &XDSConfig{ + BalancerName: balancerName, + ChildPolicy: &loadBalancingConfig{Name: fakeBalancerA}, + FallBackPolicy: &loadBalancingConfig{Name: fakeBalancerA}, + EDSServiceName: testEDSClusterName, + }, }) - td.sendResp(&response{resp: testEDSRespWithoutEndpoints}) - - var j int - for j = 0; j < 10; j++ { - if edsLB := getLatestEdsBalancer(); edsLB != nil { // edsLB won't change between the two iterations - select { - case gotEDS := <-edsLB.edsChan: - if !proto.Equal(gotEDS, testClusterLoadAssignmentWithoutEndpoints) { - t.Fatalf("edsBalancer got eds: %v, want %v", gotEDS, testClusterLoadAssignmentWithoutEndpoints) - } - case <-time.After(time.Second): - t.Fatal("haven't got EDS update after 1s") - } - break + + xdsC := waitForNewXDSClientWithEDSWatch(t, xdsClientCh, balancerName) + xdsC.InvokeWatchEDSCallback(&xdsclient.EDSUpdate{}, nil) + + // In the first iteration, an edsLB takes over from the fallbackLB. In the + // second iteration, a new xds client is created, but the same edsLB is used. + if i == 0 { + if _, err := edsLBCh.Receive(); err != nil { + t.Fatalf("edsBalancer did not create edsLB after receiveing EDS update: %v, %d", err, i) + } + } else { + if _, err := edsLBCh.Receive(); err == nil { + t.Fatal("edsBalancer created new edsLB when it was not expected to") } - time.Sleep(100 * time.Millisecond) - } - if j == 10 { - t.Fatal("edsBalancer instance has not been created or updated after 1s") } } } -// switch child policy, lb stays the same -// cds->eds or eds -> cds, restart xdsClient, lb stays the same -func (s) TestXdsBalanceHandleBalancerConfigChildPolicyUpdate(t *testing.T) { - originalNewEDSBalancer := newEDSBalancer - newEDSBalancer = newFakeEDSBalancer - defer func() { - newEDSBalancer = originalNewEDSBalancer - }() - - builder := balancer.Get(xdsName) +// TestXDSConnfigChildPolicyUpdate verifies scenarios where the childPolicy +// section of the lbConfig is updated. +// +// The test does the following: +// * Builds a new xds balancer. +// * Pushes a new ClientConnState with a childPolicy set to fakeBalancerA. +// Verifies that a new xdsClient is created. It then pushes a new edsUpdate +// through the fakexds client. Verifies that a new edsLB is created and it +// receives the expected childPolicy. +// * Pushes a new ClientConnState with a childPolicy set to fakeBalancerB. +// This time around, we expect no new xdsClient or edsLB to be created. +// Instead, we expect the existing edsLB to receive the new child policy. +func (s) TestXDSConnfigChildPolicyUpdate(t *testing.T) { + edsLBCh := testutils.NewChannel() + xdsClientCh := testutils.NewChannel() + cancel := setup(edsLBCh, xdsClientCh) + defer cancel() + + builder := balancer.Get(edsName) cc := newTestClientConn() - lb, ok := builder.Build(cc, balancer.BuildOptions{Target: resolver.Target{Endpoint: testServiceName}}).(*xdsBalancer) + edsB, ok := builder.Build(cc, balancer.BuildOptions{Target: resolver.Target{Endpoint: testServiceName}}).(*edsBalancer) if !ok { - t.Fatalf("unable to type assert to *xdsBalancer") + t.Fatalf("builder.Build(%s) returned type {%T}, want {*edsBalancer}", edsName, edsB) } - defer lb.Close() + defer edsB.Close() - var cleanups []func() - defer func() { - for _, cleanup := range cleanups { - cleanup() - } - }() - for _, test := range []struct { - cfg *xdsConfig - responseToSend *discoverypb.DiscoveryResponse - expectedChildPolicy *loadBalancingConfig - }{ - { - cfg: &xdsConfig{ - ChildPolicy: &loadBalancingConfig{ - Name: fakeBalancerA, - Config: json.RawMessage("{}"), - }, - }, - responseToSend: testEDSRespWithoutEndpoints, - expectedChildPolicy: &loadBalancingConfig{ - Name: string(fakeBalancerA), - Config: json.RawMessage(`{}`), + edsB.UpdateClientConnState(balancer.ClientConnState{ + BalancerConfig: &XDSConfig{ + BalancerName: testBalancerNameFooBar, + ChildPolicy: &loadBalancingConfig{ + Name: fakeBalancerA, + Config: json.RawMessage("{}"), }, + EDSServiceName: testEDSClusterName, }, - { - cfg: &xdsConfig{ - ChildPolicy: &loadBalancingConfig{ - Name: fakeBalancerB, - Config: json.RawMessage("{}"), - }, - }, - expectedChildPolicy: &loadBalancingConfig{ - Name: string(fakeBalancerB), - Config: json.RawMessage(`{}`), - }, - }, - { - cfg: &xdsConfig{}, - responseToSend: testCDSResp, - expectedChildPolicy: &loadBalancingConfig{ - Name: "ROUND_ROBIN", + }) + xdsC := waitForNewXDSClientWithEDSWatch(t, xdsClientCh, testBalancerNameFooBar) + xdsC.InvokeWatchEDSCallback(&xdsclient.EDSUpdate{}, nil) + edsLB := waitForNewEDSLB(t, edsLBCh) + edsLB.waitForChildPolicy(&loadBalancingConfig{ + Name: string(fakeBalancerA), + Config: json.RawMessage(`{}`), + }) + + edsB.UpdateClientConnState(balancer.ClientConnState{ + BalancerConfig: &XDSConfig{ + BalancerName: testBalancerNameFooBar, + ChildPolicy: &loadBalancingConfig{ + Name: fakeBalancerB, + Config: json.RawMessage("{}"), }, + EDSServiceName: testEDSClusterName, }, - } { - addr, td, _, cleanup := setupServer(t) - cleanups = append(cleanups, cleanup) - test.cfg.BalancerName = addr - - lb.UpdateClientConnState(balancer.ClientConnState{BalancerConfig: test.cfg}) - if test.responseToSend != nil { - td.sendResp(&response{resp: test.responseToSend}) - } - var i int - for i = 0; i < 10; i++ { - if edsLB := getLatestEdsBalancer(); edsLB != nil { - select { - case childPolicy := <-edsLB.childPolicy: - if !reflect.DeepEqual(childPolicy, test.expectedChildPolicy) { - t.Fatalf("got childPolicy %v, want %v", childPolicy, test.expectedChildPolicy) - } - case <-time.After(time.Second): - t.Fatal("haven't got policy update after 1s") - } - break - } - time.Sleep(100 * time.Millisecond) - } - if i == 10 { - t.Fatal("edsBalancer instance has not been created or updated after 1s") - } - } + }) + edsLB.waitForChildPolicy(&loadBalancingConfig{ + Name: string(fakeBalancerA), + Config: json.RawMessage(`{}`), + }) } -// not in fallback mode, overwrite fallback info. -// in fallback mode, update config or switch balancer. -func (s) TestXdsBalanceHandleBalancerConfigFallBackUpdate(t *testing.T) { - originalNewEDSBalancer := newEDSBalancer - newEDSBalancer = newFakeEDSBalancer - defer func() { - newEDSBalancer = originalNewEDSBalancer - }() - - builder := balancer.Get(xdsName) +// TestXDSConfigFallBackUpdate verifies different scenarios where the fallback +// config part of the lbConfig is updated. +// +// The test does the following: +// * Builds a top-level edsBalancer +// * Fakes the xdsClient and the underlying edsLB implementations. +// * Sends a ClientConn update to the edsBalancer with a bogus balancerName. +// This will get the balancer into fallback monitoring, but since the +// startupTimeout package variable is not overridden to a small value, fallback +// will not kick-in as yet. +// * Sends another ClientConn update with fallback addresses. Still fallback +// would not have kicked in because the startupTimeout hasn't expired. +// * Sends an EDSUpdate through the fakexds.Client object. This will trigger +// the creation of an edsLB object. This is verified. +// * Trigger fallback by directly calling the loseContact method on the +// top-level edsBalancer. This should instantiate the fallbackLB and should +// send the appropriate subConns. +// * Update the fallback policy to specify and different fallback LB and make +// sure the new LB receives appropriate subConns. +func (s) TestXDSConfigFallBackUpdate(t *testing.T) { + edsLBCh := testutils.NewChannel() + xdsClientCh := testutils.NewChannel() + cancel := setup(edsLBCh, xdsClientCh) + defer cancel() + + builder := balancer.Get(edsName) cc := newTestClientConn() - lb, ok := builder.Build(cc, balancer.BuildOptions{Target: resolver.Target{Endpoint: testServiceName}}).(*xdsBalancer) + edsB, ok := builder.Build(cc, balancer.BuildOptions{Target: resolver.Target{Endpoint: testEDSClusterName}}).(*edsBalancer) if !ok { - t.Fatalf("unable to type assert to *xdsBalancer") + t.Fatalf("builder.Build(%s) returned type {%T}, want {*edsBalancer}", edsName, edsB) } - defer lb.Close() - - addr, td, _, cleanup := setupServer(t) + defer edsB.Close() - cfg := xdsConfig{ - BalancerName: addr, - ChildPolicy: &loadBalancingConfig{Name: fakeBalancerA}, - FallBackPolicy: &loadBalancingConfig{Name: fakeBalancerA}, - } - lb.UpdateClientConnState(balancer.ClientConnState{BalancerConfig: &cfg}) + bogusBalancerName := "wrong-balancer-name" + edsB.UpdateClientConnState(balancer.ClientConnState{ + BalancerConfig: &XDSConfig{ + BalancerName: bogusBalancerName, + FallBackPolicy: &loadBalancingConfig{Name: fakeBalancerA}, + }, + }) + xdsC := waitForNewXDSClientWithEDSWatch(t, xdsClientCh, bogusBalancerName) addrs := []resolver.Address{{Addr: "1.1.1.1:10001"}, {Addr: "2.2.2.2:10002"}, {Addr: "3.3.3.3:10003"}} - cfg2 := cfg - cfg2.FallBackPolicy = &loadBalancingConfig{Name: fakeBalancerB} - lb.UpdateClientConnState(balancer.ClientConnState{ - ResolverState: resolver.State{Addresses: addrs}, - BalancerConfig: &cfg2, + edsB.UpdateClientConnState(balancer.ClientConnState{ + ResolverState: resolver.State{Addresses: addrs}, + BalancerConfig: &XDSConfig{ + BalancerName: bogusBalancerName, + FallBackPolicy: &loadBalancingConfig{Name: fakeBalancerB}, + }, }) - td.sendResp(&response{resp: testEDSRespWithoutEndpoints}) - - var i int - for i = 0; i < 10; i++ { - if edsLB := getLatestEdsBalancer(); edsLB != nil { - break - } - time.Sleep(100 * time.Millisecond) - } - if i == 10 { - t.Fatal("edsBalancer instance has not been created and assigned to lb.xdsLB after 1s") + xdsC.InvokeWatchEDSCallback(&xdsclient.EDSUpdate{}, nil) + if _, err := edsLBCh.Receive(); err != nil { + t.Fatalf("edsBalancer did not create edsLB after receiveing EDS update: %v", err) } - cleanup() + // Call loseContact explicitly, error in EDS callback is not handled. + // Eventually, this should call EDS ballback with an error that indicates + // "lost contact". + edsB.loseContact() - // verify fallback balancer B takes over - select { - case nsc := <-cc.newSubConns: - if !reflect.DeepEqual(append(addrs, specialAddrForBalancerB), nsc) { - t.Fatalf("got new subconn address %v, want %v", nsc, append(addrs, specialAddrForBalancerB)) - } - case <-time.After(5 * time.Second): - t.Fatalf("timeout when geting new subconn result") + // Verify that fallback (fakeBalancerB) takes over. + if err := cc.waitForNewSubConns(append(addrs, specialAddrForBalancerB)); err != nil { + t.Fatal(err) } - cfg3 := cfg - cfg3.FallBackPolicy = &loadBalancingConfig{Name: fakeBalancerA} - lb.UpdateClientConnState(balancer.ClientConnState{ - ResolverState: resolver.State{Addresses: addrs}, - BalancerConfig: &cfg3, + edsB.UpdateClientConnState(balancer.ClientConnState{ + ResolverState: resolver.State{Addresses: addrs}, + BalancerConfig: &XDSConfig{ + BalancerName: bogusBalancerName, + FallBackPolicy: &loadBalancingConfig{Name: fakeBalancerA}, + }, }) - // verify fallback balancer A takes over - select { - case nsc := <-cc.newSubConns: - if !reflect.DeepEqual(append(addrs, specialAddrForBalancerA), nsc) { - t.Fatalf("got new subconn address %v, want %v", nsc, append(addrs, specialAddrForBalancerA)) - } - case <-time.After(2 * time.Second): - t.Fatalf("timeout when geting new subconn result") + // Verify that fallbackLB (fakeBalancerA) takes over. + if err := cc.waitForNewSubConns(append(addrs, specialAddrForBalancerA)); err != nil { + t.Fatal(err) } } -func (s) TestXdsBalancerHandlerSubConnStateChange(t *testing.T) { - originalNewEDSBalancer := newEDSBalancer - newEDSBalancer = newFakeEDSBalancer - defer func() { - newEDSBalancer = originalNewEDSBalancer - }() +// TestXDSSubConnStateChange verifies if the top-level edsBalancer passes on +// the subConnStateChange to appropriate child balancers (it tests for edsLB +// and a fallbackLB). +func (s) TestXDSSubConnStateChange(t *testing.T) { + edsLBCh := testutils.NewChannel() + xdsClientCh := testutils.NewChannel() + cancel := setup(edsLBCh, xdsClientCh) + defer cancel() - builder := balancer.Get(xdsName) + builder := balancer.Get(edsName) cc := newTestClientConn() - lb, ok := builder.Build(cc, balancer.BuildOptions{Target: resolver.Target{Endpoint: testServiceName}}).(*xdsBalancer) + edsB, ok := builder.Build(cc, balancer.BuildOptions{Target: resolver.Target{Endpoint: testEDSClusterName}}).(*edsBalancer) if !ok { - t.Fatalf("unable to type assert to *xdsBalancer") - } - defer lb.Close() - - addr, td, _, cleanup := setupServer(t) - defer cleanup() - cfg := &xdsConfig{ - BalancerName: addr, - ChildPolicy: &loadBalancingConfig{Name: fakeBalancerA}, - FallBackPolicy: &loadBalancingConfig{Name: fakeBalancerA}, + t.Fatalf("builder.Build(%s) returned type {%T}, want {*edsBalancer}", edsName, edsB) } - lb.UpdateClientConnState(balancer.ClientConnState{BalancerConfig: cfg}) + defer edsB.Close() - td.sendResp(&response{resp: testEDSRespWithoutEndpoints}) + addrs := []resolver.Address{{Addr: "1.1.1.1:10001"}, {Addr: "2.2.2.2:10002"}, {Addr: "3.3.3.3:10003"}} + edsB.UpdateClientConnState(balancer.ClientConnState{ + ResolverState: resolver.State{Addresses: addrs}, + BalancerConfig: &XDSConfig{ + BalancerName: testBalancerNameFooBar, + ChildPolicy: &loadBalancingConfig{Name: fakeBalancerA}, + FallBackPolicy: &loadBalancingConfig{Name: fakeBalancerA}, + EDSServiceName: testEDSClusterName, + }, + }) - expectedScStateChange := &scStateChange{ - sc: &fakeSubConn{}, - state: connectivity.Ready, - } + xdsC := waitForNewXDSClientWithEDSWatch(t, xdsClientCh, testBalancerNameFooBar) + xdsC.InvokeWatchEDSCallback(&xdsclient.EDSUpdate{}, nil) + edsLB := waitForNewEDSLB(t, edsLBCh) - var i int - for i = 0; i < 10; i++ { - if edsLB := getLatestEdsBalancer(); edsLB != nil { - lb.UpdateSubConnState(expectedScStateChange.sc, balancer.SubConnState{ConnectivityState: expectedScStateChange.state}) - select { - case scsc := <-edsLB.subconnStateChange: - if !reflect.DeepEqual(scsc, expectedScStateChange) { - t.Fatalf("got subconn state change %v, want %v", scsc, expectedScStateChange) - } - case <-time.After(time.Second): - t.Fatal("haven't got subconn state change after 1s") - } - break - } - time.Sleep(100 * time.Millisecond) - } - if i == 10 { - t.Fatal("edsBalancer instance has not been created and assigned to lb.xdsLB after 1s") - } + fsc := &fakeSubConn{} + state := connectivity.Ready + edsB.UpdateSubConnState(fsc, balancer.SubConnState{ConnectivityState: state}) + edsLB.waitForSubConnStateChange(&scStateChange{sc: fsc, state: state}) - // lbAbuilder has a per binary record what's the last balanceA created. We need to clear the record - // to make sure there's a new one created and get the pointer to it. + // lbABuilder maintains a pointer to the last balancerA that it created. We + // need to clear that to make sure a new one is created when we attempt to + // fallback in the next line. lbABuilder.clearLastBalancer() - cleanup() - - // switch to fallback - // fallback balancer A takes over - for i = 0; i < 10; i++ { - if fblb := lbABuilder.getLastBalancer(); fblb != nil { - lb.UpdateSubConnState(expectedScStateChange.sc, balancer.SubConnState{ConnectivityState: expectedScStateChange.state}) - select { - case scsc := <-fblb.subconnStateChange: - if !reflect.DeepEqual(scsc, expectedScStateChange) { - t.Fatalf("got subconn state change %v, want %v", scsc, expectedScStateChange) - } - case <-time.After(time.Second): - t.Fatal("haven't got subconn state change after 1s") - } - break - } - time.Sleep(100 * time.Millisecond) - } - if i == 10 { - t.Fatal("balancerA instance has not been created after 1s") - } -} - -func (s) TestXdsBalancerFallBackSignalFromEdsBalancer(t *testing.T) { - originalNewEDSBalancer := newEDSBalancer - newEDSBalancer = newFakeEDSBalancer - defer func() { - newEDSBalancer = originalNewEDSBalancer - }() - - builder := balancer.Get(xdsName) - cc := newTestClientConn() - lb, ok := builder.Build(cc, balancer.BuildOptions{Target: resolver.Target{Endpoint: testServiceName}}).(*xdsBalancer) - if !ok { - t.Fatalf("unable to type assert to *xdsBalancer") - } - defer lb.Close() - - addr, td, _, cleanup := setupServer(t) - defer cleanup() - cfg := &xdsConfig{ - BalancerName: addr, - ChildPolicy: &loadBalancingConfig{Name: fakeBalancerA}, - FallBackPolicy: &loadBalancingConfig{Name: fakeBalancerA}, + // Call loseContact explicitly, error in EDS callback is not handled. + // Eventually, this should call EDS ballback with an error that indicates + // "lost contact". + edsB.loseContact() + // Verify that fallback (fakeBalancerA) takes over. + if err := cc.waitForNewSubConns(append(addrs, specialAddrForBalancerA)); err != nil { + t.Fatal(err) + } + fblb := lbABuilder.getLastBalancer() + if fblb == nil { + t.Fatal("expected fallback balancerA to be built on fallback") + } + edsB.UpdateSubConnState(fsc, balancer.SubConnState{ConnectivityState: state}) + fblb.waitForSubConnStateChange(&scStateChange{sc: fsc, state: state}) +} + +func TestXdsBalancerConfigParsing(t *testing.T) { + const testEDSName = "eds.service" + var testLRSName = "lrs.server" + b := bytes.NewBuffer(nil) + if err := (&jsonpb.Marshaler{}).Marshal(b, &scpb.XdsConfig{ + ChildPolicy: []*scpb.LoadBalancingConfig{ + {Policy: &scpb.LoadBalancingConfig_Xds{}}, + {Policy: &scpb.LoadBalancingConfig_RoundRobin{ + RoundRobin: &scpb.RoundRobinConfig{}, + }}, + }, + FallbackPolicy: []*scpb.LoadBalancingConfig{ + {Policy: &scpb.LoadBalancingConfig_Xds{}}, + {Policy: &scpb.LoadBalancingConfig_PickFirst{ + PickFirst: &scpb.PickFirstConfig{}, + }}, + }, + EdsServiceName: testEDSName, + LrsLoadReportingServerName: &wrapperspb.StringValue{Value: testLRSName}, + }); err != nil { + t.Fatalf("%v", err) } - lb.UpdateClientConnState(balancer.ClientConnState{BalancerConfig: cfg}) - - td.sendResp(&response{resp: testEDSRespWithoutEndpoints}) - expectedScStateChange := &scStateChange{ - sc: &fakeSubConn{}, - state: connectivity.Ready, + tests := []struct { + name string + js json.RawMessage + want serviceconfig.LoadBalancingConfig + wantErr bool + }{ + { + name: "jsonpb-generated", + js: b.Bytes(), + want: &XDSConfig{ + ChildPolicy: &loadBalancingConfig{ + Name: "round_robin", + Config: json.RawMessage("{}"), + }, + FallBackPolicy: &loadBalancingConfig{ + Name: "pick_first", + Config: json.RawMessage("{}"), + }, + EDSServiceName: testEDSName, + LrsLoadReportingServerName: &testLRSName, + }, + wantErr: false, + }, + { + // json with random balancers, and the first is not registered. + name: "manually-generated", + js: json.RawMessage(` +{ + "balancerName": "fake.foo.bar", + "childPolicy": [ + {"fake_balancer_C": {}}, + {"fake_balancer_A": {}}, + {"fake_balancer_B": {}} + ], + "fallbackPolicy": [ + {"fake_balancer_C": {}}, + {"fake_balancer_B": {}}, + {"fake_balancer_A": {}} + ], + "edsServiceName": "eds.service", + "lrsLoadReportingServerName": "lrs.server" +}`), + want: &XDSConfig{ + BalancerName: "fake.foo.bar", + ChildPolicy: &loadBalancingConfig{ + Name: "fake_balancer_A", + Config: json.RawMessage("{}"), + }, + FallBackPolicy: &loadBalancingConfig{ + Name: "fake_balancer_B", + Config: json.RawMessage("{}"), + }, + EDSServiceName: testEDSName, + LrsLoadReportingServerName: &testLRSName, + }, + wantErr: false, + }, + { + // json with no lrs server name, LrsLoadReportingServerName should + // be nil (not an empty string). + name: "no-lrs-server-name", + js: json.RawMessage(` +{ + "balancerName": "fake.foo.bar", + "edsServiceName": "eds.service" +}`), + want: &XDSConfig{ + BalancerName: "fake.foo.bar", + EDSServiceName: testEDSName, + LrsLoadReportingServerName: nil, + }, + wantErr: false, + }, } - - var i int - for i = 0; i < 10; i++ { - if edsLB := getLatestEdsBalancer(); edsLB != nil { - lb.UpdateSubConnState(expectedScStateChange.sc, balancer.SubConnState{ConnectivityState: expectedScStateChange.state}) - select { - case scsc := <-edsLB.subconnStateChange: - if !reflect.DeepEqual(scsc, expectedScStateChange) { - t.Fatalf("got subconn state change %v, want %v", scsc, expectedScStateChange) - } - case <-time.After(time.Second): - t.Fatal("haven't got subconn state change after 1s") + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + b := &edsBalancerBuilder{} + got, err := b.ParseConfig(tt.js) + if (err != nil) != tt.wantErr { + t.Errorf("edsBalancerBuilder.ParseConfig() error = %v, wantErr %v", err, tt.wantErr) + return } - break - } - time.Sleep(100 * time.Millisecond) - } - if i == 10 { - t.Fatal("edsBalancer instance has not been created and assigned to lb.xdsLB after 1s") - } - - // lbAbuilder has a per binary record what's the last balanceA created. We need to clear the record - // to make sure there's a new one created and get the pointer to it. - lbABuilder.clearLastBalancer() - cleanup() - - // switch to fallback - // fallback balancer A takes over - for i = 0; i < 10; i++ { - if fblb := lbABuilder.getLastBalancer(); fblb != nil { - lb.UpdateSubConnState(expectedScStateChange.sc, balancer.SubConnState{ConnectivityState: expectedScStateChange.state}) - select { - case scsc := <-fblb.subconnStateChange: - if !reflect.DeepEqual(scsc, expectedScStateChange) { - t.Fatalf("got subconn state change %v, want %v", scsc, expectedScStateChange) - } - case <-time.After(time.Second): - t.Fatal("haven't got subconn state change after 1s") + if !cmp.Equal(got, tt.want) { + t.Errorf(cmp.Diff(got, tt.want)) } - break - } - time.Sleep(100 * time.Millisecond) - } - if i == 10 { - t.Fatal("balancerA instance has not been created after 1s") - } -} - -func (s) TestXdsBalancerConfigParsingSelectingLBPolicy(t *testing.T) { - js := json.RawMessage(`{ -"balancerName": "fake.foo.bar", -"childPolicy": [{"fake_balancer_C": {}}, {"fake_balancer_A": {}}, {"fake_balancer_B": {}}], -"fallbackPolicy": [{"fake_balancer_C": {}}, {"fake_balancer_B": {}}, {"fake_balancer_A": {}}] -}`) - cfg, err := (&xdsBalancerBuilder{}).ParseConfig(js) - if err != nil { - t.Fatalf("unable to unmarshal balancer config into xds config: %v", err) - } - xdsCfg := cfg.(*xdsConfig) - wantChildPolicy := &loadBalancingConfig{Name: string(fakeBalancerA), Config: json.RawMessage(`{}`)} - if !reflect.DeepEqual(xdsCfg.ChildPolicy, wantChildPolicy) { - t.Fatalf("got child policy %v, want %v", xdsCfg.ChildPolicy, wantChildPolicy) - } - wantFallbackPolicy := &loadBalancingConfig{Name: string(fakeBalancerB), Config: json.RawMessage(`{}`)} - if !reflect.DeepEqual(xdsCfg.FallBackPolicy, wantFallbackPolicy) { - t.Fatalf("got fallback policy %v, want %v", xdsCfg.FallBackPolicy, wantFallbackPolicy) + }) } } - -func (s) TestXdsLoadbalancingConfigParsing(t *testing.T) { +func TestLoadbalancingConfigParsing(t *testing.T) { tests := []struct { name string s string - want *xdsConfig + want *XDSConfig }{ { name: "empty", s: "{}", - want: &xdsConfig{}, + want: &XDSConfig{}, }, { name: "success1", s: `{"childPolicy":[{"pick_first":{}}]}`, - want: &xdsConfig{ + want: &XDSConfig{ ChildPolicy: &loadBalancingConfig{ Name: "pick_first", Config: json.RawMessage(`{}`), @@ -708,7 +787,7 @@ func (s) TestXdsLoadbalancingConfigParsing(t *testing.T) { { name: "success2", s: `{"childPolicy":[{"round_robin":{}},{"pick_first":{}}]}`, - want: &xdsConfig{ + want: &XDSConfig{ ChildPolicy: &loadBalancingConfig{ Name: "round_robin", Config: json.RawMessage(`{}`), @@ -718,10 +797,37 @@ func (s) TestXdsLoadbalancingConfigParsing(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - var cfg xdsConfig + var cfg XDSConfig if err := json.Unmarshal([]byte(tt.s), &cfg); err != nil || !reflect.DeepEqual(&cfg, tt.want) { t.Errorf("test name: %s, parseFullServiceConfig() = %+v, err: %v, want %+v, ", tt.name, cfg, err, tt.want) } }) } } + +func TestEqualStringPointers(t *testing.T) { + var ( + ta1 = "test-a" + ta2 = "test-a" + tb = "test-b" + ) + tests := []struct { + name string + a *string + b *string + want bool + }{ + {"both-nil", nil, nil, true}, + {"a-non-nil", &ta1, nil, false}, + {"b-non-nil", nil, &tb, false}, + {"equal", &ta1, &ta2, true}, + {"different", &ta1, &tb, false}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := equalStringPointers(tt.a, tt.b); got != tt.want { + t.Errorf("equalStringPointers() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/vendor/google.golang.org/grpc/xds/internal/client/bootstrap/bootstrap.go b/vendor/google.golang.org/grpc/xds/internal/client/bootstrap/bootstrap.go new file mode 100644 index 00000000000..2472b1f1b0c --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/client/bootstrap/bootstrap.go @@ -0,0 +1,160 @@ +/* + * + * 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. + * + */ + +// Package bootstrap provides the functionality to initialize certain aspects +// of an xDS client by reading a bootstrap file. +package bootstrap + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "os" + + "github.com/golang/protobuf/jsonpb" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/google" + "google.golang.org/grpc/grpclog" + + corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +) + +const ( + // Environment variable which holds the name of the xDS bootstrap file. + fileEnv = "GRPC_XDS_BOOTSTRAP" + // Type name for Google default credentials. + googleDefaultCreds = "google_default" +) + +var gRPCVersion = fmt.Sprintf("gRPC-Go %s", grpc.Version) + +// For overriding in unit tests. +var fileReadFunc = ioutil.ReadFile + +// Config provides the xDS client with several key bits of information that it +// requires in its interaction with an xDS server. The Config is initialized +// from the bootstrap file. +type Config struct { + // BalancerName is the name of the xDS server to connect to. + BalancerName string + // Creds contains the credentials to be used while talking to the xDS + // server, as a grpc.DialOption. + Creds grpc.DialOption + // NodeProto contains the node proto to be used in xDS requests. + NodeProto *corepb.Node +} + +type channelCreds struct { + Type string `json:"type"` + Config json.RawMessage `json:"config"` +} + +type xdsServer struct { + ServerURI string `json:"server_uri"` + ChannelCreds []channelCreds `json:"channel_creds"` +} + +// NewConfig returns a new instance of Config initialized by reading the +// bootstrap file found at ${GRPC_XDS_BOOTSTRAP}. +// +// The format of the bootstrap file will be as follows: +// { +// "xds_server": { +// "server_uri": , +// "channel_creds": [ +// { +// "type": , +// "config": +// } +// ] +// }, +// "node": +// } +// +// Currently, we support exactly one type of credential, which is +// "google_default", where we use the host's default certs for transport +// credentials and a Google oauth token for call credentials. +// +// This function tries to process as much of the bootstrap file as possible (in +// the presence of the errors) and may return a Config object with certain +// fields left unspecified, in which case the caller should use some sane +// defaults. +func NewConfig() *Config { + config := &Config{} + + fName, ok := os.LookupEnv(fileEnv) + if !ok { + grpclog.Errorf("xds: %s environment variable not set", fileEnv) + return config + } + + grpclog.Infof("xds: Reading bootstrap file from %s", fName) + data, err := fileReadFunc(fName) + if err != nil { + grpclog.Errorf("xds: bootstrap file {%v} read failed: %v", fName, err) + return config + } + + var jsonData map[string]json.RawMessage + if err := json.Unmarshal(data, &jsonData); err != nil { + grpclog.Errorf("xds: json.Unmarshal(%v) failed during bootstrap: %v", string(data), err) + return config + } + + m := jsonpb.Unmarshaler{AllowUnknownFields: true} + for k, v := range jsonData { + switch k { + case "node": + n := &corepb.Node{} + if err := m.Unmarshal(bytes.NewReader(v), n); err != nil { + grpclog.Errorf("xds: jsonpb.Unmarshal(%v) failed during bootstrap: %v", string(v), err) + break + } + config.NodeProto = n + case "xds_server": + xs := &xdsServer{} + if err := json.Unmarshal(v, &xs); err != nil { + grpclog.Errorf("xds: json.Unmarshal(%v) failed during bootstrap: %v", string(v), err) + break + } + config.BalancerName = xs.ServerURI + for _, cc := range xs.ChannelCreds { + if cc.Type == googleDefaultCreds { + config.Creds = grpc.WithCredentialsBundle(google.NewComputeEngineCredentials()) + // We stop at the first credential type that we support. + break + } + } + default: + // Do not fail the xDS bootstrap when an unknown field is seen. + grpclog.Warningf("xds: unexpected data in bootstrap file: {%v, %v}", k, string(v)) + } + } + + // If we don't find a nodeProto in the bootstrap file, we just create an + // empty one here. That way, callers of this function can always expect + // that the NodeProto field is non-nil. + if config.NodeProto == nil { + config.NodeProto = &corepb.Node{} + } + config.NodeProto.BuildVersion = gRPCVersion + + grpclog.Infof("xds: bootstrap.NewConfig returning: %+v", config) + return config +} diff --git a/vendor/google.golang.org/grpc/xds/internal/client/bootstrap/bootstrap_test.go b/vendor/google.golang.org/grpc/xds/internal/client/bootstrap/bootstrap_test.go new file mode 100644 index 00000000000..9e73b5f3804 --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/client/bootstrap/bootstrap_test.go @@ -0,0 +1,243 @@ +/* + * + * 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. + * + */ + +package bootstrap + +import ( + "os" + "testing" + + "github.com/golang/protobuf/proto" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/google" + + corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" + structpb "github.com/golang/protobuf/ptypes/struct" +) + +var ( + nodeProto = &corepb.Node{ + Id: "ENVOY_NODE_ID", + Metadata: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "TRAFFICDIRECTOR_GRPC_HOSTNAME": { + Kind: &structpb.Value_StringValue{StringValue: "trafficdirector"}, + }, + }, + }, + BuildVersion: gRPCVersion, + } + nilCredsConfig = &Config{ + BalancerName: "trafficdirector.googleapis.com:443", + Creds: nil, + NodeProto: nodeProto, + } + nonNilCredsConfig = &Config{ + BalancerName: "trafficdirector.googleapis.com:443", + Creds: grpc.WithCredentialsBundle(google.NewComputeEngineCredentials()), + NodeProto: nodeProto, + } +) + +// TestNewConfig exercises the functionality in NewConfig with different +// bootstrap file contents. It overrides the fileReadFunc by returning +// bootstrap file contents defined in this test, instead of reading from a +// file. +func TestNewConfig(t *testing.T) { + bootstrapFileMap := map[string]string{ + "empty": "", + "badJSON": `["test": 123]`, + "emptyNodeProto": ` + { + "xds_server" : { + "server_uri": "trafficdirector.googleapis.com:443" + } + }`, + "emptyXdsServer": ` + { + "node": { + "id": "ENVOY_NODE_ID", + "metadata": { + "TRAFFICDIRECTOR_GRPC_HOSTNAME": "trafficdirector" + } + } + }`, + "unknownTopLevelFieldInFile": ` + { + "node": { + "id": "ENVOY_NODE_ID", + "metadata": { + "TRAFFICDIRECTOR_GRPC_HOSTNAME": "trafficdirector" + } + }, + "xds_server" : { + "server_uri": "trafficdirector.googleapis.com:443", + "channel_creds": [ + { "type": "not-google-default" } + ] + }, + "unknownField": "foobar" + }`, + "unknownFieldInNodeProto": ` + { + "node": { + "id": "ENVOY_NODE_ID", + "unknownField": "foobar", + "metadata": { + "TRAFFICDIRECTOR_GRPC_HOSTNAME": "trafficdirector" + } + } + }`, + "unknownFieldInXdsServer": ` + { + "node": { + "id": "ENVOY_NODE_ID", + "metadata": { + "TRAFFICDIRECTOR_GRPC_HOSTNAME": "trafficdirector" + } + }, + "xds_server" : { + "server_uri": "trafficdirector.googleapis.com:443", + "channel_creds": [ + { "type": "not-google-default" } + ], + "unknownField": "foobar" + } + }`, + "emptyChannelCreds": ` + { + "node": { + "id": "ENVOY_NODE_ID", + "metadata": { + "TRAFFICDIRECTOR_GRPC_HOSTNAME": "trafficdirector" + } + }, + "xds_server" : { + "server_uri": "trafficdirector.googleapis.com:443" + } + }`, + "nonGoogleDefaultCreds": ` + { + "node": { + "id": "ENVOY_NODE_ID", + "metadata": { + "TRAFFICDIRECTOR_GRPC_HOSTNAME": "trafficdirector" + } + }, + "xds_server" : { + "server_uri": "trafficdirector.googleapis.com:443", + "channel_creds": [ + { "type": "not-google-default" } + ] + } + }`, + "multipleChannelCreds": ` + { + "node": { + "id": "ENVOY_NODE_ID", + "metadata": { + "TRAFFICDIRECTOR_GRPC_HOSTNAME": "trafficdirector" + } + }, + "xds_server" : { + "server_uri": "trafficdirector.googleapis.com:443", + "channel_creds": [ + { "type": "not-google-default" }, + { "type": "google_default" } + ] + } + }`, + "goodBootstrap": ` + { + "node": { + "id": "ENVOY_NODE_ID", + "metadata": { + "TRAFFICDIRECTOR_GRPC_HOSTNAME": "trafficdirector" + } + }, + "xds_server" : { + "server_uri": "trafficdirector.googleapis.com:443", + "channel_creds": [ + { "type": "google_default" } + ] + } + }`, + } + + oldFileReadFunc := fileReadFunc + fileReadFunc = func(name string) ([]byte, error) { + if b, ok := bootstrapFileMap[name]; ok { + return []byte(b), nil + } + return nil, os.ErrNotExist + } + defer func() { + fileReadFunc = oldFileReadFunc + os.Unsetenv(fileEnv) + }() + + tests := []struct { + name string + wantConfig *Config + }{ + {"nonExistentBootstrapFile", &Config{}}, + {"empty", &Config{}}, + {"badJSON", &Config{}}, + { + "emptyNodeProto", + &Config{ + BalancerName: "trafficdirector.googleapis.com:443", + NodeProto: &corepb.Node{BuildVersion: gRPCVersion}, + }, + }, + {"emptyXdsServer", &Config{NodeProto: nodeProto}}, + {"unknownTopLevelFieldInFile", nilCredsConfig}, + {"unknownFieldInNodeProto", &Config{NodeProto: nodeProto}}, + {"unknownFieldInXdsServer", nilCredsConfig}, + {"emptyChannelCreds", nilCredsConfig}, + {"nonGoogleDefaultCreds", nilCredsConfig}, + {"multipleChannelCreds", nonNilCredsConfig}, + {"goodBootstrap", nonNilCredsConfig}, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + if err := os.Setenv(fileEnv, test.name); err != nil { + t.Fatalf("os.Setenv(%s, %s) failed with error: %v", fileEnv, test.name, err) + } + config := NewConfig() + if config.BalancerName != test.wantConfig.BalancerName { + t.Errorf("config.BalancerName is %s, want %s", config.BalancerName, test.wantConfig.BalancerName) + } + if !proto.Equal(config.NodeProto, test.wantConfig.NodeProto) { + t.Errorf("config.NodeProto is %#v, want %#v", config.NodeProto, test.wantConfig.NodeProto) + } + if (config.Creds != nil) != (test.wantConfig.Creds != nil) { + t.Errorf("config.Creds is %#v, want %#v", config.Creds, test.wantConfig.Creds) + } + }) + } +} + +func TestNewConfigEnvNotSet(t *testing.T) { + os.Unsetenv(fileEnv) + wantConfig := Config{} + if config := NewConfig(); *config != wantConfig { + t.Errorf("NewConfig() returned : %#v, wanted an empty Config object", config) + } +} diff --git a/vendor/google.golang.org/grpc/xds/internal/client/cds.go b/vendor/google.golang.org/grpc/xds/internal/client/cds.go new file mode 100644 index 00000000000..a0ffda21e6a --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/client/cds.go @@ -0,0 +1,91 @@ +/* + * + * 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. + * + */ + +package client + +import ( + "fmt" + + xdspb "github.com/envoyproxy/go-control-plane/envoy/api/v2" + "github.com/golang/protobuf/ptypes" +) + +// handleCDSResponse processes an CDS response received from the xDS server. On +// receipt of a good response, it also invokes the registered watcher callback. +func (v2c *v2Client) handleCDSResponse(resp *xdspb.DiscoveryResponse) error { + v2c.mu.Lock() + defer v2c.mu.Unlock() + + wi := v2c.watchMap[cdsURL] + if wi == nil { + return fmt.Errorf("xds: no CDS watcher found when handling CDS response: %+v", resp) + } + + var returnUpdate CDSUpdate + localCache := make(map[string]CDSUpdate) + for _, r := range resp.GetResources() { + var resource ptypes.DynamicAny + if err := ptypes.UnmarshalAny(r, &resource); err != nil { + return fmt.Errorf("xds: failed to unmarshal resource in CDS response: %v", err) + } + cluster, ok := resource.Message.(*xdspb.Cluster) + if !ok { + return fmt.Errorf("xds: unexpected resource type: %T in CDS response", resource.Message) + } + update, err := validateCluster(cluster) + if err != nil { + return err + } + + // If the Cluster message in the CDS response did not contain a + // serviceName, we will just use the clusterName for EDS. + if update.ServiceName == "" { + update.ServiceName = cluster.GetName() + } + localCache[cluster.GetName()] = update + if cluster.GetName() == wi.target[0] { + returnUpdate = update + } + } + v2c.cdsCache = localCache + + var err error + if returnUpdate.ServiceName == "" { + err = fmt.Errorf("xds: CDS target %s not found in received response %+v", wi.target, resp) + } + wi.stopTimer() + wi.callback.(cdsCallback)(returnUpdate, err) + return nil +} + +func validateCluster(cluster *xdspb.Cluster) (CDSUpdate, error) { + emptyUpdate := CDSUpdate{ServiceName: "", EnableLRS: false} + switch { + case cluster.GetType() != xdspb.Cluster_EDS: + return emptyUpdate, fmt.Errorf("xds: unexpected cluster type %v in response: %+v", cluster.GetType(), cluster) + case cluster.GetEdsClusterConfig().GetEdsConfig().GetAds() == nil: + return emptyUpdate, fmt.Errorf("xds: unexpected edsConfig in response: %+v", cluster) + case cluster.GetLbPolicy() != xdspb.Cluster_ROUND_ROBIN: + return emptyUpdate, fmt.Errorf("xds: unexpected lbPolicy %v in response: %+v", cluster.GetLbPolicy(), cluster) + } + + return CDSUpdate{ + ServiceName: cluster.GetEdsClusterConfig().GetServiceName(), + EnableLRS: cluster.GetLrsServer().GetSelf() != nil, + }, nil +} diff --git a/vendor/google.golang.org/grpc/xds/internal/client/cds_test.go b/vendor/google.golang.org/grpc/xds/internal/client/cds_test.go new file mode 100644 index 00000000000..025e8a55e96 --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/client/cds_test.go @@ -0,0 +1,539 @@ +/* + * + * 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. + * + */ + +package client + +import ( + "errors" + "fmt" + "reflect" + "testing" + "time" + + xdspb "github.com/envoyproxy/go-control-plane/envoy/api/v2" + corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" + "github.com/golang/protobuf/proto" + anypb "github.com/golang/protobuf/ptypes/any" + "google.golang.org/grpc/xds/internal/client/fakexds" +) + +const ( + clusterName1 = "foo-cluster" + clusterName2 = "bar-cluster" + serviceName1 = "foo-service" + serviceName2 = "bar-service" +) + +func (v2c *v2Client) cloneCDSCacheForTesting() map[string]CDSUpdate { + v2c.mu.Lock() + defer v2c.mu.Unlock() + + cloneCache := make(map[string]CDSUpdate) + for k, v := range v2c.cdsCache { + cloneCache[k] = v + } + return cloneCache +} + +func TestValidateCluster(t *testing.T) { + emptyUpdate := CDSUpdate{ServiceName: "", EnableLRS: false} + tests := []struct { + name string + cluster *xdspb.Cluster + wantUpdate CDSUpdate + wantErr bool + }{ + { + name: "non-eds-cluster-type", + cluster: &xdspb.Cluster{ + ClusterDiscoveryType: &xdspb.Cluster_Type{Type: xdspb.Cluster_STATIC}, + EdsClusterConfig: &xdspb.Cluster_EdsClusterConfig{ + EdsConfig: &corepb.ConfigSource{ + ConfigSourceSpecifier: &corepb.ConfigSource_Ads{ + Ads: &corepb.AggregatedConfigSource{}, + }, + }, + }, + LbPolicy: xdspb.Cluster_LEAST_REQUEST, + }, + wantUpdate: emptyUpdate, + wantErr: true, + }, + { + name: "no-eds-config", + cluster: &xdspb.Cluster{ + ClusterDiscoveryType: &xdspb.Cluster_Type{Type: xdspb.Cluster_EDS}, + LbPolicy: xdspb.Cluster_ROUND_ROBIN, + }, + wantUpdate: emptyUpdate, + wantErr: true, + }, + { + name: "no-ads-config-source", + cluster: &xdspb.Cluster{ + ClusterDiscoveryType: &xdspb.Cluster_Type{Type: xdspb.Cluster_EDS}, + EdsClusterConfig: &xdspb.Cluster_EdsClusterConfig{}, + LbPolicy: xdspb.Cluster_ROUND_ROBIN, + }, + wantUpdate: emptyUpdate, + wantErr: true, + }, + { + name: "non-round-robin-lb-policy", + cluster: &xdspb.Cluster{ + ClusterDiscoveryType: &xdspb.Cluster_Type{Type: xdspb.Cluster_EDS}, + EdsClusterConfig: &xdspb.Cluster_EdsClusterConfig{ + EdsConfig: &corepb.ConfigSource{ + ConfigSourceSpecifier: &corepb.ConfigSource_Ads{ + Ads: &corepb.AggregatedConfigSource{}, + }, + }, + }, + LbPolicy: xdspb.Cluster_LEAST_REQUEST, + }, + wantUpdate: emptyUpdate, + wantErr: true, + }, + { + name: "happy-case-no-service-name-no-lrs", + cluster: &xdspb.Cluster{ + ClusterDiscoveryType: &xdspb.Cluster_Type{Type: xdspb.Cluster_EDS}, + EdsClusterConfig: &xdspb.Cluster_EdsClusterConfig{ + EdsConfig: &corepb.ConfigSource{ + ConfigSourceSpecifier: &corepb.ConfigSource_Ads{ + Ads: &corepb.AggregatedConfigSource{}, + }, + }, + }, + LbPolicy: xdspb.Cluster_ROUND_ROBIN, + }, + wantUpdate: emptyUpdate, + }, + { + name: "happy-case-no-lrs", + cluster: &xdspb.Cluster{ + ClusterDiscoveryType: &xdspb.Cluster_Type{Type: xdspb.Cluster_EDS}, + EdsClusterConfig: &xdspb.Cluster_EdsClusterConfig{ + EdsConfig: &corepb.ConfigSource{ + ConfigSourceSpecifier: &corepb.ConfigSource_Ads{ + Ads: &corepb.AggregatedConfigSource{}, + }, + }, + ServiceName: serviceName1, + }, + LbPolicy: xdspb.Cluster_ROUND_ROBIN, + }, + wantUpdate: CDSUpdate{ServiceName: serviceName1, EnableLRS: false}, + }, + { + name: "happiest-case", + cluster: goodCluster1, + wantUpdate: CDSUpdate{ServiceName: serviceName1, EnableLRS: true}, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + gotUpdate, gotErr := validateCluster(test.cluster) + if (gotErr != nil) != test.wantErr { + t.Errorf("validateCluster(%+v) returned error: %v, wantErr: %v", test.cluster, gotErr, test.wantErr) + } + if !reflect.DeepEqual(gotUpdate, test.wantUpdate) { + t.Errorf("validateCluster(%+v) = %v, want: %v", test.cluster, gotUpdate, test.wantUpdate) + } + }) + } +} + +// TestCDSHandleResponse starts a fake xDS server, makes a ClientConn to it, +// and creates a v2Client using it. Then, it registers a CDS watcher and tests +// different CDS responses. +func TestCDSHandleResponse(t *testing.T) { + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) + defer v2c.close() + + tests := []struct { + name string + cdsResponse *xdspb.DiscoveryResponse + wantErr bool + wantUpdate *CDSUpdate + wantUpdateErr bool + }{ + // Badly marshaled CDS response. + { + name: "badly-marshaled-response", + cdsResponse: badlyMarshaledCDSResponse, + wantErr: true, + wantUpdate: nil, + wantUpdateErr: false, + }, + // Response does not contain Cluster proto. + { + name: "no-cluster-proto-in-response", + cdsResponse: badResourceTypeInLDSResponse, + wantErr: true, + wantUpdate: nil, + wantUpdateErr: false, + }, + // Response contains no clusters. + { + name: "no-cluster", + cdsResponse: &xdspb.DiscoveryResponse{}, + wantErr: false, + wantUpdate: &CDSUpdate{}, + wantUpdateErr: true, + }, + // Response contains one good cluster we are not interested in. + { + name: "one-uninteresting-cluster", + cdsResponse: goodCDSResponse2, + wantErr: false, + wantUpdate: &CDSUpdate{}, + wantUpdateErr: true, + }, + // Response contains one cluster and it is good. + { + name: "one-good-cluster", + cdsResponse: goodCDSResponse1, + wantErr: false, + wantUpdate: &CDSUpdate{ServiceName: serviceName1, EnableLRS: true}, + wantUpdateErr: false, + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + gotUpdateCh := make(chan CDSUpdate, 1) + gotUpdateErrCh := make(chan error, 1) + + // Register a watcher, to trigger the v2Client to send an CDS request. + cancelWatch := v2c.watchCDS(clusterName1, func(u CDSUpdate, err error) { + t.Logf("in v2c.watchCDS callback, CDSUpdate: %+v, err: %v", u, err) + gotUpdateCh <- u + gotUpdateErrCh <- err + }) + + // Wait till the request makes it to the fakeServer. This ensures that + // the watch request has been processed by the v2Client. + <-fakeServer.RequestChan + + // Directly push the response through a call to handleLDSResponse, + // thereby bypassing the fakeServer. + if err := v2c.handleCDSResponse(test.cdsResponse); (err != nil) != test.wantErr { + t.Fatalf("v2c.handleCDSResponse() returned err: %v, wantErr: %v", err, test.wantErr) + } + + // If the test needs the callback to be invoked, verify the update and + // error pushed to the callback. + if test.wantUpdate != nil { + timer := time.NewTimer(defaultTestTimeout) + select { + case <-timer.C: + t.Fatal("Timeout when expecting CDS update") + case gotUpdate := <-gotUpdateCh: + timer.Stop() + if !reflect.DeepEqual(gotUpdate, *test.wantUpdate) { + t.Fatalf("got CDS update : %+v, want %+v", gotUpdate, test.wantUpdate) + } + } + // Since the callback that we registered pushes to both channels at + // the same time, this channel read should return immediately. + gotUpdateErr := <-gotUpdateErrCh + if (gotUpdateErr != nil) != test.wantUpdateErr { + t.Fatalf("got CDS update error {%v}, wantErr: %v", gotUpdateErr, test.wantUpdateErr) + } + } + cancelWatch() + }) + } +} + +// TestCDSHandleResponseWithoutWatch tests the case where the v2Client receives +// a CDS response without a registered watcher. +func TestCDSHandleResponseWithoutWatch(t *testing.T) { + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) + defer v2c.close() + + if v2c.handleCDSResponse(goodCDSResponse1) == nil { + t.Fatal("v2c.handleCDSResponse() succeeded, should have failed") + } +} + +// cdsTestOp contains all data related to one particular test operation. Not +// all fields make sense for all tests. +type cdsTestOp struct { + // target is the resource name to watch for. + target string + // responseToSend is the xDS response sent to the client + responseToSend *fakexds.Response + // wantOpErr specfies whether the main operation should return an error. + wantOpErr bool + // wantCDSCache is the expected rdsCache at the end of an operation. + wantCDSCache map[string]CDSUpdate + // wantWatchCallback specifies if the watch callback should be invoked. + wantWatchCallback bool +} + +// testCDSCaching is a helper function which starts a fake xDS server, makes a +// ClientConn to it, creates a v2Client using it. It then reads a bunch of +// test operations to be performed from cdsTestOps and returns error, if any, +// on the provided error channel. This is executed in a separate goroutine. +func testCDSCaching(t *testing.T, cdsTestOps []cdsTestOp, errCh chan error) { + t.Helper() + + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) + defer v2c.close() + t.Log("Started xds v2Client...") + + callbackCh := make(chan struct{}, 1) + for _, cdsTestOp := range cdsTestOps { + // Register a watcher if required, and use a channel to signal the + // successful invocation of the callback. + if cdsTestOp.target != "" { + v2c.watchCDS(cdsTestOp.target, func(u CDSUpdate, err error) { + t.Logf("Received callback with CDSUpdate {%+v} and error {%v}", u, err) + callbackCh <- struct{}{} + }) + t.Logf("Registered a watcher for CDS target: %v...", cdsTestOp.target) + + // Wait till the request makes it to the fakeServer. This ensures that + // the watch request has been processed by the v2Client. + <-fakeServer.RequestChan + t.Log("FakeServer received request...") + } + + // Directly push the response through a call to handleCDSResponse, + // thereby bypassing the fakeServer. + if cdsTestOp.responseToSend != nil { + if err := v2c.handleCDSResponse(cdsTestOp.responseToSend.Resp); (err != nil) != cdsTestOp.wantOpErr { + errCh <- fmt.Errorf("v2c.handleCDSResponse() returned err: %v", err) + return + } + } + + // If the test needs the callback to be invoked, just verify that + // it was invoked. Since we verify the contents of the cache, it's + // ok not to verify the contents of the callback. + if cdsTestOp.wantWatchCallback { + <-callbackCh + } + + if !reflect.DeepEqual(v2c.cloneCDSCacheForTesting(), cdsTestOp.wantCDSCache) { + errCh <- fmt.Errorf("gotCDSCache: %v, wantCDSCache: %v", v2c.rdsCache, cdsTestOp.wantCDSCache) + return + } + } + t.Log("Completed all test ops successfully...") + errCh <- nil +} + +// TestCDSCaching tests some end-to-end CDS flows using a fake xDS server, and +// verifies the CDS data cached at the v2Client. +func TestCDSCaching(t *testing.T) { + errCh := make(chan error, 1) + ops := []cdsTestOp{ + // Add an CDS watch for a cluster name (clusterName1), which returns one + // matching resource in the response. + { + target: clusterName1, + responseToSend: &fakexds.Response{Resp: goodCDSResponse1}, + wantCDSCache: map[string]CDSUpdate{ + clusterName1: {serviceName1, true}, + }, + wantWatchCallback: true, + }, + // Push an CDS response which contains a new resource (apart from the + // one received in the previous response). This should be cached. + { + responseToSend: &fakexds.Response{Resp: cdsResponseWithMultipleResources}, + wantCDSCache: map[string]CDSUpdate{ + clusterName1: {serviceName1, true}, + clusterName2: {serviceName2, false}, + }, + wantWatchCallback: true, + }, + // Switch the watch target to clusterName2, which was already cached. No + // response is received from the server (as expected), but we want the + // callback to be invoked with the new serviceName. + { + target: clusterName2, + wantCDSCache: map[string]CDSUpdate{ + clusterName1: {serviceName1, true}, + clusterName2: {serviceName2, false}, + }, + wantWatchCallback: true, + }, + // Push an empty CDS response. This should clear the cache. + { + responseToSend: &fakexds.Response{Resp: &xdspb.DiscoveryResponse{TypeUrl: cdsURL}}, + wantOpErr: false, + wantCDSCache: map[string]CDSUpdate{}, + wantWatchCallback: true, + }, + } + go testCDSCaching(t, ops, errCh) + + timer := time.NewTimer(defaultTestTimeout) + select { + case <-timer.C: + t.Fatal("Timeout when expecting CDS update") + case err := <-errCh: + timer.Stop() + if err != nil { + t.Fatal(err) + } + } +} + +// TestCDSWatchExpiryTimer tests the case where the client does not receive an +// CDS response for the request that it sends out. We want the watch callback +// to be invoked with an error once the watchExpiryTimer fires. +func TestCDSWatchExpiryTimer(t *testing.T) { + oldWatchExpiryTimeout := defaultWatchExpiryTimeout + defaultWatchExpiryTimeout = 1 * time.Second + defer func() { + defaultWatchExpiryTimeout = oldWatchExpiryTimeout + }() + + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) + defer v2c.close() + t.Log("Started xds v2Client...") + + cdsCallbackCh := make(chan error, 1) + v2c.watchCDS(clusterName1, func(u CDSUpdate, err error) { + t.Logf("Received callback with CDSUpdate {%+v} and error {%v}", u, err) + if u.ServiceName != "" { + cdsCallbackCh <- fmt.Errorf("received serviceName %v in cdsCallback, wanted empty string", u.ServiceName) + } + if err == nil { + cdsCallbackCh <- errors.New("received nil error in cdsCallback") + } + cdsCallbackCh <- nil + }) + <-fakeServer.RequestChan + + timer := time.NewTimer(2 * time.Second) + select { + case <-timer.C: + t.Fatalf("Timeout expired when expecting CDS update") + case err := <-cdsCallbackCh: + timer.Stop() + if err != nil { + t.Fatal(err) + } + } +} + +var ( + badlyMarshaledCDSResponse = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + { + TypeUrl: cdsURL, + Value: []byte{1, 2, 3, 4}, + }, + }, + TypeUrl: cdsURL, + } + goodCluster1 = &xdspb.Cluster{ + Name: clusterName1, + ClusterDiscoveryType: &xdspb.Cluster_Type{Type: xdspb.Cluster_EDS}, + EdsClusterConfig: &xdspb.Cluster_EdsClusterConfig{ + EdsConfig: &corepb.ConfigSource{ + ConfigSourceSpecifier: &corepb.ConfigSource_Ads{ + Ads: &corepb.AggregatedConfigSource{}, + }, + }, + ServiceName: serviceName1, + }, + LbPolicy: xdspb.Cluster_ROUND_ROBIN, + LrsServer: &corepb.ConfigSource{ + ConfigSourceSpecifier: &corepb.ConfigSource_Self{ + Self: &corepb.SelfConfigSource{}, + }, + }, + } + marshaledCluster1, _ = proto.Marshal(goodCluster1) + goodCluster2 = &xdspb.Cluster{ + Name: clusterName2, + ClusterDiscoveryType: &xdspb.Cluster_Type{Type: xdspb.Cluster_EDS}, + EdsClusterConfig: &xdspb.Cluster_EdsClusterConfig{ + EdsConfig: &corepb.ConfigSource{ + ConfigSourceSpecifier: &corepb.ConfigSource_Ads{ + Ads: &corepb.AggregatedConfigSource{}, + }, + }, + ServiceName: serviceName2, + }, + LbPolicy: xdspb.Cluster_ROUND_ROBIN, + } + marshaledCluster2, _ = proto.Marshal(goodCluster2) + goodCDSResponse1 = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + { + TypeUrl: cdsURL, + Value: marshaledCluster1, + }, + }, + TypeUrl: cdsURL, + } + goodCDSResponse2 = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + { + TypeUrl: cdsURL, + Value: marshaledCluster2, + }, + }, + TypeUrl: cdsURL, + } + cdsResponseWithMultipleResources = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + { + TypeUrl: cdsURL, + Value: marshaledCluster1, + }, + { + TypeUrl: cdsURL, + Value: marshaledCluster2, + }, + }, + TypeUrl: cdsURL, + } +) diff --git a/vendor/google.golang.org/grpc/xds/internal/client/client.go b/vendor/google.golang.org/grpc/xds/internal/client/client.go new file mode 100644 index 00000000000..67efc4474d3 --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/client/client.go @@ -0,0 +1,166 @@ +/* + * + * 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. + * + */ + +// Package client implementation a full fledged gRPC client for the xDS API +// used by the xds resolver and balancer implementations. +package client + +import ( + "errors" + "fmt" + "sync" + + "google.golang.org/grpc" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal/backoff" + "google.golang.org/grpc/xds/internal/client/bootstrap" +) + +// Options provides all parameters required for the creation of an xDS client. +type Options struct { + // Config contains a fully populated bootstrap config. It is the + // responsibility of the caller to use some sane defaults here if the + // bootstrap process returned with certain fields left unspecified. + Config bootstrap.Config + // DialOpts contains dial options to be used when dialing the xDS server. + DialOpts []grpc.DialOption +} + +// Client is a full fledged gRPC client which queries a set of discovery APIs +// (collectively termed as xDS) on a remote management server, to discover +// various dynamic resources. A single client object will be shared by the xds +// resolver and balancer implementations. +type Client struct { + opts Options + cc *grpc.ClientConn // Connection to the xDS server + v2c *v2Client // Actual xDS client implementation using the v2 API + + mu sync.Mutex + serviceCallback func(ServiceUpdate, error) + ldsCancel func() + rdsCancel func() +} + +// New returns a new xdsClient configured with opts. +func New(opts Options) (*Client, error) { + switch { + case opts.Config.BalancerName == "": + return nil, errors.New("xds: no xds_server name provided in options") + case opts.Config.Creds == nil: + return nil, errors.New("xds: no credentials provided in options") + case opts.Config.NodeProto == nil: + return nil, errors.New("xds: no node_proto provided in options") + } + + dopts := append([]grpc.DialOption{opts.Config.Creds}, opts.DialOpts...) + cc, err := grpc.Dial(opts.Config.BalancerName, dopts...) + if err != nil { + // An error from a non-blocking dial indicates something serious. + return nil, fmt.Errorf("xds: failed to dial balancer {%s}: %v", opts.Config.BalancerName, err) + } + + c := &Client{ + opts: opts, + cc: cc, + v2c: newV2Client(cc, opts.Config.NodeProto, backoff.DefaultExponential.Backoff), + } + return c, nil +} + +// Close closes the gRPC connection to the xDS server. +func (c *Client) Close() { + // TODO: Should we invoke the registered callbacks here with an error that + // the client is closed? + c.v2c.close() + c.cc.Close() +} + +// ServiceUpdate contains update about the service. +type ServiceUpdate struct { + Cluster string +} + +// handleLDSUpdate is the LDS watcher callback we registered with the v2Client. +func (c *Client) handleLDSUpdate(u ldsUpdate, err error) { + grpclog.Infof("xds: client received LDS update: %+v, err: %v", u, err) + if err != nil { + c.mu.Lock() + if c.serviceCallback != nil { + c.serviceCallback(ServiceUpdate{}, err) + } + c.mu.Unlock() + return + } + + c.mu.Lock() + c.rdsCancel = c.v2c.watchRDS(u.routeName, c.handleRDSUpdate) + c.mu.Unlock() +} + +// handleRDSUpdate is the RDS watcher callback we registered with the v2Client. +func (c *Client) handleRDSUpdate(u rdsUpdate, err error) { + grpclog.Infof("xds: client received RDS update: %+v, err: %v", u, err) + if err != nil { + c.mu.Lock() + if c.serviceCallback != nil { + c.serviceCallback(ServiceUpdate{}, err) + } + c.mu.Unlock() + return + } + + c.mu.Lock() + if c.serviceCallback != nil { + c.serviceCallback(ServiceUpdate{Cluster: u.clusterName}, nil) + } + c.mu.Unlock() +} + +// WatchService uses LDS and RDS protocols to discover information about the +// provided serviceName. +func (c *Client) WatchService(serviceName string, callback func(ServiceUpdate, error)) (cancel func()) { + // TODO: Error out early if the client is closed. Ideally, this should + // never be called after the client is closed though. + c.mu.Lock() + c.serviceCallback = callback + c.ldsCancel = c.v2c.watchLDS(serviceName, c.handleLDSUpdate) + c.mu.Unlock() + + return func() { + c.mu.Lock() + c.serviceCallback = nil + if c.ldsCancel != nil { + c.ldsCancel() + } + if c.rdsCancel != nil { + c.rdsCancel() + } + c.mu.Unlock() + } +} + +// WatchCluster uses CDS to discover information about the provided +// clusterName. +func (c *Client) WatchCluster(clusterName string, cdsCb func(CDSUpdate, error)) (cancel func()) { + return c.v2c.watchCDS(clusterName, cdsCb) +} + +// WatchEDS watches the ghost. +func (c *Client) WatchEDS(clusterName string, edsCb func(*EDSUpdate, error)) (cancel func()) { + return c.v2c.watchEDS(clusterName, edsCb) +} diff --git a/vendor/google.golang.org/grpc/xds/internal/client/client_loadreport.go b/vendor/google.golang.org/grpc/xds/internal/client/client_loadreport.go new file mode 100644 index 00000000000..09313ba2c4a --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/client/client_loadreport.go @@ -0,0 +1,63 @@ +/* + * + * 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. + */ + +package client + +import ( + "context" + + "google.golang.org/grpc" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/xds/internal/balancer/lrs" +) + +// ReportLoad sends the load of the given clusterName from loadStore to the +// given server. If the server is not an empty string, and is different from the +// xds server, a new ClientConn will be created. +// +// The same options used for creating the Client will be used (including +// NodeProto, and dial options if necessary). +// +// It returns a function to cancel the load reporting stream. If server is +// different from xds server, the ClientConn will also be closed. +func (c *Client) ReportLoad(server string, clusterName string, loadStore lrs.Store) func() { + var ( + cc *grpc.ClientConn + closeCC bool + ) + if server == "" || server == c.opts.Config.BalancerName { + cc = c.cc + } else { + dopts := append([]grpc.DialOption{c.opts.Config.Creds}, c.opts.DialOpts...) + ccNew, err := grpc.Dial(server, dopts...) + if err != nil { + // An error from a non-blocking dial indicates something serious. + grpclog.Infof("xds: failed to dial load report server {%s}: %v", server, err) + return func() {} + } + cc = ccNew + closeCC = true + } + ctx, cancel := context.WithCancel(context.Background()) + go loadStore.ReportTo(ctx, c.cc, clusterName, c.opts.Config.NodeProto) + return func() { + cancel() + if closeCC { + cc.Close() + } + } +} diff --git a/vendor/google.golang.org/grpc/xds/internal/client/client_test.go b/vendor/google.golang.org/grpc/xds/internal/client/client_test.go new file mode 100644 index 00000000000..f9edff4f1e6 --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/client/client_test.go @@ -0,0 +1,295 @@ +/* + * + * 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. + * + */ + +package client + +import ( + "errors" + "fmt" + "testing" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/xds/internal/client/bootstrap" + "google.golang.org/grpc/xds/internal/client/fakexds" + + corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +) + +func clientOpts(balancerName string) Options { + return Options{ + Config: bootstrap.Config{ + BalancerName: balancerName, + Creds: grpc.WithInsecure(), + NodeProto: &corepb.Node{}, + }, + // WithTimeout is deprecated. But we are OK to call it here from the + // test, so we clearly know that the dial failed. + DialOpts: []grpc.DialOption{grpc.WithTimeout(5 * time.Second), grpc.WithBlock()}, + } +} + +func TestNew(t *testing.T) { + fakeServer, cleanup := fakexds.StartServer(t) + defer cleanup() + + tests := []struct { + name string + opts Options + wantErr bool + }{ + {name: "empty-opts", opts: Options{}, wantErr: true}, + { + name: "empty-balancer-name", + opts: Options{ + Config: bootstrap.Config{ + Creds: grpc.WithInsecure(), + NodeProto: &corepb.Node{}, + }, + }, + wantErr: true, + }, + { + name: "empty-dial-creds", + opts: Options{ + Config: bootstrap.Config{ + BalancerName: "dummy", + NodeProto: &corepb.Node{}, + }, + }, + wantErr: true, + }, + { + name: "empty-node-proto", + opts: Options{ + Config: bootstrap.Config{ + BalancerName: "dummy", + Creds: grpc.WithInsecure(), + }, + }, + wantErr: true, + }, + { + name: "happy-case", + opts: clientOpts(fakeServer.Address), + wantErr: false, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + c, err := New(test.opts) + if err == nil { + defer c.Close() + } + if (err != nil) != test.wantErr { + t.Fatalf("New(%+v) = %v, wantErr: %v", test.opts, err, test.wantErr) + } + }) + } +} + +// TestWatchService tests the happy case of registering a watcher for +// service updates and receiving a good update. +func TestWatchService(t *testing.T) { + fakeServer, cleanup := fakexds.StartServer(t) + defer cleanup() + + xdsClient, err := New(clientOpts(fakeServer.Address)) + if err != nil { + t.Fatalf("New returned error: %v", err) + } + defer xdsClient.Close() + t.Log("Created an xdsClient...") + + callbackCh := make(chan error, 1) + cancelWatch := xdsClient.WatchService(goodLDSTarget1, func(su ServiceUpdate, err error) { + if err != nil { + callbackCh <- fmt.Errorf("xdsClient.WatchService returned error: %v", err) + return + } + if su.Cluster != goodClusterName1 { + callbackCh <- fmt.Errorf("got clusterName: %+v, want clusterName: %+v", su.Cluster, goodClusterName1) + return + } + callbackCh <- nil + }) + defer cancelWatch() + t.Log("Registered a watcher for service updates...") + + // Make the fakeServer send LDS and RDS responses. + <-fakeServer.RequestChan + fakeServer.ResponseChan <- &fakexds.Response{Resp: goodLDSResponse1} + <-fakeServer.RequestChan + fakeServer.ResponseChan <- &fakexds.Response{Resp: goodRDSResponse1} + + timer := time.NewTimer(defaultTestTimeout) + select { + case <-timer.C: + t.Fatal("Timeout when expecting a service update") + case err := <-callbackCh: + timer.Stop() + if err != nil { + t.Fatal(err) + } + } +} + +// TestWatchServiceWithNoResponseFromServer tests the case where the +// xDS server does not respond to the requests being sent out as part of +// registering a service update watcher. The underlying v2Client will timeout +// and will send us an error. +func TestWatchServiceWithNoResponseFromServer(t *testing.T) { + fakeServer, cleanup := fakexds.StartServer(t) + defer cleanup() + + xdsClient, err := New(clientOpts(fakeServer.Address)) + if err != nil { + t.Fatalf("New returned error: %v", err) + } + defer xdsClient.Close() + t.Log("Created an xdsClient...") + + oldWatchExpiryTimeout := defaultWatchExpiryTimeout + defaultWatchExpiryTimeout = 1 * time.Second + defer func() { + defaultWatchExpiryTimeout = oldWatchExpiryTimeout + }() + + callbackCh := make(chan error, 1) + cancelWatch := xdsClient.WatchService(goodLDSTarget1, func(su ServiceUpdate, err error) { + if su.Cluster != "" { + callbackCh <- fmt.Errorf("got clusterName: %+v, want empty clusterName", su.Cluster) + return + } + if err == nil { + callbackCh <- errors.New("xdsClient.WatchService returned error non-nil error") + return + } + callbackCh <- nil + }) + defer cancelWatch() + t.Log("Registered a watcher for service updates...") + + // Wait for one request from the client, but send no reponses. + <-fakeServer.RequestChan + + timer := time.NewTimer(2 * time.Second) + select { + case <-timer.C: + t.Fatal("Timeout when expecting a service update") + case err := <-callbackCh: + timer.Stop() + if err != nil { + t.Fatal(err) + } + } +} + +// TestWatchServiceEmptyRDS tests the case where the underlying +// v2Client receives an empty RDS response. +func TestWatchServiceEmptyRDS(t *testing.T) { + fakeServer, cleanup := fakexds.StartServer(t) + defer cleanup() + + xdsClient, err := New(clientOpts(fakeServer.Address)) + if err != nil { + t.Fatalf("New returned error: %v", err) + } + defer xdsClient.Close() + t.Log("Created an xdsClient...") + + oldWatchExpiryTimeout := defaultWatchExpiryTimeout + defaultWatchExpiryTimeout = 1 * time.Second + defer func() { + defaultWatchExpiryTimeout = oldWatchExpiryTimeout + }() + + callbackCh := make(chan error, 1) + cancelWatch := xdsClient.WatchService(goodLDSTarget1, func(su ServiceUpdate, err error) { + if su.Cluster != "" { + callbackCh <- fmt.Errorf("got clusterName: %+v, want empty clusterName", su.Cluster) + return + } + if err == nil { + callbackCh <- errors.New("xdsClient.WatchService returned error non-nil error") + return + } + callbackCh <- nil + }) + defer cancelWatch() + t.Log("Registered a watcher for service updates...") + + // Send a good LDS response, but send an empty RDS response. + <-fakeServer.RequestChan + fakeServer.ResponseChan <- &fakexds.Response{Resp: goodLDSResponse1} + <-fakeServer.RequestChan + fakeServer.ResponseChan <- &fakexds.Response{Resp: noVirtualHostsInRDSResponse} + + timer := time.NewTimer(2 * time.Second) + select { + case <-timer.C: + t.Fatal("Timeout when expecting a service update") + case err := <-callbackCh: + timer.Stop() + if err != nil { + t.Fatal(err) + } + } +} + +// TestWatchServiceWithClientClose tests the case where xDS responses are +// received after the client is closed, and we make sure that the registered +// watcher callback is not invoked. +func TestWatchServiceWithClientClose(t *testing.T) { + fakeServer, cleanup := fakexds.StartServer(t) + defer cleanup() + + xdsClient, err := New(clientOpts(fakeServer.Address)) + if err != nil { + t.Fatalf("New returned error: %v", err) + } + defer xdsClient.Close() + t.Log("Created an xdsClient...") + + callbackCh := make(chan error, 1) + cancelWatch := xdsClient.WatchService(goodLDSTarget1, func(su ServiceUpdate, err error) { + callbackCh <- errors.New("watcher callback invoked after client close") + }) + defer cancelWatch() + t.Log("Registered a watcher for service updates...") + + // Make the fakeServer send LDS response. + <-fakeServer.RequestChan + fakeServer.ResponseChan <- &fakexds.Response{Resp: goodLDSResponse1} + + xdsClient.Close() + t.Log("Closing the xdsClient...") + + // Push an RDS response from the fakeserver + fakeServer.ResponseChan <- &fakexds.Response{Resp: goodRDSResponse1} + + timer := time.NewTimer(1 * time.Second) + select { + case <-timer.C: + // Do nothing. Success. + case err := <-callbackCh: + timer.Stop() + t.Fatal(err) + } +} diff --git a/vendor/google.golang.org/grpc/xds/internal/client/eds.go b/vendor/google.golang.org/grpc/xds/internal/client/eds.go new file mode 100644 index 00000000000..d18b598730f --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/client/eds.go @@ -0,0 +1,213 @@ +/* + * + * 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. + */ + +package client + +import ( + "fmt" + "net" + "strconv" + + xdspb "github.com/envoyproxy/go-control-plane/envoy/api/v2" + corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" + endpointpb "github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint" + typepb "github.com/envoyproxy/go-control-plane/envoy/type" + "github.com/golang/protobuf/ptypes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/xds/internal" +) + +// OverloadDropConfig contains the config to drop overloads. +type OverloadDropConfig struct { + Category string + Numerator uint32 + Denominator uint32 +} + +// EndpointHealthStatus represents the health status of an endpoint. +type EndpointHealthStatus int32 + +const ( + // EndpointHealthStatusUnknown represents HealthStatus UNKNOWN. + EndpointHealthStatusUnknown EndpointHealthStatus = iota + // EndpointHealthStatusHealthy represents HealthStatus HEALTHY. + EndpointHealthStatusHealthy + // EndpointHealthStatusUnhealthy represents HealthStatus UNHEALTHY. + EndpointHealthStatusUnhealthy + // EndpointHealthStatusDraining represents HealthStatus DRAINING. + EndpointHealthStatusDraining + // EndpointHealthStatusTimeout represents HealthStatus TIMEOUT. + EndpointHealthStatusTimeout + // EndpointHealthStatusDegraded represents HealthStatus DEGRADED. + EndpointHealthStatusDegraded +) + +// Endpoint contains information of an endpoint. +type Endpoint struct { + Address string + HealthStatus EndpointHealthStatus + Weight uint32 +} + +// Locality contains information of a locality. +type Locality struct { + Endpoints []Endpoint + ID internal.Locality + Priority uint32 + Weight uint32 +} + +// EDSUpdate contains an EDS update. +type EDSUpdate struct { + Drops []OverloadDropConfig + Localities []Locality +} + +func parseAddress(socketAddress *corepb.SocketAddress) string { + return net.JoinHostPort(socketAddress.GetAddress(), strconv.Itoa(int(socketAddress.GetPortValue()))) +} + +func parseDropPolicy(dropPolicy *xdspb.ClusterLoadAssignment_Policy_DropOverload) OverloadDropConfig { + percentage := dropPolicy.GetDropPercentage() + var ( + numerator = percentage.GetNumerator() + denominator uint32 + ) + switch percentage.GetDenominator() { + case typepb.FractionalPercent_HUNDRED: + denominator = 100 + case typepb.FractionalPercent_TEN_THOUSAND: + denominator = 10000 + case typepb.FractionalPercent_MILLION: + denominator = 1000000 + } + return OverloadDropConfig{ + Category: dropPolicy.GetCategory(), + Numerator: numerator, + Denominator: denominator, + } +} + +func parseEndpoints(lbEndpoints []*endpointpb.LbEndpoint) []Endpoint { + endpoints := make([]Endpoint, 0, len(lbEndpoints)) + for _, lbEndpoint := range lbEndpoints { + endpoints = append(endpoints, Endpoint{ + HealthStatus: EndpointHealthStatus(lbEndpoint.GetHealthStatus()), + Address: parseAddress(lbEndpoint.GetEndpoint().GetAddress().GetSocketAddress()), + Weight: lbEndpoint.GetLoadBalancingWeight().GetValue(), + }) + } + return endpoints +} + +// ParseEDSRespProto turns EDS response proto message to EDSUpdate. +// +// This is temporarily exported to be used in eds balancer, before it switches +// to use xds client. TODO: unexport. +func ParseEDSRespProto(m *xdspb.ClusterLoadAssignment) (*EDSUpdate, error) { + ret := &EDSUpdate{} + for _, dropPolicy := range m.GetPolicy().GetDropOverloads() { + ret.Drops = append(ret.Drops, parseDropPolicy(dropPolicy)) + } + priorities := make(map[uint32]struct{}) + for _, locality := range m.Endpoints { + l := locality.GetLocality() + if l == nil { + return nil, fmt.Errorf("EDS response contains a locality without ID, locality: %+v", locality) + } + lid := internal.Locality{ + Region: l.Region, + Zone: l.Zone, + SubZone: l.SubZone, + } + priority := locality.GetPriority() + priorities[priority] = struct{}{} + ret.Localities = append(ret.Localities, Locality{ + ID: lid, + Endpoints: parseEndpoints(locality.GetLbEndpoints()), + Weight: locality.GetLoadBalancingWeight().GetValue(), + Priority: priority, + }) + } + for i := 0; i < len(priorities); i++ { + if _, ok := priorities[uint32(i)]; !ok { + return nil, fmt.Errorf("priority %v missing (with different priorities %v received)", i, priorities) + } + } + return ret, nil +} + +// ParseEDSRespProtoForTesting parses EDS response, and panic if parsing fails. +// This is used by EDS balancer tests. +// +// TODO: delete this. The EDS balancer should build an EDSUpdate directly, +// instead of building and parsing a proto message. +func ParseEDSRespProtoForTesting(m *xdspb.ClusterLoadAssignment) *EDSUpdate { + u, err := ParseEDSRespProto(m) + if err != nil { + panic(err.Error()) + } + return u +} + +func (v2c *v2Client) handleEDSResponse(resp *xdspb.DiscoveryResponse) error { + v2c.mu.Lock() + defer v2c.mu.Unlock() + + wi := v2c.watchMap[edsURL] + if wi == nil { + return fmt.Errorf("xds: no EDS watcher found when handling EDS response: %+v", resp) + } + + var returnUpdate *EDSUpdate + for _, r := range resp.GetResources() { + var resource ptypes.DynamicAny + if err := ptypes.UnmarshalAny(r, &resource); err != nil { + return fmt.Errorf("xds: failed to unmarshal resource in EDS response: %v", err) + } + cla, ok := resource.Message.(*xdspb.ClusterLoadAssignment) + if !ok { + return fmt.Errorf("xds: unexpected resource type: %T in EDS response", resource.Message) + } + + if cla.GetClusterName() != wi.target[0] { + grpclog.Warningf("xds: got uninteresting EDS resource, got %s, want %s", cla.GetClusterName(), wi.target[0]) + // We won't validate the remaining resources. If one of the + // uninteresting ones is invalid, we will still ACK the response. + continue + } + + u, err := ParseEDSRespProto(cla) + if err != nil { + return err + } + + returnUpdate = u + // Break from the loop because the request resource is found. But + // this also means we won't validate the remaining resources. If one + // of the uninteresting ones is invalid, we will still ACK the + // response. + break + } + + if returnUpdate != nil { + wi.stopTimer() + wi.callback.(edsCallback)(returnUpdate, nil) + } + + return nil +} diff --git a/vendor/google.golang.org/grpc/xds/internal/client/eds_test.go b/vendor/google.golang.org/grpc/xds/internal/client/eds_test.go new file mode 100644 index 00000000000..1c75768a937 --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/client/eds_test.go @@ -0,0 +1,333 @@ +/* + * + * 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. + */ + +package client + +import ( + "errors" + "fmt" + "testing" + "time" + + xdspb "github.com/envoyproxy/go-control-plane/envoy/api/v2" + corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" + "github.com/golang/protobuf/ptypes" + anypb "github.com/golang/protobuf/ptypes/any" + "github.com/google/go-cmp/cmp" + "google.golang.org/grpc/xds/internal" + "google.golang.org/grpc/xds/internal/client/fakexds" +) + +func TestEDSParseRespProto(t *testing.T) { + tests := []struct { + name string + m *xdspb.ClusterLoadAssignment + want *EDSUpdate + wantErr bool + }{ + { + name: "missing-priority", + m: func() *xdspb.ClusterLoadAssignment { + clab0 := NewClusterLoadAssignmentBuilder("test", nil) + clab0.AddLocality("locality-1", 1, 0, []string{"addr1:314"}, nil) + clab0.AddLocality("locality-2", 1, 2, []string{"addr2:159"}, nil) + return clab0.Build() + }(), + want: nil, + wantErr: true, + }, + { + name: "missing-locality-ID", + m: func() *xdspb.ClusterLoadAssignment { + clab0 := NewClusterLoadAssignmentBuilder("test", nil) + clab0.AddLocality("", 1, 0, []string{"addr1:314"}, nil) + return clab0.Build() + }(), + want: nil, + wantErr: true, + }, + { + name: "good", + m: func() *xdspb.ClusterLoadAssignment { + clab0 := NewClusterLoadAssignmentBuilder("test", nil) + clab0.AddLocality("locality-1", 1, 1, []string{"addr1:314"}, &AddLocalityOptions{ + Health: []corepb.HealthStatus{corepb.HealthStatus_UNHEALTHY}, + Weight: []uint32{271}, + }) + clab0.AddLocality("locality-2", 1, 0, []string{"addr2:159"}, &AddLocalityOptions{ + Health: []corepb.HealthStatus{corepb.HealthStatus_DRAINING}, + Weight: []uint32{828}, + }) + return clab0.Build() + }(), + want: &EDSUpdate{ + Drops: nil, + Localities: []Locality{ + { + Endpoints: []Endpoint{{ + Address: "addr1:314", + HealthStatus: EndpointHealthStatusUnhealthy, + Weight: 271, + }}, + ID: internal.Locality{SubZone: "locality-1"}, + Priority: 1, + Weight: 1, + }, + { + Endpoints: []Endpoint{{ + Address: "addr2:159", + HealthStatus: EndpointHealthStatusDraining, + Weight: 828, + }}, + ID: internal.Locality{SubZone: "locality-2"}, + Priority: 0, + Weight: 1, + }, + }, + }, + wantErr: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := ParseEDSRespProto(tt.m) + if (err != nil) != tt.wantErr { + t.Errorf("ParseEDSRespProto() error = %v, wantErr %v", err, tt.wantErr) + return + } + if d := cmp.Diff(got, tt.want); d != "" { + t.Errorf("ParseEDSRespProto() got = %v, want %v, diff: %v", got, tt.want, d) + } + }) + } +} + +var ( + badlyMarshaledEDSResponse = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + { + TypeUrl: edsURL, + Value: []byte{1, 2, 3, 4}, + }, + }, + TypeUrl: edsURL, + } + badResourceTypeInEDSResponse = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + { + TypeUrl: httpConnManagerURL, + Value: marshaledConnMgr1, + }, + }, + TypeUrl: edsURL, + } + goodEDSResponse1 = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + func() *anypb.Any { + clab0 := NewClusterLoadAssignmentBuilder(goodEDSName, nil) + clab0.AddLocality("locality-1", 1, 1, []string{"addr1:314"}, nil) + clab0.AddLocality("locality-2", 1, 0, []string{"addr2:159"}, nil) + a, _ := ptypes.MarshalAny(clab0.Build()) + return a + }(), + }, + TypeUrl: edsURL, + } + goodEDSResponse2 = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + func() *anypb.Any { + clab0 := NewClusterLoadAssignmentBuilder("not-goodEDSName", nil) + clab0.AddLocality("locality-1", 1, 1, []string{"addr1:314"}, nil) + clab0.AddLocality("locality-2", 1, 0, []string{"addr2:159"}, nil) + a, _ := ptypes.MarshalAny(clab0.Build()) + return a + }(), + }, + TypeUrl: edsURL, + } +) + +func TestEDSHandleResponse(t *testing.T) { + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) + defer v2c.close() + + tests := []struct { + name string + edsResponse *xdspb.DiscoveryResponse + wantErr bool + wantUpdate *EDSUpdate + wantUpdateErr bool + }{ + // Any in resource is badly marshaled. + { + name: "badly-marshaled_response", + edsResponse: badlyMarshaledEDSResponse, + wantErr: true, + wantUpdate: nil, + wantUpdateErr: false, + }, + // Response doesn't contain resource with the right type. + { + name: "no-config-in-response", + edsResponse: badResourceTypeInEDSResponse, + wantErr: true, + wantUpdate: nil, + wantUpdateErr: false, + }, + // Response contains one uninteresting ClusterLoadAssignment. + { + name: "one-uninterestring-assignment", + edsResponse: goodEDSResponse2, + wantErr: false, + wantUpdate: nil, + wantUpdateErr: false, + }, + // Response contains one good ClusterLoadAssignment. + { + name: "one-good-assignment", + edsResponse: goodEDSResponse1, + wantErr: false, + wantUpdate: &EDSUpdate{ + Localities: []Locality{ + { + Endpoints: []Endpoint{{Address: "addr1:314"}}, + ID: internal.Locality{SubZone: "locality-1"}, + Priority: 1, + Weight: 1, + }, + { + Endpoints: []Endpoint{{Address: "addr2:159"}}, + ID: internal.Locality{SubZone: "locality-2"}, + Priority: 0, + Weight: 1, + }, + }, + }, + wantUpdateErr: false, + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + gotUpdateCh := make(chan *EDSUpdate, 1) + gotUpdateErrCh := make(chan error, 1) + + // Register a watcher, to trigger the v2Client to send an EDS request. + cancelWatch := v2c.watchEDS(goodEDSName, func(u *EDSUpdate, err error) { + t.Logf("in v2c.watchEDS callback, edsUpdate: %+v, err: %v", u, err) + gotUpdateCh <- u + gotUpdateErrCh <- err + }) + + // Wait till the request makes it to the fakeServer. This ensures that + // the watch request has been processed by the v2Client. + <-fakeServer.RequestChan + + // Directly push the response through a call to handleEDSResponse, + // thereby bypassing the fakeServer. + if err := v2c.handleEDSResponse(test.edsResponse); (err != nil) != test.wantErr { + t.Fatalf("v2c.handleEDSResponse() returned err: %v, wantErr: %v", err, test.wantErr) + } + + // If the test needs the callback to be invoked, verify the update and + // error pushed to the callback. + if test.wantUpdate != nil { + timer := time.NewTimer(defaultTestTimeout) + select { + case <-timer.C: + t.Fatal("Timeout when expecting EDS update") + case gotUpdate := <-gotUpdateCh: + timer.Stop() + if d := cmp.Diff(gotUpdate, test.wantUpdate); d != "" { + t.Fatalf("got EDS update : %+v, want %+v, diff: %v", gotUpdate, *test.wantUpdate, d) + } + } + // Since the callback that we registered pushes to both channels at + // the same time, this channel read should return immediately. + gotUpdateErr := <-gotUpdateErrCh + if (gotUpdateErr != nil) != test.wantUpdateErr { + t.Fatalf("got EDS update error {%v}, wantErr: %v", gotUpdateErr, test.wantUpdateErr) + } + } + cancelWatch() + }) + } +} + +// TestEDSHandleResponseWithoutWatch tests the case where the v2Client +// receives an EDS response without a registered EDS watcher. +func TestEDSHandleResponseWithoutWatch(t *testing.T) { + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) + defer v2c.close() + + if v2c.handleEDSResponse(goodEDSResponse1) == nil { + t.Fatal("v2c.handleEDSResponse() succeeded, should have failed") + } +} + +func TestEDSWatchExpiryTimer(t *testing.T) { + oldWatchExpiryTimeout := defaultWatchExpiryTimeout + defaultWatchExpiryTimeout = 1 * time.Second + defer func() { + defaultWatchExpiryTimeout = oldWatchExpiryTimeout + }() + + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) + defer v2c.close() + t.Log("Started xds v2Client...") + + edsCallbackCh := make(chan error, 1) + v2c.watchEDS(goodRouteName1, func(u *EDSUpdate, err error) { + t.Logf("Received callback with edsUpdate {%+v} and error {%v}", u, err) + if u != nil { + edsCallbackCh <- fmt.Errorf("received EDSUpdate %v in edsCallback, wanted nil", u) + } + if err == nil { + edsCallbackCh <- errors.New("received nil error in edsCallback") + } + edsCallbackCh <- nil + }) + <-fakeServer.RequestChan + + timer := time.NewTimer(2 * time.Second) + select { + case <-timer.C: + t.Fatalf("Timeout expired when expecting EDS update") + case err := <-edsCallbackCh: + timer.Stop() + if err != nil { + t.Fatal(err) + } + } +} diff --git a/vendor/google.golang.org/grpc/xds/internal/client/eds_testutil.go b/vendor/google.golang.org/grpc/xds/internal/client/eds_testutil.go new file mode 100644 index 00000000000..503a9073c6c --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/client/eds_testutil.go @@ -0,0 +1,128 @@ +/* + * + * 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. + */ + +// All structs/functions in this file should be unexported. They are used in EDS +// balancer tests now, to generate test inputs. Eventually, EDS balancer tests +// should generate EDSUpdate directly, instead of generating and parsing the +// proto message. +// TODO: unexported everything in this file. + +package client + +import ( + "fmt" + "net" + "strconv" + + xdspb "github.com/envoyproxy/go-control-plane/envoy/api/v2" + corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" + endpointpb "github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint" + typepb "github.com/envoyproxy/go-control-plane/envoy/type" + wrapperspb "github.com/golang/protobuf/ptypes/wrappers" +) + +// ClusterLoadAssignmentBuilder builds a ClusterLoadAssignment, aka EDS +// response. +type ClusterLoadAssignmentBuilder struct { + v *xdspb.ClusterLoadAssignment +} + +// NewClusterLoadAssignmentBuilder creates a ClusterLoadAssignmentBuilder. +func NewClusterLoadAssignmentBuilder(clusterName string, dropPercents []uint32) *ClusterLoadAssignmentBuilder { + var drops []*xdspb.ClusterLoadAssignment_Policy_DropOverload + for i, d := range dropPercents { + drops = append(drops, &xdspb.ClusterLoadAssignment_Policy_DropOverload{ + Category: fmt.Sprintf("test-drop-%d", i), + DropPercentage: &typepb.FractionalPercent{ + Numerator: d, + Denominator: typepb.FractionalPercent_HUNDRED, + }, + }) + } + + return &ClusterLoadAssignmentBuilder{ + v: &xdspb.ClusterLoadAssignment{ + ClusterName: clusterName, + Policy: &xdspb.ClusterLoadAssignment_Policy{ + DropOverloads: drops, + }, + }, + } +} + +// AddLocalityOptions contains options when adding locality to the builder. +type AddLocalityOptions struct { + Health []corepb.HealthStatus + Weight []uint32 +} + +// AddLocality adds a locality to the builder. +func (clab *ClusterLoadAssignmentBuilder) AddLocality(subzone string, weight uint32, priority uint32, addrsWithPort []string, opts *AddLocalityOptions) { + var lbEndPoints []*endpointpb.LbEndpoint + for i, a := range addrsWithPort { + host, portStr, err := net.SplitHostPort(a) + if err != nil { + panic("failed to split " + a) + } + port, err := strconv.Atoi(portStr) + if err != nil { + panic("failed to atoi " + portStr) + } + + lbe := &endpointpb.LbEndpoint{ + HostIdentifier: &endpointpb.LbEndpoint_Endpoint{ + Endpoint: &endpointpb.Endpoint{ + Address: &corepb.Address{ + Address: &corepb.Address_SocketAddress{ + SocketAddress: &corepb.SocketAddress{ + Protocol: corepb.SocketAddress_TCP, + Address: host, + PortSpecifier: &corepb.SocketAddress_PortValue{ + PortValue: uint32(port)}}}}}}, + } + if opts != nil { + if i < len(opts.Health) { + lbe.HealthStatus = opts.Health[i] + } + if i < len(opts.Weight) { + lbe.LoadBalancingWeight = &wrapperspb.UInt32Value{Value: opts.Weight[i]} + } + } + lbEndPoints = append(lbEndPoints, lbe) + } + + var localityID *corepb.Locality + if subzone != "" { + localityID = &corepb.Locality{ + Region: "", + Zone: "", + SubZone: subzone, + } + } + + clab.v.Endpoints = append(clab.v.Endpoints, &endpointpb.LocalityLbEndpoints{ + Locality: localityID, + LbEndpoints: lbEndPoints, + LoadBalancingWeight: &wrapperspb.UInt32Value{Value: weight}, + Priority: priority, + }) +} + +// Build builds ClusterLoadAssignment. +func (clab *ClusterLoadAssignmentBuilder) Build() *xdspb.ClusterLoadAssignment { + return clab.v +} diff --git a/vendor/google.golang.org/grpc/xds/internal/client/fakexds/fakexds.go b/vendor/google.golang.org/grpc/xds/internal/client/fakexds/fakexds.go new file mode 100644 index 00000000000..9505e5ac9bb --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/client/fakexds/fakexds.go @@ -0,0 +1,164 @@ +/* + * + * 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. + * + */ + +// Package fakexds provides a very basic fake implementation of the xDS server +// for unit testing purposes. +package fakexds + +import ( + "context" + "net" + "testing" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + discoverypb "github.com/envoyproxy/go-control-plane/envoy/api/v2" + adsgrpc "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2" + lrsgrpc "github.com/envoyproxy/go-control-plane/envoy/service/load_stats/v2" +) + +// TODO: Make this a var or a field in the server if there is a need to use a +// value other than this default. +const defaultChannelBufferSize = 50 + +// Request wraps an xDS request and error. +type Request struct { + Req *discoverypb.DiscoveryRequest + Err error +} + +// Response wraps an xDS response and error. +type Response struct { + Resp *discoverypb.DiscoveryResponse + Err error +} + +// Server is a very basic implementation of a fake xDS server. It provides a +// request and response channel for the user to control the requests that are +// expected and the responses that needs to be sent out. +type Server struct { + // RequestChan is a buffered channel on which the fake server writes the + // received requests onto. + RequestChan chan *Request + // ResponseChan is a buffered channel from which the fake server reads the + // responses that it must send out to the client. + ResponseChan chan *Response + // Address is the host:port on which the fake xdsServer is listening on. + Address string + // LRS is the LRS server installed. + LRS *LRSServer +} + +// StartServer starts a fakexds.Server. The returned function should be invoked +// by the caller once the test is done. +func StartServer(t *testing.T) (*Server, func()) { + t.Helper() + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + t.Fatalf("net.Listen() failed: %v", err) + } + server := grpc.NewServer() + + lrss := newLRSServer() + lrsgrpc.RegisterLoadReportingServiceServer(server, lrss) + + fs := &Server{ + RequestChan: make(chan *Request, defaultChannelBufferSize), + ResponseChan: make(chan *Response, defaultChannelBufferSize), + Address: lis.Addr().String(), + LRS: lrss, + } + adsgrpc.RegisterAggregatedDiscoveryServiceServer(server, fs) + + go server.Serve(lis) + t.Logf("Starting fake xDS server at %v...", fs.Address) + + return fs, func() { server.Stop() } +} + +// GetClientConn returns a grpc.ClientConn talking to the fake server. The +// returned function should be invoked by the caller once the test is done. +func (fs *Server) GetClientConn(t *testing.T) (*grpc.ClientConn, func()) { + t.Helper() + + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + + cc, err := grpc.DialContext(ctx, fs.Address, grpc.WithInsecure(), grpc.WithBlock()) + if err != nil { + t.Fatalf("grpc.DialContext(%s) failed: %v", fs.Address, err) + } + t.Log("Started xDS gRPC client...") + + return cc, func() { + cc.Close() + } +} + +// StreamAggregatedResources is the fake implementation to handle an ADS +// stream. +func (fs *Server) StreamAggregatedResources(s adsgrpc.AggregatedDiscoveryService_StreamAggregatedResourcesServer) error { + errCh := make(chan error, 2) + go func() { + for { + req, err := s.Recv() + if err != nil { + errCh <- err + return + } + fs.RequestChan <- &Request{req, err} + } + }() + go func() { + var retErr error + defer func() { + errCh <- retErr + }() + + for { + select { + case r := <-fs.ResponseChan: + if r.Err != nil { + retErr = r.Err + return + } + if err := s.Send(r.Resp); err != nil { + retErr = err + return + } + case <-s.Context().Done(): + retErr = s.Context().Err() + return + } + } + }() + + if err := <-errCh; err != nil { + return err + } + return nil +} + +// DeltaAggregatedResources helps implement the ADS service. +func (fs *Server) DeltaAggregatedResources(adsgrpc.AggregatedDiscoveryService_DeltaAggregatedResourcesServer) error { + return status.Error(codes.Unimplemented, "") +} diff --git a/vendor/google.golang.org/grpc/xds/internal/client/fakexds/lrsserver.go b/vendor/google.golang.org/grpc/xds/internal/client/fakexds/lrsserver.go new file mode 100644 index 00000000000..55a6feeffac --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/client/fakexds/lrsserver.go @@ -0,0 +1,104 @@ +/* + * + * 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. + */ + +package fakexds + +import ( + "io" + "sync" + + corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" + endpointpb "github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint" + lrsgrpc "github.com/envoyproxy/go-control-plane/envoy/service/load_stats/v2" + lrspb "github.com/envoyproxy/go-control-plane/envoy/service/load_stats/v2" + "github.com/golang/protobuf/proto" + durationpb "github.com/golang/protobuf/ptypes/duration" + "github.com/google/go-cmp/cmp" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// LRSServer implements the LRS service, and is to be installed on the fakexds +// server. It collects load reports, and returned them later for comparison. +type LRSServer struct { + // ReportingInterval will be sent in the first response to control reporting + // interval. + ReportingInterval *durationpb.Duration + // ExpectedEDSClusterName is checked against the first LRS request. The RPC + // is failed if they don't match. + ExpectedEDSClusterName string + + mu sync.Mutex + dropTotal uint64 + drops map[string]uint64 +} + +func newLRSServer() *LRSServer { + return &LRSServer{ + drops: make(map[string]uint64), + ReportingInterval: &durationpb.Duration{ + Seconds: 60 * 60, // 1 hour, each test can override this to a shorter duration. + }, + } +} + +// StreamLoadStats implements LRS service. +func (lrss *LRSServer) StreamLoadStats(stream lrsgrpc.LoadReportingService_StreamLoadStatsServer) error { + req, err := stream.Recv() + if err != nil { + return err + } + wantReq := &lrspb.LoadStatsRequest{ + ClusterStats: []*endpointpb.ClusterStats{{ + ClusterName: lrss.ExpectedEDSClusterName, + }}, + Node: &corepb.Node{}, + } + if !proto.Equal(req, wantReq) { + return status.Errorf(codes.FailedPrecondition, "unexpected req: %+v, want %+v, diff: %s", req, wantReq, cmp.Diff(req, wantReq, cmp.Comparer(proto.Equal))) + } + if err := stream.Send(&lrspb.LoadStatsResponse{ + Clusters: []string{lrss.ExpectedEDSClusterName}, + LoadReportingInterval: lrss.ReportingInterval, + }); err != nil { + return err + } + + for { + req, err := stream.Recv() + if err != nil { + if err == io.EOF { + return nil + } + return err + } + stats := req.ClusterStats[0] + lrss.mu.Lock() + lrss.dropTotal += stats.TotalDroppedRequests + for _, d := range stats.DroppedRequests { + lrss.drops[d.Category] += d.DroppedCount + } + lrss.mu.Unlock() + } +} + +// GetDrops returns the drops reported to this server. +func (lrss *LRSServer) GetDrops() map[string]uint64 { + lrss.mu.Lock() + defer lrss.mu.Unlock() + return lrss.drops +} diff --git a/vendor/google.golang.org/grpc/xds/internal/client/lds.go b/vendor/google.golang.org/grpc/xds/internal/client/lds.go new file mode 100644 index 00000000000..661b976fca7 --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/client/lds.go @@ -0,0 +1,104 @@ +/* + * + * 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. + * + */ + +package client + +import ( + "fmt" + + xdspb "github.com/envoyproxy/go-control-plane/envoy/api/v2" + httppb "github.com/envoyproxy/go-control-plane/envoy/config/filter/network/http_connection_manager/v2" + "github.com/golang/protobuf/ptypes" +) + +// handleLDSResponse processes an LDS response received from the xDS server. On +// receipt of a good response, it also invokes the registered watcher callback. +func (v2c *v2Client) handleLDSResponse(resp *xdspb.DiscoveryResponse) error { + v2c.mu.Lock() + defer v2c.mu.Unlock() + + wi := v2c.watchMap[ldsURL] + if wi == nil { + return fmt.Errorf("xds: no LDS watcher found when handling LDS response: %+v", resp) + } + + routeName := "" + for _, r := range resp.GetResources() { + var resource ptypes.DynamicAny + if err := ptypes.UnmarshalAny(r, &resource); err != nil { + return fmt.Errorf("xds: failed to unmarshal resource in LDS response: %v", err) + } + lis, ok := resource.Message.(*xdspb.Listener) + if !ok { + return fmt.Errorf("xds: unexpected resource type: %T in LDS response", resource.Message) + } + if lis.GetName() != wi.target[0] { + // We ignore listeners we are not watching for because LDS is + // special in the sense that there is only one resource we are + // interested in, and this resource does not change over the + // lifetime of the v2Client. So, we don't have to cache other + // listeners which we are not interested in. + continue + } + var err error + routeName, err = getRouteConfigNameFromListener(lis) + if err != nil { + return err + } + } + + var err error + if routeName == "" { + err = fmt.Errorf("xds: LDS target %s not found in received response %+v", wi.target, resp) + } + wi.stopTimer() + wi.callback.(ldsCallback)(ldsUpdate{routeName: routeName}, err) + return nil +} + +// getRouteConfigNameFromListener checks if the provided Listener proto meets +// the expected criteria. If so, it returns a non-empty routeConfigName. +func getRouteConfigNameFromListener(lis *xdspb.Listener) (string, error) { + if lis.GetApiListener() == nil { + return "", fmt.Errorf("xds: no api_listener field in LDS response %+v", lis) + } + var apiAny ptypes.DynamicAny + if err := ptypes.UnmarshalAny(lis.GetApiListener().GetApiListener(), &apiAny); err != nil { + return "", fmt.Errorf("xds: failed to unmarshal api_listner in LDS response: %v", err) + } + apiLis, ok := apiAny.Message.(*httppb.HttpConnectionManager) + if !ok { + return "", fmt.Errorf("xds: unexpected api_listener type: %T in LDS response", apiAny.Message) + } + switch apiLis.RouteSpecifier.(type) { + case *httppb.HttpConnectionManager_Rds: + name := apiLis.GetRds().GetRouteConfigName() + if name == "" { + return "", fmt.Errorf("xds: empty route_config_name in LDS response: %+v", lis) + } + return name, nil + case *httppb.HttpConnectionManager_RouteConfig: + // TODO: Add support for specifying the RouteConfiguration inline + // in the LDS response. + return "", fmt.Errorf("xds: LDS response contains RDS config inline. Not supported for now: %+v", apiLis) + case nil: + return "", fmt.Errorf("xds: no RouteSpecifier in received LDS response: %+v", apiLis) + default: + return "", fmt.Errorf("xds: unsupported type %T for RouteSpecifier in received LDS response", apiLis.RouteSpecifier) + } +} diff --git a/vendor/google.golang.org/grpc/xds/internal/client/lds_test.go b/vendor/google.golang.org/grpc/xds/internal/client/lds_test.go new file mode 100644 index 00000000000..ce045a5af10 --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/client/lds_test.go @@ -0,0 +1,289 @@ +/* + * + * 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. + * + */ + +package client + +import ( + "errors" + "fmt" + "reflect" + "testing" + "time" + + xdspb "github.com/envoyproxy/go-control-plane/envoy/api/v2" + "google.golang.org/grpc/xds/internal/client/fakexds" +) + +func TestLDSGetRouteConfig(t *testing.T) { + tests := []struct { + name string + lis *xdspb.Listener + wantRoute string + wantErr bool + }{ + { + name: "no-apiListener-field", + lis: &xdspb.Listener{}, + wantRoute: "", + wantErr: true, + }, + { + name: "badly-marshaled-apiListener", + lis: badAPIListener1, + wantRoute: "", + wantErr: true, + }, + { + name: "wrong-type-in-apiListener", + lis: badResourceListener, + wantRoute: "", + wantErr: true, + }, + { + name: "empty-httpConnMgr-in-apiListener", + lis: listenerWithEmptyHTTPConnMgr, + wantRoute: "", + wantErr: true, + }, + { + name: "scopedRoutes-routeConfig-in-apiListener", + lis: listenerWithScopedRoutesRouteConfig, + wantRoute: "", + wantErr: true, + }, + { + name: "goodListener1", + lis: goodListener1, + wantRoute: goodRouteName1, + wantErr: false, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + gotRoute, err := getRouteConfigNameFromListener(test.lis) + if gotRoute != test.wantRoute { + t.Errorf("getRouteConfigNameFromListener(%+v) = %v, want %v", test.lis, gotRoute, test.wantRoute) + } + if (err != nil) != test.wantErr { + t.Errorf("getRouteConfigNameFromListener(%+v) = %v, want %v", test.lis, err, test.wantErr) + } + }) + } +} + +// TestLDSHandleResponse starts a fake xDS server, makes a ClientConn to it, +// and creates a v2Client using it. Then, it registers a watchLDS and tests +// different LDS responses. +func TestLDSHandleResponse(t *testing.T) { + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) + defer v2c.close() + + tests := []struct { + name string + ldsResponse *xdspb.DiscoveryResponse + wantErr bool + wantUpdate *ldsUpdate + wantUpdateErr bool + }{ + // Badly marshaled LDS response. + { + name: "badly-marshaled-response", + ldsResponse: badlyMarshaledLDSResponse, + wantErr: true, + wantUpdate: nil, + wantUpdateErr: false, + }, + // Response does not contain Listener proto. + { + name: "no-listener-proto-in-response", + ldsResponse: badResourceTypeInLDSResponse, + wantErr: true, + wantUpdate: nil, + wantUpdateErr: false, + }, + // No APIListener in the response. Just one test case here for a bad + // ApiListener, since the others are covered in + // TestGetRouteConfigNameFromListener. + { + name: "no-apiListener-in-response", + ldsResponse: noAPIListenerLDSResponse, + wantErr: true, + wantUpdate: nil, + wantUpdateErr: false, + }, + // Response contains one listener and it is good. + { + name: "one-good-listener", + ldsResponse: goodLDSResponse1, + wantErr: false, + wantUpdate: &ldsUpdate{routeName: goodRouteName1}, + wantUpdateErr: false, + }, + // Response contains multiple good listeners, including the one we are + // interested in. + { + name: "multiple-good-listener", + ldsResponse: ldsResponseWithMultipleResources, + wantErr: false, + wantUpdate: &ldsUpdate{routeName: goodRouteName1}, + wantUpdateErr: false, + }, + // Response contains two good listeners (one interesting and one + // uninteresting), and one badly marshaled listener. + { + name: "good-bad-ugly-listeners", + ldsResponse: goodBadUglyLDSResponse, + wantErr: false, + wantUpdate: &ldsUpdate{routeName: goodRouteName1}, + wantUpdateErr: false, + }, + // Response contains one listener, but we are not interested in it. + { + name: "one-uninteresting-listener", + ldsResponse: goodLDSResponse2, + wantErr: false, + wantUpdate: &ldsUpdate{routeName: ""}, + wantUpdateErr: true, + }, + // Response constains no resources. This is the case where the server + // does not know about the target we are interested in. + { + name: "empty-response", + ldsResponse: emptyLDSResponse, + wantErr: false, + wantUpdate: &ldsUpdate{routeName: ""}, + wantUpdateErr: true, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + gotUpdateCh := make(chan ldsUpdate, 1) + gotUpdateErrCh := make(chan error, 1) + + // Register a watcher, to trigger the v2Client to send an LDS request. + cancelWatch := v2c.watchLDS(goodLDSTarget1, func(u ldsUpdate, err error) { + t.Logf("in v2c.watchLDS callback, ldsUpdate: %+v, err: %v", u, err) + gotUpdateCh <- u + gotUpdateErrCh <- err + }) + + // Wait till the request makes it to the fakeServer. This ensures that + // the watch request has been processed by the v2Client. + <-fakeServer.RequestChan + + // Directly push the response through a call to handleLDSResponse, + // thereby bypassing the fakeServer. + if err := v2c.handleLDSResponse(test.ldsResponse); (err != nil) != test.wantErr { + t.Fatalf("v2c.handleLDSResponse() returned err: %v, wantErr: %v", err, test.wantErr) + } + + // If the test needs the callback to be invoked, verify the update and + // error pushed to the callback. + if test.wantUpdate != nil { + timer := time.NewTimer(defaultTestTimeout) + select { + case <-timer.C: + t.Fatal("Timeout when expecting LDS update") + case gotUpdate := <-gotUpdateCh: + timer.Stop() + if !reflect.DeepEqual(gotUpdate, *test.wantUpdate) { + t.Fatalf("got LDS update : %+v, want %+v", gotUpdate, *test.wantUpdate) + } + } + // Since the callback that we registered pushes to both channels at + // the same time, this channel read should return immediately. + gotUpdateErr := <-gotUpdateErrCh + if (gotUpdateErr != nil) != test.wantUpdateErr { + t.Fatalf("got LDS update error {%v}, wantErr: %v", gotUpdateErr, test.wantUpdateErr) + } + } + cancelWatch() + }) + } +} + +// TestLDSHandleResponseWithoutWatch tests the case where the v2Client receives +// an LDS response without a registered watcher. +func TestLDSHandleResponseWithoutWatch(t *testing.T) { + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) + defer v2c.close() + + if v2c.handleLDSResponse(goodLDSResponse1) == nil { + t.Fatal("v2c.handleLDSResponse() succeeded, should have failed") + } +} + +// TestLDSWatchExpiryTimer tests the case where the client does not receive an +// LDS response for the request that it sends out. We want the watch callback +// to be invoked with an error once the watchExpiryTimer fires. +func TestLDSWatchExpiryTimer(t *testing.T) { + oldWatchExpiryTimeout := defaultWatchExpiryTimeout + defaultWatchExpiryTimeout = 1 * time.Second + defer func() { + defaultWatchExpiryTimeout = oldWatchExpiryTimeout + }() + + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) + defer v2c.close() + + // Wait till the request makes it to the fakeServer. This ensures that + // the watch request has been processed by the v2Client. + callbackCh := make(chan error, 1) + v2c.watchLDS(goodLDSTarget1, func(u ldsUpdate, err error) { + t.Logf("in v2c.watchLDS callback, ldsUpdate: %+v, err: %v", u, err) + if u.routeName != "" { + callbackCh <- fmt.Errorf("received routeName %v in ldsCallback, wanted empty string", u.routeName) + } + if err == nil { + callbackCh <- errors.New("received nil error in ldsCallback") + } + callbackCh <- nil + }) + <-fakeServer.RequestChan + + timer := time.NewTimer(2 * time.Second) + select { + case <-timer.C: + t.Fatalf("Timeout expired when expecting LDS update") + case err := <-callbackCh: + timer.Stop() + if err != nil { + t.Fatal(err) + } + } +} diff --git a/vendor/google.golang.org/grpc/xds/internal/client/rds.go b/vendor/google.golang.org/grpc/xds/internal/client/rds.go new file mode 100644 index 00000000000..35c017b81ae --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/client/rds.go @@ -0,0 +1,155 @@ +/* + * + * 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. + * + */ + +package client + +import ( + "fmt" + "net" + "strings" + + xdspb "github.com/envoyproxy/go-control-plane/envoy/api/v2" + "github.com/golang/protobuf/ptypes" +) + +// handleRDSResponse processes an RDS response received from the xDS server. On +// receipt of a good response, it caches validated resources and also invokes +// the registered watcher callback. +func (v2c *v2Client) handleRDSResponse(resp *xdspb.DiscoveryResponse) error { + v2c.mu.Lock() + defer v2c.mu.Unlock() + + if v2c.watchMap[ldsURL] == nil { + return fmt.Errorf("xds: unexpected RDS response when no LDS watcher is registered: %+v", resp) + } + target := v2c.watchMap[ldsURL].target[0] + + wi := v2c.watchMap[rdsURL] + if wi == nil { + return fmt.Errorf("xds: no RDS watcher found when handling RDS response: %+v", resp) + } + + returnCluster := "" + localCache := make(map[string]string) + for _, r := range resp.GetResources() { + var resource ptypes.DynamicAny + if err := ptypes.UnmarshalAny(r, &resource); err != nil { + return fmt.Errorf("xds: failed to unmarshal resource in RDS response: %v", err) + } + rc, ok := resource.Message.(*xdspb.RouteConfiguration) + if !ok { + return fmt.Errorf("xds: unexpected resource type: %T in RDS response", resource.Message) + } + cluster := getClusterFromRouteConfiguration(rc, target) + if cluster == "" { + return fmt.Errorf("xds: received invalid RouteConfiguration in RDS response: %+v", rc) + } + + // If we get here, it means that this resource was a good one. + localCache[rc.GetName()] = cluster + + // TODO: remove cache, and only process resources that are interesting. + if rc.GetName() == wi.target[0] { + returnCluster = cluster + } + } + + // Update the cache in the v2Client only after we have confirmed that all + // resources in the received response were good. + for k, v := range localCache { + // TODO: Need to handle deletion of entries from the cache based on LDS + // watch calls. Not handling it does not affect correctness, but leads + // to unnecessary memory consumption. + v2c.rdsCache[k] = v + } + + if returnCluster != "" { + // We stop the expiry timer and invoke the callback only when we have + // received the resource that we are watching for. Since RDS is an + // incremental protocol, the fact that we did not receive the resource + // that we are watching for in this response does not mean that the + // server does not know about it. + wi.stopTimer() + wi.callback.(rdsCallback)(rdsUpdate{clusterName: returnCluster}, nil) + } + return nil +} + +// getClusterFromRouteConfiguration checks if the provided RouteConfiguration +// meets the expected criteria. If so, it returns a non-empty clusterName. +// +// A RouteConfiguration resource is considered valid when only if it contains a +// VirtualHost whose domain field matches the server name from the URI passed +// to the gRPC channel, and it contains a clusterName. +// +// The RouteConfiguration includes a list of VirtualHosts, which may have zero +// or more elements. We are interested in the element whose domains field +// matches the server name specified in the "xds:" URI (with port, if any, +// stripped off). The only field in the VirtualHost proto that the we are +// interested in is the list of routes. We only look at the last route in the +// list (the default route), whose match field must be empty and whose route +// field must be set. Inside that route message, the cluster field will +// contain the clusterName we are looking for. +func getClusterFromRouteConfiguration(rc *xdspb.RouteConfiguration, target string) string { + // TODO: return error for better error logging and nack. + // + // Currently this returns "" on error, and the caller will return an error. + // But the error doesn't contain details of why the response is invalid + // (mismatch domain or empty route). + // + // For logging purposes, we can log in line. But if we want to populate + // error details for nack, a detailed error needs to be returned. + + host, err := hostFromTarget(target) + if err != nil { + return "" + } + for _, vh := range rc.GetVirtualHosts() { + for _, domain := range vh.GetDomains() { + // TODO: Add support for wildcard matching here? + if domain != host || len(vh.GetRoutes()) == 0 { + continue + } + dr := vh.Routes[len(vh.Routes)-1] + if match := dr.GetMatch(); match == nil || match.GetPrefix() != "" { + continue + } + route := dr.GetRoute() + if route == nil { + continue + } + return route.GetCluster() + } + } + return "" +} + +// hostFromTarget calls net.SplitHostPort and returns the host. +// +// It returns the original string instead of error if port is missing. +func hostFromTarget(target string) (string, error) { + const portMissingErrDesc = "missing port in address" + h, _, err := net.SplitHostPort(target) + if err != nil { + if addrErr, ok := err.(*net.AddrError); ok && strings.Contains(addrErr.Err, portMissingErrDesc) { + return target, nil + } + return "", err + } + return h, nil +} diff --git a/vendor/google.golang.org/grpc/xds/internal/client/rds_test.go b/vendor/google.golang.org/grpc/xds/internal/client/rds_test.go new file mode 100644 index 00000000000..9225617401a --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/client/rds_test.go @@ -0,0 +1,580 @@ +/* + * + * 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. + * + */ + +package client + +import ( + "errors" + "fmt" + "reflect" + "testing" + "time" + + xdspb "github.com/envoyproxy/go-control-plane/envoy/api/v2" + routepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/route" + "google.golang.org/grpc/xds/internal/client/fakexds" +) + +func (v2c *v2Client) cloneRDSCacheForTesting() map[string]string { + v2c.mu.Lock() + defer v2c.mu.Unlock() + + cloneCache := make(map[string]string) + for k, v := range v2c.rdsCache { + cloneCache[k] = v + } + return cloneCache +} + +func TestRDSGetClusterFromRouteConfiguration(t *testing.T) { + tests := []struct { + name string + rc *xdspb.RouteConfiguration + wantCluster string + }{ + { + name: "no-virtual-hosts-in-rc", + rc: emptyRouteConfig, + wantCluster: "", + }, + { + name: "no-domains-in-rc", + rc: noDomainsInRouteConfig, + wantCluster: "", + }, + { + name: "non-matching-domain-in-rc", + rc: &xdspb.RouteConfiguration{ + VirtualHosts: []*routepb.VirtualHost{ + {Domains: []string{uninterestingDomain}}, + }, + }, + wantCluster: "", + }, + { + name: "no-routes-in-rc", + rc: &xdspb.RouteConfiguration{ + VirtualHosts: []*routepb.VirtualHost{ + {Domains: []string{goodMatchingDomain}}, + }, + }, + wantCluster: "", + }, + { + name: "default-route-match-field-is-nil", + rc: &xdspb.RouteConfiguration{ + VirtualHosts: []*routepb.VirtualHost{ + { + Domains: []string{goodMatchingDomain}, + Routes: []*routepb.Route{ + { + Action: &routepb.Route_Route{ + Route: &routepb.RouteAction{ + ClusterSpecifier: &routepb.RouteAction_Cluster{Cluster: goodClusterName1}, + }, + }, + }, + }, + }, + }, + }, + wantCluster: "", + }, + { + name: "default-route-match-field-is-non-nil", + rc: &xdspb.RouteConfiguration{ + VirtualHosts: []*routepb.VirtualHost{ + { + Domains: []string{goodMatchingDomain}, + Routes: []*routepb.Route{ + { + Match: &routepb.RouteMatch{}, + Action: &routepb.Route_Route{}, + }, + }, + }, + }, + }, + wantCluster: "", + }, + { + name: "default-route-routeaction-field-is-nil", + rc: &xdspb.RouteConfiguration{ + VirtualHosts: []*routepb.VirtualHost{ + { + Domains: []string{goodMatchingDomain}, + Routes: []*routepb.Route{{}}, + }, + }, + }, + wantCluster: "", + }, + { + name: "default-route-cluster-field-is-empty", + rc: &xdspb.RouteConfiguration{ + VirtualHosts: []*routepb.VirtualHost{ + { + Domains: []string{goodMatchingDomain}, + Routes: []*routepb.Route{ + { + Action: &routepb.Route_Route{ + Route: &routepb.RouteAction{ + ClusterSpecifier: &routepb.RouteAction_ClusterHeader{}, + }, + }, + }, + }, + }, + }, + }, + wantCluster: "", + }, + { + name: "good-route-config", + rc: goodRouteConfig1, + wantCluster: goodClusterName1, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + if gotCluster := getClusterFromRouteConfiguration(test.rc, goodLDSTarget1); gotCluster != test.wantCluster { + t.Errorf("getClusterFromRouteConfiguration(%+v, %v) = %v, want %v", test.rc, goodLDSTarget1, gotCluster, test.wantCluster) + } + }) + } +} + +// TestRDSHandleResponse starts a fake xDS server, makes a ClientConn to it, +// and creates a v2Client using it. Then, it registers an LDS and RDS watcher +// and tests different RDS responses. +func TestRDSHandleResponse(t *testing.T) { + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) + defer v2c.close() + + // Register an LDS watcher, and wait till the request is sent out, the + // response is received and the callback is invoked. + cbCh := make(chan error, 1) + v2c.watchLDS(goodLDSTarget1, func(u ldsUpdate, err error) { + t.Logf("v2c.watchLDS callback, ldsUpdate: %+v, err: %v", u, err) + cbCh <- err + }) + <-fakeServer.RequestChan + fakeServer.ResponseChan <- &fakexds.Response{Resp: goodLDSResponse1} + if err := <-cbCh; err != nil { + t.Fatalf("v2c.watchLDS returned error in callback: %v", err) + } + + tests := []struct { + name string + rdsResponse *xdspb.DiscoveryResponse + wantErr bool + wantUpdate *rdsUpdate + wantUpdateErr bool + }{ + // Badly marshaled RDS response. + { + name: "badly-marshaled-response", + rdsResponse: badlyMarshaledRDSResponse, + wantErr: true, + wantUpdate: nil, + wantUpdateErr: false, + }, + // Response does not contain RouteConfiguration proto. + { + name: "no-route-config-in-response", + rdsResponse: badResourceTypeInRDSResponse, + wantErr: true, + wantUpdate: nil, + wantUpdateErr: false, + }, + // No VirtualHosts in the response. Just one test case here for a bad + // RouteConfiguration, since the others are covered in + // TestGetClusterFromRouteConfiguration. + { + name: "no-virtual-hosts-in-response", + rdsResponse: noVirtualHostsInRDSResponse, + wantErr: true, + wantUpdate: nil, + wantUpdateErr: false, + }, + // Response contains one good RouteConfiguration, uninteresting though. + { + name: "one-uninteresting-route-config", + rdsResponse: goodRDSResponse2, + wantErr: false, + wantUpdate: nil, + wantUpdateErr: false, + }, + // Response contains one good interesting RouteConfiguration. + { + name: "one-good-route-config", + rdsResponse: goodRDSResponse1, + wantErr: false, + wantUpdate: &rdsUpdate{clusterName: goodClusterName1}, + wantUpdateErr: false, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + gotUpdateCh := make(chan rdsUpdate, 1) + gotUpdateErrCh := make(chan error, 1) + + // Register a watcher, to trigger the v2Client to send an RDS request. + cancelWatch := v2c.watchRDS(goodRouteName1, func(u rdsUpdate, err error) { + t.Logf("in v2c.watchRDS callback, rdsUpdate: %+v, err: %v", u, err) + gotUpdateCh <- u + gotUpdateErrCh <- err + }) + + // Wait till the request makes it to the fakeServer. This ensures that + // the watch request has been processed by the v2Client. + <-fakeServer.RequestChan + + // Directly push the response through a call to handleRDSResponse, + // thereby bypassing the fakeServer. + if err := v2c.handleRDSResponse(test.rdsResponse); (err != nil) != test.wantErr { + t.Fatalf("v2c.handleRDSResponse() returned err: %v, wantErr: %v", err, test.wantErr) + } + + // If the test needs the callback to be invoked, verify the update and + // error pushed to the callback. + if test.wantUpdate != nil { + timer := time.NewTimer(defaultTestTimeout) + select { + case <-timer.C: + t.Fatal("Timeout when expecting RDS update") + case gotUpdate := <-gotUpdateCh: + timer.Stop() + if !reflect.DeepEqual(gotUpdate, *test.wantUpdate) { + t.Fatalf("got RDS update : %+v, want %+v", gotUpdate, *test.wantUpdate) + } + } + // Since the callback that we registered pushes to both channels at + // the same time, this channel read should return immediately. + gotUpdateErr := <-gotUpdateErrCh + if (gotUpdateErr != nil) != test.wantUpdateErr { + t.Fatalf("got RDS update error {%v}, wantErr: %v", gotUpdateErr, test.wantUpdateErr) + } + } + cancelWatch() + }) + } +} + +// TestRDSHandleResponseWithoutLDSWatch tests the case where the v2Client +// receives an RDS response without a registered LDS watcher. +func TestRDSHandleResponseWithoutLDSWatch(t *testing.T) { + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) + defer v2c.close() + + if v2c.handleRDSResponse(goodRDSResponse1) == nil { + t.Fatal("v2c.handleRDSResponse() succeeded, should have failed") + } +} + +// TestRDSHandleResponseWithoutRDSWatch tests the case where the v2Client +// receives an RDS response without a registered RDS watcher. +func TestRDSHandleResponseWithoutRDSWatch(t *testing.T) { + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) + defer v2c.close() + + // Register an LDS watcher, and wait till the request is sent out, the + // response is received and the callback is invoked. + cbCh := make(chan error, 1) + v2c.watchLDS(goodLDSTarget1, func(u ldsUpdate, err error) { + t.Logf("v2c.watchLDS callback, ldsUpdate: %+v, err: %v", u, err) + cbCh <- err + }) + <-fakeServer.RequestChan + fakeServer.ResponseChan <- &fakexds.Response{Resp: goodLDSResponse1} + if err := <-cbCh; err != nil { + t.Fatalf("v2c.watchLDS returned error in callback: %v", err) + } + + if v2c.handleRDSResponse(goodRDSResponse1) == nil { + t.Fatal("v2c.handleRDSResponse() succeeded, should have failed") + } +} + +// rdsTestOp contains all data related to one particular test operation. Not +// all fields make sense for all tests. +type rdsTestOp struct { + // target is the resource name to watch for. + target string + // responseToSend is the xDS response sent to the client + responseToSend *fakexds.Response + // wantOpErr specfies whether the main operation should return an error. + wantOpErr bool + // wantRDSCache is the expected rdsCache at the end of an operation. + wantRDSCache map[string]string + // wantWatchCallback specifies if the watch callback should be invoked. + wantWatchCallback bool +} + +// testRDSCaching is a helper function which starts a fake xDS server, makes a +// ClientConn to it, creates a v2Client using it, registers an LDS watcher and +// pushes a good LDS response. It then reads a bunch of test operations to be +// performed from rdsTestOps and returns error, if any, on the provided error +// channel. This is executed in a separate goroutine. +func testRDSCaching(t *testing.T, rdsTestOps []rdsTestOp, errCh chan error) { + t.Helper() + + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) + defer v2c.close() + t.Log("Started xds v2Client...") + + // Register an LDS watcher, and wait till the request is sent out, the + // response is received and the callback is invoked. + cbCh := make(chan error, 1) + v2c.watchLDS(goodLDSTarget1, func(u ldsUpdate, err error) { + t.Logf("v2c.watchLDS callback, ldsUpdate: %+v, err: %v", u, err) + cbCh <- err + }) + <-fakeServer.RequestChan + fakeServer.ResponseChan <- &fakexds.Response{Resp: goodLDSResponse1} + if err := <-cbCh; err != nil { + errCh <- fmt.Errorf("v2c.watchLDS returned error in callback: %v", err) + return + } + + callbackCh := make(chan struct{}, 1) + for _, rdsTestOp := range rdsTestOps { + // Register a watcher if required, and use a channel to signal the + // successful invocation of the callback. + if rdsTestOp.target != "" { + v2c.watchRDS(rdsTestOp.target, func(u rdsUpdate, err error) { + t.Logf("Received callback with rdsUpdate {%+v} and error {%v}", u, err) + callbackCh <- struct{}{} + }) + t.Logf("Registered a watcher for RDS target: %v...", rdsTestOp.target) + + // Wait till the request makes it to the fakeServer. This ensures that + // the watch request has been processed by the v2Client. + <-fakeServer.RequestChan + t.Log("FakeServer received request...") + } + + // Directly push the response through a call to handleRDSResponse, + // thereby bypassing the fakeServer. + if rdsTestOp.responseToSend != nil { + if err := v2c.handleRDSResponse(rdsTestOp.responseToSend.Resp); (err != nil) != rdsTestOp.wantOpErr { + errCh <- fmt.Errorf("v2c.handleRDSResponse() returned err: %v", err) + return + } + } + + // If the test needs the callback to be invoked, just verify that + // it was invoked. Since we verify the contents of the cache, it's + // ok not to verify the contents of the callback. + if rdsTestOp.wantWatchCallback { + <-callbackCh + } + + if !reflect.DeepEqual(v2c.cloneRDSCacheForTesting(), rdsTestOp.wantRDSCache) { + errCh <- fmt.Errorf("gotRDSCache: %v, wantRDSCache: %v", v2c.rdsCache, rdsTestOp.wantRDSCache) + return + } + } + t.Log("Completed all test ops successfully...") + errCh <- nil +} + +// TestRDSCaching tests some end-to-end RDS flows using a fake xDS server, and +// verifies the RDS data cached at the v2Client. +func TestRDSCaching(t *testing.T) { + errCh := make(chan error, 1) + ops := []rdsTestOp{ + // Add an RDS watch for a resource name (goodRouteName1), which returns one + // matching resource in the response. + { + target: goodRouteName1, + responseToSend: &fakexds.Response{Resp: goodRDSResponse1}, + wantRDSCache: map[string]string{goodRouteName1: goodClusterName1}, + wantWatchCallback: true, + }, + // Push an RDS response with a new resource. This resource is considered + // good because its domain field matches our LDS watch target, but the + // routeConfigName does not match our RDS watch (so the watch callback will + // not be invoked). But this should still be cached. + { + responseToSend: &fakexds.Response{Resp: goodRDSResponse2}, + wantRDSCache: map[string]string{ + goodRouteName1: goodClusterName1, + goodRouteName2: goodClusterName2, + }, + }, + // Push an uninteresting RDS response. This should cause handleRDSResponse + // to return an error. But the watch callback should not be invoked, and + // the cache should not be updated. + { + responseToSend: &fakexds.Response{Resp: uninterestingRDSResponse}, + wantOpErr: true, + wantRDSCache: map[string]string{ + goodRouteName1: goodClusterName1, + goodRouteName2: goodClusterName2, + }, + }, + // Switch the watch target to goodRouteName2, which was already cached. No + // response is received from the server (as expected), but we want the + // callback to be invoked with the new clusterName. + { + target: goodRouteName2, + wantRDSCache: map[string]string{ + goodRouteName1: goodClusterName1, + goodRouteName2: goodClusterName2, + }, + wantWatchCallback: true, + }, + } + go testRDSCaching(t, ops, errCh) + + timer := time.NewTimer(defaultTestTimeout) + select { + case <-timer.C: + t.Fatal("Timeout when expecting RDS update") + case err := <-errCh: + timer.Stop() + if err != nil { + t.Fatal(err) + } + } +} + +// TestRDSWatchExpiryTimer tests the case where the client does not receive an +// RDS response for the request that it sends out. We want the watch callback +// to be invoked with an error once the watchExpiryTimer fires. +func TestRDSWatchExpiryTimer(t *testing.T) { + oldWatchExpiryTimeout := defaultWatchExpiryTimeout + defaultWatchExpiryTimeout = 1 * time.Second + defer func() { + defaultWatchExpiryTimeout = oldWatchExpiryTimeout + }() + + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) + defer v2c.close() + t.Log("Started xds v2Client...") + + // Register an LDS watcher, and wait till the request is sent out, the + // response is received and the callback is invoked. + ldsCallbackCh := make(chan struct{}) + v2c.watchLDS(goodLDSTarget1, func(u ldsUpdate, err error) { + t.Logf("v2c.watchLDS callback, ldsUpdate: %+v, err: %v", u, err) + close(ldsCallbackCh) + }) + <-fakeServer.RequestChan + fakeServer.ResponseChan <- &fakexds.Response{Resp: goodLDSResponse1} + <-ldsCallbackCh + + // Wait till the request makes it to the fakeServer. This ensures that + // the watch request has been processed by the v2Client. + rdsCallbackCh := make(chan error, 1) + v2c.watchRDS(goodRouteName1, func(u rdsUpdate, err error) { + t.Logf("Received callback with rdsUpdate {%+v} and error {%v}", u, err) + if u.clusterName != "" { + rdsCallbackCh <- fmt.Errorf("received clusterName %v in rdsCallback, wanted empty string", u.clusterName) + } + if err == nil { + rdsCallbackCh <- errors.New("received nil error in rdsCallback") + } + rdsCallbackCh <- nil + }) + <-fakeServer.RequestChan + + timer := time.NewTimer(2 * time.Second) + select { + case <-timer.C: + t.Fatalf("Timeout expired when expecting RDS update") + case err := <-rdsCallbackCh: + timer.Stop() + if err != nil { + t.Fatal(err) + } + } +} + +func TestHostFromTarget(t *testing.T) { + tests := []struct { + name string + target string + want string + wantErr bool + }{ + { + name: "correct", + target: "foo.bar.com:1234", + want: "foo.bar.com", + wantErr: false, + }, + { + name: "error", + target: "invalid:1234:3421", + want: "", + wantErr: true, + }, + { + name: "correct but missing port", + target: "foo.bar.com", + want: "foo.bar.com", + wantErr: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := hostFromTarget(tt.target) + if (err != nil) != tt.wantErr { + t.Errorf("hostFromTarget() error = %v, wantErr %v", err, tt.wantErr) + return + } + if got != tt.want { + t.Errorf("hostFromTarget() got = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/vendor/google.golang.org/grpc/xds/internal/client/types.go b/vendor/google.golang.org/grpc/xds/internal/client/types.go new file mode 100644 index 00000000000..6162d7e92bf --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/client/types.go @@ -0,0 +1,97 @@ +/* + * + * 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. + * + */ + +package client + +import ( + "time" + + adsgrpc "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2" +) + +type adsStream adsgrpc.AggregatedDiscoveryService_StreamAggregatedResourcesClient + +const ( + ldsURL = "type.googleapis.com/envoy.api.v2.Listener" + rdsURL = "type.googleapis.com/envoy.api.v2.RouteConfiguration" + cdsURL = "type.googleapis.com/envoy.api.v2.Cluster" + edsURL = "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment" +) + +// watchState is an enum to represent the state of a watch call. +type watchState int + +const ( + watchEnqueued watchState = iota + watchCancelled + watchStarted +) + +// watchInfo holds all the information about a watch call. +type watchInfo struct { + typeURL string + target []string + state watchState + + callback interface{} + expiryTimer *time.Timer +} + +// cancel marks the state as cancelled, and also stops the expiry timer. +func (wi *watchInfo) cancel() { + wi.state = watchCancelled + if wi.expiryTimer != nil { + wi.expiryTimer.Stop() + } +} + +// stopTimer stops the expiry timer without cancelling the watch. +func (wi *watchInfo) stopTimer() { + if wi.expiryTimer != nil { + wi.expiryTimer.Stop() + } +} + +type ackInfo struct { + typeURL string + version string // Nack if version is an empty string. + nonce string +} + +type ldsUpdate struct { + routeName string +} +type ldsCallback func(ldsUpdate, error) + +type rdsUpdate struct { + clusterName string +} +type rdsCallback func(rdsUpdate, error) + +// CDSUpdate contains information from a received CDS response, which is of +// interest to the registered CDS watcher. +type CDSUpdate struct { + // ServiceName is the service name corresponding to the clusterName which + // is being watched for through CDS. + ServiceName string + // EnableLRS indicates whether or not load should be reported through LRS. + EnableLRS bool +} +type cdsCallback func(CDSUpdate, error) + +type edsCallback func(*EDSUpdate, error) diff --git a/vendor/google.golang.org/grpc/xds/internal/client/v2client.go b/vendor/google.golang.org/grpc/xds/internal/client/v2client.go new file mode 100644 index 00000000000..f3fbdf8eb65 --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/client/v2client.go @@ -0,0 +1,493 @@ +/* + * + * 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. + * + */ + +package client + +import ( + "context" + "fmt" + "sync" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal/buffer" + + xdspb "github.com/envoyproxy/go-control-plane/envoy/api/v2" + corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" + adsgrpc "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2" +) + +// The value chosen here is based on the default value of the +// initial_fetch_timeout field in corepb.ConfigSource proto. +var defaultWatchExpiryTimeout = 15 * time.Second + +// v2Client performs the actual xDS RPCs using the xDS v2 API. It creates a +// single ADS stream on which the different types of xDS requests and responses +// are multiplexed. +// The reason for splitting this out from the top level xdsClient object is +// because there is already an xDS v3Aplha API in development. If and when we +// want to switch to that, this separation will ease that process. +type v2Client struct { + ctx context.Context + cancelCtx context.CancelFunc + + // ClientConn to the xDS gRPC server. Owned by the parent xdsClient. + cc *grpc.ClientConn + nodeProto *corepb.Node + backoff func(int) time.Duration + + // sendCh in the channel onto which watchInfo objects are pushed by the + // watch API, and it is read and acted upon by the send() goroutine. + sendCh *buffer.Unbounded + + mu sync.Mutex + // Message specific watch infos, protected by the above mutex. These are + // written to, after successfully reading from the update channel, and are + // read from when recovering from a broken stream to resend the xDS + // messages. When the user of this client object cancels a watch call, + // these are set to nil. All accesses to the map protected and any value + // inside the map should be protected with the above mutex. + watchMap map[string]*watchInfo + // ackMap contains the version that was acked (the version in the ack + // request that was sent on wire). The key is typeURL, the value is the + // version string, becaues the versions for different resource types + // should be independent. + ackMap map[string]string + // rdsCache maintains a mapping of {routeConfigName --> clusterName} from + // validated route configurations received in RDS responses. We cache all + // valid route configurations, whether or not we are interested in them + // when we received them (because we could become interested in them in the + // future and the server wont send us those resources again). + // Protected by the above mutex. + // + // TODO: remove RDS cache. The updated spec says client can ignore + // unrequested resources. + // https://github.com/envoyproxy/envoy/blob/master/api/xds_protocol.rst#resource-hints + rdsCache map[string]string + // rdsCache maintains a mapping of {clusterName --> CDSUpdate} from + // validated cluster configurations received in CDS responses. We cache all + // valid cluster configurations, whether or not we are interested in them + // when we received them (because we could become interested in them in the + // future and the server wont send us those resources again). This is only + // to support legacy management servers that do not honor the + // resource_names field. As per the latest spec, the server should resend + // the response when the request changes, even if it had sent the same + // resource earlier (when not asked for). Protected by the above mutex. + cdsCache map[string]CDSUpdate +} + +// newV2Client creates a new v2Client initialized with the passed arguments. +func newV2Client(cc *grpc.ClientConn, nodeProto *corepb.Node, backoff func(int) time.Duration) *v2Client { + v2c := &v2Client{ + cc: cc, + nodeProto: nodeProto, + backoff: backoff, + sendCh: buffer.NewUnbounded(), + watchMap: make(map[string]*watchInfo), + ackMap: make(map[string]string), + rdsCache: make(map[string]string), + cdsCache: make(map[string]CDSUpdate), + } + v2c.ctx, v2c.cancelCtx = context.WithCancel(context.Background()) + + go v2c.run() + return v2c +} + +// close cleans up resources and goroutines allocated by this client. +func (v2c *v2Client) close() { + v2c.cancelCtx() +} + +// run starts an ADS stream (and backs off exponentially, if the previous +// stream failed without receiving a single reply) and runs the sender and +// receiver routines to send and receive data from the stream respectively. +func (v2c *v2Client) run() { + retries := 0 + for { + select { + case <-v2c.ctx.Done(): + return + default: + } + + if retries != 0 { + t := time.NewTimer(v2c.backoff(retries)) + select { + case <-t.C: + case <-v2c.ctx.Done(): + if !t.Stop() { + <-t.C + } + return + } + } + + retries++ + cli := adsgrpc.NewAggregatedDiscoveryServiceClient(v2c.cc) + stream, err := cli.StreamAggregatedResources(v2c.ctx, grpc.WaitForReady(true)) + if err != nil { + grpclog.Infof("xds: ADS stream creation failed: %v", err) + continue + } + + // send() could be blocked on reading updates from the different update + // channels when it is not actually sending out messages. So, we need a + // way to break out of send() when recv() returns. This done channel is + // used to for that purpose. + done := make(chan struct{}) + go v2c.send(stream, done) + if v2c.recv(stream) { + retries = 0 + } + close(done) + } +} + +// sendRequest sends a request for provided typeURL and resource on the provided +// stream. +// +// version is the ack version to be sent with the request +// - If this is the new request (not an ack/nack), version will be an empty +// string +// - If this is an ack, version will be the version from the response +// - If this is a nack, version will be the previous acked version (from +// ackMap). If there was no ack before, it will be an empty string +func (v2c *v2Client) sendRequest(stream adsStream, resourceNames []string, typeURL, version, nonce string) bool { + req := &xdspb.DiscoveryRequest{ + Node: v2c.nodeProto, + TypeUrl: typeURL, + ResourceNames: resourceNames, + VersionInfo: version, + ResponseNonce: nonce, + // TODO: populate ErrorDetails for nack. + } + if err := stream.Send(req); err != nil { + grpclog.Warningf("xds: request (type %s) for resource %v failed: %v", typeURL, resourceNames, err) + return false + } + return true +} + +// sendExisting sends out xDS requests for registered watchers when recovering +// from a broken stream. +// +// We call stream.Send() here with the lock being held. It should be OK to do +// that here because the stream has just started and Send() usually returns +// quickly (once it pushes the message onto the transport layer) and is only +// ever blocked if we don't have enough flow control quota. +func (v2c *v2Client) sendExisting(stream adsStream) bool { + v2c.mu.Lock() + defer v2c.mu.Unlock() + + // Reset the ack versions when the stream restarts. + v2c.ackMap = make(map[string]string) + + for typeURL, wi := range v2c.watchMap { + if !v2c.sendRequest(stream, wi.target, typeURL, "", "") { + return false + } + } + + return true +} + +// processWatchInfo pulls the fields needed by the request from a watchInfo. +// +// It also calls callback with cached response, and updates the watch map in +// v2c. +// +// If the watch was already canceled, it returns false for send +func (v2c *v2Client) processWatchInfo(t *watchInfo) (target []string, typeURL, version, nonce string, send bool) { + v2c.mu.Lock() + defer v2c.mu.Unlock() + if t.state == watchCancelled { + return // This returns all zero values, and false for send. + } + t.state = watchStarted + send = true + + typeURL = t.typeURL + target = t.target + v2c.checkCacheAndUpdateWatchMap(t) + // TODO: if watch is called again with the same resource names, + // there's no need to send another request. + // + // TODO: should we reset version (for ack) when a new watch is + // started? Or do this only if the resource names are different + // (so we send a new request)? + return +} + +// processAckInfo pulls the fields needed by the ack request from a ackInfo. +// +// If no active watch is found for this ack, it returns false for send. +func (v2c *v2Client) processAckInfo(t *ackInfo) (target []string, typeURL, version, nonce string, send bool) { + typeURL = t.typeURL + + v2c.mu.Lock() + defer v2c.mu.Unlock() + wi, ok := v2c.watchMap[typeURL] + if !ok { + // We don't send the request ack if there's no active watch (this can be + // either the server sends responses before any request, or the watch is + // canceled while the ackInfo is in queue), because there's no resource + // name. And if we send a request with empty resource name list, the + // server may treat it as a wild card and send us everything. + grpclog.Warningf("xds: ack (type %s) not sent because there's no active watch for the type", typeURL) + return // This returns all zero values, and false for send. + } + send = true + + version = t.version + nonce = t.nonce + target = wi.target + if version == "" { + // This is a nack, get the previous acked version. + version = v2c.ackMap[typeURL] + // version will still be an empty string if typeURL isn't + // found in ackMap, this can happen if there wasn't any ack + // before. + } else { + v2c.ackMap[typeURL] = version + } + return +} + +// send reads watch infos from update channel and sends out actual xDS requests +// on the provided ADS stream. +func (v2c *v2Client) send(stream adsStream, done chan struct{}) { + if !v2c.sendExisting(stream) { + return + } + + for { + select { + case <-v2c.ctx.Done(): + return + case u := <-v2c.sendCh.Get(): + v2c.sendCh.Load() + + var ( + target []string + typeURL, version, nonce string + send bool + ) + switch t := u.(type) { + case *watchInfo: + target, typeURL, version, nonce, send = v2c.processWatchInfo(t) + case *ackInfo: + target, typeURL, version, nonce, send = v2c.processAckInfo(t) + } + if !send { + continue + } + if !v2c.sendRequest(stream, target, typeURL, version, nonce) { + return + } + case <-done: + return + } + } +} + +// recv receives xDS responses on the provided ADS stream and branches out to +// message specific handlers. +func (v2c *v2Client) recv(stream adsStream) bool { + success := false + for { + resp, err := stream.Recv() + // TODO: call watch callbacks with error when stream is broken. + if err != nil { + grpclog.Warningf("xds: ADS stream recv failed: %v", err) + return success + } + var respHandleErr error + switch resp.GetTypeUrl() { + case ldsURL: + respHandleErr = v2c.handleLDSResponse(resp) + case rdsURL: + respHandleErr = v2c.handleRDSResponse(resp) + case cdsURL: + respHandleErr = v2c.handleCDSResponse(resp) + case edsURL: + respHandleErr = v2c.handleEDSResponse(resp) + default: + grpclog.Warningf("xds: unknown response URL type: %v", resp.GetTypeUrl()) + continue + } + + typeURL := resp.GetTypeUrl() + if respHandleErr != nil { + grpclog.Warningf("xds: response (type %s) handler failed: %v", typeURL, respHandleErr) + v2c.sendCh.Put(&ackInfo{ + typeURL: typeURL, + version: "", + nonce: resp.GetNonce(), + }) + continue + } + v2c.sendCh.Put(&ackInfo{ + typeURL: typeURL, + version: resp.GetVersionInfo(), + nonce: resp.GetNonce(), + }) + success = true + } +} + +// watchLDS registers an LDS watcher for the provided target. Updates +// corresponding to received LDS responses will be pushed to the provided +// callback. The caller can cancel the watch by invoking the returned cancel +// function. +// The provided callback should not block or perform any expensive operations +// or call other methods of the v2Client object. +func (v2c *v2Client) watchLDS(target string, ldsCb ldsCallback) (cancel func()) { + return v2c.watch(&watchInfo{ + typeURL: ldsURL, + target: []string{target}, + callback: ldsCb, + }) +} + +// watchRDS registers an RDS watcher for the provided routeName. Updates +// corresponding to received RDS responses will be pushed to the provided +// callback. The caller can cancel the watch by invoking the returned cancel +// function. +// The provided callback should not block or perform any expensive operations +// or call other methods of the v2Client object. +func (v2c *v2Client) watchRDS(routeName string, rdsCb rdsCallback) (cancel func()) { + return v2c.watch(&watchInfo{ + typeURL: rdsURL, + target: []string{routeName}, + callback: rdsCb, + }) + // TODO: Once a registered RDS watch is cancelled, we should send an RDS + // request with no resources. This will let the server know that we are no + // longer interested in this resource. +} + +// watchCDS registers an CDS watcher for the provided clusterName. Updates +// corresponding to received CDS responses will be pushed to the provided +// callback. The caller can cancel the watch by invoking the returned cancel +// function. +// The provided callback should not block or perform any expensive operations +// or call other methods of the v2Client object. +func (v2c *v2Client) watchCDS(clusterName string, cdsCb cdsCallback) (cancel func()) { + return v2c.watch(&watchInfo{ + typeURL: cdsURL, + target: []string{clusterName}, + callback: cdsCb, + }) +} + +// watchEDS registers an EDS watcher for the provided clusterName. Updates +// corresponding to received EDS responses will be pushed to the provided +// callback. The caller can cancel the watch by invoking the returned cancel +// function. +// The provided callback should not block or perform any expensive operations +// or call other methods of the v2Client object. +func (v2c *v2Client) watchEDS(clusterName string, edsCb edsCallback) (cancel func()) { + return v2c.watch(&watchInfo{ + typeURL: edsURL, + target: []string{clusterName}, + callback: edsCb, + }) + // TODO: Once a registered EDS watch is cancelled, we should send an EDS + // request with no resources. This will let the server know that we are no + // longer interested in this resource. +} + +func (v2c *v2Client) watch(wi *watchInfo) (cancel func()) { + v2c.sendCh.Put(wi) + return func() { + v2c.mu.Lock() + defer v2c.mu.Unlock() + if wi.state == watchEnqueued { + wi.state = watchCancelled + return + } + v2c.watchMap[wi.typeURL].cancel() + delete(v2c.watchMap, wi.typeURL) + // TODO: should we reset ack version string when cancelling the watch? + } +} + +// checkCacheAndUpdateWatchMap is called when a new watch call is handled in +// send(). If an existing watcher is found, its expiry timer is stopped. If the +// watchInfo to be added to the watchMap is found in the cache, the watcher +// callback is immediately invoked. +// +// Caller should hold v2c.mu +func (v2c *v2Client) checkCacheAndUpdateWatchMap(wi *watchInfo) { + if existing := v2c.watchMap[wi.typeURL]; existing != nil { + existing.cancel() + } + + v2c.watchMap[wi.typeURL] = wi + switch wi.typeURL { + // We need to grab the lock inside of the expiryTimer's afterFunc because + // we need to access the watchInfo, which is stored in the watchMap. + case ldsURL: + wi.expiryTimer = time.AfterFunc(defaultWatchExpiryTimeout, func() { + v2c.mu.Lock() + wi.callback.(ldsCallback)(ldsUpdate{}, fmt.Errorf("xds: LDS target %s not found", wi.target)) + v2c.mu.Unlock() + }) + case rdsURL: + routeName := wi.target[0] + if cluster := v2c.rdsCache[routeName]; cluster != "" { + var err error + if v2c.watchMap[ldsURL] == nil { + cluster = "" + err = fmt.Errorf("xds: no LDS watcher found when handling RDS watch for route {%v} from cache", routeName) + } + wi.callback.(rdsCallback)(rdsUpdate{clusterName: cluster}, err) + return + } + // Add the watch expiry timer only for new watches we don't find in + // the cache, and return from here. + wi.expiryTimer = time.AfterFunc(defaultWatchExpiryTimeout, func() { + v2c.mu.Lock() + wi.callback.(rdsCallback)(rdsUpdate{}, fmt.Errorf("xds: RDS target %s not found", wi.target)) + v2c.mu.Unlock() + }) + case cdsURL: + clusterName := wi.target[0] + if update, ok := v2c.cdsCache[clusterName]; ok { + var err error + if v2c.watchMap[cdsURL] == nil { + err = fmt.Errorf("xds: no CDS watcher found when handling CDS watch for cluster {%v} from cache", clusterName) + } + wi.callback.(cdsCallback)(update, err) + return + } + wi.expiryTimer = time.AfterFunc(defaultWatchExpiryTimeout, func() { + v2c.mu.Lock() + wi.callback.(cdsCallback)(CDSUpdate{}, fmt.Errorf("xds: CDS target %s not found", wi.target)) + v2c.mu.Unlock() + }) + case edsURL: + wi.expiryTimer = time.AfterFunc(defaultWatchExpiryTimeout, func() { + v2c.mu.Lock() + wi.callback.(edsCallback)(nil, fmt.Errorf("xds: EDS target %s not found", wi.target)) + v2c.mu.Unlock() + }) + } +} diff --git a/vendor/google.golang.org/grpc/xds/internal/client/v2client_ack_test.go b/vendor/google.golang.org/grpc/xds/internal/client/v2client_ack_test.go new file mode 100644 index 00000000000..1e73dd529e2 --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/client/v2client_ack_test.go @@ -0,0 +1,294 @@ +/* + * + * 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. + */ + +package client + +import ( + "fmt" + "strconv" + "testing" + "time" + + xdspb "github.com/envoyproxy/go-control-plane/envoy/api/v2" + "github.com/golang/protobuf/proto" + anypb "github.com/golang/protobuf/ptypes/any" + "github.com/google/go-cmp/cmp" + "google.golang.org/grpc/xds/internal/client/fakexds" +) + +func emptyChanRecvWithTimeout(ch <-chan struct{}, d time.Duration) error { + timer := time.NewTimer(d) + select { + case <-timer.C: + return fmt.Errorf("timeout") + case <-ch: + timer.Stop() + return nil + } +} + +func requestChanRecvWithTimeout(ch <-chan *fakexds.Request, d time.Duration) (*fakexds.Request, error) { + timer := time.NewTimer(d) + select { + case <-timer.C: + return nil, fmt.Errorf("timeout waiting for request") + case r := <-ch: + timer.Stop() + return r, nil + } +} + +// compareXDSRequest reads requests from channel, compare it with want. +func compareXDSRequest(ch <-chan *fakexds.Request, d time.Duration, want *xdspb.DiscoveryRequest, version, nonce string) error { + r, err := requestChanRecvWithTimeout(ch, d) + if err != nil { + return err + } + if r.Err != nil { + return fmt.Errorf("unexpected error from request: %v", r.Err) + } + wantClone := proto.Clone(want).(*xdspb.DiscoveryRequest) + wantClone.VersionInfo = version + wantClone.ResponseNonce = nonce + if !cmp.Equal(r.Req, wantClone, cmp.Comparer(proto.Equal)) { + return fmt.Errorf("received request different from want, diff: %s", cmp.Diff(r.Req, wantClone)) + } + return nil +} + +func sendXDSRespWithVersion(ch chan<- *fakexds.Response, respWithoutVersion *xdspb.DiscoveryResponse, version int) (nonce string) { + respToSend := proto.Clone(respWithoutVersion).(*xdspb.DiscoveryResponse) + respToSend.VersionInfo = strconv.Itoa(version) + nonce = strconv.Itoa(int(time.Now().UnixNano())) + respToSend.Nonce = nonce + ch <- &fakexds.Response{Resp: respToSend} + return +} + +// TestV2ClientAck verifies that valid responses are acked, and invalid ones are +// nacked. +// +// This test also verifies the version for different types are independent. +func TestV2ClientAck(t *testing.T) { + var ( + versionLDS = 1000 + versionRDS = 2000 + versionCDS = 3000 + versionEDS = 4000 + ) + + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) + defer v2c.close() + t.Log("Started xds v2Client...") + + // Start the watch, send a good response, and check for ack. + cbLDS := startXDS(t, "LDS", v2c, fakeServer, goodLDSRequest) + sendGoodResp(t, "LDS", fakeServer, versionLDS, goodLDSResponse1, goodLDSRequest, cbLDS) + versionLDS++ + cbRDS := startXDS(t, "RDS", v2c, fakeServer, goodRDSRequest) + sendGoodResp(t, "RDS", fakeServer, versionRDS, goodRDSResponse1, goodRDSRequest, cbRDS) + versionRDS++ + cbCDS := startXDS(t, "CDS", v2c, fakeServer, goodCDSRequest) + sendGoodResp(t, "CDS", fakeServer, versionCDS, goodCDSResponse1, goodCDSRequest, cbCDS) + versionCDS++ + cbEDS := startXDS(t, "EDS", v2c, fakeServer, goodEDSRequest) + sendGoodResp(t, "EDS", fakeServer, versionEDS, goodEDSResponse1, goodEDSRequest, cbEDS) + versionEDS++ + + // Send a bad response, and check for nack. + sendBadResp(t, "LDS", fakeServer, versionLDS, goodLDSRequest) + versionLDS++ + sendBadResp(t, "RDS", fakeServer, versionRDS, goodRDSRequest) + versionRDS++ + sendBadResp(t, "CDS", fakeServer, versionCDS, goodCDSRequest) + versionCDS++ + sendBadResp(t, "EDS", fakeServer, versionEDS, goodEDSRequest) + versionEDS++ + + // send another good response, and check for ack, with the new version. + sendGoodResp(t, "LDS", fakeServer, versionLDS, goodLDSResponse1, goodLDSRequest, cbLDS) + versionLDS++ + sendGoodResp(t, "RDS", fakeServer, versionRDS, goodRDSResponse1, goodRDSRequest, cbRDS) + versionRDS++ + sendGoodResp(t, "CDS", fakeServer, versionCDS, goodCDSResponse1, goodCDSRequest, cbCDS) + versionCDS++ + sendGoodResp(t, "EDS", fakeServer, versionEDS, goodEDSResponse1, goodEDSRequest, cbEDS) + versionEDS++ +} + +// startXDS calls watch to send the first request. It then sends a good response +// and checks for ack. +func startXDS(t *testing.T, xdsname string, v2c *v2Client, fakeServer *fakexds.Server, goodReq *xdspb.DiscoveryRequest) <-chan struct{} { + callbackCh := make(chan struct{}, 1) + switch xdsname { + case "LDS": + v2c.watchLDS(goodLDSTarget1, func(u ldsUpdate, err error) { + t.Logf("Received %s callback with ldsUpdate {%+v} and error {%v}", xdsname, u, err) + callbackCh <- struct{}{} + }) + case "RDS": + v2c.watchRDS(goodRouteName1, func(u rdsUpdate, err error) { + t.Logf("Received %s callback with ldsUpdate {%+v} and error {%v}", xdsname, u, err) + callbackCh <- struct{}{} + }) + case "CDS": + v2c.watchCDS(goodClusterName1, func(u CDSUpdate, err error) { + t.Logf("Received %s callback with ldsUpdate {%+v} and error {%v}", xdsname, u, err) + callbackCh <- struct{}{} + }) + case "EDS": + v2c.watchEDS(goodEDSName, func(u *EDSUpdate, err error) { + t.Logf("Received %s callback with ldsUpdate {%+v} and error {%v}", xdsname, u, err) + callbackCh <- struct{}{} + }) + } + + if err := compareXDSRequest(fakeServer.RequestChan, defaultTestTimeout, goodReq, "", ""); err != nil { + t.Fatalf("Failed to receive %s request: %v", xdsname, err) + } + t.Logf("FakeServer received %s request...", xdsname) + return callbackCh +} + +// sendGoodResp sends the good response, with the given version, and a random +// nonce. +// +// It also waits and checks that the ack request contains the given version, and +// the generated nonce. +func sendGoodResp(t *testing.T, xdsname string, fakeServer *fakexds.Server, version int, goodResp *xdspb.DiscoveryResponse, wantReq *xdspb.DiscoveryRequest, callbackCh <-chan struct{}) { + nonce := sendXDSRespWithVersion(fakeServer.ResponseChan, goodResp, version) + t.Logf("Good %s response pushed to fakeServer...", xdsname) + + if err := compareXDSRequest(fakeServer.RequestChan, defaultTestTimeout, wantReq, strconv.Itoa(version), nonce); err != nil { + t.Errorf("Failed to receive %s request: %v", xdsname, err) + } + t.Logf("Good %s response acked", xdsname) + if err := emptyChanRecvWithTimeout(callbackCh, defaultTestTimeout); err != nil { + t.Errorf("Timeout when expecting %s update", xdsname) + } + t.Logf("Good %s response callback executed", xdsname) +} + +// sendBadResp sends a bad response with the given version. This response will +// be nacked, so we expect a request with the previous version (version-1). +// +// But the nonce in request should be the new nonce. +func sendBadResp(t *testing.T, xdsname string, fakeServer *fakexds.Server, version int, wantReq *xdspb.DiscoveryRequest) { + var typeURL string + switch xdsname { + case "LDS": + typeURL = ldsURL + case "RDS": + typeURL = rdsURL + case "CDS": + typeURL = cdsURL + case "EDS": + typeURL = edsURL + } + nonce := sendXDSRespWithVersion(fakeServer.ResponseChan, &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{{}}, + TypeUrl: typeURL, + }, version) + t.Logf("Bad %s response pushed to fakeServer...", xdsname) + if err := compareXDSRequest(fakeServer.RequestChan, defaultTestTimeout, wantReq, strconv.Itoa(version-1), nonce); err != nil { + t.Errorf("Failed to receive %s request: %v", xdsname, err) + } + t.Logf("Bad %s response nacked", xdsname) +} + +// Test when the first response is invalid, and is nacked, the nack requests +// should have an empty version string. +func TestV2ClientAckFirstIsNack(t *testing.T) { + var versionLDS = 1000 + + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) + defer v2c.close() + t.Log("Started xds v2Client...") + + // Start the watch, send a good response, and check for ack. + cbLDS := startXDS(t, "LDS", v2c, fakeServer, goodLDSRequest) + + nonce := sendXDSRespWithVersion(fakeServer.ResponseChan, &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{{}}, + TypeUrl: ldsURL, + }, versionLDS) + t.Logf("Bad response pushed to fakeServer...") + + // The expected version string is an empty string, because this is the first + // response, and it's nacked (so there's no previous ack version). + if err := compareXDSRequest(fakeServer.RequestChan, defaultTestTimeout, goodLDSRequest, "", nonce); err != nil { + t.Errorf("Failed to receive request: %v", err) + } + t.Logf("Bad response nacked") + versionLDS++ + + sendGoodResp(t, "LDS", fakeServer, versionLDS, goodLDSResponse1, goodLDSRequest, cbLDS) + versionLDS++ +} + +// Test when a nack is sent after a new watch, we nack with the previous acked +// version (instead of resetting to empty string). +func TestV2ClientAckNackAfterNewWatch(t *testing.T) { + var versionLDS = 1000 + + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) + defer v2c.close() + t.Log("Started xds v2Client...") + + // Start the watch, send a good response, and check for ack. + cbLDS := startXDS(t, "LDS", v2c, fakeServer, goodLDSRequest) + sendGoodResp(t, "LDS", fakeServer, versionLDS, goodLDSResponse1, goodLDSRequest, cbLDS) + versionLDS++ + + // Start a new watch. + cbLDS = startXDS(t, "LDS", v2c, fakeServer, goodLDSRequest) + + // This is an invalid response after the new watch. + nonce := sendXDSRespWithVersion(fakeServer.ResponseChan, &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{{}}, + TypeUrl: ldsURL, + }, versionLDS) + t.Logf("Bad response pushed to fakeServer...") + + // The expected version string is the previous acked version. + if err := compareXDSRequest(fakeServer.RequestChan, defaultTestTimeout, goodLDSRequest, strconv.Itoa(versionLDS-1), nonce); err != nil { + t.Errorf("Failed to receive request: %v", err) + } + t.Logf("Bad response nacked") + versionLDS++ + + sendGoodResp(t, "LDS", fakeServer, versionLDS, goodLDSResponse1, goodLDSRequest, cbLDS) + versionLDS++ +} diff --git a/vendor/google.golang.org/grpc/xds/internal/client/v2client_test.go b/vendor/google.golang.org/grpc/xds/internal/client/v2client_test.go new file mode 100644 index 00000000000..a844f6888a2 --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/client/v2client_test.go @@ -0,0 +1,529 @@ +/* + * + * 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. + * + */ + +package client + +import ( + "errors" + "testing" + "time" + + "github.com/golang/protobuf/proto" + "google.golang.org/grpc/xds/internal/client/fakexds" + + xdspb "github.com/envoyproxy/go-control-plane/envoy/api/v2" + basepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" + routepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/route" + httppb "github.com/envoyproxy/go-control-plane/envoy/config/filter/network/http_connection_manager/v2" + listenerpb "github.com/envoyproxy/go-control-plane/envoy/config/listener/v2" + anypb "github.com/golang/protobuf/ptypes/any" + structpb "github.com/golang/protobuf/ptypes/struct" +) + +const ( + defaultTestTimeout = 2 * time.Second + goodLDSTarget1 = "lds.target.good:1111" + goodLDSTarget2 = "lds.target.good:2222" + goodRouteName1 = "GoodRouteConfig1" + goodRouteName2 = "GoodRouteConfig2" + goodEDSName = "GoodClusterAssignment1" + uninterestingRouteName = "UninterestingRouteName" + goodMatchingDomain = "lds.target.good" + uninterestingDomain = "uninteresting.domain" + goodClusterName1 = "GoodClusterName1" + goodClusterName2 = "GoodClusterName2" + uninterestingClusterName = "UninterestingClusterName" + httpConnManagerURL = "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager" +) + +var ( + goodNodeProto = &basepb.Node{ + Id: "ENVOY_NODE_ID", + Metadata: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "TRAFFICDIRECTOR_GRPC_HOSTNAME": { + Kind: &structpb.Value_StringValue{StringValue: "trafficdirector"}, + }, + }, + }, + } + goodLDSRequest = &xdspb.DiscoveryRequest{ + Node: goodNodeProto, + TypeUrl: ldsURL, + ResourceNames: []string{goodLDSTarget1}, + } + goodRDSRequest = &xdspb.DiscoveryRequest{ + Node: goodNodeProto, + TypeUrl: rdsURL, + ResourceNames: []string{goodRouteName1}, + } + goodCDSRequest = &xdspb.DiscoveryRequest{ + Node: goodNodeProto, + TypeUrl: cdsURL, + ResourceNames: []string{goodClusterName1}, + } + goodEDSRequest = &xdspb.DiscoveryRequest{ + Node: goodNodeProto, + TypeUrl: edsURL, + ResourceNames: []string{goodEDSName}, + } + goodHTTPConnManager1 = &httppb.HttpConnectionManager{ + RouteSpecifier: &httppb.HttpConnectionManager_Rds{ + Rds: &httppb.Rds{ + RouteConfigName: goodRouteName1, + }, + }, + } + marshaledConnMgr1, _ = proto.Marshal(goodHTTPConnManager1) + emptyHTTPConnManager = &httppb.HttpConnectionManager{ + RouteSpecifier: &httppb.HttpConnectionManager_Rds{ + Rds: &httppb.Rds{}, + }, + } + emptyMarshaledConnMgr, _ = proto.Marshal(emptyHTTPConnManager) + connMgrWithScopedRoutes = &httppb.HttpConnectionManager{ + RouteSpecifier: &httppb.HttpConnectionManager_ScopedRoutes{}, + } + marshaledConnMgrWithScopedRoutes, _ = proto.Marshal(connMgrWithScopedRoutes) + goodListener1 = &xdspb.Listener{ + Name: goodLDSTarget1, + ApiListener: &listenerpb.ApiListener{ + ApiListener: &anypb.Any{ + TypeUrl: httpConnManagerURL, + Value: marshaledConnMgr1, + }, + }, + } + marshaledListener1, _ = proto.Marshal(goodListener1) + goodListener2 = &xdspb.Listener{ + Name: goodLDSTarget2, + ApiListener: &listenerpb.ApiListener{ + ApiListener: &anypb.Any{ + TypeUrl: httpConnManagerURL, + Value: marshaledConnMgr1, + }, + }, + } + marshaledListener2, _ = proto.Marshal(goodListener2) + noAPIListener = &xdspb.Listener{Name: goodLDSTarget1} + marshaledNoAPIListener, _ = proto.Marshal(noAPIListener) + badAPIListener1 = &xdspb.Listener{ + Name: goodLDSTarget1, + ApiListener: &listenerpb.ApiListener{ + ApiListener: &anypb.Any{ + TypeUrl: httpConnManagerURL, + Value: []byte{1, 2, 3, 4}, + }, + }, + } + badAPIListener2 = &xdspb.Listener{ + Name: goodLDSTarget2, + ApiListener: &listenerpb.ApiListener{ + ApiListener: &anypb.Any{ + TypeUrl: httpConnManagerURL, + Value: []byte{1, 2, 3, 4}, + }, + }, + } + badlyMarshaledAPIListener2, _ = proto.Marshal(badAPIListener2) + badResourceListener = &xdspb.Listener{ + Name: goodLDSTarget1, + ApiListener: &listenerpb.ApiListener{ + ApiListener: &anypb.Any{ + TypeUrl: ldsURL, + Value: marshaledListener1, + }, + }, + } + listenerWithEmptyHTTPConnMgr = &xdspb.Listener{ + Name: goodLDSTarget1, + ApiListener: &listenerpb.ApiListener{ + ApiListener: &anypb.Any{ + TypeUrl: httpConnManagerURL, + Value: emptyMarshaledConnMgr, + }, + }, + } + listenerWithScopedRoutesRouteConfig = &xdspb.Listener{ + Name: goodLDSTarget1, + ApiListener: &listenerpb.ApiListener{ + ApiListener: &anypb.Any{ + TypeUrl: httpConnManagerURL, + Value: marshaledConnMgrWithScopedRoutes, + }, + }, + } + goodLDSResponse1 = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + { + TypeUrl: ldsURL, + Value: marshaledListener1, + }, + }, + TypeUrl: ldsURL, + } + goodLDSResponse2 = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + { + TypeUrl: ldsURL, + Value: marshaledListener2, + }, + }, + TypeUrl: ldsURL, + } + emptyLDSResponse = &xdspb.DiscoveryResponse{TypeUrl: ldsURL} + badlyMarshaledLDSResponse = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + { + TypeUrl: ldsURL, + Value: []byte{1, 2, 3, 4}, + }, + }, + TypeUrl: ldsURL, + } + badResourceTypeInLDSResponse = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + { + TypeUrl: httpConnManagerURL, + Value: marshaledConnMgr1, + }, + }, + TypeUrl: ldsURL, + } + ldsResponseWithMultipleResources = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + { + TypeUrl: ldsURL, + Value: marshaledListener2, + }, + { + TypeUrl: ldsURL, + Value: marshaledListener1, + }, + }, + TypeUrl: ldsURL, + } + noAPIListenerLDSResponse = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + { + TypeUrl: ldsURL, + Value: marshaledNoAPIListener, + }, + }, + TypeUrl: ldsURL, + } + goodBadUglyLDSResponse = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + { + TypeUrl: ldsURL, + Value: marshaledListener2, + }, + { + TypeUrl: ldsURL, + Value: marshaledListener1, + }, + { + TypeUrl: ldsURL, + Value: badlyMarshaledAPIListener2, + }, + }, + TypeUrl: ldsURL, + } + badlyMarshaledRDSResponse = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + { + TypeUrl: rdsURL, + Value: []byte{1, 2, 3, 4}, + }, + }, + TypeUrl: rdsURL, + } + badResourceTypeInRDSResponse = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + { + TypeUrl: httpConnManagerURL, + Value: marshaledConnMgr1, + }, + }, + TypeUrl: rdsURL, + } + emptyRouteConfig = &xdspb.RouteConfiguration{} + marshaledEmptyRouteConfig, _ = proto.Marshal(emptyRouteConfig) + noDomainsInRouteConfig = &xdspb.RouteConfiguration{ + VirtualHosts: []*routepb.VirtualHost{{}}, + } + noVirtualHostsInRDSResponse = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + { + TypeUrl: rdsURL, + Value: marshaledEmptyRouteConfig, + }, + }, + TypeUrl: rdsURL, + } + goodRouteConfig1 = &xdspb.RouteConfiguration{ + Name: goodRouteName1, + VirtualHosts: []*routepb.VirtualHost{ + { + Domains: []string{uninterestingDomain}, + Routes: []*routepb.Route{ + { + Match: &routepb.RouteMatch{PathSpecifier: &routepb.RouteMatch_Prefix{Prefix: ""}}, + Action: &routepb.Route_Route{ + Route: &routepb.RouteAction{ + ClusterSpecifier: &routepb.RouteAction_Cluster{Cluster: uninterestingClusterName}, + }, + }, + }, + }, + }, + { + Domains: []string{goodMatchingDomain}, + Routes: []*routepb.Route{ + { + Match: &routepb.RouteMatch{PathSpecifier: &routepb.RouteMatch_Prefix{Prefix: ""}}, + Action: &routepb.Route_Route{ + Route: &routepb.RouteAction{ + ClusterSpecifier: &routepb.RouteAction_Cluster{Cluster: goodClusterName1}, + }, + }, + }, + }, + }, + }, + } + marshaledGoodRouteConfig1, _ = proto.Marshal(goodRouteConfig1) + goodRouteConfig2 = &xdspb.RouteConfiguration{ + Name: goodRouteName2, + VirtualHosts: []*routepb.VirtualHost{ + { + Domains: []string{uninterestingDomain}, + Routes: []*routepb.Route{ + { + Match: &routepb.RouteMatch{PathSpecifier: &routepb.RouteMatch_Prefix{Prefix: ""}}, + Action: &routepb.Route_Route{ + Route: &routepb.RouteAction{ + ClusterSpecifier: &routepb.RouteAction_Cluster{Cluster: uninterestingClusterName}, + }, + }, + }, + }, + }, + { + Domains: []string{goodMatchingDomain}, + Routes: []*routepb.Route{ + { + Match: &routepb.RouteMatch{PathSpecifier: &routepb.RouteMatch_Prefix{Prefix: ""}}, + Action: &routepb.Route_Route{ + Route: &routepb.RouteAction{ + ClusterSpecifier: &routepb.RouteAction_Cluster{Cluster: goodClusterName2}, + }, + }, + }, + }, + }, + }, + } + marshaledGoodRouteConfig2, _ = proto.Marshal(goodRouteConfig2) + uninterestingRouteConfig = &xdspb.RouteConfiguration{ + Name: uninterestingRouteName, + VirtualHosts: []*routepb.VirtualHost{ + { + Domains: []string{uninterestingDomain}, + Routes: []*routepb.Route{ + { + Action: &routepb.Route_Route{ + Route: &routepb.RouteAction{ + ClusterSpecifier: &routepb.RouteAction_Cluster{Cluster: uninterestingClusterName}, + }, + }, + }, + }, + }, + }, + } + marshaledUninterestingRouteConfig, _ = proto.Marshal(uninterestingRouteConfig) + goodRDSResponse1 = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + { + TypeUrl: rdsURL, + Value: marshaledGoodRouteConfig1, + }, + }, + TypeUrl: rdsURL, + } + goodRDSResponse2 = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + { + TypeUrl: rdsURL, + Value: marshaledGoodRouteConfig2, + }, + }, + TypeUrl: rdsURL, + } + uninterestingRDSResponse = &xdspb.DiscoveryResponse{ + Resources: []*anypb.Any{ + { + TypeUrl: rdsURL, + Value: marshaledUninterestingRouteConfig, + }, + }, + TypeUrl: rdsURL, + } +) + +// TestV2ClientBackoffAfterRecvError verifies if the v2Client backoffs when it +// encounters a Recv error while receiving an LDS response. +func TestV2ClientBackoffAfterRecvError(t *testing.T) { + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + + // Override the v2Client backoff function with this, so that we can verify + // that a backoff actually was triggerred. + boCh := make(chan int, 1) + clientBackoff := func(v int) time.Duration { + boCh <- v + return 0 + } + + v2c := newV2Client(client, goodNodeProto, clientBackoff) + defer v2c.close() + t.Log("Started xds v2Client...") + + callbackCh := make(chan struct{}) + v2c.watchLDS(goodLDSTarget1, func(u ldsUpdate, err error) { + close(callbackCh) + }) + <-fakeServer.RequestChan + t.Log("FakeServer received request...") + + fakeServer.ResponseChan <- &fakexds.Response{Err: errors.New("RPC error")} + t.Log("Bad LDS response pushed to fakeServer...") + + timer := time.NewTimer(defaultTestTimeout) + select { + case <-timer.C: + t.Fatal("Timeout when expecting LDS update") + case <-boCh: + timer.Stop() + t.Log("v2Client backed off before retrying...") + case <-callbackCh: + t.Fatal("Received unexpected LDS callback") + } +} + +// TestV2ClientRetriesAfterBrokenStream verifies the case where a stream +// encountered a Recv() error, and is expected to send out xDS requests for +// registered watchers once it comes back up again. +func TestV2ClientRetriesAfterBrokenStream(t *testing.T) { + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) + defer v2c.close() + t.Log("Started xds v2Client...") + + callbackCh := make(chan struct{}, 1) + v2c.watchLDS(goodLDSTarget1, func(u ldsUpdate, err error) { + t.Logf("Received LDS callback with ldsUpdate {%+v} and error {%v}", u, err) + callbackCh <- struct{}{} + }) + <-fakeServer.RequestChan + t.Log("FakeServer received request...") + + fakeServer.ResponseChan <- &fakexds.Response{Resp: goodLDSResponse1} + t.Log("Good LDS response pushed to fakeServer...") + + timer := time.NewTimer(defaultTestTimeout) + select { + case <-timer.C: + t.Fatal("Timeout when expecting LDS update") + case <-callbackCh: + timer.Stop() + } + // Read the ack, so the next request is sent after stream re-creation. + <-fakeServer.RequestChan + + fakeServer.ResponseChan <- &fakexds.Response{Err: errors.New("RPC error")} + t.Log("Bad LDS response pushed to fakeServer...") + + timer = time.NewTimer(defaultTestTimeout) + select { + case <-timer.C: + t.Fatal("Timeout when expecting LDS update") + case gotRequest := <-fakeServer.RequestChan: + timer.Stop() + t.Log("received LDS request after stream re-creation") + if !proto.Equal(gotRequest.Req, goodLDSRequest) { + t.Fatalf("gotRequest: %+v, wantRequest: %+v", gotRequest.Req, goodLDSRequest) + } + } +} + +// TestV2ClientCancelWatch verifies that the registered watch callback is not +// invoked if a response is received after the watcher is cancelled. +func TestV2ClientCancelWatch(t *testing.T) { + fakeServer, sCleanup := fakexds.StartServer(t) + client, cCleanup := fakeServer.GetClientConn(t) + defer func() { + cCleanup() + sCleanup() + }() + v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) + defer v2c.close() + t.Log("Started xds v2Client...") + + callbackCh := make(chan struct{}, 1) + cancelFunc := v2c.watchLDS(goodLDSTarget1, func(u ldsUpdate, err error) { + t.Logf("Received LDS callback with ldsUpdate {%+v} and error {%v}", u, err) + callbackCh <- struct{}{} + }) + <-fakeServer.RequestChan + t.Log("FakeServer received request...") + + fakeServer.ResponseChan <- &fakexds.Response{Resp: goodLDSResponse1} + t.Log("Good LDS response pushed to fakeServer...") + + timer := time.NewTimer(defaultTestTimeout) + select { + case <-timer.C: + t.Fatal("Timeout when expecting LDS update") + case <-callbackCh: + timer.Stop() + } + + cancelFunc() + + fakeServer.ResponseChan <- &fakexds.Response{Resp: goodLDSResponse1} + t.Log("Another good LDS response pushed to fakeServer...") + + timer = time.NewTimer(defaultTestTimeout) + select { + case <-timer.C: + case <-callbackCh: + timer.Stop() + t.Fatalf("Watch callback invoked after the watcher was cancelled") + } +} diff --git a/vendor/google.golang.org/grpc/xds/internal/internal.go b/vendor/google.golang.org/grpc/xds/internal/internal.go index 7403e3f2050..9ed520c96dd 100644 --- a/vendor/google.golang.org/grpc/xds/internal/internal.go +++ b/vendor/google.golang.org/grpc/xds/internal/internal.go @@ -20,9 +20,16 @@ package internal import ( "fmt" - basepb "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/base" + corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" ) +type clientID string + +// XDSClientID is the attributes key used to pass the address of the xdsClient +// object shared between the resolver and the balancer. The xdsClient object is +// created by the resolver and passed to the balancer. +const XDSClientID = clientID("xdsClientID") + // Locality is xds.Locality without XXX fields, so it can be used as map // keys. // @@ -30,6 +37,8 @@ import ( // // This struct should only be used as map keys. Use the proto message directly // in all other places. +// +// TODO: rename to LocalityID. type Locality struct { Region string Zone string @@ -41,8 +50,8 @@ func (lamk Locality) String() string { } // ToProto convert Locality to the proto representation. -func (lamk Locality) ToProto() *basepb.Locality { - return &basepb.Locality{ +func (lamk Locality) ToProto() *corepb.Locality { + return &corepb.Locality{ Region: lamk.Region, Zone: lamk.Zone, SubZone: lamk.SubZone, diff --git a/vendor/google.golang.org/grpc/xds/internal/internal_test.go b/vendor/google.golang.org/grpc/xds/internal/internal_test.go index f1be682978a..1861db62e7e 100644 --- a/vendor/google.golang.org/grpc/xds/internal/internal_test.go +++ b/vendor/google.golang.org/grpc/xds/internal/internal_test.go @@ -23,8 +23,8 @@ import ( "testing" "unicode" + corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" "github.com/google/go-cmp/cmp" - basepb "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/base" ) const ignorePrefix = "XXX_" @@ -49,7 +49,7 @@ func TestLocalityMatchProtoMessage(t *testing.T) { } want2 := make(map[string]string) - for ty, i := reflect.TypeOf(basepb.Locality{}), 0; i < ty.NumField(); i++ { + for ty, i := reflect.TypeOf(corepb.Locality{}), 0; i < ty.NumField(); i++ { f := ty.Field(i) if ignore(f.Name) { continue diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/auth/cert/cert.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/auth/cert/cert.pb.go deleted file mode 100755 index d39d9317bfa..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/auth/cert/cert.pb.go +++ /dev/null @@ -1,1144 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: envoy/api/v2/auth/cert.proto - -package auth - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import wrappers "github.com/golang/protobuf/ptypes/wrappers" -import base "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/base" -import config_source "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/config_source" -import _ "google.golang.org/grpc/xds/internal/proto/validate" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type TlsParameters_TlsProtocol int32 - -const ( - TlsParameters_TLS_AUTO TlsParameters_TlsProtocol = 0 - TlsParameters_TLSv1_0 TlsParameters_TlsProtocol = 1 - TlsParameters_TLSv1_1 TlsParameters_TlsProtocol = 2 - TlsParameters_TLSv1_2 TlsParameters_TlsProtocol = 3 - TlsParameters_TLSv1_3 TlsParameters_TlsProtocol = 4 -) - -var TlsParameters_TlsProtocol_name = map[int32]string{ - 0: "TLS_AUTO", - 1: "TLSv1_0", - 2: "TLSv1_1", - 3: "TLSv1_2", - 4: "TLSv1_3", -} -var TlsParameters_TlsProtocol_value = map[string]int32{ - "TLS_AUTO": 0, - "TLSv1_0": 1, - "TLSv1_1": 2, - "TLSv1_2": 3, - "TLSv1_3": 4, -} - -func (x TlsParameters_TlsProtocol) String() string { - return proto.EnumName(TlsParameters_TlsProtocol_name, int32(x)) -} -func (TlsParameters_TlsProtocol) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_cert_f82beca1d890b9d7, []int{0, 0} -} - -type TlsParameters struct { - TlsMinimumProtocolVersion TlsParameters_TlsProtocol `protobuf:"varint,1,opt,name=tls_minimum_protocol_version,json=tlsMinimumProtocolVersion,proto3,enum=envoy.api.v2.auth.TlsParameters_TlsProtocol" json:"tls_minimum_protocol_version,omitempty"` - TlsMaximumProtocolVersion TlsParameters_TlsProtocol `protobuf:"varint,2,opt,name=tls_maximum_protocol_version,json=tlsMaximumProtocolVersion,proto3,enum=envoy.api.v2.auth.TlsParameters_TlsProtocol" json:"tls_maximum_protocol_version,omitempty"` - CipherSuites []string `protobuf:"bytes,3,rep,name=cipher_suites,json=cipherSuites,proto3" json:"cipher_suites,omitempty"` - EcdhCurves []string `protobuf:"bytes,4,rep,name=ecdh_curves,json=ecdhCurves,proto3" json:"ecdh_curves,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TlsParameters) Reset() { *m = TlsParameters{} } -func (m *TlsParameters) String() string { return proto.CompactTextString(m) } -func (*TlsParameters) ProtoMessage() {} -func (*TlsParameters) Descriptor() ([]byte, []int) { - return fileDescriptor_cert_f82beca1d890b9d7, []int{0} -} -func (m *TlsParameters) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TlsParameters.Unmarshal(m, b) -} -func (m *TlsParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TlsParameters.Marshal(b, m, deterministic) -} -func (dst *TlsParameters) XXX_Merge(src proto.Message) { - xxx_messageInfo_TlsParameters.Merge(dst, src) -} -func (m *TlsParameters) XXX_Size() int { - return xxx_messageInfo_TlsParameters.Size(m) -} -func (m *TlsParameters) XXX_DiscardUnknown() { - xxx_messageInfo_TlsParameters.DiscardUnknown(m) -} - -var xxx_messageInfo_TlsParameters proto.InternalMessageInfo - -func (m *TlsParameters) GetTlsMinimumProtocolVersion() TlsParameters_TlsProtocol { - if m != nil { - return m.TlsMinimumProtocolVersion - } - return TlsParameters_TLS_AUTO -} - -func (m *TlsParameters) GetTlsMaximumProtocolVersion() TlsParameters_TlsProtocol { - if m != nil { - return m.TlsMaximumProtocolVersion - } - return TlsParameters_TLS_AUTO -} - -func (m *TlsParameters) GetCipherSuites() []string { - if m != nil { - return m.CipherSuites - } - return nil -} - -func (m *TlsParameters) GetEcdhCurves() []string { - if m != nil { - return m.EcdhCurves - } - return nil -} - -type TlsCertificate struct { - CertificateChain *base.DataSource `protobuf:"bytes,1,opt,name=certificate_chain,json=certificateChain,proto3" json:"certificate_chain,omitempty"` - PrivateKey *base.DataSource `protobuf:"bytes,2,opt,name=private_key,json=privateKey,proto3" json:"private_key,omitempty"` - Password *base.DataSource `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` - OcspStaple *base.DataSource `protobuf:"bytes,4,opt,name=ocsp_staple,json=ocspStaple,proto3" json:"ocsp_staple,omitempty"` - SignedCertificateTimestamp []*base.DataSource `protobuf:"bytes,5,rep,name=signed_certificate_timestamp,json=signedCertificateTimestamp,proto3" json:"signed_certificate_timestamp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TlsCertificate) Reset() { *m = TlsCertificate{} } -func (m *TlsCertificate) String() string { return proto.CompactTextString(m) } -func (*TlsCertificate) ProtoMessage() {} -func (*TlsCertificate) Descriptor() ([]byte, []int) { - return fileDescriptor_cert_f82beca1d890b9d7, []int{1} -} -func (m *TlsCertificate) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TlsCertificate.Unmarshal(m, b) -} -func (m *TlsCertificate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TlsCertificate.Marshal(b, m, deterministic) -} -func (dst *TlsCertificate) XXX_Merge(src proto.Message) { - xxx_messageInfo_TlsCertificate.Merge(dst, src) -} -func (m *TlsCertificate) XXX_Size() int { - return xxx_messageInfo_TlsCertificate.Size(m) -} -func (m *TlsCertificate) XXX_DiscardUnknown() { - xxx_messageInfo_TlsCertificate.DiscardUnknown(m) -} - -var xxx_messageInfo_TlsCertificate proto.InternalMessageInfo - -func (m *TlsCertificate) GetCertificateChain() *base.DataSource { - if m != nil { - return m.CertificateChain - } - return nil -} - -func (m *TlsCertificate) GetPrivateKey() *base.DataSource { - if m != nil { - return m.PrivateKey - } - return nil -} - -func (m *TlsCertificate) GetPassword() *base.DataSource { - if m != nil { - return m.Password - } - return nil -} - -func (m *TlsCertificate) GetOcspStaple() *base.DataSource { - if m != nil { - return m.OcspStaple - } - return nil -} - -func (m *TlsCertificate) GetSignedCertificateTimestamp() []*base.DataSource { - if m != nil { - return m.SignedCertificateTimestamp - } - return nil -} - -type TlsSessionTicketKeys struct { - Keys []*base.DataSource `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TlsSessionTicketKeys) Reset() { *m = TlsSessionTicketKeys{} } -func (m *TlsSessionTicketKeys) String() string { return proto.CompactTextString(m) } -func (*TlsSessionTicketKeys) ProtoMessage() {} -func (*TlsSessionTicketKeys) Descriptor() ([]byte, []int) { - return fileDescriptor_cert_f82beca1d890b9d7, []int{2} -} -func (m *TlsSessionTicketKeys) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TlsSessionTicketKeys.Unmarshal(m, b) -} -func (m *TlsSessionTicketKeys) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TlsSessionTicketKeys.Marshal(b, m, deterministic) -} -func (dst *TlsSessionTicketKeys) XXX_Merge(src proto.Message) { - xxx_messageInfo_TlsSessionTicketKeys.Merge(dst, src) -} -func (m *TlsSessionTicketKeys) XXX_Size() int { - return xxx_messageInfo_TlsSessionTicketKeys.Size(m) -} -func (m *TlsSessionTicketKeys) XXX_DiscardUnknown() { - xxx_messageInfo_TlsSessionTicketKeys.DiscardUnknown(m) -} - -var xxx_messageInfo_TlsSessionTicketKeys proto.InternalMessageInfo - -func (m *TlsSessionTicketKeys) GetKeys() []*base.DataSource { - if m != nil { - return m.Keys - } - return nil -} - -type CertificateValidationContext struct { - TrustedCa *base.DataSource `protobuf:"bytes,1,opt,name=trusted_ca,json=trustedCa,proto3" json:"trusted_ca,omitempty"` - VerifyCertificateSpki []string `protobuf:"bytes,3,rep,name=verify_certificate_spki,json=verifyCertificateSpki,proto3" json:"verify_certificate_spki,omitempty"` - VerifyCertificateHash []string `protobuf:"bytes,2,rep,name=verify_certificate_hash,json=verifyCertificateHash,proto3" json:"verify_certificate_hash,omitempty"` - VerifySubjectAltName []string `protobuf:"bytes,4,rep,name=verify_subject_alt_name,json=verifySubjectAltName,proto3" json:"verify_subject_alt_name,omitempty"` - RequireOcspStaple *wrappers.BoolValue `protobuf:"bytes,5,opt,name=require_ocsp_staple,json=requireOcspStaple,proto3" json:"require_ocsp_staple,omitempty"` - RequireSignedCertificateTimestamp *wrappers.BoolValue `protobuf:"bytes,6,opt,name=require_signed_certificate_timestamp,json=requireSignedCertificateTimestamp,proto3" json:"require_signed_certificate_timestamp,omitempty"` - Crl *base.DataSource `protobuf:"bytes,7,opt,name=crl,proto3" json:"crl,omitempty"` - AllowExpiredCertificate bool `protobuf:"varint,8,opt,name=allow_expired_certificate,json=allowExpiredCertificate,proto3" json:"allow_expired_certificate,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CertificateValidationContext) Reset() { *m = CertificateValidationContext{} } -func (m *CertificateValidationContext) String() string { return proto.CompactTextString(m) } -func (*CertificateValidationContext) ProtoMessage() {} -func (*CertificateValidationContext) Descriptor() ([]byte, []int) { - return fileDescriptor_cert_f82beca1d890b9d7, []int{3} -} -func (m *CertificateValidationContext) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CertificateValidationContext.Unmarshal(m, b) -} -func (m *CertificateValidationContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CertificateValidationContext.Marshal(b, m, deterministic) -} -func (dst *CertificateValidationContext) XXX_Merge(src proto.Message) { - xxx_messageInfo_CertificateValidationContext.Merge(dst, src) -} -func (m *CertificateValidationContext) XXX_Size() int { - return xxx_messageInfo_CertificateValidationContext.Size(m) -} -func (m *CertificateValidationContext) XXX_DiscardUnknown() { - xxx_messageInfo_CertificateValidationContext.DiscardUnknown(m) -} - -var xxx_messageInfo_CertificateValidationContext proto.InternalMessageInfo - -func (m *CertificateValidationContext) GetTrustedCa() *base.DataSource { - if m != nil { - return m.TrustedCa - } - return nil -} - -func (m *CertificateValidationContext) GetVerifyCertificateSpki() []string { - if m != nil { - return m.VerifyCertificateSpki - } - return nil -} - -func (m *CertificateValidationContext) GetVerifyCertificateHash() []string { - if m != nil { - return m.VerifyCertificateHash - } - return nil -} - -func (m *CertificateValidationContext) GetVerifySubjectAltName() []string { - if m != nil { - return m.VerifySubjectAltName - } - return nil -} - -func (m *CertificateValidationContext) GetRequireOcspStaple() *wrappers.BoolValue { - if m != nil { - return m.RequireOcspStaple - } - return nil -} - -func (m *CertificateValidationContext) GetRequireSignedCertificateTimestamp() *wrappers.BoolValue { - if m != nil { - return m.RequireSignedCertificateTimestamp - } - return nil -} - -func (m *CertificateValidationContext) GetCrl() *base.DataSource { - if m != nil { - return m.Crl - } - return nil -} - -func (m *CertificateValidationContext) GetAllowExpiredCertificate() bool { - if m != nil { - return m.AllowExpiredCertificate - } - return false -} - -type CommonTlsContext struct { - TlsParams *TlsParameters `protobuf:"bytes,1,opt,name=tls_params,json=tlsParams,proto3" json:"tls_params,omitempty"` - TlsCertificates []*TlsCertificate `protobuf:"bytes,2,rep,name=tls_certificates,json=tlsCertificates,proto3" json:"tls_certificates,omitempty"` - TlsCertificateSdsSecretConfigs []*SdsSecretConfig `protobuf:"bytes,6,rep,name=tls_certificate_sds_secret_configs,json=tlsCertificateSdsSecretConfigs,proto3" json:"tls_certificate_sds_secret_configs,omitempty"` - // Types that are valid to be assigned to ValidationContextType: - // *CommonTlsContext_ValidationContext - // *CommonTlsContext_ValidationContextSdsSecretConfig - // *CommonTlsContext_CombinedValidationContext - ValidationContextType isCommonTlsContext_ValidationContextType `protobuf_oneof:"validation_context_type"` - AlpnProtocols []string `protobuf:"bytes,4,rep,name=alpn_protocols,json=alpnProtocols,proto3" json:"alpn_protocols,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CommonTlsContext) Reset() { *m = CommonTlsContext{} } -func (m *CommonTlsContext) String() string { return proto.CompactTextString(m) } -func (*CommonTlsContext) ProtoMessage() {} -func (*CommonTlsContext) Descriptor() ([]byte, []int) { - return fileDescriptor_cert_f82beca1d890b9d7, []int{4} -} -func (m *CommonTlsContext) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CommonTlsContext.Unmarshal(m, b) -} -func (m *CommonTlsContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CommonTlsContext.Marshal(b, m, deterministic) -} -func (dst *CommonTlsContext) XXX_Merge(src proto.Message) { - xxx_messageInfo_CommonTlsContext.Merge(dst, src) -} -func (m *CommonTlsContext) XXX_Size() int { - return xxx_messageInfo_CommonTlsContext.Size(m) -} -func (m *CommonTlsContext) XXX_DiscardUnknown() { - xxx_messageInfo_CommonTlsContext.DiscardUnknown(m) -} - -var xxx_messageInfo_CommonTlsContext proto.InternalMessageInfo - -func (m *CommonTlsContext) GetTlsParams() *TlsParameters { - if m != nil { - return m.TlsParams - } - return nil -} - -func (m *CommonTlsContext) GetTlsCertificates() []*TlsCertificate { - if m != nil { - return m.TlsCertificates - } - return nil -} - -func (m *CommonTlsContext) GetTlsCertificateSdsSecretConfigs() []*SdsSecretConfig { - if m != nil { - return m.TlsCertificateSdsSecretConfigs - } - return nil -} - -type isCommonTlsContext_ValidationContextType interface { - isCommonTlsContext_ValidationContextType() -} - -type CommonTlsContext_ValidationContext struct { - ValidationContext *CertificateValidationContext `protobuf:"bytes,3,opt,name=validation_context,json=validationContext,proto3,oneof"` -} - -type CommonTlsContext_ValidationContextSdsSecretConfig struct { - ValidationContextSdsSecretConfig *SdsSecretConfig `protobuf:"bytes,7,opt,name=validation_context_sds_secret_config,json=validationContextSdsSecretConfig,proto3,oneof"` -} - -type CommonTlsContext_CombinedValidationContext struct { - CombinedValidationContext *CommonTlsContext_CombinedCertificateValidationContext `protobuf:"bytes,8,opt,name=combined_validation_context,json=combinedValidationContext,proto3,oneof"` -} - -func (*CommonTlsContext_ValidationContext) isCommonTlsContext_ValidationContextType() {} - -func (*CommonTlsContext_ValidationContextSdsSecretConfig) isCommonTlsContext_ValidationContextType() {} - -func (*CommonTlsContext_CombinedValidationContext) isCommonTlsContext_ValidationContextType() {} - -func (m *CommonTlsContext) GetValidationContextType() isCommonTlsContext_ValidationContextType { - if m != nil { - return m.ValidationContextType - } - return nil -} - -func (m *CommonTlsContext) GetValidationContext() *CertificateValidationContext { - if x, ok := m.GetValidationContextType().(*CommonTlsContext_ValidationContext); ok { - return x.ValidationContext - } - return nil -} - -func (m *CommonTlsContext) GetValidationContextSdsSecretConfig() *SdsSecretConfig { - if x, ok := m.GetValidationContextType().(*CommonTlsContext_ValidationContextSdsSecretConfig); ok { - return x.ValidationContextSdsSecretConfig - } - return nil -} - -func (m *CommonTlsContext) GetCombinedValidationContext() *CommonTlsContext_CombinedCertificateValidationContext { - if x, ok := m.GetValidationContextType().(*CommonTlsContext_CombinedValidationContext); ok { - return x.CombinedValidationContext - } - return nil -} - -func (m *CommonTlsContext) GetAlpnProtocols() []string { - if m != nil { - return m.AlpnProtocols - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*CommonTlsContext) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _CommonTlsContext_OneofMarshaler, _CommonTlsContext_OneofUnmarshaler, _CommonTlsContext_OneofSizer, []interface{}{ - (*CommonTlsContext_ValidationContext)(nil), - (*CommonTlsContext_ValidationContextSdsSecretConfig)(nil), - (*CommonTlsContext_CombinedValidationContext)(nil), - } -} - -func _CommonTlsContext_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*CommonTlsContext) - // validation_context_type - switch x := m.ValidationContextType.(type) { - case *CommonTlsContext_ValidationContext: - b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ValidationContext); err != nil { - return err - } - case *CommonTlsContext_ValidationContextSdsSecretConfig: - b.EncodeVarint(7<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ValidationContextSdsSecretConfig); err != nil { - return err - } - case *CommonTlsContext_CombinedValidationContext: - b.EncodeVarint(8<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.CombinedValidationContext); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("CommonTlsContext.ValidationContextType has unexpected type %T", x) - } - return nil -} - -func _CommonTlsContext_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*CommonTlsContext) - switch tag { - case 3: // validation_context_type.validation_context - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(CertificateValidationContext) - err := b.DecodeMessage(msg) - m.ValidationContextType = &CommonTlsContext_ValidationContext{msg} - return true, err - case 7: // validation_context_type.validation_context_sds_secret_config - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SdsSecretConfig) - err := b.DecodeMessage(msg) - m.ValidationContextType = &CommonTlsContext_ValidationContextSdsSecretConfig{msg} - return true, err - case 8: // validation_context_type.combined_validation_context - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(CommonTlsContext_CombinedCertificateValidationContext) - err := b.DecodeMessage(msg) - m.ValidationContextType = &CommonTlsContext_CombinedValidationContext{msg} - return true, err - default: - return false, nil - } -} - -func _CommonTlsContext_OneofSizer(msg proto.Message) (n int) { - m := msg.(*CommonTlsContext) - // validation_context_type - switch x := m.ValidationContextType.(type) { - case *CommonTlsContext_ValidationContext: - s := proto.Size(x.ValidationContext) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *CommonTlsContext_ValidationContextSdsSecretConfig: - s := proto.Size(x.ValidationContextSdsSecretConfig) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *CommonTlsContext_CombinedValidationContext: - s := proto.Size(x.CombinedValidationContext) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type CommonTlsContext_CombinedCertificateValidationContext struct { - DefaultValidationContext *CertificateValidationContext `protobuf:"bytes,1,opt,name=default_validation_context,json=defaultValidationContext,proto3" json:"default_validation_context,omitempty"` - ValidationContextSdsSecretConfig *SdsSecretConfig `protobuf:"bytes,2,opt,name=validation_context_sds_secret_config,json=validationContextSdsSecretConfig,proto3" json:"validation_context_sds_secret_config,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CommonTlsContext_CombinedCertificateValidationContext) Reset() { - *m = CommonTlsContext_CombinedCertificateValidationContext{} -} -func (m *CommonTlsContext_CombinedCertificateValidationContext) String() string { - return proto.CompactTextString(m) -} -func (*CommonTlsContext_CombinedCertificateValidationContext) ProtoMessage() {} -func (*CommonTlsContext_CombinedCertificateValidationContext) Descriptor() ([]byte, []int) { - return fileDescriptor_cert_f82beca1d890b9d7, []int{4, 0} -} -func (m *CommonTlsContext_CombinedCertificateValidationContext) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CommonTlsContext_CombinedCertificateValidationContext.Unmarshal(m, b) -} -func (m *CommonTlsContext_CombinedCertificateValidationContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CommonTlsContext_CombinedCertificateValidationContext.Marshal(b, m, deterministic) -} -func (dst *CommonTlsContext_CombinedCertificateValidationContext) XXX_Merge(src proto.Message) { - xxx_messageInfo_CommonTlsContext_CombinedCertificateValidationContext.Merge(dst, src) -} -func (m *CommonTlsContext_CombinedCertificateValidationContext) XXX_Size() int { - return xxx_messageInfo_CommonTlsContext_CombinedCertificateValidationContext.Size(m) -} -func (m *CommonTlsContext_CombinedCertificateValidationContext) XXX_DiscardUnknown() { - xxx_messageInfo_CommonTlsContext_CombinedCertificateValidationContext.DiscardUnknown(m) -} - -var xxx_messageInfo_CommonTlsContext_CombinedCertificateValidationContext proto.InternalMessageInfo - -func (m *CommonTlsContext_CombinedCertificateValidationContext) GetDefaultValidationContext() *CertificateValidationContext { - if m != nil { - return m.DefaultValidationContext - } - return nil -} - -func (m *CommonTlsContext_CombinedCertificateValidationContext) GetValidationContextSdsSecretConfig() *SdsSecretConfig { - if m != nil { - return m.ValidationContextSdsSecretConfig - } - return nil -} - -type UpstreamTlsContext struct { - CommonTlsContext *CommonTlsContext `protobuf:"bytes,1,opt,name=common_tls_context,json=commonTlsContext,proto3" json:"common_tls_context,omitempty"` - Sni string `protobuf:"bytes,2,opt,name=sni,proto3" json:"sni,omitempty"` - AllowRenegotiation bool `protobuf:"varint,3,opt,name=allow_renegotiation,json=allowRenegotiation,proto3" json:"allow_renegotiation,omitempty"` - MaxSessionKeys *wrappers.UInt32Value `protobuf:"bytes,4,opt,name=max_session_keys,json=maxSessionKeys,proto3" json:"max_session_keys,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UpstreamTlsContext) Reset() { *m = UpstreamTlsContext{} } -func (m *UpstreamTlsContext) String() string { return proto.CompactTextString(m) } -func (*UpstreamTlsContext) ProtoMessage() {} -func (*UpstreamTlsContext) Descriptor() ([]byte, []int) { - return fileDescriptor_cert_f82beca1d890b9d7, []int{5} -} -func (m *UpstreamTlsContext) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UpstreamTlsContext.Unmarshal(m, b) -} -func (m *UpstreamTlsContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UpstreamTlsContext.Marshal(b, m, deterministic) -} -func (dst *UpstreamTlsContext) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpstreamTlsContext.Merge(dst, src) -} -func (m *UpstreamTlsContext) XXX_Size() int { - return xxx_messageInfo_UpstreamTlsContext.Size(m) -} -func (m *UpstreamTlsContext) XXX_DiscardUnknown() { - xxx_messageInfo_UpstreamTlsContext.DiscardUnknown(m) -} - -var xxx_messageInfo_UpstreamTlsContext proto.InternalMessageInfo - -func (m *UpstreamTlsContext) GetCommonTlsContext() *CommonTlsContext { - if m != nil { - return m.CommonTlsContext - } - return nil -} - -func (m *UpstreamTlsContext) GetSni() string { - if m != nil { - return m.Sni - } - return "" -} - -func (m *UpstreamTlsContext) GetAllowRenegotiation() bool { - if m != nil { - return m.AllowRenegotiation - } - return false -} - -func (m *UpstreamTlsContext) GetMaxSessionKeys() *wrappers.UInt32Value { - if m != nil { - return m.MaxSessionKeys - } - return nil -} - -type DownstreamTlsContext struct { - CommonTlsContext *CommonTlsContext `protobuf:"bytes,1,opt,name=common_tls_context,json=commonTlsContext,proto3" json:"common_tls_context,omitempty"` - RequireClientCertificate *wrappers.BoolValue `protobuf:"bytes,2,opt,name=require_client_certificate,json=requireClientCertificate,proto3" json:"require_client_certificate,omitempty"` - RequireSni *wrappers.BoolValue `protobuf:"bytes,3,opt,name=require_sni,json=requireSni,proto3" json:"require_sni,omitempty"` - // Types that are valid to be assigned to SessionTicketKeysType: - // *DownstreamTlsContext_SessionTicketKeys - // *DownstreamTlsContext_SessionTicketKeysSdsSecretConfig - SessionTicketKeysType isDownstreamTlsContext_SessionTicketKeysType `protobuf_oneof:"session_ticket_keys_type"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DownstreamTlsContext) Reset() { *m = DownstreamTlsContext{} } -func (m *DownstreamTlsContext) String() string { return proto.CompactTextString(m) } -func (*DownstreamTlsContext) ProtoMessage() {} -func (*DownstreamTlsContext) Descriptor() ([]byte, []int) { - return fileDescriptor_cert_f82beca1d890b9d7, []int{6} -} -func (m *DownstreamTlsContext) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DownstreamTlsContext.Unmarshal(m, b) -} -func (m *DownstreamTlsContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DownstreamTlsContext.Marshal(b, m, deterministic) -} -func (dst *DownstreamTlsContext) XXX_Merge(src proto.Message) { - xxx_messageInfo_DownstreamTlsContext.Merge(dst, src) -} -func (m *DownstreamTlsContext) XXX_Size() int { - return xxx_messageInfo_DownstreamTlsContext.Size(m) -} -func (m *DownstreamTlsContext) XXX_DiscardUnknown() { - xxx_messageInfo_DownstreamTlsContext.DiscardUnknown(m) -} - -var xxx_messageInfo_DownstreamTlsContext proto.InternalMessageInfo - -func (m *DownstreamTlsContext) GetCommonTlsContext() *CommonTlsContext { - if m != nil { - return m.CommonTlsContext - } - return nil -} - -func (m *DownstreamTlsContext) GetRequireClientCertificate() *wrappers.BoolValue { - if m != nil { - return m.RequireClientCertificate - } - return nil -} - -func (m *DownstreamTlsContext) GetRequireSni() *wrappers.BoolValue { - if m != nil { - return m.RequireSni - } - return nil -} - -type isDownstreamTlsContext_SessionTicketKeysType interface { - isDownstreamTlsContext_SessionTicketKeysType() -} - -type DownstreamTlsContext_SessionTicketKeys struct { - SessionTicketKeys *TlsSessionTicketKeys `protobuf:"bytes,4,opt,name=session_ticket_keys,json=sessionTicketKeys,proto3,oneof"` -} - -type DownstreamTlsContext_SessionTicketKeysSdsSecretConfig struct { - SessionTicketKeysSdsSecretConfig *SdsSecretConfig `protobuf:"bytes,5,opt,name=session_ticket_keys_sds_secret_config,json=sessionTicketKeysSdsSecretConfig,proto3,oneof"` -} - -func (*DownstreamTlsContext_SessionTicketKeys) isDownstreamTlsContext_SessionTicketKeysType() {} - -func (*DownstreamTlsContext_SessionTicketKeysSdsSecretConfig) isDownstreamTlsContext_SessionTicketKeysType() { -} - -func (m *DownstreamTlsContext) GetSessionTicketKeysType() isDownstreamTlsContext_SessionTicketKeysType { - if m != nil { - return m.SessionTicketKeysType - } - return nil -} - -func (m *DownstreamTlsContext) GetSessionTicketKeys() *TlsSessionTicketKeys { - if x, ok := m.GetSessionTicketKeysType().(*DownstreamTlsContext_SessionTicketKeys); ok { - return x.SessionTicketKeys - } - return nil -} - -func (m *DownstreamTlsContext) GetSessionTicketKeysSdsSecretConfig() *SdsSecretConfig { - if x, ok := m.GetSessionTicketKeysType().(*DownstreamTlsContext_SessionTicketKeysSdsSecretConfig); ok { - return x.SessionTicketKeysSdsSecretConfig - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*DownstreamTlsContext) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _DownstreamTlsContext_OneofMarshaler, _DownstreamTlsContext_OneofUnmarshaler, _DownstreamTlsContext_OneofSizer, []interface{}{ - (*DownstreamTlsContext_SessionTicketKeys)(nil), - (*DownstreamTlsContext_SessionTicketKeysSdsSecretConfig)(nil), - } -} - -func _DownstreamTlsContext_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*DownstreamTlsContext) - // session_ticket_keys_type - switch x := m.SessionTicketKeysType.(type) { - case *DownstreamTlsContext_SessionTicketKeys: - b.EncodeVarint(4<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SessionTicketKeys); err != nil { - return err - } - case *DownstreamTlsContext_SessionTicketKeysSdsSecretConfig: - b.EncodeVarint(5<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SessionTicketKeysSdsSecretConfig); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("DownstreamTlsContext.SessionTicketKeysType has unexpected type %T", x) - } - return nil -} - -func _DownstreamTlsContext_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*DownstreamTlsContext) - switch tag { - case 4: // session_ticket_keys_type.session_ticket_keys - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(TlsSessionTicketKeys) - err := b.DecodeMessage(msg) - m.SessionTicketKeysType = &DownstreamTlsContext_SessionTicketKeys{msg} - return true, err - case 5: // session_ticket_keys_type.session_ticket_keys_sds_secret_config - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SdsSecretConfig) - err := b.DecodeMessage(msg) - m.SessionTicketKeysType = &DownstreamTlsContext_SessionTicketKeysSdsSecretConfig{msg} - return true, err - default: - return false, nil - } -} - -func _DownstreamTlsContext_OneofSizer(msg proto.Message) (n int) { - m := msg.(*DownstreamTlsContext) - // session_ticket_keys_type - switch x := m.SessionTicketKeysType.(type) { - case *DownstreamTlsContext_SessionTicketKeys: - s := proto.Size(x.SessionTicketKeys) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *DownstreamTlsContext_SessionTicketKeysSdsSecretConfig: - s := proto.Size(x.SessionTicketKeysSdsSecretConfig) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type SdsSecretConfig struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - SdsConfig *config_source.ConfigSource `protobuf:"bytes,2,opt,name=sds_config,json=sdsConfig,proto3" json:"sds_config,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SdsSecretConfig) Reset() { *m = SdsSecretConfig{} } -func (m *SdsSecretConfig) String() string { return proto.CompactTextString(m) } -func (*SdsSecretConfig) ProtoMessage() {} -func (*SdsSecretConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_cert_f82beca1d890b9d7, []int{7} -} -func (m *SdsSecretConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SdsSecretConfig.Unmarshal(m, b) -} -func (m *SdsSecretConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SdsSecretConfig.Marshal(b, m, deterministic) -} -func (dst *SdsSecretConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_SdsSecretConfig.Merge(dst, src) -} -func (m *SdsSecretConfig) XXX_Size() int { - return xxx_messageInfo_SdsSecretConfig.Size(m) -} -func (m *SdsSecretConfig) XXX_DiscardUnknown() { - xxx_messageInfo_SdsSecretConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_SdsSecretConfig proto.InternalMessageInfo - -func (m *SdsSecretConfig) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *SdsSecretConfig) GetSdsConfig() *config_source.ConfigSource { - if m != nil { - return m.SdsConfig - } - return nil -} - -type Secret struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Types that are valid to be assigned to Type: - // *Secret_TlsCertificate - // *Secret_SessionTicketKeys - // *Secret_ValidationContext - Type isSecret_Type `protobuf_oneof:"type"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Secret) Reset() { *m = Secret{} } -func (m *Secret) String() string { return proto.CompactTextString(m) } -func (*Secret) ProtoMessage() {} -func (*Secret) Descriptor() ([]byte, []int) { - return fileDescriptor_cert_f82beca1d890b9d7, []int{8} -} -func (m *Secret) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Secret.Unmarshal(m, b) -} -func (m *Secret) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Secret.Marshal(b, m, deterministic) -} -func (dst *Secret) XXX_Merge(src proto.Message) { - xxx_messageInfo_Secret.Merge(dst, src) -} -func (m *Secret) XXX_Size() int { - return xxx_messageInfo_Secret.Size(m) -} -func (m *Secret) XXX_DiscardUnknown() { - xxx_messageInfo_Secret.DiscardUnknown(m) -} - -var xxx_messageInfo_Secret proto.InternalMessageInfo - -func (m *Secret) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -type isSecret_Type interface { - isSecret_Type() -} - -type Secret_TlsCertificate struct { - TlsCertificate *TlsCertificate `protobuf:"bytes,2,opt,name=tls_certificate,json=tlsCertificate,proto3,oneof"` -} - -type Secret_SessionTicketKeys struct { - SessionTicketKeys *TlsSessionTicketKeys `protobuf:"bytes,3,opt,name=session_ticket_keys,json=sessionTicketKeys,proto3,oneof"` -} - -type Secret_ValidationContext struct { - ValidationContext *CertificateValidationContext `protobuf:"bytes,4,opt,name=validation_context,json=validationContext,proto3,oneof"` -} - -func (*Secret_TlsCertificate) isSecret_Type() {} - -func (*Secret_SessionTicketKeys) isSecret_Type() {} - -func (*Secret_ValidationContext) isSecret_Type() {} - -func (m *Secret) GetType() isSecret_Type { - if m != nil { - return m.Type - } - return nil -} - -func (m *Secret) GetTlsCertificate() *TlsCertificate { - if x, ok := m.GetType().(*Secret_TlsCertificate); ok { - return x.TlsCertificate - } - return nil -} - -func (m *Secret) GetSessionTicketKeys() *TlsSessionTicketKeys { - if x, ok := m.GetType().(*Secret_SessionTicketKeys); ok { - return x.SessionTicketKeys - } - return nil -} - -func (m *Secret) GetValidationContext() *CertificateValidationContext { - if x, ok := m.GetType().(*Secret_ValidationContext); ok { - return x.ValidationContext - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Secret) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Secret_OneofMarshaler, _Secret_OneofUnmarshaler, _Secret_OneofSizer, []interface{}{ - (*Secret_TlsCertificate)(nil), - (*Secret_SessionTicketKeys)(nil), - (*Secret_ValidationContext)(nil), - } -} - -func _Secret_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Secret) - // type - switch x := m.Type.(type) { - case *Secret_TlsCertificate: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.TlsCertificate); err != nil { - return err - } - case *Secret_SessionTicketKeys: - b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SessionTicketKeys); err != nil { - return err - } - case *Secret_ValidationContext: - b.EncodeVarint(4<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ValidationContext); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("Secret.Type has unexpected type %T", x) - } - return nil -} - -func _Secret_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Secret) - switch tag { - case 2: // type.tls_certificate - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(TlsCertificate) - err := b.DecodeMessage(msg) - m.Type = &Secret_TlsCertificate{msg} - return true, err - case 3: // type.session_ticket_keys - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(TlsSessionTicketKeys) - err := b.DecodeMessage(msg) - m.Type = &Secret_SessionTicketKeys{msg} - return true, err - case 4: // type.validation_context - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(CertificateValidationContext) - err := b.DecodeMessage(msg) - m.Type = &Secret_ValidationContext{msg} - return true, err - default: - return false, nil - } -} - -func _Secret_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Secret) - // type - switch x := m.Type.(type) { - case *Secret_TlsCertificate: - s := proto.Size(x.TlsCertificate) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Secret_SessionTicketKeys: - s := proto.Size(x.SessionTicketKeys) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Secret_ValidationContext: - s := proto.Size(x.ValidationContext) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -func init() { - proto.RegisterType((*TlsParameters)(nil), "envoy.api.v2.auth.TlsParameters") - proto.RegisterType((*TlsCertificate)(nil), "envoy.api.v2.auth.TlsCertificate") - proto.RegisterType((*TlsSessionTicketKeys)(nil), "envoy.api.v2.auth.TlsSessionTicketKeys") - proto.RegisterType((*CertificateValidationContext)(nil), "envoy.api.v2.auth.CertificateValidationContext") - proto.RegisterType((*CommonTlsContext)(nil), "envoy.api.v2.auth.CommonTlsContext") - proto.RegisterType((*CommonTlsContext_CombinedCertificateValidationContext)(nil), "envoy.api.v2.auth.CommonTlsContext.CombinedCertificateValidationContext") - proto.RegisterType((*UpstreamTlsContext)(nil), "envoy.api.v2.auth.UpstreamTlsContext") - proto.RegisterType((*DownstreamTlsContext)(nil), "envoy.api.v2.auth.DownstreamTlsContext") - proto.RegisterType((*SdsSecretConfig)(nil), "envoy.api.v2.auth.SdsSecretConfig") - proto.RegisterType((*Secret)(nil), "envoy.api.v2.auth.Secret") - proto.RegisterEnum("envoy.api.v2.auth.TlsParameters_TlsProtocol", TlsParameters_TlsProtocol_name, TlsParameters_TlsProtocol_value) -} - -func init() { proto.RegisterFile("envoy/api/v2/auth/cert.proto", fileDescriptor_cert_f82beca1d890b9d7) } - -var fileDescriptor_cert_f82beca1d890b9d7 = []byte{ - // 1295 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4d, 0x77, 0xdb, 0x44, - 0x17, 0x8e, 0x6c, 0xc7, 0x75, 0xae, 0xdb, 0x54, 0x99, 0xf6, 0x3d, 0x51, 0xfc, 0x86, 0xd6, 0x55, - 0xdb, 0x43, 0x16, 0x3d, 0x36, 0x75, 0x61, 0xc1, 0x57, 0xa1, 0x76, 0xe1, 0x84, 0x36, 0xd0, 0x22, - 0x3b, 0x3d, 0xc0, 0x46, 0x4c, 0xe4, 0x49, 0x3c, 0x44, 0x5f, 0xcc, 0x8c, 0x9d, 0x98, 0x05, 0x0b, - 0x96, 0x5d, 0x76, 0xcd, 0x86, 0x5f, 0xc0, 0x9e, 0x15, 0x7f, 0x80, 0x1f, 0xc2, 0xa6, 0x6b, 0x56, - 0xc0, 0x99, 0x91, 0x14, 0x4b, 0x96, 0x5a, 0x1b, 0x4e, 0x0f, 0x3b, 0xcd, 0xdc, 0xb9, 0xcf, 0x33, - 0x73, 0xef, 0x73, 0xef, 0x15, 0x6c, 0x13, 0x7f, 0x12, 0x4c, 0xdb, 0x38, 0xa4, 0xed, 0x49, 0xa7, - 0x8d, 0xc7, 0x62, 0xd4, 0x76, 0x08, 0x13, 0xad, 0x90, 0x05, 0x22, 0x40, 0x1b, 0xca, 0xda, 0xc2, - 0x21, 0x6d, 0x4d, 0x3a, 0x2d, 0x69, 0x6d, 0x64, 0x1d, 0x9c, 0x80, 0x91, 0xf6, 0x01, 0xe6, 0x24, - 0x72, 0x68, 0xdc, 0xcc, 0x5b, 0x9d, 0xc0, 0x3f, 0xa4, 0x47, 0x36, 0x0f, 0xc6, 0xcc, 0x49, 0x8e, - 0x5d, 0x39, 0x0a, 0x82, 0x23, 0x97, 0xb4, 0xd5, 0xea, 0x60, 0x7c, 0xd8, 0x3e, 0x61, 0x38, 0x0c, - 0x09, 0xe3, 0xb1, 0x7d, 0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0xd4, 0x76, 0x6a, 0xd6, 0xa6, 0x3a, 0xf0, 0x51, 0x64, 0x4f, 0xb1, 0x9a, 0xcf, - 0xcf, 0x81, 0xde, 0x0b, 0x3c, 0x2f, 0xf0, 0x65, 0x9f, 0x88, 0x35, 0xf4, 0x01, 0x80, 0x6c, 0xa4, - 0xa1, 0x6c, 0x89, 0x3c, 0xd6, 0x50, 0x73, 0x51, 0xdb, 0xb4, 0xd6, 0x44, 0xbc, 0xe4, 0x68, 0x0f, - 0x74, 0x09, 0x90, 0xba, 0x07, 0x57, 0x59, 0xaf, 0x77, 0xae, 0x15, 0xc3, 0xa4, 0xae, 0x64, 0x5d, - 0x14, 0x99, 0x35, 0x47, 0xdf, 0x81, 0x39, 0x87, 0x66, 0xf3, 0x21, 0xb7, 0x39, 0x71, 0x18, 0x11, - 0x76, 0x34, 0xcf, 0xb8, 0x51, 0x55, 0xf8, 0x66, 0x01, 0x7e, 0x7f, 0xc8, 0xfb, 0xea, 0x6c, 0x4f, - 0x1d, 0x9d, 0x55, 0x95, 0xae, 0x59, 0x57, 0xb2, 0x64, 0x73, 0x47, 0x39, 0xfa, 0x1a, 0xd0, 0xe4, - 0xac, 0xc6, 0x24, 0x97, 0x0c, 0x50, 0xdc, 0xac, 0xda, 0x05, 0x5c, 0x2f, 0xab, 0xcd, 0xdd, 0x15, - 0x6b, 0x63, 0x92, 0x2b, 0x58, 0x01, 0x37, 0xf2, 0x0c, 0xf9, 0x07, 0xc6, 0x7a, 0x58, 0xe2, 0x7d, - 0xbb, 0x2b, 0x56, 0x33, 0x47, 0x33, 0x77, 0x06, 0x3d, 0xd5, 0xe0, 0xff, 0x4e, 0xe0, 0x1d, 0x50, - 0x29, 0xe6, 0x82, 0x17, 0xd6, 0x14, 0xdb, 0x6e, 0xd1, 0x0b, 0xe7, 0xd4, 0x22, 0x37, 0x14, 0xcc, - 0x82, 0xa7, 0x6f, 0x25, 0x74, 0xf9, 0x9e, 0x75, 0x13, 0xd6, 0xb1, 0x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, 0xb9, 0x75, 0x50, 0x55, 0xe2, 0xbe, - 0xf3, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3c, 0x5e, 0x86, 0x05, 0x2a, 0x0f, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/cds/cds.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/cds/cds.pb.go deleted file mode 100755 index 9e7c6adf01d..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/cds/cds.pb.go +++ /dev/null @@ -1,1845 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: envoy/api/v2/cds.proto - -package envoy_api_v2 - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import any "github.com/golang/protobuf/ptypes/any" -import duration "github.com/golang/protobuf/ptypes/duration" -import _struct "github.com/golang/protobuf/ptypes/struct" -import wrappers "github.com/golang/protobuf/ptypes/wrappers" -import _ "google.golang.org/genproto/googleapis/api/annotations" -import cert "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/auth/cert" -import circuit_breaker "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/cluster/circuit_breaker" -import outlier_detection "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/cluster/outlier_detection" -import address "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/address" -import base "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/base" -import config_source "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/config_source" -import health_check "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/health_check" -import protocol "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/protocol" -import discovery "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/discovery" -import eds "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/eds" -import percent "google.golang.org/grpc/xds/internal/proto/envoy/type/percent" -import _ "google.golang.org/grpc/xds/internal/proto/validate" - -import ( - context "golang.org/x/net/context" - grpc "google.golang.org/grpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type Cluster_DiscoveryType int32 - -const ( - Cluster_STATIC Cluster_DiscoveryType = 0 - Cluster_STRICT_DNS Cluster_DiscoveryType = 1 - Cluster_LOGICAL_DNS Cluster_DiscoveryType = 2 - Cluster_EDS Cluster_DiscoveryType = 3 - Cluster_ORIGINAL_DST Cluster_DiscoveryType = 4 -) - -var Cluster_DiscoveryType_name = map[int32]string{ - 0: "STATIC", - 1: "STRICT_DNS", - 2: "LOGICAL_DNS", - 3: "EDS", - 4: "ORIGINAL_DST", -} -var Cluster_DiscoveryType_value = map[string]int32{ - "STATIC": 0, - "STRICT_DNS": 1, - "LOGICAL_DNS": 2, - "EDS": 3, - "ORIGINAL_DST": 4, -} - -func (x Cluster_DiscoveryType) String() string { - return proto.EnumName(Cluster_DiscoveryType_name, int32(x)) -} -func (Cluster_DiscoveryType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_cds_3e3c13a974b77399, []int{0, 0} -} - -type Cluster_LbPolicy int32 - -const ( - Cluster_ROUND_ROBIN Cluster_LbPolicy = 0 - Cluster_LEAST_REQUEST Cluster_LbPolicy = 1 - Cluster_RING_HASH Cluster_LbPolicy = 2 - Cluster_RANDOM Cluster_LbPolicy = 3 - Cluster_ORIGINAL_DST_LB Cluster_LbPolicy = 4 - Cluster_MAGLEV Cluster_LbPolicy = 5 - Cluster_CLUSTER_PROVIDED Cluster_LbPolicy = 6 -) - -var Cluster_LbPolicy_name = map[int32]string{ - 0: "ROUND_ROBIN", - 1: "LEAST_REQUEST", - 2: "RING_HASH", - 3: "RANDOM", - 4: "ORIGINAL_DST_LB", - 5: "MAGLEV", - 6: "CLUSTER_PROVIDED", -} -var Cluster_LbPolicy_value = map[string]int32{ - "ROUND_ROBIN": 0, - "LEAST_REQUEST": 1, - "RING_HASH": 2, - "RANDOM": 3, - "ORIGINAL_DST_LB": 4, - "MAGLEV": 5, - "CLUSTER_PROVIDED": 6, -} - -func (x Cluster_LbPolicy) String() string { - return proto.EnumName(Cluster_LbPolicy_name, int32(x)) -} -func (Cluster_LbPolicy) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_cds_3e3c13a974b77399, []int{0, 1} -} - -type Cluster_DnsLookupFamily int32 - -const ( - Cluster_AUTO Cluster_DnsLookupFamily = 0 - Cluster_V4_ONLY Cluster_DnsLookupFamily = 1 - Cluster_V6_ONLY Cluster_DnsLookupFamily = 2 -) - -var Cluster_DnsLookupFamily_name = map[int32]string{ - 0: "AUTO", - 1: "V4_ONLY", - 2: "V6_ONLY", -} -var Cluster_DnsLookupFamily_value = map[string]int32{ - "AUTO": 0, - "V4_ONLY": 1, - "V6_ONLY": 2, -} - -func (x Cluster_DnsLookupFamily) String() string { - return proto.EnumName(Cluster_DnsLookupFamily_name, int32(x)) -} -func (Cluster_DnsLookupFamily) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_cds_3e3c13a974b77399, []int{0, 2} -} - -type Cluster_ClusterProtocolSelection int32 - -const ( - Cluster_USE_CONFIGURED_PROTOCOL Cluster_ClusterProtocolSelection = 0 - Cluster_USE_DOWNSTREAM_PROTOCOL Cluster_ClusterProtocolSelection = 1 -) - -var Cluster_ClusterProtocolSelection_name = map[int32]string{ - 0: "USE_CONFIGURED_PROTOCOL", - 1: "USE_DOWNSTREAM_PROTOCOL", -} -var Cluster_ClusterProtocolSelection_value = map[string]int32{ - "USE_CONFIGURED_PROTOCOL": 0, - "USE_DOWNSTREAM_PROTOCOL": 1, -} - -func (x Cluster_ClusterProtocolSelection) String() string { - return proto.EnumName(Cluster_ClusterProtocolSelection_name, int32(x)) -} -func (Cluster_ClusterProtocolSelection) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_cds_3e3c13a974b77399, []int{0, 3} -} - -type Cluster_LbSubsetConfig_LbSubsetFallbackPolicy int32 - -const ( - Cluster_LbSubsetConfig_NO_FALLBACK Cluster_LbSubsetConfig_LbSubsetFallbackPolicy = 0 - Cluster_LbSubsetConfig_ANY_ENDPOINT Cluster_LbSubsetConfig_LbSubsetFallbackPolicy = 1 - Cluster_LbSubsetConfig_DEFAULT_SUBSET Cluster_LbSubsetConfig_LbSubsetFallbackPolicy = 2 -) - -var Cluster_LbSubsetConfig_LbSubsetFallbackPolicy_name = map[int32]string{ - 0: "NO_FALLBACK", - 1: "ANY_ENDPOINT", - 2: "DEFAULT_SUBSET", -} -var Cluster_LbSubsetConfig_LbSubsetFallbackPolicy_value = map[string]int32{ - "NO_FALLBACK": 0, - "ANY_ENDPOINT": 1, - "DEFAULT_SUBSET": 2, -} - -func (x Cluster_LbSubsetConfig_LbSubsetFallbackPolicy) String() string { - return proto.EnumName(Cluster_LbSubsetConfig_LbSubsetFallbackPolicy_name, int32(x)) -} -func (Cluster_LbSubsetConfig_LbSubsetFallbackPolicy) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_cds_3e3c13a974b77399, []int{0, 4, 0} -} - -type Cluster_LbSubsetConfig_LbSubsetSelector_LbSubsetSelectorFallbackPolicy int32 - -const ( - Cluster_LbSubsetConfig_LbSubsetSelector_NOT_DEFINED Cluster_LbSubsetConfig_LbSubsetSelector_LbSubsetSelectorFallbackPolicy = 0 - Cluster_LbSubsetConfig_LbSubsetSelector_NO_FALLBACK Cluster_LbSubsetConfig_LbSubsetSelector_LbSubsetSelectorFallbackPolicy = 1 - Cluster_LbSubsetConfig_LbSubsetSelector_ANY_ENDPOINT Cluster_LbSubsetConfig_LbSubsetSelector_LbSubsetSelectorFallbackPolicy = 2 - Cluster_LbSubsetConfig_LbSubsetSelector_DEFAULT_SUBSET Cluster_LbSubsetConfig_LbSubsetSelector_LbSubsetSelectorFallbackPolicy = 3 -) - -var Cluster_LbSubsetConfig_LbSubsetSelector_LbSubsetSelectorFallbackPolicy_name = map[int32]string{ - 0: "NOT_DEFINED", - 1: "NO_FALLBACK", - 2: "ANY_ENDPOINT", - 3: "DEFAULT_SUBSET", -} -var Cluster_LbSubsetConfig_LbSubsetSelector_LbSubsetSelectorFallbackPolicy_value = map[string]int32{ - "NOT_DEFINED": 0, - "NO_FALLBACK": 1, - "ANY_ENDPOINT": 2, - "DEFAULT_SUBSET": 3, -} - -func (x Cluster_LbSubsetConfig_LbSubsetSelector_LbSubsetSelectorFallbackPolicy) String() string { - return proto.EnumName(Cluster_LbSubsetConfig_LbSubsetSelector_LbSubsetSelectorFallbackPolicy_name, int32(x)) -} -func (Cluster_LbSubsetConfig_LbSubsetSelector_LbSubsetSelectorFallbackPolicy) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_cds_3e3c13a974b77399, []int{0, 4, 0, 0} -} - -type Cluster_RingHashLbConfig_HashFunction int32 - -const ( - Cluster_RingHashLbConfig_XX_HASH Cluster_RingHashLbConfig_HashFunction = 0 - Cluster_RingHashLbConfig_MURMUR_HASH_2 Cluster_RingHashLbConfig_HashFunction = 1 -) - -var Cluster_RingHashLbConfig_HashFunction_name = map[int32]string{ - 0: "XX_HASH", - 1: "MURMUR_HASH_2", -} -var Cluster_RingHashLbConfig_HashFunction_value = map[string]int32{ - "XX_HASH": 0, - "MURMUR_HASH_2": 1, -} - -func (x Cluster_RingHashLbConfig_HashFunction) String() string { - return proto.EnumName(Cluster_RingHashLbConfig_HashFunction_name, int32(x)) -} -func (Cluster_RingHashLbConfig_HashFunction) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_cds_3e3c13a974b77399, []int{0, 6, 0} -} - -type Cluster struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - AltStatName string `protobuf:"bytes,28,opt,name=alt_stat_name,json=altStatName,proto3" json:"alt_stat_name,omitempty"` - // Types that are valid to be assigned to ClusterDiscoveryType: - // *Cluster_Type - // *Cluster_ClusterType - ClusterDiscoveryType isCluster_ClusterDiscoveryType `protobuf_oneof:"cluster_discovery_type"` - EdsClusterConfig *Cluster_EdsClusterConfig `protobuf:"bytes,3,opt,name=eds_cluster_config,json=edsClusterConfig,proto3" json:"eds_cluster_config,omitempty"` - ConnectTimeout *duration.Duration `protobuf:"bytes,4,opt,name=connect_timeout,json=connectTimeout,proto3" json:"connect_timeout,omitempty"` - PerConnectionBufferLimitBytes *wrappers.UInt32Value `protobuf:"bytes,5,opt,name=per_connection_buffer_limit_bytes,json=perConnectionBufferLimitBytes,proto3" json:"per_connection_buffer_limit_bytes,omitempty"` - LbPolicy Cluster_LbPolicy `protobuf:"varint,6,opt,name=lb_policy,json=lbPolicy,proto3,enum=envoy.api.v2.Cluster_LbPolicy" json:"lb_policy,omitempty"` - Hosts []*address.Address `protobuf:"bytes,7,rep,name=hosts,proto3" json:"hosts,omitempty"` // Deprecated: Do not use. - LoadAssignment *eds.ClusterLoadAssignment `protobuf:"bytes,33,opt,name=load_assignment,json=loadAssignment,proto3" json:"load_assignment,omitempty"` - HealthChecks []*health_check.HealthCheck `protobuf:"bytes,8,rep,name=health_checks,json=healthChecks,proto3" json:"health_checks,omitempty"` - MaxRequestsPerConnection *wrappers.UInt32Value `protobuf:"bytes,9,opt,name=max_requests_per_connection,json=maxRequestsPerConnection,proto3" json:"max_requests_per_connection,omitempty"` - CircuitBreakers *circuit_breaker.CircuitBreakers `protobuf:"bytes,10,opt,name=circuit_breakers,json=circuitBreakers,proto3" json:"circuit_breakers,omitempty"` - TlsContext *cert.UpstreamTlsContext `protobuf:"bytes,11,opt,name=tls_context,json=tlsContext,proto3" json:"tls_context,omitempty"` - CommonHttpProtocolOptions *protocol.HttpProtocolOptions `protobuf:"bytes,29,opt,name=common_http_protocol_options,json=commonHttpProtocolOptions,proto3" json:"common_http_protocol_options,omitempty"` - HttpProtocolOptions *protocol.Http1ProtocolOptions `protobuf:"bytes,13,opt,name=http_protocol_options,json=httpProtocolOptions,proto3" json:"http_protocol_options,omitempty"` - Http2ProtocolOptions *protocol.Http2ProtocolOptions `protobuf:"bytes,14,opt,name=http2_protocol_options,json=http2ProtocolOptions,proto3" json:"http2_protocol_options,omitempty"` - ExtensionProtocolOptions map[string]*_struct.Struct `protobuf:"bytes,35,rep,name=extension_protocol_options,json=extensionProtocolOptions,proto3" json:"extension_protocol_options,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - TypedExtensionProtocolOptions map[string]*any.Any `protobuf:"bytes,36,rep,name=typed_extension_protocol_options,json=typedExtensionProtocolOptions,proto3" json:"typed_extension_protocol_options,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - DnsRefreshRate *duration.Duration `protobuf:"bytes,16,opt,name=dns_refresh_rate,json=dnsRefreshRate,proto3" json:"dns_refresh_rate,omitempty"` - RespectDnsTtl bool `protobuf:"varint,39,opt,name=respect_dns_ttl,json=respectDnsTtl,proto3" json:"respect_dns_ttl,omitempty"` - DnsLookupFamily Cluster_DnsLookupFamily `protobuf:"varint,17,opt,name=dns_lookup_family,json=dnsLookupFamily,proto3,enum=envoy.api.v2.Cluster_DnsLookupFamily" json:"dns_lookup_family,omitempty"` - DnsResolvers []*address.Address `protobuf:"bytes,18,rep,name=dns_resolvers,json=dnsResolvers,proto3" json:"dns_resolvers,omitempty"` - OutlierDetection *outlier_detection.OutlierDetection `protobuf:"bytes,19,opt,name=outlier_detection,json=outlierDetection,proto3" json:"outlier_detection,omitempty"` - CleanupInterval *duration.Duration `protobuf:"bytes,20,opt,name=cleanup_interval,json=cleanupInterval,proto3" json:"cleanup_interval,omitempty"` - UpstreamBindConfig *address.BindConfig `protobuf:"bytes,21,opt,name=upstream_bind_config,json=upstreamBindConfig,proto3" json:"upstream_bind_config,omitempty"` - LbSubsetConfig *Cluster_LbSubsetConfig `protobuf:"bytes,22,opt,name=lb_subset_config,json=lbSubsetConfig,proto3" json:"lb_subset_config,omitempty"` - // Types that are valid to be assigned to LbConfig: - // *Cluster_RingHashLbConfig_ - // *Cluster_OriginalDstLbConfig_ - // *Cluster_LeastRequestLbConfig_ - LbConfig isCluster_LbConfig `protobuf_oneof:"lb_config"` - CommonLbConfig *Cluster_CommonLbConfig `protobuf:"bytes,27,opt,name=common_lb_config,json=commonLbConfig,proto3" json:"common_lb_config,omitempty"` - TransportSocket *base.TransportSocket `protobuf:"bytes,24,opt,name=transport_socket,json=transportSocket,proto3" json:"transport_socket,omitempty"` - Metadata *base.Metadata `protobuf:"bytes,25,opt,name=metadata,proto3" json:"metadata,omitempty"` - ProtocolSelection Cluster_ClusterProtocolSelection `protobuf:"varint,26,opt,name=protocol_selection,json=protocolSelection,proto3,enum=envoy.api.v2.Cluster_ClusterProtocolSelection" json:"protocol_selection,omitempty"` - UpstreamConnectionOptions *UpstreamConnectionOptions `protobuf:"bytes,30,opt,name=upstream_connection_options,json=upstreamConnectionOptions,proto3" json:"upstream_connection_options,omitempty"` - CloseConnectionsOnHostHealthFailure bool `protobuf:"varint,31,opt,name=close_connections_on_host_health_failure,json=closeConnectionsOnHostHealthFailure,proto3" json:"close_connections_on_host_health_failure,omitempty"` - DrainConnectionsOnHostRemoval bool `protobuf:"varint,32,opt,name=drain_connections_on_host_removal,json=drainConnectionsOnHostRemoval,proto3" json:"drain_connections_on_host_removal,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Cluster) Reset() { *m = Cluster{} } -func (m *Cluster) String() string { return proto.CompactTextString(m) } -func (*Cluster) ProtoMessage() {} -func (*Cluster) Descriptor() ([]byte, []int) { - return fileDescriptor_cds_3e3c13a974b77399, []int{0} -} -func (m *Cluster) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Cluster.Unmarshal(m, b) -} -func (m *Cluster) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Cluster.Marshal(b, m, deterministic) -} -func (dst *Cluster) XXX_Merge(src proto.Message) { - xxx_messageInfo_Cluster.Merge(dst, src) -} -func (m *Cluster) XXX_Size() int { - return xxx_messageInfo_Cluster.Size(m) -} -func (m *Cluster) XXX_DiscardUnknown() { - xxx_messageInfo_Cluster.DiscardUnknown(m) -} - -var xxx_messageInfo_Cluster proto.InternalMessageInfo - -func (m *Cluster) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *Cluster) GetAltStatName() string { - if m != nil { - return m.AltStatName - } - return "" -} - -type isCluster_ClusterDiscoveryType interface { - isCluster_ClusterDiscoveryType() -} - -type Cluster_Type struct { - Type Cluster_DiscoveryType `protobuf:"varint,2,opt,name=type,proto3,enum=envoy.api.v2.Cluster_DiscoveryType,oneof"` -} - -type Cluster_ClusterType struct { - ClusterType *Cluster_CustomClusterType `protobuf:"bytes,38,opt,name=cluster_type,json=clusterType,proto3,oneof"` -} - -func (*Cluster_Type) isCluster_ClusterDiscoveryType() {} - -func (*Cluster_ClusterType) isCluster_ClusterDiscoveryType() {} - -func (m *Cluster) GetClusterDiscoveryType() isCluster_ClusterDiscoveryType { - if m != nil { - return m.ClusterDiscoveryType - } - return nil -} - -func (m *Cluster) GetType() Cluster_DiscoveryType { - if x, ok := m.GetClusterDiscoveryType().(*Cluster_Type); ok { - return x.Type - } - return Cluster_STATIC -} - -func (m *Cluster) GetClusterType() *Cluster_CustomClusterType { - if x, ok := m.GetClusterDiscoveryType().(*Cluster_ClusterType); ok { - return x.ClusterType - } - return nil -} - -func (m *Cluster) GetEdsClusterConfig() *Cluster_EdsClusterConfig { - if m != nil { - return m.EdsClusterConfig - } - return nil -} - -func (m *Cluster) GetConnectTimeout() *duration.Duration { - if m != nil { - return m.ConnectTimeout - } - return nil -} - -func (m *Cluster) GetPerConnectionBufferLimitBytes() *wrappers.UInt32Value { - if m != nil { - return m.PerConnectionBufferLimitBytes - } - return nil -} - -func (m *Cluster) GetLbPolicy() Cluster_LbPolicy { - if m != nil { - return m.LbPolicy - } - return Cluster_ROUND_ROBIN -} - -// Deprecated: Do not use. -func (m *Cluster) GetHosts() []*address.Address { - if m != nil { - return m.Hosts - } - return nil -} - -func (m *Cluster) GetLoadAssignment() *eds.ClusterLoadAssignment { - if m != nil { - return m.LoadAssignment - } - return nil -} - -func (m *Cluster) GetHealthChecks() []*health_check.HealthCheck { - if m != nil { - return m.HealthChecks - } - return nil -} - -func (m *Cluster) GetMaxRequestsPerConnection() *wrappers.UInt32Value { - if m != nil { - return m.MaxRequestsPerConnection - } - return nil -} - -func (m *Cluster) GetCircuitBreakers() *circuit_breaker.CircuitBreakers { - if m != nil { - return m.CircuitBreakers - } - return nil -} - -func (m *Cluster) GetTlsContext() *cert.UpstreamTlsContext { - if m != nil { - return m.TlsContext - } - return nil -} - -func (m *Cluster) GetCommonHttpProtocolOptions() *protocol.HttpProtocolOptions { - if m != nil { - return m.CommonHttpProtocolOptions - } - return nil -} - -func (m *Cluster) GetHttpProtocolOptions() *protocol.Http1ProtocolOptions { - if m != nil { - return m.HttpProtocolOptions - } - return nil -} - -func (m *Cluster) GetHttp2ProtocolOptions() *protocol.Http2ProtocolOptions { - if m != nil { - return m.Http2ProtocolOptions - } - return nil -} - -func (m *Cluster) GetExtensionProtocolOptions() map[string]*_struct.Struct { - if m != nil { - return m.ExtensionProtocolOptions - } - return nil -} - -func (m *Cluster) GetTypedExtensionProtocolOptions() map[string]*any.Any { - if m != nil { - return m.TypedExtensionProtocolOptions - } - return nil -} - -func (m *Cluster) GetDnsRefreshRate() *duration.Duration { - if m != nil { - return m.DnsRefreshRate - } - return nil -} - -func (m *Cluster) GetRespectDnsTtl() bool { - if m != nil { - return m.RespectDnsTtl - } - return false -} - -func (m *Cluster) GetDnsLookupFamily() Cluster_DnsLookupFamily { - if m != nil { - return m.DnsLookupFamily - } - return Cluster_AUTO -} - -func (m *Cluster) GetDnsResolvers() []*address.Address { - if m != nil { - return m.DnsResolvers - } - return nil -} - -func (m *Cluster) GetOutlierDetection() *outlier_detection.OutlierDetection { - if m != nil { - return m.OutlierDetection - } - return nil -} - -func (m *Cluster) GetCleanupInterval() *duration.Duration { - if m != nil { - return m.CleanupInterval - } - return nil -} - -func (m *Cluster) GetUpstreamBindConfig() *address.BindConfig { - if m != nil { - return m.UpstreamBindConfig - } - return nil -} - -func (m *Cluster) GetLbSubsetConfig() *Cluster_LbSubsetConfig { - if m != nil { - return m.LbSubsetConfig - } - return nil -} - -type isCluster_LbConfig interface { - isCluster_LbConfig() -} - -type Cluster_RingHashLbConfig_ struct { - RingHashLbConfig *Cluster_RingHashLbConfig `protobuf:"bytes,23,opt,name=ring_hash_lb_config,json=ringHashLbConfig,proto3,oneof"` -} - -type Cluster_OriginalDstLbConfig_ struct { - OriginalDstLbConfig *Cluster_OriginalDstLbConfig `protobuf:"bytes,34,opt,name=original_dst_lb_config,json=originalDstLbConfig,proto3,oneof"` -} - -type Cluster_LeastRequestLbConfig_ struct { - LeastRequestLbConfig *Cluster_LeastRequestLbConfig `protobuf:"bytes,37,opt,name=least_request_lb_config,json=leastRequestLbConfig,proto3,oneof"` -} - -func (*Cluster_RingHashLbConfig_) isCluster_LbConfig() {} - -func (*Cluster_OriginalDstLbConfig_) isCluster_LbConfig() {} - -func (*Cluster_LeastRequestLbConfig_) isCluster_LbConfig() {} - -func (m *Cluster) GetLbConfig() isCluster_LbConfig { - if m != nil { - return m.LbConfig - } - return nil -} - -func (m *Cluster) GetRingHashLbConfig() *Cluster_RingHashLbConfig { - if x, ok := m.GetLbConfig().(*Cluster_RingHashLbConfig_); ok { - return x.RingHashLbConfig - } - return nil -} - -func (m *Cluster) GetOriginalDstLbConfig() *Cluster_OriginalDstLbConfig { - if x, ok := m.GetLbConfig().(*Cluster_OriginalDstLbConfig_); ok { - return x.OriginalDstLbConfig - } - return nil -} - -func (m *Cluster) GetLeastRequestLbConfig() *Cluster_LeastRequestLbConfig { - if x, ok := m.GetLbConfig().(*Cluster_LeastRequestLbConfig_); ok { - return x.LeastRequestLbConfig - } - return nil -} - -func (m *Cluster) GetCommonLbConfig() *Cluster_CommonLbConfig { - if m != nil { - return m.CommonLbConfig - } - return nil -} - -func (m *Cluster) GetTransportSocket() *base.TransportSocket { - if m != nil { - return m.TransportSocket - } - return nil -} - -func (m *Cluster) GetMetadata() *base.Metadata { - if m != nil { - return m.Metadata - } - return nil -} - -func (m *Cluster) GetProtocolSelection() Cluster_ClusterProtocolSelection { - if m != nil { - return m.ProtocolSelection - } - return Cluster_USE_CONFIGURED_PROTOCOL -} - -func (m *Cluster) GetUpstreamConnectionOptions() *UpstreamConnectionOptions { - if m != nil { - return m.UpstreamConnectionOptions - } - return nil -} - -func (m *Cluster) GetCloseConnectionsOnHostHealthFailure() bool { - if m != nil { - return m.CloseConnectionsOnHostHealthFailure - } - return false -} - -func (m *Cluster) GetDrainConnectionsOnHostRemoval() bool { - if m != nil { - return m.DrainConnectionsOnHostRemoval - } - return false -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Cluster) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Cluster_OneofMarshaler, _Cluster_OneofUnmarshaler, _Cluster_OneofSizer, []interface{}{ - (*Cluster_Type)(nil), - (*Cluster_ClusterType)(nil), - (*Cluster_RingHashLbConfig_)(nil), - (*Cluster_OriginalDstLbConfig_)(nil), - (*Cluster_LeastRequestLbConfig_)(nil), - } -} - -func _Cluster_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Cluster) - // cluster_discovery_type - switch x := m.ClusterDiscoveryType.(type) { - case *Cluster_Type: - b.EncodeVarint(2<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.Type)) - case *Cluster_ClusterType: - b.EncodeVarint(38<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ClusterType); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("Cluster.ClusterDiscoveryType has unexpected type %T", x) - } - // lb_config - switch x := m.LbConfig.(type) { - case *Cluster_RingHashLbConfig_: - b.EncodeVarint(23<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.RingHashLbConfig); err != nil { - return err - } - case *Cluster_OriginalDstLbConfig_: - b.EncodeVarint(34<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.OriginalDstLbConfig); err != nil { - return err - } - case *Cluster_LeastRequestLbConfig_: - b.EncodeVarint(37<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.LeastRequestLbConfig); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("Cluster.LbConfig has unexpected type %T", x) - } - return nil -} - -func _Cluster_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Cluster) - switch tag { - case 2: // cluster_discovery_type.type - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.ClusterDiscoveryType = &Cluster_Type{Cluster_DiscoveryType(x)} - return true, err - case 38: // cluster_discovery_type.cluster_type - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Cluster_CustomClusterType) - err := b.DecodeMessage(msg) - m.ClusterDiscoveryType = &Cluster_ClusterType{msg} - return true, err - case 23: // lb_config.ring_hash_lb_config - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Cluster_RingHashLbConfig) - err := b.DecodeMessage(msg) - m.LbConfig = &Cluster_RingHashLbConfig_{msg} - return true, err - case 34: // lb_config.original_dst_lb_config - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Cluster_OriginalDstLbConfig) - err := b.DecodeMessage(msg) - m.LbConfig = &Cluster_OriginalDstLbConfig_{msg} - return true, err - case 37: // lb_config.least_request_lb_config - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Cluster_LeastRequestLbConfig) - err := b.DecodeMessage(msg) - m.LbConfig = &Cluster_LeastRequestLbConfig_{msg} - return true, err - default: - return false, nil - } -} - -func _Cluster_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Cluster) - // cluster_discovery_type - switch x := m.ClusterDiscoveryType.(type) { - case *Cluster_Type: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.Type)) - case *Cluster_ClusterType: - s := proto.Size(x.ClusterType) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - // lb_config - switch x := m.LbConfig.(type) { - case *Cluster_RingHashLbConfig_: - s := proto.Size(x.RingHashLbConfig) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Cluster_OriginalDstLbConfig_: - s := proto.Size(x.OriginalDstLbConfig) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Cluster_LeastRequestLbConfig_: - s := proto.Size(x.LeastRequestLbConfig) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type Cluster_CustomClusterType struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - TypedConfig *any.Any `protobuf:"bytes,2,opt,name=typed_config,json=typedConfig,proto3" json:"typed_config,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Cluster_CustomClusterType) Reset() { *m = Cluster_CustomClusterType{} } -func (m *Cluster_CustomClusterType) String() string { return proto.CompactTextString(m) } -func (*Cluster_CustomClusterType) ProtoMessage() {} -func (*Cluster_CustomClusterType) Descriptor() ([]byte, []int) { - return fileDescriptor_cds_3e3c13a974b77399, []int{0, 0} -} -func (m *Cluster_CustomClusterType) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Cluster_CustomClusterType.Unmarshal(m, b) -} -func (m *Cluster_CustomClusterType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Cluster_CustomClusterType.Marshal(b, m, deterministic) -} -func (dst *Cluster_CustomClusterType) XXX_Merge(src proto.Message) { - xxx_messageInfo_Cluster_CustomClusterType.Merge(dst, src) -} -func (m *Cluster_CustomClusterType) XXX_Size() int { - return xxx_messageInfo_Cluster_CustomClusterType.Size(m) -} -func (m *Cluster_CustomClusterType) XXX_DiscardUnknown() { - xxx_messageInfo_Cluster_CustomClusterType.DiscardUnknown(m) -} - -var xxx_messageInfo_Cluster_CustomClusterType proto.InternalMessageInfo - -func (m *Cluster_CustomClusterType) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *Cluster_CustomClusterType) GetTypedConfig() *any.Any { - if m != nil { - return m.TypedConfig - } - return nil -} - -type Cluster_EdsClusterConfig struct { - EdsConfig *config_source.ConfigSource `protobuf:"bytes,1,opt,name=eds_config,json=edsConfig,proto3" json:"eds_config,omitempty"` - ServiceName string `protobuf:"bytes,2,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Cluster_EdsClusterConfig) Reset() { *m = Cluster_EdsClusterConfig{} } -func (m *Cluster_EdsClusterConfig) String() string { return proto.CompactTextString(m) } -func (*Cluster_EdsClusterConfig) ProtoMessage() {} -func (*Cluster_EdsClusterConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_cds_3e3c13a974b77399, []int{0, 1} -} -func (m *Cluster_EdsClusterConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Cluster_EdsClusterConfig.Unmarshal(m, b) -} -func (m *Cluster_EdsClusterConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Cluster_EdsClusterConfig.Marshal(b, m, deterministic) -} -func (dst *Cluster_EdsClusterConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_Cluster_EdsClusterConfig.Merge(dst, src) -} -func (m *Cluster_EdsClusterConfig) XXX_Size() int { - return xxx_messageInfo_Cluster_EdsClusterConfig.Size(m) -} -func (m *Cluster_EdsClusterConfig) XXX_DiscardUnknown() { - xxx_messageInfo_Cluster_EdsClusterConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_Cluster_EdsClusterConfig proto.InternalMessageInfo - -func (m *Cluster_EdsClusterConfig) GetEdsConfig() *config_source.ConfigSource { - if m != nil { - return m.EdsConfig - } - return nil -} - -func (m *Cluster_EdsClusterConfig) GetServiceName() string { - if m != nil { - return m.ServiceName - } - return "" -} - -type Cluster_LbSubsetConfig struct { - FallbackPolicy Cluster_LbSubsetConfig_LbSubsetFallbackPolicy `protobuf:"varint,1,opt,name=fallback_policy,json=fallbackPolicy,proto3,enum=envoy.api.v2.Cluster_LbSubsetConfig_LbSubsetFallbackPolicy" json:"fallback_policy,omitempty"` - DefaultSubset *_struct.Struct `protobuf:"bytes,2,opt,name=default_subset,json=defaultSubset,proto3" json:"default_subset,omitempty"` - SubsetSelectors []*Cluster_LbSubsetConfig_LbSubsetSelector `protobuf:"bytes,3,rep,name=subset_selectors,json=subsetSelectors,proto3" json:"subset_selectors,omitempty"` - LocalityWeightAware bool `protobuf:"varint,4,opt,name=locality_weight_aware,json=localityWeightAware,proto3" json:"locality_weight_aware,omitempty"` - ScaleLocalityWeight bool `protobuf:"varint,5,opt,name=scale_locality_weight,json=scaleLocalityWeight,proto3" json:"scale_locality_weight,omitempty"` - PanicModeAny bool `protobuf:"varint,6,opt,name=panic_mode_any,json=panicModeAny,proto3" json:"panic_mode_any,omitempty"` - ListAsAny bool `protobuf:"varint,7,opt,name=list_as_any,json=listAsAny,proto3" json:"list_as_any,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Cluster_LbSubsetConfig) Reset() { *m = Cluster_LbSubsetConfig{} } -func (m *Cluster_LbSubsetConfig) String() string { return proto.CompactTextString(m) } -func (*Cluster_LbSubsetConfig) ProtoMessage() {} -func (*Cluster_LbSubsetConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_cds_3e3c13a974b77399, []int{0, 4} -} -func (m *Cluster_LbSubsetConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Cluster_LbSubsetConfig.Unmarshal(m, b) -} -func (m *Cluster_LbSubsetConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Cluster_LbSubsetConfig.Marshal(b, m, deterministic) -} -func (dst *Cluster_LbSubsetConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_Cluster_LbSubsetConfig.Merge(dst, src) -} -func (m *Cluster_LbSubsetConfig) XXX_Size() int { - return xxx_messageInfo_Cluster_LbSubsetConfig.Size(m) -} -func (m *Cluster_LbSubsetConfig) XXX_DiscardUnknown() { - xxx_messageInfo_Cluster_LbSubsetConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_Cluster_LbSubsetConfig proto.InternalMessageInfo - -func (m *Cluster_LbSubsetConfig) GetFallbackPolicy() Cluster_LbSubsetConfig_LbSubsetFallbackPolicy { - if m != nil { - return m.FallbackPolicy - } - return Cluster_LbSubsetConfig_NO_FALLBACK -} - -func (m *Cluster_LbSubsetConfig) GetDefaultSubset() *_struct.Struct { - if m != nil { - return m.DefaultSubset - } - return nil -} - -func (m *Cluster_LbSubsetConfig) GetSubsetSelectors() []*Cluster_LbSubsetConfig_LbSubsetSelector { - if m != nil { - return m.SubsetSelectors - } - return nil -} - -func (m *Cluster_LbSubsetConfig) GetLocalityWeightAware() bool { - if m != nil { - return m.LocalityWeightAware - } - return false -} - -func (m *Cluster_LbSubsetConfig) GetScaleLocalityWeight() bool { - if m != nil { - return m.ScaleLocalityWeight - } - return false -} - -func (m *Cluster_LbSubsetConfig) GetPanicModeAny() bool { - if m != nil { - return m.PanicModeAny - } - return false -} - -func (m *Cluster_LbSubsetConfig) GetListAsAny() bool { - if m != nil { - return m.ListAsAny - } - return false -} - -type Cluster_LbSubsetConfig_LbSubsetSelector struct { - Keys []string `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"` - FallbackPolicy Cluster_LbSubsetConfig_LbSubsetSelector_LbSubsetSelectorFallbackPolicy `protobuf:"varint,2,opt,name=fallback_policy,json=fallbackPolicy,proto3,enum=envoy.api.v2.Cluster_LbSubsetConfig_LbSubsetSelector_LbSubsetSelectorFallbackPolicy" json:"fallback_policy,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Cluster_LbSubsetConfig_LbSubsetSelector) Reset() { - *m = Cluster_LbSubsetConfig_LbSubsetSelector{} -} -func (m *Cluster_LbSubsetConfig_LbSubsetSelector) String() string { return proto.CompactTextString(m) } -func (*Cluster_LbSubsetConfig_LbSubsetSelector) ProtoMessage() {} -func (*Cluster_LbSubsetConfig_LbSubsetSelector) Descriptor() ([]byte, []int) { - return fileDescriptor_cds_3e3c13a974b77399, []int{0, 4, 0} -} -func (m *Cluster_LbSubsetConfig_LbSubsetSelector) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Cluster_LbSubsetConfig_LbSubsetSelector.Unmarshal(m, b) -} -func (m *Cluster_LbSubsetConfig_LbSubsetSelector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Cluster_LbSubsetConfig_LbSubsetSelector.Marshal(b, m, deterministic) -} -func (dst *Cluster_LbSubsetConfig_LbSubsetSelector) XXX_Merge(src proto.Message) { - xxx_messageInfo_Cluster_LbSubsetConfig_LbSubsetSelector.Merge(dst, src) -} -func (m *Cluster_LbSubsetConfig_LbSubsetSelector) XXX_Size() int { - return xxx_messageInfo_Cluster_LbSubsetConfig_LbSubsetSelector.Size(m) -} -func (m *Cluster_LbSubsetConfig_LbSubsetSelector) XXX_DiscardUnknown() { - xxx_messageInfo_Cluster_LbSubsetConfig_LbSubsetSelector.DiscardUnknown(m) -} - -var xxx_messageInfo_Cluster_LbSubsetConfig_LbSubsetSelector proto.InternalMessageInfo - -func (m *Cluster_LbSubsetConfig_LbSubsetSelector) GetKeys() []string { - if m != nil { - return m.Keys - } - return nil -} - -func (m *Cluster_LbSubsetConfig_LbSubsetSelector) GetFallbackPolicy() Cluster_LbSubsetConfig_LbSubsetSelector_LbSubsetSelectorFallbackPolicy { - if m != nil { - return m.FallbackPolicy - } - return Cluster_LbSubsetConfig_LbSubsetSelector_NOT_DEFINED -} - -type Cluster_LeastRequestLbConfig struct { - ChoiceCount *wrappers.UInt32Value `protobuf:"bytes,1,opt,name=choice_count,json=choiceCount,proto3" json:"choice_count,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Cluster_LeastRequestLbConfig) Reset() { *m = Cluster_LeastRequestLbConfig{} } -func (m *Cluster_LeastRequestLbConfig) String() string { return proto.CompactTextString(m) } -func (*Cluster_LeastRequestLbConfig) ProtoMessage() {} -func (*Cluster_LeastRequestLbConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_cds_3e3c13a974b77399, []int{0, 5} -} -func (m *Cluster_LeastRequestLbConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Cluster_LeastRequestLbConfig.Unmarshal(m, b) -} -func (m *Cluster_LeastRequestLbConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Cluster_LeastRequestLbConfig.Marshal(b, m, deterministic) -} -func (dst *Cluster_LeastRequestLbConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_Cluster_LeastRequestLbConfig.Merge(dst, src) -} -func (m *Cluster_LeastRequestLbConfig) XXX_Size() int { - return xxx_messageInfo_Cluster_LeastRequestLbConfig.Size(m) -} -func (m *Cluster_LeastRequestLbConfig) XXX_DiscardUnknown() { - xxx_messageInfo_Cluster_LeastRequestLbConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_Cluster_LeastRequestLbConfig proto.InternalMessageInfo - -func (m *Cluster_LeastRequestLbConfig) GetChoiceCount() *wrappers.UInt32Value { - if m != nil { - return m.ChoiceCount - } - return nil -} - -type Cluster_RingHashLbConfig struct { - MinimumRingSize *wrappers.UInt64Value `protobuf:"bytes,1,opt,name=minimum_ring_size,json=minimumRingSize,proto3" json:"minimum_ring_size,omitempty"` - HashFunction Cluster_RingHashLbConfig_HashFunction `protobuf:"varint,3,opt,name=hash_function,json=hashFunction,proto3,enum=envoy.api.v2.Cluster_RingHashLbConfig_HashFunction" json:"hash_function,omitempty"` - MaximumRingSize *wrappers.UInt64Value `protobuf:"bytes,4,opt,name=maximum_ring_size,json=maximumRingSize,proto3" json:"maximum_ring_size,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Cluster_RingHashLbConfig) Reset() { *m = Cluster_RingHashLbConfig{} } -func (m *Cluster_RingHashLbConfig) String() string { return proto.CompactTextString(m) } -func (*Cluster_RingHashLbConfig) ProtoMessage() {} -func (*Cluster_RingHashLbConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_cds_3e3c13a974b77399, []int{0, 6} -} -func (m *Cluster_RingHashLbConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Cluster_RingHashLbConfig.Unmarshal(m, b) -} -func (m *Cluster_RingHashLbConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Cluster_RingHashLbConfig.Marshal(b, m, deterministic) -} -func (dst *Cluster_RingHashLbConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_Cluster_RingHashLbConfig.Merge(dst, src) -} -func (m *Cluster_RingHashLbConfig) XXX_Size() int { - return xxx_messageInfo_Cluster_RingHashLbConfig.Size(m) -} -func (m *Cluster_RingHashLbConfig) XXX_DiscardUnknown() { - xxx_messageInfo_Cluster_RingHashLbConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_Cluster_RingHashLbConfig proto.InternalMessageInfo - -func (m *Cluster_RingHashLbConfig) GetMinimumRingSize() *wrappers.UInt64Value { - if m != nil { - return m.MinimumRingSize - } - return nil -} - -func (m *Cluster_RingHashLbConfig) GetHashFunction() Cluster_RingHashLbConfig_HashFunction { - if m != nil { - return m.HashFunction - } - return Cluster_RingHashLbConfig_XX_HASH -} - -func (m *Cluster_RingHashLbConfig) GetMaximumRingSize() *wrappers.UInt64Value { - if m != nil { - return m.MaximumRingSize - } - return nil -} - -type Cluster_OriginalDstLbConfig struct { - UseHttpHeader bool `protobuf:"varint,1,opt,name=use_http_header,json=useHttpHeader,proto3" json:"use_http_header,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Cluster_OriginalDstLbConfig) Reset() { *m = Cluster_OriginalDstLbConfig{} } -func (m *Cluster_OriginalDstLbConfig) String() string { return proto.CompactTextString(m) } -func (*Cluster_OriginalDstLbConfig) ProtoMessage() {} -func (*Cluster_OriginalDstLbConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_cds_3e3c13a974b77399, []int{0, 7} -} -func (m *Cluster_OriginalDstLbConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Cluster_OriginalDstLbConfig.Unmarshal(m, b) -} -func (m *Cluster_OriginalDstLbConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Cluster_OriginalDstLbConfig.Marshal(b, m, deterministic) -} -func (dst *Cluster_OriginalDstLbConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_Cluster_OriginalDstLbConfig.Merge(dst, src) -} -func (m *Cluster_OriginalDstLbConfig) XXX_Size() int { - return xxx_messageInfo_Cluster_OriginalDstLbConfig.Size(m) -} -func (m *Cluster_OriginalDstLbConfig) XXX_DiscardUnknown() { - xxx_messageInfo_Cluster_OriginalDstLbConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_Cluster_OriginalDstLbConfig proto.InternalMessageInfo - -func (m *Cluster_OriginalDstLbConfig) GetUseHttpHeader() bool { - if m != nil { - return m.UseHttpHeader - } - return false -} - -type Cluster_CommonLbConfig struct { - HealthyPanicThreshold *percent.Percent `protobuf:"bytes,1,opt,name=healthy_panic_threshold,json=healthyPanicThreshold,proto3" json:"healthy_panic_threshold,omitempty"` - // Types that are valid to be assigned to LocalityConfigSpecifier: - // *Cluster_CommonLbConfig_ZoneAwareLbConfig_ - // *Cluster_CommonLbConfig_LocalityWeightedLbConfig_ - LocalityConfigSpecifier isCluster_CommonLbConfig_LocalityConfigSpecifier `protobuf_oneof:"locality_config_specifier"` - UpdateMergeWindow *duration.Duration `protobuf:"bytes,4,opt,name=update_merge_window,json=updateMergeWindow,proto3" json:"update_merge_window,omitempty"` - IgnoreNewHostsUntilFirstHc bool `protobuf:"varint,5,opt,name=ignore_new_hosts_until_first_hc,json=ignoreNewHostsUntilFirstHc,proto3" json:"ignore_new_hosts_until_first_hc,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Cluster_CommonLbConfig) Reset() { *m = Cluster_CommonLbConfig{} } -func (m *Cluster_CommonLbConfig) String() string { return proto.CompactTextString(m) } -func (*Cluster_CommonLbConfig) ProtoMessage() {} -func (*Cluster_CommonLbConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_cds_3e3c13a974b77399, []int{0, 8} -} -func (m *Cluster_CommonLbConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Cluster_CommonLbConfig.Unmarshal(m, b) -} -func (m *Cluster_CommonLbConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Cluster_CommonLbConfig.Marshal(b, m, deterministic) -} -func (dst *Cluster_CommonLbConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_Cluster_CommonLbConfig.Merge(dst, src) -} -func (m *Cluster_CommonLbConfig) XXX_Size() int { - return xxx_messageInfo_Cluster_CommonLbConfig.Size(m) -} -func (m *Cluster_CommonLbConfig) XXX_DiscardUnknown() { - xxx_messageInfo_Cluster_CommonLbConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_Cluster_CommonLbConfig proto.InternalMessageInfo - -func (m *Cluster_CommonLbConfig) GetHealthyPanicThreshold() *percent.Percent { - if m != nil { - return m.HealthyPanicThreshold - } - return nil -} - -type isCluster_CommonLbConfig_LocalityConfigSpecifier interface { - isCluster_CommonLbConfig_LocalityConfigSpecifier() -} - -type Cluster_CommonLbConfig_ZoneAwareLbConfig_ struct { - ZoneAwareLbConfig *Cluster_CommonLbConfig_ZoneAwareLbConfig `protobuf:"bytes,2,opt,name=zone_aware_lb_config,json=zoneAwareLbConfig,proto3,oneof"` -} - -type Cluster_CommonLbConfig_LocalityWeightedLbConfig_ struct { - LocalityWeightedLbConfig *Cluster_CommonLbConfig_LocalityWeightedLbConfig `protobuf:"bytes,3,opt,name=locality_weighted_lb_config,json=localityWeightedLbConfig,proto3,oneof"` -} - -func (*Cluster_CommonLbConfig_ZoneAwareLbConfig_) isCluster_CommonLbConfig_LocalityConfigSpecifier() {} - -func (*Cluster_CommonLbConfig_LocalityWeightedLbConfig_) isCluster_CommonLbConfig_LocalityConfigSpecifier() { -} - -func (m *Cluster_CommonLbConfig) GetLocalityConfigSpecifier() isCluster_CommonLbConfig_LocalityConfigSpecifier { - if m != nil { - return m.LocalityConfigSpecifier - } - return nil -} - -func (m *Cluster_CommonLbConfig) GetZoneAwareLbConfig() *Cluster_CommonLbConfig_ZoneAwareLbConfig { - if x, ok := m.GetLocalityConfigSpecifier().(*Cluster_CommonLbConfig_ZoneAwareLbConfig_); ok { - return x.ZoneAwareLbConfig - } - return nil -} - -func (m *Cluster_CommonLbConfig) GetLocalityWeightedLbConfig() *Cluster_CommonLbConfig_LocalityWeightedLbConfig { - if x, ok := m.GetLocalityConfigSpecifier().(*Cluster_CommonLbConfig_LocalityWeightedLbConfig_); ok { - return x.LocalityWeightedLbConfig - } - return nil -} - -func (m *Cluster_CommonLbConfig) GetUpdateMergeWindow() *duration.Duration { - if m != nil { - return m.UpdateMergeWindow - } - return nil -} - -func (m *Cluster_CommonLbConfig) GetIgnoreNewHostsUntilFirstHc() bool { - if m != nil { - return m.IgnoreNewHostsUntilFirstHc - } - return false -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Cluster_CommonLbConfig) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Cluster_CommonLbConfig_OneofMarshaler, _Cluster_CommonLbConfig_OneofUnmarshaler, _Cluster_CommonLbConfig_OneofSizer, []interface{}{ - (*Cluster_CommonLbConfig_ZoneAwareLbConfig_)(nil), - (*Cluster_CommonLbConfig_LocalityWeightedLbConfig_)(nil), - } -} - -func _Cluster_CommonLbConfig_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Cluster_CommonLbConfig) - // locality_config_specifier - switch x := m.LocalityConfigSpecifier.(type) { - case *Cluster_CommonLbConfig_ZoneAwareLbConfig_: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ZoneAwareLbConfig); err != nil { - return err - } - case *Cluster_CommonLbConfig_LocalityWeightedLbConfig_: - b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.LocalityWeightedLbConfig); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("Cluster_CommonLbConfig.LocalityConfigSpecifier has unexpected type %T", x) - } - return nil -} - -func _Cluster_CommonLbConfig_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Cluster_CommonLbConfig) - switch tag { - case 2: // locality_config_specifier.zone_aware_lb_config - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Cluster_CommonLbConfig_ZoneAwareLbConfig) - err := b.DecodeMessage(msg) - m.LocalityConfigSpecifier = &Cluster_CommonLbConfig_ZoneAwareLbConfig_{msg} - return true, err - case 3: // locality_config_specifier.locality_weighted_lb_config - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Cluster_CommonLbConfig_LocalityWeightedLbConfig) - err := b.DecodeMessage(msg) - m.LocalityConfigSpecifier = &Cluster_CommonLbConfig_LocalityWeightedLbConfig_{msg} - return true, err - default: - return false, nil - } -} - -func _Cluster_CommonLbConfig_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Cluster_CommonLbConfig) - // locality_config_specifier - switch x := m.LocalityConfigSpecifier.(type) { - case *Cluster_CommonLbConfig_ZoneAwareLbConfig_: - s := proto.Size(x.ZoneAwareLbConfig) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Cluster_CommonLbConfig_LocalityWeightedLbConfig_: - s := proto.Size(x.LocalityWeightedLbConfig) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type Cluster_CommonLbConfig_ZoneAwareLbConfig struct { - RoutingEnabled *percent.Percent `protobuf:"bytes,1,opt,name=routing_enabled,json=routingEnabled,proto3" json:"routing_enabled,omitempty"` - MinClusterSize *wrappers.UInt64Value `protobuf:"bytes,2,opt,name=min_cluster_size,json=minClusterSize,proto3" json:"min_cluster_size,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) Reset() { - *m = Cluster_CommonLbConfig_ZoneAwareLbConfig{} -} -func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) String() string { return proto.CompactTextString(m) } -func (*Cluster_CommonLbConfig_ZoneAwareLbConfig) ProtoMessage() {} -func (*Cluster_CommonLbConfig_ZoneAwareLbConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_cds_3e3c13a974b77399, []int{0, 8, 0} -} -func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Cluster_CommonLbConfig_ZoneAwareLbConfig.Unmarshal(m, b) -} -func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Cluster_CommonLbConfig_ZoneAwareLbConfig.Marshal(b, m, deterministic) -} -func (dst *Cluster_CommonLbConfig_ZoneAwareLbConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_Cluster_CommonLbConfig_ZoneAwareLbConfig.Merge(dst, src) -} -func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) XXX_Size() int { - return xxx_messageInfo_Cluster_CommonLbConfig_ZoneAwareLbConfig.Size(m) -} -func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) XXX_DiscardUnknown() { - xxx_messageInfo_Cluster_CommonLbConfig_ZoneAwareLbConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_Cluster_CommonLbConfig_ZoneAwareLbConfig proto.InternalMessageInfo - -func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) GetRoutingEnabled() *percent.Percent { - if m != nil { - return m.RoutingEnabled - } - return nil -} - -func (m *Cluster_CommonLbConfig_ZoneAwareLbConfig) GetMinClusterSize() *wrappers.UInt64Value { - if m != nil { - return m.MinClusterSize - } - return nil -} - -type Cluster_CommonLbConfig_LocalityWeightedLbConfig struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig) Reset() { - *m = Cluster_CommonLbConfig_LocalityWeightedLbConfig{} -} -func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig) String() string { - return proto.CompactTextString(m) -} -func (*Cluster_CommonLbConfig_LocalityWeightedLbConfig) ProtoMessage() {} -func (*Cluster_CommonLbConfig_LocalityWeightedLbConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_cds_3e3c13a974b77399, []int{0, 8, 1} -} -func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Cluster_CommonLbConfig_LocalityWeightedLbConfig.Unmarshal(m, b) -} -func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Cluster_CommonLbConfig_LocalityWeightedLbConfig.Marshal(b, m, deterministic) -} -func (dst *Cluster_CommonLbConfig_LocalityWeightedLbConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_Cluster_CommonLbConfig_LocalityWeightedLbConfig.Merge(dst, src) -} -func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig) XXX_Size() int { - return xxx_messageInfo_Cluster_CommonLbConfig_LocalityWeightedLbConfig.Size(m) -} -func (m *Cluster_CommonLbConfig_LocalityWeightedLbConfig) XXX_DiscardUnknown() { - xxx_messageInfo_Cluster_CommonLbConfig_LocalityWeightedLbConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_Cluster_CommonLbConfig_LocalityWeightedLbConfig proto.InternalMessageInfo - -type UpstreamBindConfig struct { - SourceAddress *address.Address `protobuf:"bytes,1,opt,name=source_address,json=sourceAddress,proto3" json:"source_address,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UpstreamBindConfig) Reset() { *m = UpstreamBindConfig{} } -func (m *UpstreamBindConfig) String() string { return proto.CompactTextString(m) } -func (*UpstreamBindConfig) ProtoMessage() {} -func (*UpstreamBindConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_cds_3e3c13a974b77399, []int{1} -} -func (m *UpstreamBindConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UpstreamBindConfig.Unmarshal(m, b) -} -func (m *UpstreamBindConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UpstreamBindConfig.Marshal(b, m, deterministic) -} -func (dst *UpstreamBindConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpstreamBindConfig.Merge(dst, src) -} -func (m *UpstreamBindConfig) XXX_Size() int { - return xxx_messageInfo_UpstreamBindConfig.Size(m) -} -func (m *UpstreamBindConfig) XXX_DiscardUnknown() { - xxx_messageInfo_UpstreamBindConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_UpstreamBindConfig proto.InternalMessageInfo - -func (m *UpstreamBindConfig) GetSourceAddress() *address.Address { - if m != nil { - return m.SourceAddress - } - return nil -} - -type UpstreamConnectionOptions struct { - TcpKeepalive *address.TcpKeepalive `protobuf:"bytes,1,opt,name=tcp_keepalive,json=tcpKeepalive,proto3" json:"tcp_keepalive,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UpstreamConnectionOptions) Reset() { *m = UpstreamConnectionOptions{} } -func (m *UpstreamConnectionOptions) String() string { return proto.CompactTextString(m) } -func (*UpstreamConnectionOptions) ProtoMessage() {} -func (*UpstreamConnectionOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_cds_3e3c13a974b77399, []int{2} -} -func (m *UpstreamConnectionOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UpstreamConnectionOptions.Unmarshal(m, b) -} -func (m *UpstreamConnectionOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UpstreamConnectionOptions.Marshal(b, m, deterministic) -} -func (dst *UpstreamConnectionOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpstreamConnectionOptions.Merge(dst, src) -} -func (m *UpstreamConnectionOptions) XXX_Size() int { - return xxx_messageInfo_UpstreamConnectionOptions.Size(m) -} -func (m *UpstreamConnectionOptions) XXX_DiscardUnknown() { - xxx_messageInfo_UpstreamConnectionOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_UpstreamConnectionOptions proto.InternalMessageInfo - -func (m *UpstreamConnectionOptions) GetTcpKeepalive() *address.TcpKeepalive { - if m != nil { - return m.TcpKeepalive - } - return nil -} - -func init() { - proto.RegisterType((*Cluster)(nil), "envoy.api.v2.Cluster") - proto.RegisterMapType((map[string]*_struct.Struct)(nil), "envoy.api.v2.Cluster.ExtensionProtocolOptionsEntry") - proto.RegisterMapType((map[string]*any.Any)(nil), "envoy.api.v2.Cluster.TypedExtensionProtocolOptionsEntry") - proto.RegisterType((*Cluster_CustomClusterType)(nil), "envoy.api.v2.Cluster.CustomClusterType") - proto.RegisterType((*Cluster_EdsClusterConfig)(nil), "envoy.api.v2.Cluster.EdsClusterConfig") - proto.RegisterType((*Cluster_LbSubsetConfig)(nil), "envoy.api.v2.Cluster.LbSubsetConfig") - proto.RegisterType((*Cluster_LbSubsetConfig_LbSubsetSelector)(nil), "envoy.api.v2.Cluster.LbSubsetConfig.LbSubsetSelector") - proto.RegisterType((*Cluster_LeastRequestLbConfig)(nil), "envoy.api.v2.Cluster.LeastRequestLbConfig") - proto.RegisterType((*Cluster_RingHashLbConfig)(nil), "envoy.api.v2.Cluster.RingHashLbConfig") - proto.RegisterType((*Cluster_OriginalDstLbConfig)(nil), "envoy.api.v2.Cluster.OriginalDstLbConfig") - proto.RegisterType((*Cluster_CommonLbConfig)(nil), "envoy.api.v2.Cluster.CommonLbConfig") - proto.RegisterType((*Cluster_CommonLbConfig_ZoneAwareLbConfig)(nil), "envoy.api.v2.Cluster.CommonLbConfig.ZoneAwareLbConfig") - proto.RegisterType((*Cluster_CommonLbConfig_LocalityWeightedLbConfig)(nil), "envoy.api.v2.Cluster.CommonLbConfig.LocalityWeightedLbConfig") - proto.RegisterType((*UpstreamBindConfig)(nil), "envoy.api.v2.UpstreamBindConfig") - proto.RegisterType((*UpstreamConnectionOptions)(nil), "envoy.api.v2.UpstreamConnectionOptions") - proto.RegisterEnum("envoy.api.v2.Cluster_DiscoveryType", Cluster_DiscoveryType_name, Cluster_DiscoveryType_value) - proto.RegisterEnum("envoy.api.v2.Cluster_LbPolicy", Cluster_LbPolicy_name, Cluster_LbPolicy_value) - proto.RegisterEnum("envoy.api.v2.Cluster_DnsLookupFamily", Cluster_DnsLookupFamily_name, Cluster_DnsLookupFamily_value) - proto.RegisterEnum("envoy.api.v2.Cluster_ClusterProtocolSelection", Cluster_ClusterProtocolSelection_name, Cluster_ClusterProtocolSelection_value) - proto.RegisterEnum("envoy.api.v2.Cluster_LbSubsetConfig_LbSubsetFallbackPolicy", Cluster_LbSubsetConfig_LbSubsetFallbackPolicy_name, Cluster_LbSubsetConfig_LbSubsetFallbackPolicy_value) - proto.RegisterEnum("envoy.api.v2.Cluster_LbSubsetConfig_LbSubsetSelector_LbSubsetSelectorFallbackPolicy", Cluster_LbSubsetConfig_LbSubsetSelector_LbSubsetSelectorFallbackPolicy_name, Cluster_LbSubsetConfig_LbSubsetSelector_LbSubsetSelectorFallbackPolicy_value) - proto.RegisterEnum("envoy.api.v2.Cluster_RingHashLbConfig_HashFunction", Cluster_RingHashLbConfig_HashFunction_name, Cluster_RingHashLbConfig_HashFunction_value) -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// ClusterDiscoveryServiceClient is the client API for ClusterDiscoveryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ClusterDiscoveryServiceClient interface { - StreamClusters(ctx context.Context, opts ...grpc.CallOption) (ClusterDiscoveryService_StreamClustersClient, error) - DeltaClusters(ctx context.Context, opts ...grpc.CallOption) (ClusterDiscoveryService_DeltaClustersClient, error) - FetchClusters(ctx context.Context, in *discovery.DiscoveryRequest, opts ...grpc.CallOption) (*discovery.DiscoveryResponse, error) -} - -type clusterDiscoveryServiceClient struct { - cc *grpc.ClientConn -} - -func NewClusterDiscoveryServiceClient(cc *grpc.ClientConn) ClusterDiscoveryServiceClient { - return &clusterDiscoveryServiceClient{cc} -} - -func (c *clusterDiscoveryServiceClient) StreamClusters(ctx context.Context, opts ...grpc.CallOption) (ClusterDiscoveryService_StreamClustersClient, error) { - stream, err := c.cc.NewStream(ctx, &_ClusterDiscoveryService_serviceDesc.Streams[0], "/envoy.api.v2.ClusterDiscoveryService/StreamClusters", opts...) - if err != nil { - return nil, err - } - x := &clusterDiscoveryServiceStreamClustersClient{stream} - return x, nil -} - -type ClusterDiscoveryService_StreamClustersClient interface { - Send(*discovery.DiscoveryRequest) error - Recv() (*discovery.DiscoveryResponse, error) - grpc.ClientStream -} - -type clusterDiscoveryServiceStreamClustersClient struct { - grpc.ClientStream -} - -func (x *clusterDiscoveryServiceStreamClustersClient) Send(m *discovery.DiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *clusterDiscoveryServiceStreamClustersClient) Recv() (*discovery.DiscoveryResponse, error) { - m := new(discovery.DiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *clusterDiscoveryServiceClient) DeltaClusters(ctx context.Context, opts ...grpc.CallOption) (ClusterDiscoveryService_DeltaClustersClient, error) { - stream, err := c.cc.NewStream(ctx, &_ClusterDiscoveryService_serviceDesc.Streams[1], "/envoy.api.v2.ClusterDiscoveryService/DeltaClusters", opts...) - if err != nil { - return nil, err - } - x := &clusterDiscoveryServiceDeltaClustersClient{stream} - return x, nil -} - -type ClusterDiscoveryService_DeltaClustersClient interface { - Send(*discovery.DeltaDiscoveryRequest) error - Recv() (*discovery.DeltaDiscoveryResponse, error) - grpc.ClientStream -} - -type clusterDiscoveryServiceDeltaClustersClient struct { - grpc.ClientStream -} - -func (x *clusterDiscoveryServiceDeltaClustersClient) Send(m *discovery.DeltaDiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *clusterDiscoveryServiceDeltaClustersClient) Recv() (*discovery.DeltaDiscoveryResponse, error) { - m := new(discovery.DeltaDiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *clusterDiscoveryServiceClient) FetchClusters(ctx context.Context, in *discovery.DiscoveryRequest, opts ...grpc.CallOption) (*discovery.DiscoveryResponse, error) { - out := new(discovery.DiscoveryResponse) - err := c.cc.Invoke(ctx, "/envoy.api.v2.ClusterDiscoveryService/FetchClusters", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ClusterDiscoveryServiceServer is the server API for ClusterDiscoveryService service. -type ClusterDiscoveryServiceServer interface { - StreamClusters(ClusterDiscoveryService_StreamClustersServer) error - DeltaClusters(ClusterDiscoveryService_DeltaClustersServer) error - FetchClusters(context.Context, *discovery.DiscoveryRequest) (*discovery.DiscoveryResponse, error) -} - -func RegisterClusterDiscoveryServiceServer(s *grpc.Server, srv ClusterDiscoveryServiceServer) { - s.RegisterService(&_ClusterDiscoveryService_serviceDesc, srv) -} - -func _ClusterDiscoveryService_StreamClusters_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ClusterDiscoveryServiceServer).StreamClusters(&clusterDiscoveryServiceStreamClustersServer{stream}) -} - -type ClusterDiscoveryService_StreamClustersServer interface { - Send(*discovery.DiscoveryResponse) error - Recv() (*discovery.DiscoveryRequest, error) - grpc.ServerStream -} - -type clusterDiscoveryServiceStreamClustersServer struct { - grpc.ServerStream -} - -func (x *clusterDiscoveryServiceStreamClustersServer) Send(m *discovery.DiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *clusterDiscoveryServiceStreamClustersServer) Recv() (*discovery.DiscoveryRequest, error) { - m := new(discovery.DiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _ClusterDiscoveryService_DeltaClusters_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ClusterDiscoveryServiceServer).DeltaClusters(&clusterDiscoveryServiceDeltaClustersServer{stream}) -} - -type ClusterDiscoveryService_DeltaClustersServer interface { - Send(*discovery.DeltaDiscoveryResponse) error - Recv() (*discovery.DeltaDiscoveryRequest, error) - grpc.ServerStream -} - -type clusterDiscoveryServiceDeltaClustersServer struct { - grpc.ServerStream -} - -func (x *clusterDiscoveryServiceDeltaClustersServer) Send(m *discovery.DeltaDiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *clusterDiscoveryServiceDeltaClustersServer) Recv() (*discovery.DeltaDiscoveryRequest, error) { - m := new(discovery.DeltaDiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _ClusterDiscoveryService_FetchClusters_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(discovery.DiscoveryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ClusterDiscoveryServiceServer).FetchClusters(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/envoy.api.v2.ClusterDiscoveryService/FetchClusters", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ClusterDiscoveryServiceServer).FetchClusters(ctx, req.(*discovery.DiscoveryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _ClusterDiscoveryService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "envoy.api.v2.ClusterDiscoveryService", - HandlerType: (*ClusterDiscoveryServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "FetchClusters", - Handler: _ClusterDiscoveryService_FetchClusters_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "StreamClusters", - Handler: _ClusterDiscoveryService_StreamClusters_Handler, - ServerStreams: true, - ClientStreams: true, - }, - { - StreamName: "DeltaClusters", - Handler: _ClusterDiscoveryService_DeltaClusters_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "envoy/api/v2/cds.proto", -} - -func init() { proto.RegisterFile("envoy/api/v2/cds.proto", fileDescriptor_cds_3e3c13a974b77399) } - -var fileDescriptor_cds_3e3c13a974b77399 = []byte{ - // 2682 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x59, 0x4b, 0x73, 0x1b, 0xc7, - 0xf1, 0xe7, 0x82, 0x94, 0x44, 0x0e, 0x09, 0x60, 0x39, 0xa4, 0xa4, 0x15, 0xa8, 0x07, 0x05, 0x4b, - 0x36, 0xff, 0xfa, 0x27, 0x60, 0x42, 0xf9, 0x55, 0x4e, 0xec, 0x14, 0x5e, 0x14, 0x29, 0x83, 0x00, - 0x33, 0x00, 0x24, 0x3b, 0x2e, 0xd7, 0x78, 0xb0, 0x3b, 0x20, 0xb6, 0xb8, 0xd8, 0x5d, 0xef, 0xcc, - 0x52, 0x82, 0x0e, 0x29, 0xc5, 0xa7, 0xe4, 0x9c, 0x53, 0xaa, 0x92, 0x2f, 0x90, 0xaa, 0x7c, 0x81, - 0x9c, 0x52, 0xb9, 0xe5, 0x9c, 0x7b, 0x4e, 0xb9, 0xe4, 0x5b, 0xa4, 0xe6, 0xb1, 0x20, 0x1e, 0x4b, - 0x4a, 0x76, 0xe5, 0x44, 0x4c, 0xf7, 0xaf, 0x7f, 0x3d, 0xdb, 0xd3, 0xd3, 0xd3, 0x33, 0x04, 0x37, - 0xa8, 0x7f, 0x16, 0x8c, 0x76, 0x49, 0xe8, 0xee, 0x9e, 0xed, 0xed, 0xda, 0x0e, 0x2b, 0x85, 0x51, - 0xc0, 0x03, 0xb8, 0x26, 0xe5, 0x25, 0x12, 0xba, 0xa5, 0xb3, 0xbd, 0xc2, 0xbd, 0x69, 0x54, 0x10, - 0xd1, 0x5d, 0xe2, 0x38, 0x11, 0x65, 0x1a, 0x5e, 0xb8, 0x3d, 0x05, 0x20, 0x31, 0x1f, 0xec, 0xda, - 0x34, 0xe2, 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x3d, 0xa3, 0x97, 0xb4, 0xcf, 0x1d, 0x3b, 0xfc, 0x3c, 0x81, 0xa1, 0x35, 0x3e, - 0x31, 0xda, 0xfb, 0x47, 0x06, 0xdc, 0xd4, 0x51, 0x1c, 0xe7, 0x57, 0x5b, 0xb5, 0xcf, 0xf0, 0x39, - 0xc8, 0xb5, 0x95, 0x73, 0x05, 0x60, 0x70, 0xe6, 0xcd, 0x74, 0x6c, 0xa1, 0x4f, 0xd2, 0xc2, 0xbd, - 0x0b, 0xf5, 0x2c, 0x0c, 0x7c, 0x46, 0x8b, 0x0b, 0x3b, 0xc6, 0x4f, 0x0c, 0xf8, 0x0d, 0xc8, 0xd6, - 0xa8, 0xc7, 0xc9, 0x98, 0x77, 0xe6, 0x5d, 0x57, 0x2a, 0xe7, 0xc8, 0x1f, 0x5c, 0x0e, 0x9a, 0xf2, - 0xc0, 0x40, 0x76, 0x9f, 0x72, 0x7b, 0xf0, 0xbf, 0x9b, 0xf9, 0xfd, 0xef, 0xfe, 0xf9, 0xef, 0xdf, - 0x67, 0xb6, 0x8a, 0x37, 0xa6, 0xfe, 0x4b, 0xf5, 0x89, 0xce, 0x15, 0xf6, 0x89, 0xf1, 0xa8, 0xf2, - 0xff, 0xa0, 0xe0, 0x06, 0x8a, 0x27, 0x8c, 0x82, 0x97, 0xa3, 0x29, 0xca, 0xca, 0x72, 0xd5, 0x61, - 0x32, 0x51, 0x8f, 0x8d, 0xdf, 0x1a, 0x46, 0xef, 0xaa, 0xac, 0x17, 0x8f, 0xff, 0x1b, 0x00, 0x00, - 0xff, 0xff, 0xe9, 0x85, 0x2f, 0x4e, 0xa9, 0x1b, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/cluster/circuit_breaker/circuit_breaker.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/cluster/circuit_breaker/circuit_breaker.pb.go deleted file mode 100755 index b631f7a714e..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/cluster/circuit_breaker/circuit_breaker.pb.go +++ /dev/null @@ -1,185 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: envoy/api/v2/cluster/circuit_breaker.proto - -package cluster - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import wrappers "github.com/golang/protobuf/ptypes/wrappers" -import base "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/base" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type CircuitBreakers struct { - Thresholds []*CircuitBreakers_Thresholds `protobuf:"bytes,1,rep,name=thresholds,proto3" json:"thresholds,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CircuitBreakers) Reset() { *m = CircuitBreakers{} } -func (m *CircuitBreakers) String() string { return proto.CompactTextString(m) } -func (*CircuitBreakers) ProtoMessage() {} -func (*CircuitBreakers) Descriptor() ([]byte, []int) { - return fileDescriptor_circuit_breaker_6d322bb388c83ee8, []int{0} -} -func (m *CircuitBreakers) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CircuitBreakers.Unmarshal(m, b) -} -func (m *CircuitBreakers) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CircuitBreakers.Marshal(b, m, deterministic) -} -func (dst *CircuitBreakers) XXX_Merge(src proto.Message) { - xxx_messageInfo_CircuitBreakers.Merge(dst, src) -} -func (m *CircuitBreakers) XXX_Size() int { - return xxx_messageInfo_CircuitBreakers.Size(m) -} -func (m *CircuitBreakers) XXX_DiscardUnknown() { - xxx_messageInfo_CircuitBreakers.DiscardUnknown(m) -} - -var xxx_messageInfo_CircuitBreakers proto.InternalMessageInfo - -func (m *CircuitBreakers) GetThresholds() []*CircuitBreakers_Thresholds { - if m != nil { - return m.Thresholds - } - return nil -} - -type CircuitBreakers_Thresholds struct { - Priority base.RoutingPriority `protobuf:"varint,1,opt,name=priority,proto3,enum=envoy.api.v2.core.RoutingPriority" json:"priority,omitempty"` - MaxConnections *wrappers.UInt32Value `protobuf:"bytes,2,opt,name=max_connections,json=maxConnections,proto3" json:"max_connections,omitempty"` - MaxPendingRequests *wrappers.UInt32Value `protobuf:"bytes,3,opt,name=max_pending_requests,json=maxPendingRequests,proto3" json:"max_pending_requests,omitempty"` - MaxRequests *wrappers.UInt32Value `protobuf:"bytes,4,opt,name=max_requests,json=maxRequests,proto3" json:"max_requests,omitempty"` - MaxRetries *wrappers.UInt32Value `protobuf:"bytes,5,opt,name=max_retries,json=maxRetries,proto3" json:"max_retries,omitempty"` - TrackRemaining bool `protobuf:"varint,6,opt,name=track_remaining,json=trackRemaining,proto3" json:"track_remaining,omitempty"` - MaxConnectionPools *wrappers.UInt32Value `protobuf:"bytes,7,opt,name=max_connection_pools,json=maxConnectionPools,proto3" json:"max_connection_pools,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CircuitBreakers_Thresholds) Reset() { *m = CircuitBreakers_Thresholds{} } -func (m *CircuitBreakers_Thresholds) String() string { return proto.CompactTextString(m) } -func (*CircuitBreakers_Thresholds) ProtoMessage() {} -func (*CircuitBreakers_Thresholds) Descriptor() ([]byte, []int) { - return fileDescriptor_circuit_breaker_6d322bb388c83ee8, []int{0, 0} -} -func (m *CircuitBreakers_Thresholds) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CircuitBreakers_Thresholds.Unmarshal(m, b) -} -func (m *CircuitBreakers_Thresholds) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CircuitBreakers_Thresholds.Marshal(b, m, deterministic) -} -func (dst *CircuitBreakers_Thresholds) XXX_Merge(src proto.Message) { - xxx_messageInfo_CircuitBreakers_Thresholds.Merge(dst, src) -} -func (m *CircuitBreakers_Thresholds) XXX_Size() int { - return xxx_messageInfo_CircuitBreakers_Thresholds.Size(m) -} -func (m *CircuitBreakers_Thresholds) XXX_DiscardUnknown() { - xxx_messageInfo_CircuitBreakers_Thresholds.DiscardUnknown(m) -} - -var xxx_messageInfo_CircuitBreakers_Thresholds proto.InternalMessageInfo - -func (m *CircuitBreakers_Thresholds) GetPriority() base.RoutingPriority { - if m != nil { - return m.Priority - } - return base.RoutingPriority_DEFAULT -} - -func (m *CircuitBreakers_Thresholds) GetMaxConnections() *wrappers.UInt32Value { - if m != nil { - return m.MaxConnections - } - return nil -} - -func (m *CircuitBreakers_Thresholds) GetMaxPendingRequests() *wrappers.UInt32Value { - if m != nil { - return m.MaxPendingRequests - } - return nil -} - -func (m *CircuitBreakers_Thresholds) GetMaxRequests() *wrappers.UInt32Value { - if m != nil { - return m.MaxRequests - } - return nil -} - -func (m *CircuitBreakers_Thresholds) GetMaxRetries() *wrappers.UInt32Value { - if m != nil { - return m.MaxRetries - } - return nil -} - -func (m *CircuitBreakers_Thresholds) GetTrackRemaining() bool { - if m != nil { - return m.TrackRemaining - } - return false -} - -func (m *CircuitBreakers_Thresholds) GetMaxConnectionPools() *wrappers.UInt32Value { - if m != nil { - return m.MaxConnectionPools - } - return nil -} - -func init() { - proto.RegisterType((*CircuitBreakers)(nil), "envoy.api.v2.cluster.CircuitBreakers") - proto.RegisterType((*CircuitBreakers_Thresholds)(nil), "envoy.api.v2.cluster.CircuitBreakers.Thresholds") -} - -func init() { - proto.RegisterFile("envoy/api/v2/cluster/circuit_breaker.proto", fileDescriptor_circuit_breaker_6d322bb388c83ee8) -} - -var fileDescriptor_circuit_breaker_6d322bb388c83ee8 = []byte{ - // 422 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x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 0xca, 0xec, 0xc5, 0xc3, 0xc7, 0x92, 0xac, 0xed, 0x49, 0xf0, 0xed, 0x74, 0xd3, - 0xff, 0x75, 0xf4, 0xf2, 0xaa, 0xc5, 0x3e, 0x1a, 0x25, 0x6e, 0x62, 0x31, 0xf7, 0xe5, 0xeb, 0xcf, - 0x7f, 0x9f, 0x6a, 0x2c, 0x4e, 0xda, 0x3f, 0xbc, 0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, 0xb7, 0x50, - 0x58, 0xfa, 0x45, 0x03, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/cluster/outlier_detection/outlier_detection.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/cluster/outlier_detection/outlier_detection.pb.go deleted file mode 100755 index 80ee535390f..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/cluster/outlier_detection/outlier_detection.pb.go +++ /dev/null @@ -1,224 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: envoy/api/v2/cluster/outlier_detection.proto - -package envoy_api_v2_cluster - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import duration "github.com/golang/protobuf/ptypes/duration" -import wrappers "github.com/golang/protobuf/ptypes/wrappers" -import _ "google.golang.org/grpc/xds/internal/proto/validate" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type OutlierDetection struct { - Consecutive_5Xx *wrappers.UInt32Value `protobuf:"bytes,1,opt,name=consecutive_5xx,json=consecutive5xx,proto3" json:"consecutive_5xx,omitempty"` - Interval *duration.Duration `protobuf:"bytes,2,opt,name=interval,proto3" json:"interval,omitempty"` - BaseEjectionTime *duration.Duration `protobuf:"bytes,3,opt,name=base_ejection_time,json=baseEjectionTime,proto3" json:"base_ejection_time,omitempty"` - MaxEjectionPercent *wrappers.UInt32Value `protobuf:"bytes,4,opt,name=max_ejection_percent,json=maxEjectionPercent,proto3" json:"max_ejection_percent,omitempty"` - EnforcingConsecutive_5Xx *wrappers.UInt32Value `protobuf:"bytes,5,opt,name=enforcing_consecutive_5xx,json=enforcingConsecutive5xx,proto3" json:"enforcing_consecutive_5xx,omitempty"` - EnforcingSuccessRate *wrappers.UInt32Value `protobuf:"bytes,6,opt,name=enforcing_success_rate,json=enforcingSuccessRate,proto3" json:"enforcing_success_rate,omitempty"` - SuccessRateMinimumHosts *wrappers.UInt32Value `protobuf:"bytes,7,opt,name=success_rate_minimum_hosts,json=successRateMinimumHosts,proto3" json:"success_rate_minimum_hosts,omitempty"` - SuccessRateRequestVolume *wrappers.UInt32Value `protobuf:"bytes,8,opt,name=success_rate_request_volume,json=successRateRequestVolume,proto3" json:"success_rate_request_volume,omitempty"` - SuccessRateStdevFactor *wrappers.UInt32Value `protobuf:"bytes,9,opt,name=success_rate_stdev_factor,json=successRateStdevFactor,proto3" json:"success_rate_stdev_factor,omitempty"` - ConsecutiveGatewayFailure *wrappers.UInt32Value `protobuf:"bytes,10,opt,name=consecutive_gateway_failure,json=consecutiveGatewayFailure,proto3" json:"consecutive_gateway_failure,omitempty"` - EnforcingConsecutiveGatewayFailure *wrappers.UInt32Value `protobuf:"bytes,11,opt,name=enforcing_consecutive_gateway_failure,json=enforcingConsecutiveGatewayFailure,proto3" json:"enforcing_consecutive_gateway_failure,omitempty"` - SplitExternalLocalOriginErrors bool `protobuf:"varint,12,opt,name=split_external_local_origin_errors,json=splitExternalLocalOriginErrors,proto3" json:"split_external_local_origin_errors,omitempty"` - ConsecutiveLocalOriginFailure *wrappers.UInt32Value `protobuf:"bytes,13,opt,name=consecutive_local_origin_failure,json=consecutiveLocalOriginFailure,proto3" json:"consecutive_local_origin_failure,omitempty"` - EnforcingConsecutiveLocalOriginFailure *wrappers.UInt32Value `protobuf:"bytes,14,opt,name=enforcing_consecutive_local_origin_failure,json=enforcingConsecutiveLocalOriginFailure,proto3" json:"enforcing_consecutive_local_origin_failure,omitempty"` - EnforcingLocalOriginSuccessRate *wrappers.UInt32Value `protobuf:"bytes,15,opt,name=enforcing_local_origin_success_rate,json=enforcingLocalOriginSuccessRate,proto3" json:"enforcing_local_origin_success_rate,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OutlierDetection) Reset() { *m = OutlierDetection{} } -func (m *OutlierDetection) String() string { return proto.CompactTextString(m) } -func (*OutlierDetection) ProtoMessage() {} -func (*OutlierDetection) Descriptor() ([]byte, []int) { - return fileDescriptor_outlier_detection_dd7f40a1b13f2024, []int{0} -} -func (m *OutlierDetection) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OutlierDetection.Unmarshal(m, b) -} -func (m *OutlierDetection) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OutlierDetection.Marshal(b, m, deterministic) -} -func (dst *OutlierDetection) XXX_Merge(src proto.Message) { - xxx_messageInfo_OutlierDetection.Merge(dst, src) -} -func (m *OutlierDetection) XXX_Size() int { - return xxx_messageInfo_OutlierDetection.Size(m) -} -func (m *OutlierDetection) XXX_DiscardUnknown() { - xxx_messageInfo_OutlierDetection.DiscardUnknown(m) -} - -var xxx_messageInfo_OutlierDetection proto.InternalMessageInfo - -func (m *OutlierDetection) GetConsecutive_5Xx() *wrappers.UInt32Value { - if m != nil { - return m.Consecutive_5Xx - } - return nil -} - -func (m *OutlierDetection) GetInterval() *duration.Duration { - if m != nil { - return m.Interval - } - return nil -} - -func (m *OutlierDetection) GetBaseEjectionTime() *duration.Duration { - if m != nil { - return m.BaseEjectionTime - } - return nil -} - -func (m *OutlierDetection) GetMaxEjectionPercent() *wrappers.UInt32Value { - if m != nil { - return m.MaxEjectionPercent - } - return nil -} - -func (m *OutlierDetection) GetEnforcingConsecutive_5Xx() *wrappers.UInt32Value { - if m != nil { - return m.EnforcingConsecutive_5Xx - } - return nil -} - -func (m *OutlierDetection) GetEnforcingSuccessRate() *wrappers.UInt32Value { - if m != nil { - return m.EnforcingSuccessRate - } - return nil -} - -func (m *OutlierDetection) GetSuccessRateMinimumHosts() *wrappers.UInt32Value { - if m != nil { - return m.SuccessRateMinimumHosts - } - return nil -} - -func (m *OutlierDetection) GetSuccessRateRequestVolume() *wrappers.UInt32Value { - if m != nil { - return m.SuccessRateRequestVolume - } - return nil -} - -func (m *OutlierDetection) GetSuccessRateStdevFactor() *wrappers.UInt32Value { - if m != nil { - return m.SuccessRateStdevFactor - } - return nil -} - -func (m *OutlierDetection) GetConsecutiveGatewayFailure() *wrappers.UInt32Value { - if m != nil { - return m.ConsecutiveGatewayFailure - } - return nil -} - -func (m *OutlierDetection) GetEnforcingConsecutiveGatewayFailure() *wrappers.UInt32Value { - if m != nil { - return m.EnforcingConsecutiveGatewayFailure - } - return nil -} - -func (m *OutlierDetection) GetSplitExternalLocalOriginErrors() bool { - if m != nil { - return m.SplitExternalLocalOriginErrors - } - return false -} - -func (m *OutlierDetection) GetConsecutiveLocalOriginFailure() *wrappers.UInt32Value { - if m != nil { - return m.ConsecutiveLocalOriginFailure - } - return nil -} - -func (m *OutlierDetection) GetEnforcingConsecutiveLocalOriginFailure() *wrappers.UInt32Value { - if m != nil { - return m.EnforcingConsecutiveLocalOriginFailure - } - return nil -} - -func (m *OutlierDetection) GetEnforcingLocalOriginSuccessRate() *wrappers.UInt32Value { - if m != nil { - return m.EnforcingLocalOriginSuccessRate - } - return nil -} - -func init() { - proto.RegisterType((*OutlierDetection)(nil), "envoy.api.v2.cluster.OutlierDetection") -} - -func init() { - proto.RegisterFile("envoy/api/v2/cluster/outlier_detection.proto", fileDescriptor_outlier_detection_dd7f40a1b13f2024) -} - -var fileDescriptor_outlier_detection_dd7f40a1b13f2024 = []byte{ - // 636 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x95, 0xeb, 0x4e, 0x13, 0x4f, - 0x18, 0xc6, 0xff, 0x2d, 0x87, 0x3f, 0x0c, 0x0a, 0x64, 0x82, 0x30, 0x05, 0x45, 0x52, 0xa3, 0x21, - 0xc4, 0xec, 0x26, 0x25, 0x5c, 0x00, 0x85, 0xe2, 0x21, 0x2a, 0xa4, 0x55, 0x8c, 0x51, 0x33, 0x19, - 0xb6, 0x6f, 0xeb, 0x98, 0xd9, 0x9d, 0x75, 0x0e, 0xcb, 0xe2, 0x57, 0xef, 0x06, 0xef, 0xc0, 0x4f, - 0xde, 0x8e, 0x5e, 0x85, 0xd9, 0xdd, 0x1e, 0xb6, 0x65, 0x8d, 0xed, 0xb7, 0x26, 0xef, 0xf3, 0xfc, - 0x9e, 0x67, 0xde, 0x9d, 0xed, 0xa2, 0xc7, 0x10, 0x44, 0xf2, 0xca, 0x65, 0x21, 0x77, 0xa3, 0x9a, - 0xeb, 0x09, 0xab, 0x0d, 0x28, 0x57, 0x5a, 0x23, 0x38, 0x28, 0xda, 0x06, 0x03, 0x9e, 0xe1, 0x32, - 0x70, 0x42, 0x25, 0x8d, 0xc4, 0x6b, 0xa9, 0xda, 0x61, 0x21, 0x77, 0xa2, 0x9a, 0xd3, 0x53, 0x6f, - 0x6e, 0x77, 0xa5, 0xec, 0x0a, 0x70, 0x53, 0xcd, 0x85, 0xed, 0xb8, 0x6d, 0xab, 0xd8, 0xd0, 0x75, - 0x73, 0x7e, 0xa9, 0x58, 0x18, 0x82, 0xd2, 0xbd, 0xf9, 0x46, 0xc4, 0x04, 0x6f, 0x33, 0x03, 0x6e, - 0xff, 0x47, 0x36, 0xa8, 0x7e, 0x5f, 0x42, 0xab, 0xa7, 0x59, 0x95, 0xe3, 0x7e, 0x13, 0xdc, 0x40, - 0x2b, 0x9e, 0x0c, 0x34, 0x78, 0xd6, 0x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 0x1e, 0x15, 0x2d, 0xad, 0xa0, 0x85, 0x45, 0x0f, 0x86, 0x25, 0x46, 0x82, - 0x47, 0xde, 0xc7, 0x95, 0xe9, 0xd2, 0xef, 0x0f, 0x98, 0xb9, 0xc8, 0xdc, 0xab, 0x59, 0x97, 0xa8, - 0xca, 0xa5, 0x93, 0x7e, 0x21, 0x42, 0x25, 0xe3, 0x2b, 0xa7, 0xe8, 0x63, 0x51, 0xbf, 0x33, 0xfe, - 0x87, 0x7e, 0x96, 0xe4, 0x9e, 0x95, 0xae, 0xcb, 0xeb, 0x8d, 0x54, 0x7f, 0x18, 0x72, 0xe7, 0xbc, - 0xe6, 0x1c, 0x65, 0xfa, 0x57, 0xad, 0xdf, 0x7f, 0x1b, 0x5c, 0xcc, 0xa7, 0x95, 0xf7, 0xff, 0x04, - 0x00, 0x00, 0xff, 0xff, 0x1c, 0xe0, 0x70, 0xdc, 0xc4, 0x06, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/address/address.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/address/address.pb.go deleted file mode 100755 index 5c54813cf09..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/address/address.pb.go +++ /dev/null @@ -1,610 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: envoy/api/v2/core/address.proto - -package envoy_api_v2_core - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import wrappers "github.com/golang/protobuf/ptypes/wrappers" -import base "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/base" -import _ "google.golang.org/grpc/xds/internal/proto/validate" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type SocketAddress_Protocol int32 - -const ( - SocketAddress_TCP SocketAddress_Protocol = 0 - SocketAddress_UDP SocketAddress_Protocol = 1 -) - -var SocketAddress_Protocol_name = map[int32]string{ - 0: "TCP", - 1: "UDP", -} -var SocketAddress_Protocol_value = map[string]int32{ - "TCP": 0, - "UDP": 1, -} - -func (x SocketAddress_Protocol) String() string { - return proto.EnumName(SocketAddress_Protocol_name, int32(x)) -} -func (SocketAddress_Protocol) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_address_b91d58d2da3489da, []int{1, 0} -} - -type Pipe struct { - Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Pipe) Reset() { *m = Pipe{} } -func (m *Pipe) String() string { return proto.CompactTextString(m) } -func (*Pipe) ProtoMessage() {} -func (*Pipe) Descriptor() ([]byte, []int) { - return fileDescriptor_address_b91d58d2da3489da, []int{0} -} -func (m *Pipe) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Pipe.Unmarshal(m, b) -} -func (m *Pipe) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Pipe.Marshal(b, m, deterministic) -} -func (dst *Pipe) XXX_Merge(src proto.Message) { - xxx_messageInfo_Pipe.Merge(dst, src) -} -func (m *Pipe) XXX_Size() int { - return xxx_messageInfo_Pipe.Size(m) -} -func (m *Pipe) XXX_DiscardUnknown() { - xxx_messageInfo_Pipe.DiscardUnknown(m) -} - -var xxx_messageInfo_Pipe proto.InternalMessageInfo - -func (m *Pipe) GetPath() string { - if m != nil { - return m.Path - } - return "" -} - -type SocketAddress struct { - Protocol SocketAddress_Protocol `protobuf:"varint,1,opt,name=protocol,proto3,enum=envoy.api.v2.core.SocketAddress_Protocol" json:"protocol,omitempty"` - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - // Types that are valid to be assigned to PortSpecifier: - // *SocketAddress_PortValue - // *SocketAddress_NamedPort - PortSpecifier isSocketAddress_PortSpecifier `protobuf_oneof:"port_specifier"` - ResolverName string `protobuf:"bytes,5,opt,name=resolver_name,json=resolverName,proto3" json:"resolver_name,omitempty"` - Ipv4Compat bool `protobuf:"varint,6,opt,name=ipv4_compat,json=ipv4Compat,proto3" json:"ipv4_compat,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SocketAddress) Reset() { *m = SocketAddress{} } -func (m *SocketAddress) String() string { return proto.CompactTextString(m) } -func (*SocketAddress) ProtoMessage() {} -func (*SocketAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_address_b91d58d2da3489da, []int{1} -} -func (m *SocketAddress) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SocketAddress.Unmarshal(m, b) -} -func (m *SocketAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SocketAddress.Marshal(b, m, deterministic) -} -func (dst *SocketAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_SocketAddress.Merge(dst, src) -} -func (m *SocketAddress) XXX_Size() int { - return xxx_messageInfo_SocketAddress.Size(m) -} -func (m *SocketAddress) XXX_DiscardUnknown() { - xxx_messageInfo_SocketAddress.DiscardUnknown(m) -} - -var xxx_messageInfo_SocketAddress proto.InternalMessageInfo - -func (m *SocketAddress) GetProtocol() SocketAddress_Protocol { - if m != nil { - return m.Protocol - } - return SocketAddress_TCP -} - -func (m *SocketAddress) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -type isSocketAddress_PortSpecifier interface { - isSocketAddress_PortSpecifier() -} - -type SocketAddress_PortValue struct { - PortValue uint32 `protobuf:"varint,3,opt,name=port_value,json=portValue,proto3,oneof"` -} - -type SocketAddress_NamedPort struct { - NamedPort string `protobuf:"bytes,4,opt,name=named_port,json=namedPort,proto3,oneof"` -} - -func (*SocketAddress_PortValue) isSocketAddress_PortSpecifier() {} - -func (*SocketAddress_NamedPort) isSocketAddress_PortSpecifier() {} - -func (m *SocketAddress) GetPortSpecifier() isSocketAddress_PortSpecifier { - if m != nil { - return m.PortSpecifier - } - return nil -} - -func (m *SocketAddress) GetPortValue() uint32 { - if x, ok := m.GetPortSpecifier().(*SocketAddress_PortValue); ok { - return x.PortValue - } - return 0 -} - -func (m *SocketAddress) GetNamedPort() string { - if x, ok := m.GetPortSpecifier().(*SocketAddress_NamedPort); ok { - return x.NamedPort - } - return "" -} - -func (m *SocketAddress) GetResolverName() string { - if m != nil { - return m.ResolverName - } - return "" -} - -func (m *SocketAddress) GetIpv4Compat() bool { - if m != nil { - return m.Ipv4Compat - } - return false -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*SocketAddress) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _SocketAddress_OneofMarshaler, _SocketAddress_OneofUnmarshaler, _SocketAddress_OneofSizer, []interface{}{ - (*SocketAddress_PortValue)(nil), - (*SocketAddress_NamedPort)(nil), - } -} - -func _SocketAddress_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*SocketAddress) - // port_specifier - switch x := m.PortSpecifier.(type) { - case *SocketAddress_PortValue: - b.EncodeVarint(3<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.PortValue)) - case *SocketAddress_NamedPort: - b.EncodeVarint(4<<3 | proto.WireBytes) - b.EncodeStringBytes(x.NamedPort) - case nil: - default: - return fmt.Errorf("SocketAddress.PortSpecifier has unexpected type %T", x) - } - return nil -} - -func _SocketAddress_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*SocketAddress) - switch tag { - case 3: // port_specifier.port_value - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.PortSpecifier = &SocketAddress_PortValue{uint32(x)} - return true, err - case 4: // port_specifier.named_port - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.PortSpecifier = &SocketAddress_NamedPort{x} - return true, err - default: - return false, nil - } -} - -func _SocketAddress_OneofSizer(msg proto.Message) (n int) { - m := msg.(*SocketAddress) - // port_specifier - switch x := m.PortSpecifier.(type) { - case *SocketAddress_PortValue: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.PortValue)) - case *SocketAddress_NamedPort: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.NamedPort))) - n += len(x.NamedPort) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type TcpKeepalive struct { - KeepaliveProbes *wrappers.UInt32Value `protobuf:"bytes,1,opt,name=keepalive_probes,json=keepaliveProbes,proto3" json:"keepalive_probes,omitempty"` - KeepaliveTime *wrappers.UInt32Value `protobuf:"bytes,2,opt,name=keepalive_time,json=keepaliveTime,proto3" json:"keepalive_time,omitempty"` - KeepaliveInterval *wrappers.UInt32Value `protobuf:"bytes,3,opt,name=keepalive_interval,json=keepaliveInterval,proto3" json:"keepalive_interval,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TcpKeepalive) Reset() { *m = TcpKeepalive{} } -func (m *TcpKeepalive) String() string { return proto.CompactTextString(m) } -func (*TcpKeepalive) ProtoMessage() {} -func (*TcpKeepalive) Descriptor() ([]byte, []int) { - return fileDescriptor_address_b91d58d2da3489da, []int{2} -} -func (m *TcpKeepalive) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TcpKeepalive.Unmarshal(m, b) -} -func (m *TcpKeepalive) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TcpKeepalive.Marshal(b, m, deterministic) -} -func (dst *TcpKeepalive) XXX_Merge(src proto.Message) { - xxx_messageInfo_TcpKeepalive.Merge(dst, src) -} -func (m *TcpKeepalive) XXX_Size() int { - return xxx_messageInfo_TcpKeepalive.Size(m) -} -func (m *TcpKeepalive) XXX_DiscardUnknown() { - xxx_messageInfo_TcpKeepalive.DiscardUnknown(m) -} - -var xxx_messageInfo_TcpKeepalive proto.InternalMessageInfo - -func (m *TcpKeepalive) GetKeepaliveProbes() *wrappers.UInt32Value { - if m != nil { - return m.KeepaliveProbes - } - return nil -} - -func (m *TcpKeepalive) GetKeepaliveTime() *wrappers.UInt32Value { - if m != nil { - return m.KeepaliveTime - } - return nil -} - -func (m *TcpKeepalive) GetKeepaliveInterval() *wrappers.UInt32Value { - if m != nil { - return m.KeepaliveInterval - } - return nil -} - -type BindConfig struct { - SourceAddress *SocketAddress `protobuf:"bytes,1,opt,name=source_address,json=sourceAddress,proto3" json:"source_address,omitempty"` - Freebind *wrappers.BoolValue `protobuf:"bytes,2,opt,name=freebind,proto3" json:"freebind,omitempty"` - SocketOptions []*base.SocketOption `protobuf:"bytes,3,rep,name=socket_options,json=socketOptions,proto3" json:"socket_options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BindConfig) Reset() { *m = BindConfig{} } -func (m *BindConfig) String() string { return proto.CompactTextString(m) } -func (*BindConfig) ProtoMessage() {} -func (*BindConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_address_b91d58d2da3489da, []int{3} -} -func (m *BindConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BindConfig.Unmarshal(m, b) -} -func (m *BindConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BindConfig.Marshal(b, m, deterministic) -} -func (dst *BindConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_BindConfig.Merge(dst, src) -} -func (m *BindConfig) XXX_Size() int { - return xxx_messageInfo_BindConfig.Size(m) -} -func (m *BindConfig) XXX_DiscardUnknown() { - xxx_messageInfo_BindConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_BindConfig proto.InternalMessageInfo - -func (m *BindConfig) GetSourceAddress() *SocketAddress { - if m != nil { - return m.SourceAddress - } - return nil -} - -func (m *BindConfig) GetFreebind() *wrappers.BoolValue { - if m != nil { - return m.Freebind - } - return nil -} - -func (m *BindConfig) GetSocketOptions() []*base.SocketOption { - if m != nil { - return m.SocketOptions - } - return nil -} - -type Address struct { - // Types that are valid to be assigned to Address: - // *Address_SocketAddress - // *Address_Pipe - Address isAddress_Address `protobuf_oneof:"address"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Address) Reset() { *m = Address{} } -func (m *Address) String() string { return proto.CompactTextString(m) } -func (*Address) ProtoMessage() {} -func (*Address) Descriptor() ([]byte, []int) { - return fileDescriptor_address_b91d58d2da3489da, []int{4} -} -func (m *Address) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Address.Unmarshal(m, b) -} -func (m *Address) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Address.Marshal(b, m, deterministic) -} -func (dst *Address) XXX_Merge(src proto.Message) { - xxx_messageInfo_Address.Merge(dst, src) -} -func (m *Address) XXX_Size() int { - return xxx_messageInfo_Address.Size(m) -} -func (m *Address) XXX_DiscardUnknown() { - xxx_messageInfo_Address.DiscardUnknown(m) -} - -var xxx_messageInfo_Address proto.InternalMessageInfo - -type isAddress_Address interface { - isAddress_Address() -} - -type Address_SocketAddress struct { - SocketAddress *SocketAddress `protobuf:"bytes,1,opt,name=socket_address,json=socketAddress,proto3,oneof"` -} - -type Address_Pipe struct { - Pipe *Pipe `protobuf:"bytes,2,opt,name=pipe,proto3,oneof"` -} - -func (*Address_SocketAddress) isAddress_Address() {} - -func (*Address_Pipe) isAddress_Address() {} - -func (m *Address) GetAddress() isAddress_Address { - if m != nil { - return m.Address - } - return nil -} - -func (m *Address) GetSocketAddress() *SocketAddress { - if x, ok := m.GetAddress().(*Address_SocketAddress); ok { - return x.SocketAddress - } - return nil -} - -func (m *Address) GetPipe() *Pipe { - if x, ok := m.GetAddress().(*Address_Pipe); ok { - return x.Pipe - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Address) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Address_OneofMarshaler, _Address_OneofUnmarshaler, _Address_OneofSizer, []interface{}{ - (*Address_SocketAddress)(nil), - (*Address_Pipe)(nil), - } -} - -func _Address_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Address) - // address - switch x := m.Address.(type) { - case *Address_SocketAddress: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SocketAddress); err != nil { - return err - } - case *Address_Pipe: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Pipe); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("Address.Address has unexpected type %T", x) - } - return nil -} - -func _Address_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Address) - switch tag { - case 1: // address.socket_address - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SocketAddress) - err := b.DecodeMessage(msg) - m.Address = &Address_SocketAddress{msg} - return true, err - case 2: // address.pipe - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Pipe) - err := b.DecodeMessage(msg) - m.Address = &Address_Pipe{msg} - return true, err - default: - return false, nil - } -} - -func _Address_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Address) - // address - switch x := m.Address.(type) { - case *Address_SocketAddress: - s := proto.Size(x.SocketAddress) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Address_Pipe: - s := proto.Size(x.Pipe) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type CidrRange struct { - AddressPrefix string `protobuf:"bytes,1,opt,name=address_prefix,json=addressPrefix,proto3" json:"address_prefix,omitempty"` - PrefixLen *wrappers.UInt32Value `protobuf:"bytes,2,opt,name=prefix_len,json=prefixLen,proto3" json:"prefix_len,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CidrRange) Reset() { *m = CidrRange{} } -func (m *CidrRange) String() string { return proto.CompactTextString(m) } -func (*CidrRange) ProtoMessage() {} -func (*CidrRange) Descriptor() ([]byte, []int) { - return fileDescriptor_address_b91d58d2da3489da, []int{5} -} -func (m *CidrRange) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CidrRange.Unmarshal(m, b) -} -func (m *CidrRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CidrRange.Marshal(b, m, deterministic) -} -func (dst *CidrRange) XXX_Merge(src proto.Message) { - xxx_messageInfo_CidrRange.Merge(dst, src) -} -func (m *CidrRange) XXX_Size() int { - return xxx_messageInfo_CidrRange.Size(m) -} -func (m *CidrRange) XXX_DiscardUnknown() { - xxx_messageInfo_CidrRange.DiscardUnknown(m) -} - -var xxx_messageInfo_CidrRange proto.InternalMessageInfo - -func (m *CidrRange) GetAddressPrefix() string { - if m != nil { - return m.AddressPrefix - } - return "" -} - -func (m *CidrRange) GetPrefixLen() *wrappers.UInt32Value { - if m != nil { - return m.PrefixLen - } - return nil -} - -func init() { - proto.RegisterType((*Pipe)(nil), "envoy.api.v2.core.Pipe") - proto.RegisterType((*SocketAddress)(nil), "envoy.api.v2.core.SocketAddress") - proto.RegisterType((*TcpKeepalive)(nil), "envoy.api.v2.core.TcpKeepalive") - proto.RegisterType((*BindConfig)(nil), "envoy.api.v2.core.BindConfig") - proto.RegisterType((*Address)(nil), "envoy.api.v2.core.Address") - proto.RegisterType((*CidrRange)(nil), "envoy.api.v2.core.CidrRange") - proto.RegisterEnum("envoy.api.v2.core.SocketAddress_Protocol", SocketAddress_Protocol_name, SocketAddress_Protocol_value) -} - -func init() { - proto.RegisterFile("envoy/api/v2/core/address.proto", fileDescriptor_address_b91d58d2da3489da) -} - -var fileDescriptor_address_b91d58d2da3489da = []byte{ - // 667 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x4f, 0x4f, 0xdb, 0x48, - 0x14, 0xcf, 0xc4, 0x01, 0x92, 0x17, 0x92, 0x0d, 0x73, 0xc1, 0x8a, 0xd8, 0x4d, 0x14, 0xb4, 0x52, - 0x16, 0xed, 0x3a, 0xbb, 0x61, 0xb5, 0x77, 0x9c, 0x55, 0x01, 0x51, 0xb5, 0xae, 0x81, 0x5e, 0xad, - 0x49, 0xf2, 0x92, 0x8e, 0x70, 0x3c, 0xa3, 0xb1, 0x71, 0xe1, 0x56, 0xf5, 0xd0, 0x43, 0xef, 0xfd, - 0x2e, 0x55, 0x4f, 0x7c, 0x87, 0x7e, 0x82, 0x1e, 0xf9, 0x14, 0x54, 0x33, 0xb6, 0x83, 0xda, 0xb4, - 0xa2, 0xbd, 0xcd, 0xbc, 0xf7, 0xfb, 0xfd, 0xe6, 0xf7, 0xfe, 0x0c, 0x74, 0x30, 0x4a, 0xc5, 0xf5, - 0x80, 0x49, 0x3e, 0x48, 0x87, 0x83, 0x89, 0x50, 0x38, 0x60, 0xd3, 0xa9, 0xc2, 0x38, 0x76, 0xa4, - 0x12, 0x89, 0xa0, 0x5b, 0x06, 0xe0, 0x30, 0xc9, 0x9d, 0x74, 0xe8, 0x68, 0x40, 0x7b, 0x67, 0x95, - 0x33, 0x66, 0x31, 0x66, 0x84, 0xf6, 0x6f, 0x73, 0x21, 0xe6, 0x21, 0x0e, 0xcc, 0x6d,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d, 0x21, 0xc2, 0xcc, 0xe4, 0x12, - 0x4b, 0x1f, 0x69, 0x33, 0xfa, 0x8d, 0x40, 0xc8, 0x84, 0x8b, 0x28, 0xb6, 0xad, 0xae, 0xd5, 0xaf, - 0x0f, 0x3b, 0xdf, 0x35, 0xf3, 0xd4, 0xe0, 0xf4, 0xfb, 0xf7, 0xb7, 0xb8, 0xf7, 0x8e, 0xc0, 0x46, - 0xe1, 0xe5, 0x78, 0xa9, 0xf9, 0x93, 0x05, 0x1e, 0x95, 0x0a, 0xd9, 0x42, 0xea, 0x2f, 0xa8, 0x48, - 0x2e, 0x8b, 0x11, 0x6e, 0x7f, 0x43, 0x40, 0x7f, 0xe1, 0xa3, 0x92, 0x6f, 0x60, 0x6e, 0x6b, 0xf9, - 0x8d, 0x8a, 0x3d, 0x7b, 0x43, 0xa0, 0x36, 0xe2, 0x53, 0xe5, 0xb3, 0x68, 0x8e, 0xf4, 0x6f, 0x68, - 0xe6, 0xf9, 0x40, 0x2a, 0x9c, 0xf1, 0xab, 0xd5, 0x4f, 0xdf, 0xc8, 0x01, 0x9e, 0xc9, 0xd3, 0x43, - 0x80, 0x0c, 0x19, 0x84, 0x18, 0xfd, 0xc8, 0x26, 0xe5, 0x43, 0xda, 0xb3, 0xec, 0x57, 0xc4, 0xaf, - 0x65, 0xdc, 0xc7, 0x18, 0xb9, 0xff, 0x40, 0x87, 0x8b, 0xcc, 0xbf, 0x54, 0xe2, 0xea, 0x7a, 0xb5, - 0x14, 0x77, 0xf3, 0xa0, 0x78, 0x5a, 0x24, 0xc2, 0x23, 0xe3, 0x75, 0xa3, 0xbf, 0xff, 0x39, 0x00, - 0x00, 0xff, 0xff, 0x03, 0x02, 0x9c, 0x89, 0x34, 0x05, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/base/base.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/base/base.pb.go deleted file mode 100755 index 23558047985..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/base/base.pb.go +++ /dev/null @@ -1,1125 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: envoy/api/v2/core/base.proto - -package envoy_api_v2_core - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import any "github.com/golang/protobuf/ptypes/any" -import _struct "github.com/golang/protobuf/ptypes/struct" -import wrappers "github.com/golang/protobuf/ptypes/wrappers" -import percent "google.golang.org/grpc/xds/internal/proto/envoy/type/percent" -import _ "google.golang.org/grpc/xds/internal/proto/validate" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type RoutingPriority int32 - -const ( - RoutingPriority_DEFAULT RoutingPriority = 0 - RoutingPriority_HIGH RoutingPriority = 1 -) - -var RoutingPriority_name = map[int32]string{ - 0: "DEFAULT", - 1: "HIGH", -} -var RoutingPriority_value = map[string]int32{ - "DEFAULT": 0, - "HIGH": 1, -} - -func (x RoutingPriority) String() string { - return proto.EnumName(RoutingPriority_name, int32(x)) -} -func (RoutingPriority) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_base_12218511885b7551, []int{0} -} - -type RequestMethod int32 - -const ( - RequestMethod_METHOD_UNSPECIFIED RequestMethod = 0 - RequestMethod_GET RequestMethod = 1 - RequestMethod_HEAD RequestMethod = 2 - RequestMethod_POST RequestMethod = 3 - RequestMethod_PUT RequestMethod = 4 - RequestMethod_DELETE RequestMethod = 5 - RequestMethod_CONNECT RequestMethod = 6 - RequestMethod_OPTIONS RequestMethod = 7 - RequestMethod_TRACE RequestMethod = 8 - RequestMethod_PATCH RequestMethod = 9 -) - -var RequestMethod_name = map[int32]string{ - 0: "METHOD_UNSPECIFIED", - 1: "GET", - 2: "HEAD", - 3: "POST", - 4: "PUT", - 5: "DELETE", - 6: "CONNECT", - 7: "OPTIONS", - 8: "TRACE", - 9: "PATCH", -} -var RequestMethod_value = map[string]int32{ - "METHOD_UNSPECIFIED": 0, - "GET": 1, - "HEAD": 2, - "POST": 3, - "PUT": 4, - "DELETE": 5, - "CONNECT": 6, - "OPTIONS": 7, - "TRACE": 8, - "PATCH": 9, -} - -func (x RequestMethod) String() string { - return proto.EnumName(RequestMethod_name, int32(x)) -} -func (RequestMethod) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_base_12218511885b7551, []int{1} -} - -type SocketOption_SocketState int32 - -const ( - SocketOption_STATE_PREBIND SocketOption_SocketState = 0 - SocketOption_STATE_BOUND SocketOption_SocketState = 1 - SocketOption_STATE_LISTENING SocketOption_SocketState = 2 -) - -var SocketOption_SocketState_name = map[int32]string{ - 0: "STATE_PREBIND", - 1: "STATE_BOUND", - 2: "STATE_LISTENING", -} -var SocketOption_SocketState_value = map[string]int32{ - "STATE_PREBIND": 0, - "STATE_BOUND": 1, - "STATE_LISTENING": 2, -} - -func (x SocketOption_SocketState) String() string { - return proto.EnumName(SocketOption_SocketState_name, int32(x)) -} -func (SocketOption_SocketState) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_base_12218511885b7551, []int{9, 0} -} - -type Locality struct { - Region string `protobuf:"bytes,1,opt,name=region,proto3" json:"region,omitempty"` - Zone string `protobuf:"bytes,2,opt,name=zone,proto3" json:"zone,omitempty"` - SubZone string `protobuf:"bytes,3,opt,name=sub_zone,json=subZone,proto3" json:"sub_zone,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Locality) Reset() { *m = Locality{} } -func (m *Locality) String() string { return proto.CompactTextString(m) } -func (*Locality) ProtoMessage() {} -func (*Locality) Descriptor() ([]byte, []int) { - return fileDescriptor_base_12218511885b7551, []int{0} -} -func (m *Locality) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Locality.Unmarshal(m, b) -} -func (m *Locality) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Locality.Marshal(b, m, deterministic) -} -func (dst *Locality) XXX_Merge(src proto.Message) { - xxx_messageInfo_Locality.Merge(dst, src) -} -func (m *Locality) XXX_Size() int { - return xxx_messageInfo_Locality.Size(m) -} -func (m *Locality) XXX_DiscardUnknown() { - xxx_messageInfo_Locality.DiscardUnknown(m) -} - -var xxx_messageInfo_Locality proto.InternalMessageInfo - -func (m *Locality) GetRegion() string { - if m != nil { - return m.Region - } - return "" -} - -func (m *Locality) GetZone() string { - if m != nil { - return m.Zone - } - return "" -} - -func (m *Locality) GetSubZone() string { - if m != nil { - return m.SubZone - } - return "" -} - -type Node struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Cluster string `protobuf:"bytes,2,opt,name=cluster,proto3" json:"cluster,omitempty"` - Metadata *_struct.Struct `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"` - Locality *Locality `protobuf:"bytes,4,opt,name=locality,proto3" json:"locality,omitempty"` - BuildVersion string `protobuf:"bytes,5,opt,name=build_version,json=buildVersion,proto3" json:"build_version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Node) Reset() { *m = Node{} } -func (m *Node) String() string { return proto.CompactTextString(m) } -func (*Node) ProtoMessage() {} -func (*Node) Descriptor() ([]byte, []int) { - return fileDescriptor_base_12218511885b7551, []int{1} -} -func (m *Node) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Node.Unmarshal(m, b) -} -func (m *Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Node.Marshal(b, m, deterministic) -} -func (dst *Node) XXX_Merge(src proto.Message) { - xxx_messageInfo_Node.Merge(dst, src) -} -func (m *Node) XXX_Size() int { - return xxx_messageInfo_Node.Size(m) -} -func (m *Node) XXX_DiscardUnknown() { - xxx_messageInfo_Node.DiscardUnknown(m) -} - -var xxx_messageInfo_Node proto.InternalMessageInfo - -func (m *Node) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *Node) GetCluster() string { - if m != nil { - return m.Cluster - } - return "" -} - -func (m *Node) GetMetadata() *_struct.Struct { - if m != nil { - return m.Metadata - } - return nil -} - -func (m *Node) GetLocality() *Locality { - if m != nil { - return m.Locality - } - return nil -} - -func (m *Node) GetBuildVersion() string { - if m != nil { - return m.BuildVersion - } - return "" -} - -type Metadata struct { - FilterMetadata map[string]*_struct.Struct `protobuf:"bytes,1,rep,name=filter_metadata,json=filterMetadata,proto3" json:"filter_metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Metadata) Reset() { *m = Metadata{} } -func (m *Metadata) String() string { return proto.CompactTextString(m) } -func (*Metadata) ProtoMessage() {} -func (*Metadata) Descriptor() ([]byte, []int) { - return fileDescriptor_base_12218511885b7551, []int{2} -} -func (m *Metadata) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Metadata.Unmarshal(m, b) -} -func (m *Metadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Metadata.Marshal(b, m, deterministic) -} -func (dst *Metadata) XXX_Merge(src proto.Message) { - xxx_messageInfo_Metadata.Merge(dst, src) -} -func (m *Metadata) XXX_Size() int { - return xxx_messageInfo_Metadata.Size(m) -} -func (m *Metadata) XXX_DiscardUnknown() { - xxx_messageInfo_Metadata.DiscardUnknown(m) -} - -var xxx_messageInfo_Metadata proto.InternalMessageInfo - -func (m *Metadata) GetFilterMetadata() map[string]*_struct.Struct { - if m != nil { - return m.FilterMetadata - } - return nil -} - -type RuntimeUInt32 struct { - DefaultValue uint32 `protobuf:"varint,2,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` - RuntimeKey string `protobuf:"bytes,3,opt,name=runtime_key,json=runtimeKey,proto3" json:"runtime_key,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RuntimeUInt32) Reset() { *m = RuntimeUInt32{} } -func (m *RuntimeUInt32) String() string { return proto.CompactTextString(m) } -func (*RuntimeUInt32) ProtoMessage() {} -func (*RuntimeUInt32) Descriptor() ([]byte, []int) { - return fileDescriptor_base_12218511885b7551, []int{3} -} -func (m *RuntimeUInt32) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RuntimeUInt32.Unmarshal(m, b) -} -func (m *RuntimeUInt32) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RuntimeUInt32.Marshal(b, m, deterministic) -} -func (dst *RuntimeUInt32) XXX_Merge(src proto.Message) { - xxx_messageInfo_RuntimeUInt32.Merge(dst, src) -} -func (m *RuntimeUInt32) XXX_Size() int { - return xxx_messageInfo_RuntimeUInt32.Size(m) -} -func (m *RuntimeUInt32) XXX_DiscardUnknown() { - xxx_messageInfo_RuntimeUInt32.DiscardUnknown(m) -} - -var xxx_messageInfo_RuntimeUInt32 proto.InternalMessageInfo - -func (m *RuntimeUInt32) GetDefaultValue() uint32 { - if m != nil { - return m.DefaultValue - } - return 0 -} - -func (m *RuntimeUInt32) GetRuntimeKey() string { - if m != nil { - return m.RuntimeKey - } - return "" -} - -type HeaderValue struct { - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HeaderValue) Reset() { *m = HeaderValue{} } -func (m *HeaderValue) String() string { return proto.CompactTextString(m) } -func (*HeaderValue) ProtoMessage() {} -func (*HeaderValue) Descriptor() ([]byte, []int) { - return fileDescriptor_base_12218511885b7551, []int{4} -} -func (m *HeaderValue) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HeaderValue.Unmarshal(m, b) -} -func (m *HeaderValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HeaderValue.Marshal(b, m, deterministic) -} -func (dst *HeaderValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_HeaderValue.Merge(dst, src) -} -func (m *HeaderValue) XXX_Size() int { - return xxx_messageInfo_HeaderValue.Size(m) -} -func (m *HeaderValue) XXX_DiscardUnknown() { - xxx_messageInfo_HeaderValue.DiscardUnknown(m) -} - -var xxx_messageInfo_HeaderValue proto.InternalMessageInfo - -func (m *HeaderValue) GetKey() string { - if m != nil { - return m.Key - } - return "" -} - -func (m *HeaderValue) GetValue() string { - if m != nil { - return m.Value - } - return "" -} - -type HeaderValueOption struct { - Header *HeaderValue `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - Append *wrappers.BoolValue `protobuf:"bytes,2,opt,name=append,proto3" json:"append,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HeaderValueOption) Reset() { *m = HeaderValueOption{} } -func (m *HeaderValueOption) String() string { return proto.CompactTextString(m) } -func (*HeaderValueOption) ProtoMessage() {} -func (*HeaderValueOption) Descriptor() ([]byte, []int) { - return fileDescriptor_base_12218511885b7551, []int{5} -} -func (m *HeaderValueOption) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HeaderValueOption.Unmarshal(m, b) -} -func (m *HeaderValueOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HeaderValueOption.Marshal(b, m, deterministic) -} -func (dst *HeaderValueOption) XXX_Merge(src proto.Message) { - xxx_messageInfo_HeaderValueOption.Merge(dst, src) -} -func (m *HeaderValueOption) XXX_Size() int { - return xxx_messageInfo_HeaderValueOption.Size(m) -} -func (m *HeaderValueOption) XXX_DiscardUnknown() { - xxx_messageInfo_HeaderValueOption.DiscardUnknown(m) -} - -var xxx_messageInfo_HeaderValueOption proto.InternalMessageInfo - -func (m *HeaderValueOption) GetHeader() *HeaderValue { - if m != nil { - return m.Header - } - return nil -} - -func (m *HeaderValueOption) GetAppend() *wrappers.BoolValue { - if m != nil { - return m.Append - } - return nil -} - -type HeaderMap struct { - Headers []*HeaderValue `protobuf:"bytes,1,rep,name=headers,proto3" json:"headers,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HeaderMap) Reset() { *m = HeaderMap{} } -func (m *HeaderMap) String() string { return proto.CompactTextString(m) } -func (*HeaderMap) ProtoMessage() {} -func (*HeaderMap) Descriptor() ([]byte, []int) { - return fileDescriptor_base_12218511885b7551, []int{6} -} -func (m *HeaderMap) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HeaderMap.Unmarshal(m, b) -} -func (m *HeaderMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HeaderMap.Marshal(b, m, deterministic) -} -func (dst *HeaderMap) XXX_Merge(src proto.Message) { - xxx_messageInfo_HeaderMap.Merge(dst, src) -} -func (m *HeaderMap) XXX_Size() int { - return xxx_messageInfo_HeaderMap.Size(m) -} -func (m *HeaderMap) XXX_DiscardUnknown() { - xxx_messageInfo_HeaderMap.DiscardUnknown(m) -} - -var xxx_messageInfo_HeaderMap proto.InternalMessageInfo - -func (m *HeaderMap) GetHeaders() []*HeaderValue { - if m != nil { - return m.Headers - } - return nil -} - -type DataSource struct { - // Types that are valid to be assigned to Specifier: - // *DataSource_Filename - // *DataSource_InlineBytes - // *DataSource_InlineString - Specifier isDataSource_Specifier `protobuf_oneof:"specifier"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DataSource) Reset() { *m = DataSource{} } -func (m *DataSource) String() string { return proto.CompactTextString(m) } -func (*DataSource) ProtoMessage() {} -func (*DataSource) Descriptor() ([]byte, []int) { - return fileDescriptor_base_12218511885b7551, []int{7} -} -func (m *DataSource) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DataSource.Unmarshal(m, b) -} -func (m *DataSource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DataSource.Marshal(b, m, deterministic) -} -func (dst *DataSource) XXX_Merge(src proto.Message) { - xxx_messageInfo_DataSource.Merge(dst, src) -} -func (m *DataSource) XXX_Size() int { - return xxx_messageInfo_DataSource.Size(m) -} -func (m *DataSource) XXX_DiscardUnknown() { - xxx_messageInfo_DataSource.DiscardUnknown(m) -} - -var xxx_messageInfo_DataSource proto.InternalMessageInfo - -type isDataSource_Specifier interface { - isDataSource_Specifier() -} - -type DataSource_Filename struct { - Filename string `protobuf:"bytes,1,opt,name=filename,proto3,oneof"` -} - -type DataSource_InlineBytes struct { - InlineBytes []byte `protobuf:"bytes,2,opt,name=inline_bytes,json=inlineBytes,proto3,oneof"` -} - -type DataSource_InlineString struct { - InlineString string `protobuf:"bytes,3,opt,name=inline_string,json=inlineString,proto3,oneof"` -} - -func (*DataSource_Filename) isDataSource_Specifier() {} - -func (*DataSource_InlineBytes) isDataSource_Specifier() {} - -func (*DataSource_InlineString) isDataSource_Specifier() {} - -func (m *DataSource) GetSpecifier() isDataSource_Specifier { - if m != nil { - return m.Specifier - } - return nil -} - -func (m *DataSource) GetFilename() string { - if x, ok := m.GetSpecifier().(*DataSource_Filename); ok { - return x.Filename - } - return "" -} - -func (m *DataSource) GetInlineBytes() []byte { - if x, ok := m.GetSpecifier().(*DataSource_InlineBytes); ok { - return x.InlineBytes - } - return nil -} - -func (m *DataSource) GetInlineString() string { - if x, ok := m.GetSpecifier().(*DataSource_InlineString); ok { - return x.InlineString - } - return "" -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*DataSource) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _DataSource_OneofMarshaler, _DataSource_OneofUnmarshaler, _DataSource_OneofSizer, []interface{}{ - (*DataSource_Filename)(nil), - (*DataSource_InlineBytes)(nil), - (*DataSource_InlineString)(nil), - } -} - -func _DataSource_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*DataSource) - // specifier - switch x := m.Specifier.(type) { - case *DataSource_Filename: - b.EncodeVarint(1<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Filename) - case *DataSource_InlineBytes: - b.EncodeVarint(2<<3 | proto.WireBytes) - b.EncodeRawBytes(x.InlineBytes) - case *DataSource_InlineString: - b.EncodeVarint(3<<3 | proto.WireBytes) - b.EncodeStringBytes(x.InlineString) - case nil: - default: - return fmt.Errorf("DataSource.Specifier has unexpected type %T", x) - } - return nil -} - -func _DataSource_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*DataSource) - switch tag { - case 1: // specifier.filename - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Specifier = &DataSource_Filename{x} - return true, err - case 2: // specifier.inline_bytes - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeRawBytes(true) - m.Specifier = &DataSource_InlineBytes{x} - return true, err - case 3: // specifier.inline_string - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Specifier = &DataSource_InlineString{x} - return true, err - default: - return false, nil - } -} - -func _DataSource_OneofSizer(msg proto.Message) (n int) { - m := msg.(*DataSource) - // specifier - switch x := m.Specifier.(type) { - case *DataSource_Filename: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Filename))) - n += len(x.Filename) - case *DataSource_InlineBytes: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.InlineBytes))) - n += len(x.InlineBytes) - case *DataSource_InlineString: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.InlineString))) - n += len(x.InlineString) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type TransportSocket struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Types that are valid to be assigned to ConfigType: - // *TransportSocket_Config - // *TransportSocket_TypedConfig - ConfigType isTransportSocket_ConfigType `protobuf_oneof:"config_type"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TransportSocket) Reset() { *m = TransportSocket{} } -func (m *TransportSocket) String() string { return proto.CompactTextString(m) } -func (*TransportSocket) ProtoMessage() {} -func (*TransportSocket) Descriptor() ([]byte, []int) { - return fileDescriptor_base_12218511885b7551, []int{8} -} -func (m *TransportSocket) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TransportSocket.Unmarshal(m, b) -} -func (m *TransportSocket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TransportSocket.Marshal(b, m, deterministic) -} -func (dst *TransportSocket) XXX_Merge(src proto.Message) { - xxx_messageInfo_TransportSocket.Merge(dst, src) -} -func (m *TransportSocket) XXX_Size() int { - return xxx_messageInfo_TransportSocket.Size(m) -} -func (m *TransportSocket) XXX_DiscardUnknown() { - xxx_messageInfo_TransportSocket.DiscardUnknown(m) -} - -var xxx_messageInfo_TransportSocket proto.InternalMessageInfo - -func (m *TransportSocket) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -type isTransportSocket_ConfigType interface { - isTransportSocket_ConfigType() -} - -type TransportSocket_Config struct { - Config *_struct.Struct `protobuf:"bytes,2,opt,name=config,proto3,oneof"` -} - -type TransportSocket_TypedConfig struct { - TypedConfig *any.Any `protobuf:"bytes,3,opt,name=typed_config,json=typedConfig,proto3,oneof"` -} - -func (*TransportSocket_Config) isTransportSocket_ConfigType() {} - -func (*TransportSocket_TypedConfig) isTransportSocket_ConfigType() {} - -func (m *TransportSocket) GetConfigType() isTransportSocket_ConfigType { - if m != nil { - return m.ConfigType - } - return nil -} - -func (m *TransportSocket) GetConfig() *_struct.Struct { - if x, ok := m.GetConfigType().(*TransportSocket_Config); ok { - return x.Config - } - return nil -} - -func (m *TransportSocket) GetTypedConfig() *any.Any { - if x, ok := m.GetConfigType().(*TransportSocket_TypedConfig); ok { - return x.TypedConfig - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*TransportSocket) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _TransportSocket_OneofMarshaler, _TransportSocket_OneofUnmarshaler, _TransportSocket_OneofSizer, []interface{}{ - (*TransportSocket_Config)(nil), - (*TransportSocket_TypedConfig)(nil), - } -} - -func _TransportSocket_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*TransportSocket) - // config_type - switch x := m.ConfigType.(type) { - case *TransportSocket_Config: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Config); err != nil { - return err - } - case *TransportSocket_TypedConfig: - b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.TypedConfig); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("TransportSocket.ConfigType has unexpected type %T", x) - } - return nil -} - -func _TransportSocket_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*TransportSocket) - switch tag { - case 2: // config_type.config - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(_struct.Struct) - err := b.DecodeMessage(msg) - m.ConfigType = &TransportSocket_Config{msg} - return true, err - case 3: // config_type.typed_config - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(any.Any) - err := b.DecodeMessage(msg) - m.ConfigType = &TransportSocket_TypedConfig{msg} - return true, err - default: - return false, nil - } -} - -func _TransportSocket_OneofSizer(msg proto.Message) (n int) { - m := msg.(*TransportSocket) - // config_type - switch x := m.ConfigType.(type) { - case *TransportSocket_Config: - s := proto.Size(x.Config) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *TransportSocket_TypedConfig: - s := proto.Size(x.TypedConfig) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type SocketOption struct { - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - Level int64 `protobuf:"varint,2,opt,name=level,proto3" json:"level,omitempty"` - Name int64 `protobuf:"varint,3,opt,name=name,proto3" json:"name,omitempty"` - // Types that are valid to be assigned to Value: - // *SocketOption_IntValue - // *SocketOption_BufValue - Value isSocketOption_Value `protobuf_oneof:"value"` - State SocketOption_SocketState `protobuf:"varint,6,opt,name=state,proto3,enum=envoy.api.v2.core.SocketOption_SocketState" json:"state,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SocketOption) Reset() { *m = SocketOption{} } -func (m *SocketOption) String() string { return proto.CompactTextString(m) } -func (*SocketOption) ProtoMessage() {} -func (*SocketOption) Descriptor() ([]byte, []int) { - return fileDescriptor_base_12218511885b7551, []int{9} -} -func (m *SocketOption) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SocketOption.Unmarshal(m, b) -} -func (m *SocketOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SocketOption.Marshal(b, m, deterministic) -} -func (dst *SocketOption) XXX_Merge(src proto.Message) { - xxx_messageInfo_SocketOption.Merge(dst, src) -} -func (m *SocketOption) XXX_Size() int { - return xxx_messageInfo_SocketOption.Size(m) -} -func (m *SocketOption) XXX_DiscardUnknown() { - xxx_messageInfo_SocketOption.DiscardUnknown(m) -} - -var xxx_messageInfo_SocketOption proto.InternalMessageInfo - -func (m *SocketOption) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *SocketOption) GetLevel() int64 { - if m != nil { - return m.Level - } - return 0 -} - -func (m *SocketOption) GetName() int64 { - if m != nil { - return m.Name - } - return 0 -} - -type isSocketOption_Value interface { - isSocketOption_Value() -} - -type SocketOption_IntValue struct { - IntValue int64 `protobuf:"varint,4,opt,name=int_value,json=intValue,proto3,oneof"` -} - -type SocketOption_BufValue struct { - BufValue []byte `protobuf:"bytes,5,opt,name=buf_value,json=bufValue,proto3,oneof"` -} - -func (*SocketOption_IntValue) isSocketOption_Value() {} - -func (*SocketOption_BufValue) isSocketOption_Value() {} - -func (m *SocketOption) GetValue() isSocketOption_Value { - if m != nil { - return m.Value - } - return nil -} - -func (m *SocketOption) GetIntValue() int64 { - if x, ok := m.GetValue().(*SocketOption_IntValue); ok { - return x.IntValue - } - return 0 -} - -func (m *SocketOption) GetBufValue() []byte { - if x, ok := m.GetValue().(*SocketOption_BufValue); ok { - return x.BufValue - } - return nil -} - -func (m *SocketOption) GetState() SocketOption_SocketState { - if m != nil { - return m.State - } - return SocketOption_STATE_PREBIND -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*SocketOption) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _SocketOption_OneofMarshaler, _SocketOption_OneofUnmarshaler, _SocketOption_OneofSizer, []interface{}{ - (*SocketOption_IntValue)(nil), - (*SocketOption_BufValue)(nil), - } -} - -func _SocketOption_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*SocketOption) - // value - switch x := m.Value.(type) { - case *SocketOption_IntValue: - b.EncodeVarint(4<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.IntValue)) - case *SocketOption_BufValue: - b.EncodeVarint(5<<3 | proto.WireBytes) - b.EncodeRawBytes(x.BufValue) - case nil: - default: - return fmt.Errorf("SocketOption.Value has unexpected type %T", x) - } - return nil -} - -func _SocketOption_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*SocketOption) - switch tag { - case 4: // value.int_value - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Value = &SocketOption_IntValue{int64(x)} - return true, err - case 5: // value.buf_value - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeRawBytes(true) - m.Value = &SocketOption_BufValue{x} - return true, err - default: - return false, nil - } -} - -func _SocketOption_OneofSizer(msg proto.Message) (n int) { - m := msg.(*SocketOption) - // value - switch x := m.Value.(type) { - case *SocketOption_IntValue: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.IntValue)) - case *SocketOption_BufValue: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.BufValue))) - n += len(x.BufValue) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type RuntimeFractionalPercent struct { - DefaultValue *percent.FractionalPercent `protobuf:"bytes,1,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` - RuntimeKey string `protobuf:"bytes,2,opt,name=runtime_key,json=runtimeKey,proto3" json:"runtime_key,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RuntimeFractionalPercent) Reset() { *m = RuntimeFractionalPercent{} } -func (m *RuntimeFractionalPercent) String() string { return proto.CompactTextString(m) } -func (*RuntimeFractionalPercent) ProtoMessage() {} -func (*RuntimeFractionalPercent) Descriptor() ([]byte, []int) { - return fileDescriptor_base_12218511885b7551, []int{10} -} -func (m *RuntimeFractionalPercent) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RuntimeFractionalPercent.Unmarshal(m, b) -} -func (m *RuntimeFractionalPercent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RuntimeFractionalPercent.Marshal(b, m, deterministic) -} -func (dst *RuntimeFractionalPercent) XXX_Merge(src proto.Message) { - xxx_messageInfo_RuntimeFractionalPercent.Merge(dst, src) -} -func (m *RuntimeFractionalPercent) XXX_Size() int { - return xxx_messageInfo_RuntimeFractionalPercent.Size(m) -} -func (m *RuntimeFractionalPercent) XXX_DiscardUnknown() { - xxx_messageInfo_RuntimeFractionalPercent.DiscardUnknown(m) -} - -var xxx_messageInfo_RuntimeFractionalPercent proto.InternalMessageInfo - -func (m *RuntimeFractionalPercent) GetDefaultValue() *percent.FractionalPercent { - if m != nil { - return m.DefaultValue - } - return nil -} - -func (m *RuntimeFractionalPercent) GetRuntimeKey() string { - if m != nil { - return m.RuntimeKey - } - return "" -} - -type ControlPlane struct { - Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ControlPlane) Reset() { *m = ControlPlane{} } -func (m *ControlPlane) String() string { return proto.CompactTextString(m) } -func (*ControlPlane) ProtoMessage() {} -func (*ControlPlane) Descriptor() ([]byte, []int) { - return fileDescriptor_base_12218511885b7551, []int{11} -} -func (m *ControlPlane) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ControlPlane.Unmarshal(m, b) -} -func (m *ControlPlane) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ControlPlane.Marshal(b, m, deterministic) -} -func (dst *ControlPlane) XXX_Merge(src proto.Message) { - xxx_messageInfo_ControlPlane.Merge(dst, src) -} -func (m *ControlPlane) XXX_Size() int { - return xxx_messageInfo_ControlPlane.Size(m) -} -func (m *ControlPlane) XXX_DiscardUnknown() { - xxx_messageInfo_ControlPlane.DiscardUnknown(m) -} - -var xxx_messageInfo_ControlPlane proto.InternalMessageInfo - -func (m *ControlPlane) GetIdentifier() string { - if m != nil { - return m.Identifier - } - return "" -} - -func init() { - proto.RegisterType((*Locality)(nil), "envoy.api.v2.core.Locality") - proto.RegisterType((*Node)(nil), "envoy.api.v2.core.Node") - proto.RegisterType((*Metadata)(nil), "envoy.api.v2.core.Metadata") - proto.RegisterMapType((map[string]*_struct.Struct)(nil), "envoy.api.v2.core.Metadata.FilterMetadataEntry") - proto.RegisterType((*RuntimeUInt32)(nil), "envoy.api.v2.core.RuntimeUInt32") - proto.RegisterType((*HeaderValue)(nil), "envoy.api.v2.core.HeaderValue") - proto.RegisterType((*HeaderValueOption)(nil), "envoy.api.v2.core.HeaderValueOption") - proto.RegisterType((*HeaderMap)(nil), "envoy.api.v2.core.HeaderMap") - proto.RegisterType((*DataSource)(nil), "envoy.api.v2.core.DataSource") - proto.RegisterType((*TransportSocket)(nil), "envoy.api.v2.core.TransportSocket") - proto.RegisterType((*SocketOption)(nil), "envoy.api.v2.core.SocketOption") - proto.RegisterType((*RuntimeFractionalPercent)(nil), "envoy.api.v2.core.RuntimeFractionalPercent") - proto.RegisterType((*ControlPlane)(nil), "envoy.api.v2.core.ControlPlane") - proto.RegisterEnum("envoy.api.v2.core.RoutingPriority", RoutingPriority_name, RoutingPriority_value) - proto.RegisterEnum("envoy.api.v2.core.RequestMethod", RequestMethod_name, RequestMethod_value) - proto.RegisterEnum("envoy.api.v2.core.SocketOption_SocketState", SocketOption_SocketState_name, SocketOption_SocketState_value) -} - -func init() { proto.RegisterFile("envoy/api/v2/core/base.proto", fileDescriptor_base_12218511885b7551) } - -var fileDescriptor_base_12218511885b7551 = []byte{ - // 1125 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xcd, 0x72, 0x1b, 0x45, - 0x10, 0xf6, 0xea, 0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0x1b, 0xd6, 0x81, 0x75, 0x58, - 0xf1, 0xcd, 0x0d, 0x21, 0x28, 0xbc, 0x64, 0x31, 0x69, 0xe4, 0x14, 0xaa, 0xce, 0xe8, 0x36, 0x94, - 0xd3, 0x6c, 0x3a, 0x51, 0x78, 0x5e, 0xe1, 0xdb, 0x69, 0x36, 0x7d, 0xca, 0x62, 0xd2, 0xfc, 0xc7, - 0x82, 0xc2, 0x80, 0x85, 0x04, 0xed, 0x40, 0x8e, 0x86, 0xc6, 0x57, 0x8e, 0x86, 0xa8, 0x01, 0xdb, - 0xb3, 0x28, 0x4b, 0x05, 0xe1, 0xc6, 0xd5, 0xea, 0x8a, 0x1e, 0x40, 0xf9, 0x05, 0x11, 0x38, 0xc4, - 0x02, 0x2b, 0x6f, 0xd5, 0xf6, 0x2d, 0x47, 0xe7, 0xea, 0xac, 0x72, 0x75, 0xc6, 0xaa, 0x12, 0xfe, - 0x05, 0x11, 0x7d, 0x0d, 0xe5, 0xc8, 0x84, 0xde, 0x28, 0x28, 0xd1, 0x47, 0xce, 0x46, 0xb1, 0x9d, - 0x55, 0x76, 0xfe, 0x05, 0x19, 0x7d, 0x02, 0xf5, 0x69, 0x46, 0xa3, 0x70, 0xb2, 0x20, 0x3c, 0x95, - 0xe9, 0x16, 0x55, 0x34, 0x35, 0x05, 0x3e, 0xd1, 0x58, 0xf3, 0x8d, 0x05, 0xe5, 0xd3, 0xd5, 0xa7, - 0x7e, 0x80, 0xdd, 0x39, 0x8d, 0x04, 0xe1, 0x93, 0x8b, 0x30, 0xad, 0x83, 0xfc, 0x61, 0xb5, 0xdd, - 0xba, 0xe2, 0x8b, 0x2b, 0x95, 0x73, 0xac, 0x24, 0xab, 0xab, 0x17, 0x0b, 0xbe, 0xf4, 0x77, 0xe6, - 0x97, 0xc0, 0xbd, 0xa7, 0x70, 0xfd, 0x0a, 0x1a, 0xb2, 0x21, 0xff, 0x9c, 0x2c, 0x4d, 0xed, 0xe4, - 0x11, 0x7d, 0x0e,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, 0xde, 0xfc, 0xc3, 0x02, 0xe8, 0x62, 0x81, - 0xc7, 0x2c, 0xe3, 0x33, 0x82, 0x3e, 0x85, 0xf2, 0x9c, 0x46, 0x24, 0xc6, 0x2f, 0x88, 0x29, 0xd6, - 0xbb, 0xfa, 0xf6, 0xb6, 0xfc, 0x0b, 0x23, 0x72, 0xa0, 0x46, 0xe3, 0x88, 0xc6, 0x64, 0x32, 0x5d, - 0x0a, 0x92, 0xaa, 0xc0, 0x6b, 0x86, 0xfc, 0x32, 0x67, 0x4b, 0x72, 0x55, 0x13, 0x5c, 0x69, 0x47, - 0x5f, 0x40, 0xdd, 0xf0, 0x53, 0xc1, 0x69, 0x7c, 0xbe, 0xf1, 0x7a, 0xbd, 0x2d, 0xdf, 0x78, 0x1c, - 0x2b, 0x82, 0x8b, 0xa0, 0x92, 0x26, 0x64, 0x46, 0xe7, 0x94, 0x70, 0x54, 0xfc, 0xeb, 0xed, 0x9b, - 0xbc, 0xd5, 0xfc, 0xd3, 0x82, 0xdd, 0x80, 0xe3, 0x38, 0x4d, 0x18, 0x17, 0x63, 0x36, 0x7b, 0x4e, - 0x04, 0xda, 0x87, 0xc2, 0x95, 0xe1, 0xfa, 0x0a, 0x46, 0x5f, 0x42, 0x69, 0xc6, 0xe2, 0x39, 0x3d, - 0xff, 0x40, 0x7b, 0xf6, 0xb6, 0x7c, 0x43, 0x44, 0xdf, 0x40, 0x4d, 0xee, 0xa3, 0x70, 0x62, 0x84, - 0x7a, 0xee, 0x6f, 0x6c, 0x08, 0x8f, 0xe2, 0xa5, 0x4c, 0x53, 0x71, 0x3b, 0x8a, 0xea, 0xd6, 0xa1, - 0xaa, 0x45, 0x13, 0x89, 0x36, 0xff, 0xcd, 0x41, 0x4d, 0x87, 0x69, 0xba, 0xe5, 0x00, 0xaa, 0x21, - 0x49, 0x67, 0x9c, 0xaa, 0xab, 0x99, 0xa2, 0x75, 0x08, 0xdd, 0x80, 0x62, 0x44, 0x16, 0x24, 0x52, - 0xe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0x01, 0x68, 0x48, 0x62, 0xa1, 0xda, 0xd5, 0xbc, 0xeb, 0x1a, - 0x72, 0xff, 0x10, 0x76, 0x7d, 0x96, 0x09, 0x1a, 0x9f, 0x8f, 0x38, 0x65, 0x5c, 0x2e, 0xfb, 0x2a, - 0x6c, 0x77, 0xbd, 0xe3, 0xa3, 0xb3, 0x93, 0xc0, 0xde, 0x42, 0x65, 0x28, 0xf4, 0xfa, 0x8f, 0x7a, - 0xb6, 0x75, 0xff, 0x37, 0x0b, 0xea, 0x3e, 0xf9, 0x29, 0x23, 0xa9, 0x38, 0x25, 0xe2, 0x19, 0x0b, - 0xd1, 0x4d, 0x40, 0xa7, 0x5e, 0xd0, 0x1b, 0x76, 0x27, 0x67, 0x83, 0xf1, 0xc8, 0xeb, 0xf4, 0x8f, - 0xfb, 0x9e, 0xac, 0xe3, 0x36, 0xe4, 0x1f, 0x79, 0x81, 0x6d, 0x29, 0xb1, 0x77, 0xd4, 0xb5, 0x73, - 0xf2, 0x34, 0x1a, 0x8e, 0x03, 0x3b, 0x2f, 0x8d, 0xa3, 0xb3, 0xc0, 0x2e, 0x20, 0x80, 0x52, 0xd7, - 0x3b, 0xf1, 0x02, 0xcf, 0x2e, 0xca, 0x4f, 0x76, 0x86, 0x83, 0x81, 0xd7, 0x09, 0xec, 0x92, 0xbc, - 0x0c, 0x47, 0x41, 0x7f, 0x38, 0x18, 0xdb, 0xdb, 0xa8, 0x02, 0xc5, 0xc0, 0x3f, 0xea, 0x78, 0x76, - 0x59, 0x1e, 0x47, 0x47, 0x41, 0xa7, 0x67, 0x57, 0xdc, 0xaf, 0xe0, 0x1e, 0x65, 0xba, 0x86, 0x09, - 0x67, 0xbf, 0x2c, 0x37, 0x9b, 0xc4, 0xad, 0xb8, 0x38, 0x25, 0x23, 0x39, 0x12, 0x23, 0xeb, 0x69, - 0x41, 0x42, 0xd3, 0x92, 0x9a, 0x90, 0x07, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xb5, 0x03, 0x41, - 0x71, 0x7f, 0x08, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/config_source/config_source.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/config_source/config_source.pb.go deleted file mode 100755 index 9853ff3d9e4..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/config_source/config_source.pb.go +++ /dev/null @@ -1,446 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: envoy/api/v2/core/config_source.proto - -package envoy_api_v2_core - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import duration "github.com/golang/protobuf/ptypes/duration" -import wrappers "github.com/golang/protobuf/ptypes/wrappers" -import grpc_service "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/grpc_service" -import _ "google.golang.org/grpc/xds/internal/proto/validate" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type ApiConfigSource_ApiType int32 - -const ( - ApiConfigSource_UNSUPPORTED_REST_LEGACY ApiConfigSource_ApiType = 0 // Deprecated: Do not use. - ApiConfigSource_REST ApiConfigSource_ApiType = 1 - ApiConfigSource_GRPC ApiConfigSource_ApiType = 2 - ApiConfigSource_DELTA_GRPC ApiConfigSource_ApiType = 3 -) - -var ApiConfigSource_ApiType_name = map[int32]string{ - 0: "UNSUPPORTED_REST_LEGACY", - 1: "REST", - 2: "GRPC", - 3: "DELTA_GRPC", -} -var ApiConfigSource_ApiType_value = map[string]int32{ - "UNSUPPORTED_REST_LEGACY": 0, - "REST": 1, - "GRPC": 2, - "DELTA_GRPC": 3, -} - -func (x ApiConfigSource_ApiType) String() string { - return proto.EnumName(ApiConfigSource_ApiType_name, int32(x)) -} -func (ApiConfigSource_ApiType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_config_source_d368846786cd1f7d, []int{0, 0} -} - -type ApiConfigSource struct { - ApiType ApiConfigSource_ApiType `protobuf:"varint,1,opt,name=api_type,json=apiType,proto3,enum=envoy.api.v2.core.ApiConfigSource_ApiType" json:"api_type,omitempty"` - ClusterNames []string `protobuf:"bytes,2,rep,name=cluster_names,json=clusterNames,proto3" json:"cluster_names,omitempty"` - GrpcServices []*grpc_service.GrpcService `protobuf:"bytes,4,rep,name=grpc_services,json=grpcServices,proto3" json:"grpc_services,omitempty"` - RefreshDelay *duration.Duration `protobuf:"bytes,3,opt,name=refresh_delay,json=refreshDelay,proto3" json:"refresh_delay,omitempty"` - RequestTimeout *duration.Duration `protobuf:"bytes,5,opt,name=request_timeout,json=requestTimeout,proto3" json:"request_timeout,omitempty"` - RateLimitSettings *RateLimitSettings `protobuf:"bytes,6,opt,name=rate_limit_settings,json=rateLimitSettings,proto3" json:"rate_limit_settings,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ApiConfigSource) Reset() { *m = ApiConfigSource{} } -func (m *ApiConfigSource) String() string { return proto.CompactTextString(m) } -func (*ApiConfigSource) ProtoMessage() {} -func (*ApiConfigSource) Descriptor() ([]byte, []int) { - return fileDescriptor_config_source_d368846786cd1f7d, []int{0} -} -func (m *ApiConfigSource) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ApiConfigSource.Unmarshal(m, b) -} -func (m *ApiConfigSource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ApiConfigSource.Marshal(b, m, deterministic) -} -func (dst *ApiConfigSource) XXX_Merge(src proto.Message) { - xxx_messageInfo_ApiConfigSource.Merge(dst, src) -} -func (m *ApiConfigSource) XXX_Size() int { - return xxx_messageInfo_ApiConfigSource.Size(m) -} -func (m *ApiConfigSource) XXX_DiscardUnknown() { - xxx_messageInfo_ApiConfigSource.DiscardUnknown(m) -} - -var xxx_messageInfo_ApiConfigSource proto.InternalMessageInfo - -func (m *ApiConfigSource) GetApiType() ApiConfigSource_ApiType { - if m != nil { - return m.ApiType - } - return ApiConfigSource_UNSUPPORTED_REST_LEGACY -} - -func (m *ApiConfigSource) GetClusterNames() []string { - if m != nil { - return m.ClusterNames - } - return nil -} - -func (m *ApiConfigSource) GetGrpcServices() []*grpc_service.GrpcService { - if m != nil { - return m.GrpcServices - } - return nil -} - -func (m *ApiConfigSource) GetRefreshDelay() *duration.Duration { - if m != nil { - return m.RefreshDelay - } - return nil -} - -func (m *ApiConfigSource) GetRequestTimeout() *duration.Duration { - if m != nil { - return m.RequestTimeout - } - return nil -} - -func (m *ApiConfigSource) GetRateLimitSettings() *RateLimitSettings { - if m != nil { - return m.RateLimitSettings - } - return nil -} - -type AggregatedConfigSource struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AggregatedConfigSource) Reset() { *m = AggregatedConfigSource{} } -func (m *AggregatedConfigSource) String() string { return proto.CompactTextString(m) } -func (*AggregatedConfigSource) ProtoMessage() {} -func (*AggregatedConfigSource) Descriptor() ([]byte, []int) { - return fileDescriptor_config_source_d368846786cd1f7d, []int{1} -} -func (m *AggregatedConfigSource) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AggregatedConfigSource.Unmarshal(m, b) -} -func (m *AggregatedConfigSource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AggregatedConfigSource.Marshal(b, m, deterministic) -} -func (dst *AggregatedConfigSource) XXX_Merge(src proto.Message) { - xxx_messageInfo_AggregatedConfigSource.Merge(dst, src) -} -func (m *AggregatedConfigSource) XXX_Size() int { - return xxx_messageInfo_AggregatedConfigSource.Size(m) -} -func (m *AggregatedConfigSource) XXX_DiscardUnknown() { - xxx_messageInfo_AggregatedConfigSource.DiscardUnknown(m) -} - -var xxx_messageInfo_AggregatedConfigSource proto.InternalMessageInfo - -type RateLimitSettings struct { - MaxTokens *wrappers.UInt32Value `protobuf:"bytes,1,opt,name=max_tokens,json=maxTokens,proto3" json:"max_tokens,omitempty"` - FillRate *wrappers.DoubleValue `protobuf:"bytes,2,opt,name=fill_rate,json=fillRate,proto3" json:"fill_rate,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RateLimitSettings) Reset() { *m = RateLimitSettings{} } -func (m *RateLimitSettings) String() string { return proto.CompactTextString(m) } -func (*RateLimitSettings) ProtoMessage() {} -func (*RateLimitSettings) Descriptor() ([]byte, []int) { - return fileDescriptor_config_source_d368846786cd1f7d, []int{2} -} -func (m *RateLimitSettings) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RateLimitSettings.Unmarshal(m, b) -} -func (m *RateLimitSettings) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RateLimitSettings.Marshal(b, m, deterministic) -} -func (dst *RateLimitSettings) XXX_Merge(src proto.Message) { - xxx_messageInfo_RateLimitSettings.Merge(dst, src) -} -func (m *RateLimitSettings) XXX_Size() int { - return xxx_messageInfo_RateLimitSettings.Size(m) -} -func (m *RateLimitSettings) XXX_DiscardUnknown() { - xxx_messageInfo_RateLimitSettings.DiscardUnknown(m) -} - -var xxx_messageInfo_RateLimitSettings proto.InternalMessageInfo - -func (m *RateLimitSettings) GetMaxTokens() *wrappers.UInt32Value { - if m != nil { - return m.MaxTokens - } - return nil -} - -func (m *RateLimitSettings) GetFillRate() *wrappers.DoubleValue { - if m != nil { - return m.FillRate - } - return nil -} - -type ConfigSource struct { - // Types that are valid to be assigned to ConfigSourceSpecifier: - // *ConfigSource_Path - // *ConfigSource_ApiConfigSource - // *ConfigSource_Ads - ConfigSourceSpecifier isConfigSource_ConfigSourceSpecifier `protobuf_oneof:"config_source_specifier"` - InitialFetchTimeout *duration.Duration `protobuf:"bytes,4,opt,name=initial_fetch_timeout,json=initialFetchTimeout,proto3" json:"initial_fetch_timeout,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ConfigSource) Reset() { *m = ConfigSource{} } -func (m *ConfigSource) String() string { return proto.CompactTextString(m) } -func (*ConfigSource) ProtoMessage() {} -func (*ConfigSource) Descriptor() ([]byte, []int) { - return fileDescriptor_config_source_d368846786cd1f7d, []int{3} -} -func (m *ConfigSource) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ConfigSource.Unmarshal(m, b) -} -func (m *ConfigSource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ConfigSource.Marshal(b, m, deterministic) -} -func (dst *ConfigSource) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConfigSource.Merge(dst, src) -} -func (m *ConfigSource) XXX_Size() int { - return xxx_messageInfo_ConfigSource.Size(m) -} -func (m *ConfigSource) XXX_DiscardUnknown() { - xxx_messageInfo_ConfigSource.DiscardUnknown(m) -} - -var xxx_messageInfo_ConfigSource proto.InternalMessageInfo - -type isConfigSource_ConfigSourceSpecifier interface { - isConfigSource_ConfigSourceSpecifier() -} - -type ConfigSource_Path struct { - Path string `protobuf:"bytes,1,opt,name=path,proto3,oneof"` -} - -type ConfigSource_ApiConfigSource struct { - ApiConfigSource *ApiConfigSource `protobuf:"bytes,2,opt,name=api_config_source,json=apiConfigSource,proto3,oneof"` -} - -type ConfigSource_Ads struct { - Ads *AggregatedConfigSource `protobuf:"bytes,3,opt,name=ads,proto3,oneof"` -} - -func (*ConfigSource_Path) isConfigSource_ConfigSourceSpecifier() {} - -func (*ConfigSource_ApiConfigSource) isConfigSource_ConfigSourceSpecifier() {} - -func (*ConfigSource_Ads) isConfigSource_ConfigSourceSpecifier() {} - -func (m *ConfigSource) GetConfigSourceSpecifier() isConfigSource_ConfigSourceSpecifier { - if m != nil { - return m.ConfigSourceSpecifier - } - return nil -} - -func (m *ConfigSource) GetPath() string { - if x, ok := m.GetConfigSourceSpecifier().(*ConfigSource_Path); ok { - return x.Path - } - return "" -} - -func (m *ConfigSource) GetApiConfigSource() *ApiConfigSource { - if x, ok := m.GetConfigSourceSpecifier().(*ConfigSource_ApiConfigSource); ok { - return x.ApiConfigSource - } - return nil -} - -func (m *ConfigSource) GetAds() *AggregatedConfigSource { - if x, ok := m.GetConfigSourceSpecifier().(*ConfigSource_Ads); ok { - return x.Ads - } - return nil -} - -func (m *ConfigSource) GetInitialFetchTimeout() *duration.Duration { - if m != nil { - return m.InitialFetchTimeout - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*ConfigSource) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _ConfigSource_OneofMarshaler, _ConfigSource_OneofUnmarshaler, _ConfigSource_OneofSizer, []interface{}{ - (*ConfigSource_Path)(nil), - (*ConfigSource_ApiConfigSource)(nil), - (*ConfigSource_Ads)(nil), - } -} - -func _ConfigSource_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*ConfigSource) - // config_source_specifier - switch x := m.ConfigSourceSpecifier.(type) { - case *ConfigSource_Path: - b.EncodeVarint(1<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Path) - case *ConfigSource_ApiConfigSource: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ApiConfigSource); err != nil { - return err - } - case *ConfigSource_Ads: - b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Ads); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("ConfigSource.ConfigSourceSpecifier has unexpected type %T", x) - } - return nil -} - -func _ConfigSource_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*ConfigSource) - switch tag { - case 1: // config_source_specifier.path - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.ConfigSourceSpecifier = &ConfigSource_Path{x} - return true, err - case 2: // config_source_specifier.api_config_source - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ApiConfigSource) - err := b.DecodeMessage(msg) - m.ConfigSourceSpecifier = &ConfigSource_ApiConfigSource{msg} - return true, err - case 3: // config_source_specifier.ads - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(AggregatedConfigSource) - err := b.DecodeMessage(msg) - m.ConfigSourceSpecifier = &ConfigSource_Ads{msg} - return true, err - default: - return false, nil - } -} - -func _ConfigSource_OneofSizer(msg proto.Message) (n int) { - m := msg.(*ConfigSource) - // config_source_specifier - switch x := m.ConfigSourceSpecifier.(type) { - case *ConfigSource_Path: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Path))) - n += len(x.Path) - case *ConfigSource_ApiConfigSource: - s := proto.Size(x.ApiConfigSource) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *ConfigSource_Ads: - s := proto.Size(x.Ads) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -func init() { - proto.RegisterType((*ApiConfigSource)(nil), "envoy.api.v2.core.ApiConfigSource") - proto.RegisterType((*AggregatedConfigSource)(nil), "envoy.api.v2.core.AggregatedConfigSource") - proto.RegisterType((*RateLimitSettings)(nil), "envoy.api.v2.core.RateLimitSettings") - proto.RegisterType((*ConfigSource)(nil), "envoy.api.v2.core.ConfigSource") - proto.RegisterEnum("envoy.api.v2.core.ApiConfigSource_ApiType", ApiConfigSource_ApiType_name, ApiConfigSource_ApiType_value) -} - -func init() { - proto.RegisterFile("envoy/api/v2/core/config_source.proto", fileDescriptor_config_source_d368846786cd1f7d) -} - -var fileDescriptor_config_source_d368846786cd1f7d = []byte{ - // 667 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0xcd, 0x6e, 0x13, 0x3d, - 0x14, 0xcd, 0x24, 0x69, 0x9b, 0x38, 0x69, 0x9b, 0xb8, 0xdf, 0xf7, 0x75, 0xbe, 0x0a, 0xb5, 0x21, - 0x14, 0x29, 0x74, 0x31, 0x91, 0x52, 0x89, 0x0d, 0x02, 0x29, 0x7f, 0xb4, 0x88, 0x52, 0x82, 0x93, - 0x22, 0xb1, 0xb2, 0xdc, 0xc9, 0xcd, 0xd4, 0x62, 0x32, 0x63, 0x6c, 0x4f, 0x68, 0xb6, 0x2c, 0x78, - 0x0b, 0xb6, 0x2c, 0x78, 0x02, 0xc4, 0xaa, 0xaf, 0xd3, 0xb7, 0x40, 0x9e, 0x4c, 0xa1, 0x6d, 0x52, - 0x35, 0xab, 0xb9, 0xd7, 0xe7, 0x5c, 0x9f, 0x7b, 0x72, 0x8c, 0x1e, 0x43, 0x30, 0x09, 0xa7, 0x75, - 0x26, 0x78, 0x7d, 0xd2, 0xa8, 0xbb, 0xa1, 0x84, 0xba, 0x1b, 0x06, 0x23, 0xee, 0x51, 0x15, 0x46, - 0xd2, 0x05, 0x47, 0xc8, 0x50, 0x87, 0xb8, 0x1c, 0xc3, 0x1c, 0x26, 0xb8, 0x33, 0x69, 0x38, 0x06, - 0xb6, 0xb5, 0x3b, 0xcf, 0xf4, 0xa4, 0x70, 0xa9, 0x02, 0x39, 0xe1, 0x57, 0xc4, 0xad, 0x6d, 0x2f, - 0x0c, 0x3d, 0x1f, 0xea, 0x71, 0x75, 0x1a, 0x8d, 0xea, 0xc3, 0x48, 0x32, 0xcd, 0xc3, 0xe0, 0xae, - 0xf3, 0xcf, 0x92, 0x09, 0x01, 0x52, 0x25, 0xe7, 0x9b, 0x13, 0xe6, 0xf3, 0x21, 0xd3, 0x50, 0xbf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 0x8b, 0x45, 0xe5, 0x0f, 0x53, 0x24, - 0xae, 0x70, 0x0f, 0x95, 0x4d, 0xaa, 0x6f, 0x3c, 0xcb, 0xe4, 0xee, 0xea, 0xfd, 0xf1, 0x3e, 0x4c, - 0x91, 0x75, 0x76, 0xeb, 0x9d, 0x3c, 0x47, 0x19, 0x36, 0x54, 0x49, 0xc0, 0x9e, 0x2c, 0x9a, 0xb1, - 0xd0, 0xd0, 0xc3, 0x14, 0x31, 0x3c, 0xfc, 0x06, 0xfd, 0xcb, 0x03, 0xae, 0x39, 0xf3, 0xe9, 0x08, - 0xb4, 0x7b, 0xf6, 0x27, 0x6f, 0xd9, 0xfb, 0x12, 0xbb, 0x91, 0xf0, 0x5e, 0x1a, 0x5a, 0x12, 0xb3, - 0x56, 0x05, 0x6d, 0xde, 0xd8, 0x8d, 0x2a, 0x01, 0x2e, 0x1f, 0x71, 0x90, 0x78, 0xe9, 0xe7, 0xe5, - 0x45, 0xc6, 0x6a, 0x3d, 0x45, 0x3b, 0x3c, 0x9c, 0xc9, 0x14, 0x32, 0x3c, 0x9f, 0xce, 0x2b, 0x6e, - 0x95, 0xaf, 0x0b, 0xed, 0x99, 0x8b, 0x7b, 0xd6, 0xe9, 0x72, 0xac, 0x60, 0xff, 0x77, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x4c, 0x68, 0x6a, 0x4f, 0xe5, 0x04, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/grpc_service/grpc_service.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/grpc_service/grpc_service.pb.go deleted file mode 100755 index 0f1d143e6a6..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/grpc_service/grpc_service.pb.go +++ /dev/null @@ -1,1196 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: envoy/api/v2/core/grpc_service.proto - -package envoy_api_v2_core - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import any "github.com/golang/protobuf/ptypes/any" -import duration "github.com/golang/protobuf/ptypes/duration" -import empty "github.com/golang/protobuf/ptypes/empty" -import _struct "github.com/golang/protobuf/ptypes/struct" -import base "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/base" -import _ "google.golang.org/grpc/xds/internal/proto/validate" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type GrpcService struct { - // Types that are valid to be assigned to TargetSpecifier: - // *GrpcService_EnvoyGrpc_ - // *GrpcService_GoogleGrpc_ - TargetSpecifier isGrpcService_TargetSpecifier `protobuf_oneof:"target_specifier"` - Timeout *duration.Duration `protobuf:"bytes,3,opt,name=timeout,proto3" json:"timeout,omitempty"` - InitialMetadata []*base.HeaderValue `protobuf:"bytes,5,rep,name=initial_metadata,json=initialMetadata,proto3" json:"initial_metadata,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GrpcService) Reset() { *m = GrpcService{} } -func (m *GrpcService) String() string { return proto.CompactTextString(m) } -func (*GrpcService) ProtoMessage() {} -func (*GrpcService) Descriptor() ([]byte, []int) { - return fileDescriptor_grpc_service_b85549433708d753, []int{0} -} -func (m *GrpcService) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GrpcService.Unmarshal(m, b) -} -func (m *GrpcService) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GrpcService.Marshal(b, m, deterministic) -} -func (dst *GrpcService) XXX_Merge(src proto.Message) { - xxx_messageInfo_GrpcService.Merge(dst, src) -} -func (m *GrpcService) XXX_Size() int { - return xxx_messageInfo_GrpcService.Size(m) -} -func (m *GrpcService) XXX_DiscardUnknown() { - xxx_messageInfo_GrpcService.DiscardUnknown(m) -} - -var xxx_messageInfo_GrpcService proto.InternalMessageInfo - -type isGrpcService_TargetSpecifier interface { - isGrpcService_TargetSpecifier() -} - -type GrpcService_EnvoyGrpc_ struct { - EnvoyGrpc *GrpcService_EnvoyGrpc `protobuf:"bytes,1,opt,name=envoy_grpc,json=envoyGrpc,proto3,oneof"` -} - -type GrpcService_GoogleGrpc_ struct { - GoogleGrpc *GrpcService_GoogleGrpc `protobuf:"bytes,2,opt,name=google_grpc,json=googleGrpc,proto3,oneof"` -} - -func (*GrpcService_EnvoyGrpc_) isGrpcService_TargetSpecifier() {} - -func (*GrpcService_GoogleGrpc_) isGrpcService_TargetSpecifier() {} - -func (m *GrpcService) GetTargetSpecifier() isGrpcService_TargetSpecifier { - if m != nil { - return m.TargetSpecifier - } - return nil -} - -func (m *GrpcService) GetEnvoyGrpc() *GrpcService_EnvoyGrpc { - if x, ok := m.GetTargetSpecifier().(*GrpcService_EnvoyGrpc_); ok { - return x.EnvoyGrpc - } - return nil -} - -func (m *GrpcService) GetGoogleGrpc() *GrpcService_GoogleGrpc { - if x, ok := m.GetTargetSpecifier().(*GrpcService_GoogleGrpc_); ok { - return x.GoogleGrpc - } - return nil -} - -func (m *GrpcService) GetTimeout() *duration.Duration { - if m != nil { - return m.Timeout - } - return nil -} - -func (m *GrpcService) GetInitialMetadata() []*base.HeaderValue { - if m != nil { - return m.InitialMetadata - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*GrpcService) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _GrpcService_OneofMarshaler, _GrpcService_OneofUnmarshaler, _GrpcService_OneofSizer, []interface{}{ - (*GrpcService_EnvoyGrpc_)(nil), - (*GrpcService_GoogleGrpc_)(nil), - } -} - -func _GrpcService_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*GrpcService) - // target_specifier - switch x := m.TargetSpecifier.(type) { - case *GrpcService_EnvoyGrpc_: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.EnvoyGrpc); err != nil { - return err - } - case *GrpcService_GoogleGrpc_: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.GoogleGrpc); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("GrpcService.TargetSpecifier has unexpected type %T", x) - } - return nil -} - -func _GrpcService_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*GrpcService) - switch tag { - case 1: // target_specifier.envoy_grpc - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(GrpcService_EnvoyGrpc) - err := b.DecodeMessage(msg) - m.TargetSpecifier = &GrpcService_EnvoyGrpc_{msg} - return true, err - case 2: // target_specifier.google_grpc - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(GrpcService_GoogleGrpc) - err := b.DecodeMessage(msg) - m.TargetSpecifier = &GrpcService_GoogleGrpc_{msg} - return true, err - default: - return false, nil - } -} - -func _GrpcService_OneofSizer(msg proto.Message) (n int) { - m := msg.(*GrpcService) - // target_specifier - switch x := m.TargetSpecifier.(type) { - case *GrpcService_EnvoyGrpc_: - s := proto.Size(x.EnvoyGrpc) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *GrpcService_GoogleGrpc_: - s := proto.Size(x.GoogleGrpc) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type GrpcService_EnvoyGrpc struct { - ClusterName string `protobuf:"bytes,1,opt,name=cluster_name,json=clusterName,proto3" json:"cluster_name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GrpcService_EnvoyGrpc) Reset() { *m = GrpcService_EnvoyGrpc{} } -func (m *GrpcService_EnvoyGrpc) String() string { return proto.CompactTextString(m) } -func (*GrpcService_EnvoyGrpc) ProtoMessage() {} -func (*GrpcService_EnvoyGrpc) Descriptor() ([]byte, []int) { - return fileDescriptor_grpc_service_b85549433708d753, []int{0, 0} -} -func (m *GrpcService_EnvoyGrpc) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GrpcService_EnvoyGrpc.Unmarshal(m, b) -} -func (m *GrpcService_EnvoyGrpc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GrpcService_EnvoyGrpc.Marshal(b, m, deterministic) -} -func (dst *GrpcService_EnvoyGrpc) XXX_Merge(src proto.Message) { - xxx_messageInfo_GrpcService_EnvoyGrpc.Merge(dst, src) -} -func (m *GrpcService_EnvoyGrpc) XXX_Size() int { - return xxx_messageInfo_GrpcService_EnvoyGrpc.Size(m) -} -func (m *GrpcService_EnvoyGrpc) XXX_DiscardUnknown() { - xxx_messageInfo_GrpcService_EnvoyGrpc.DiscardUnknown(m) -} - -var xxx_messageInfo_GrpcService_EnvoyGrpc proto.InternalMessageInfo - -func (m *GrpcService_EnvoyGrpc) GetClusterName() string { - if m != nil { - return m.ClusterName - } - return "" -} - -type GrpcService_GoogleGrpc struct { - TargetUri string `protobuf:"bytes,1,opt,name=target_uri,json=targetUri,proto3" json:"target_uri,omitempty"` - ChannelCredentials *GrpcService_GoogleGrpc_ChannelCredentials `protobuf:"bytes,2,opt,name=channel_credentials,json=channelCredentials,proto3" json:"channel_credentials,omitempty"` - CallCredentials []*GrpcService_GoogleGrpc_CallCredentials `protobuf:"bytes,3,rep,name=call_credentials,json=callCredentials,proto3" json:"call_credentials,omitempty"` - StatPrefix string `protobuf:"bytes,4,opt,name=stat_prefix,json=statPrefix,proto3" json:"stat_prefix,omitempty"` - CredentialsFactoryName string `protobuf:"bytes,5,opt,name=credentials_factory_name,json=credentialsFactoryName,proto3" json:"credentials_factory_name,omitempty"` - Config *_struct.Struct `protobuf:"bytes,6,opt,name=config,proto3" json:"config,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GrpcService_GoogleGrpc) Reset() { *m = GrpcService_GoogleGrpc{} } -func (m *GrpcService_GoogleGrpc) String() string { return proto.CompactTextString(m) } -func (*GrpcService_GoogleGrpc) ProtoMessage() {} -func (*GrpcService_GoogleGrpc) Descriptor() ([]byte, []int) { - return fileDescriptor_grpc_service_b85549433708d753, []int{0, 1} -} -func (m *GrpcService_GoogleGrpc) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GrpcService_GoogleGrpc.Unmarshal(m, b) -} -func (m *GrpcService_GoogleGrpc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GrpcService_GoogleGrpc.Marshal(b, m, deterministic) -} -func (dst *GrpcService_GoogleGrpc) XXX_Merge(src proto.Message) { - xxx_messageInfo_GrpcService_GoogleGrpc.Merge(dst, src) -} -func (m *GrpcService_GoogleGrpc) XXX_Size() int { - return xxx_messageInfo_GrpcService_GoogleGrpc.Size(m) -} -func (m *GrpcService_GoogleGrpc) XXX_DiscardUnknown() { - xxx_messageInfo_GrpcService_GoogleGrpc.DiscardUnknown(m) -} - -var xxx_messageInfo_GrpcService_GoogleGrpc proto.InternalMessageInfo - -func (m *GrpcService_GoogleGrpc) GetTargetUri() string { - if m != nil { - return m.TargetUri - } - return "" -} - -func (m *GrpcService_GoogleGrpc) GetChannelCredentials() *GrpcService_GoogleGrpc_ChannelCredentials { - if m != nil { - return m.ChannelCredentials - } - return nil -} - -func (m *GrpcService_GoogleGrpc) GetCallCredentials() []*GrpcService_GoogleGrpc_CallCredentials { - if m != nil { - return m.CallCredentials - } - return nil -} - -func (m *GrpcService_GoogleGrpc) GetStatPrefix() string { - if m != nil { - return m.StatPrefix - } - return "" -} - -func (m *GrpcService_GoogleGrpc) GetCredentialsFactoryName() string { - if m != nil { - return m.CredentialsFactoryName - } - return "" -} - -func (m *GrpcService_GoogleGrpc) GetConfig() *_struct.Struct { - if m != nil { - return m.Config - } - return nil -} - -type GrpcService_GoogleGrpc_SslCredentials struct { - RootCerts *base.DataSource `protobuf:"bytes,1,opt,name=root_certs,json=rootCerts,proto3" json:"root_certs,omitempty"` - PrivateKey *base.DataSource `protobuf:"bytes,2,opt,name=private_key,json=privateKey,proto3" json:"private_key,omitempty"` - CertChain *base.DataSource `protobuf:"bytes,3,opt,name=cert_chain,json=certChain,proto3" json:"cert_chain,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GrpcService_GoogleGrpc_SslCredentials) Reset() { *m = GrpcService_GoogleGrpc_SslCredentials{} } -func (m *GrpcService_GoogleGrpc_SslCredentials) String() string { return proto.CompactTextString(m) } -func (*GrpcService_GoogleGrpc_SslCredentials) ProtoMessage() {} -func (*GrpcService_GoogleGrpc_SslCredentials) Descriptor() ([]byte, []int) { - return fileDescriptor_grpc_service_b85549433708d753, []int{0, 1, 0} -} -func (m *GrpcService_GoogleGrpc_SslCredentials) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GrpcService_GoogleGrpc_SslCredentials.Unmarshal(m, b) -} -func (m *GrpcService_GoogleGrpc_SslCredentials) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GrpcService_GoogleGrpc_SslCredentials.Marshal(b, m, deterministic) -} -func (dst *GrpcService_GoogleGrpc_SslCredentials) XXX_Merge(src proto.Message) { - xxx_messageInfo_GrpcService_GoogleGrpc_SslCredentials.Merge(dst, src) -} -func (m *GrpcService_GoogleGrpc_SslCredentials) XXX_Size() int { - return xxx_messageInfo_GrpcService_GoogleGrpc_SslCredentials.Size(m) -} -func (m *GrpcService_GoogleGrpc_SslCredentials) XXX_DiscardUnknown() { - xxx_messageInfo_GrpcService_GoogleGrpc_SslCredentials.DiscardUnknown(m) -} - -var xxx_messageInfo_GrpcService_GoogleGrpc_SslCredentials proto.InternalMessageInfo - -func (m *GrpcService_GoogleGrpc_SslCredentials) GetRootCerts() *base.DataSource { - if m != nil { - return m.RootCerts - } - return nil -} - -func (m *GrpcService_GoogleGrpc_SslCredentials) GetPrivateKey() *base.DataSource { - if m != nil { - return m.PrivateKey - } - return nil -} - -func (m *GrpcService_GoogleGrpc_SslCredentials) GetCertChain() *base.DataSource { - if m != nil { - return m.CertChain - } - return nil -} - -type GrpcService_GoogleGrpc_GoogleLocalCredentials struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GrpcService_GoogleGrpc_GoogleLocalCredentials) Reset() { - *m = GrpcService_GoogleGrpc_GoogleLocalCredentials{} -} -func (m *GrpcService_GoogleGrpc_GoogleLocalCredentials) String() string { - return proto.CompactTextString(m) -} -func (*GrpcService_GoogleGrpc_GoogleLocalCredentials) ProtoMessage() {} -func (*GrpcService_GoogleGrpc_GoogleLocalCredentials) Descriptor() ([]byte, []int) { - return fileDescriptor_grpc_service_b85549433708d753, []int{0, 1, 1} -} -func (m *GrpcService_GoogleGrpc_GoogleLocalCredentials) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GrpcService_GoogleGrpc_GoogleLocalCredentials.Unmarshal(m, b) -} -func (m *GrpcService_GoogleGrpc_GoogleLocalCredentials) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GrpcService_GoogleGrpc_GoogleLocalCredentials.Marshal(b, m, deterministic) -} -func (dst *GrpcService_GoogleGrpc_GoogleLocalCredentials) XXX_Merge(src proto.Message) { - xxx_messageInfo_GrpcService_GoogleGrpc_GoogleLocalCredentials.Merge(dst, src) -} -func (m *GrpcService_GoogleGrpc_GoogleLocalCredentials) XXX_Size() int { - return xxx_messageInfo_GrpcService_GoogleGrpc_GoogleLocalCredentials.Size(m) -} -func (m *GrpcService_GoogleGrpc_GoogleLocalCredentials) XXX_DiscardUnknown() { - xxx_messageInfo_GrpcService_GoogleGrpc_GoogleLocalCredentials.DiscardUnknown(m) -} - -var xxx_messageInfo_GrpcService_GoogleGrpc_GoogleLocalCredentials proto.InternalMessageInfo - -type GrpcService_GoogleGrpc_ChannelCredentials struct { - // Types that are valid to be assigned to CredentialSpecifier: - // *GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials - // *GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault - // *GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials - CredentialSpecifier isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier `protobuf_oneof:"credential_specifier"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GrpcService_GoogleGrpc_ChannelCredentials) Reset() { - *m = GrpcService_GoogleGrpc_ChannelCredentials{} -} -func (m *GrpcService_GoogleGrpc_ChannelCredentials) String() string { return proto.CompactTextString(m) } -func (*GrpcService_GoogleGrpc_ChannelCredentials) ProtoMessage() {} -func (*GrpcService_GoogleGrpc_ChannelCredentials) Descriptor() ([]byte, []int) { - return fileDescriptor_grpc_service_b85549433708d753, []int{0, 1, 2} -} -func (m *GrpcService_GoogleGrpc_ChannelCredentials) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GrpcService_GoogleGrpc_ChannelCredentials.Unmarshal(m, b) -} -func (m *GrpcService_GoogleGrpc_ChannelCredentials) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GrpcService_GoogleGrpc_ChannelCredentials.Marshal(b, m, deterministic) -} -func (dst *GrpcService_GoogleGrpc_ChannelCredentials) XXX_Merge(src proto.Message) { - xxx_messageInfo_GrpcService_GoogleGrpc_ChannelCredentials.Merge(dst, src) -} -func (m *GrpcService_GoogleGrpc_ChannelCredentials) XXX_Size() int { - return xxx_messageInfo_GrpcService_GoogleGrpc_ChannelCredentials.Size(m) -} -func (m *GrpcService_GoogleGrpc_ChannelCredentials) XXX_DiscardUnknown() { - xxx_messageInfo_GrpcService_GoogleGrpc_ChannelCredentials.DiscardUnknown(m) -} - -var xxx_messageInfo_GrpcService_GoogleGrpc_ChannelCredentials proto.InternalMessageInfo - -type isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier interface { - isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier() -} - -type GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials struct { - SslCredentials *GrpcService_GoogleGrpc_SslCredentials `protobuf:"bytes,1,opt,name=ssl_credentials,json=sslCredentials,proto3,oneof"` -} - -type GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault struct { - GoogleDefault *empty.Empty `protobuf:"bytes,2,opt,name=google_default,json=googleDefault,proto3,oneof"` -} - -type GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials struct { - LocalCredentials *GrpcService_GoogleGrpc_GoogleLocalCredentials `protobuf:"bytes,3,opt,name=local_credentials,json=localCredentials,proto3,oneof"` -} - -func (*GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials) isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier() { -} - -func (*GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault) isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier() { -} - -func (*GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials) isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier() { -} - -func (m *GrpcService_GoogleGrpc_ChannelCredentials) GetCredentialSpecifier() isGrpcService_GoogleGrpc_ChannelCredentials_CredentialSpecifier { - if m != nil { - return m.CredentialSpecifier - } - return nil -} - -func (m *GrpcService_GoogleGrpc_ChannelCredentials) GetSslCredentials() *GrpcService_GoogleGrpc_SslCredentials { - if x, ok := m.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials); ok { - return x.SslCredentials - } - return nil -} - -func (m *GrpcService_GoogleGrpc_ChannelCredentials) GetGoogleDefault() *empty.Empty { - if x, ok := m.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault); ok { - return x.GoogleDefault - } - return nil -} - -func (m *GrpcService_GoogleGrpc_ChannelCredentials) GetLocalCredentials() *GrpcService_GoogleGrpc_GoogleLocalCredentials { - if x, ok := m.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials); ok { - return x.LocalCredentials - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*GrpcService_GoogleGrpc_ChannelCredentials) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _GrpcService_GoogleGrpc_ChannelCredentials_OneofMarshaler, _GrpcService_GoogleGrpc_ChannelCredentials_OneofUnmarshaler, _GrpcService_GoogleGrpc_ChannelCredentials_OneofSizer, []interface{}{ - (*GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials)(nil), - (*GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault)(nil), - (*GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials)(nil), - } -} - -func _GrpcService_GoogleGrpc_ChannelCredentials_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*GrpcService_GoogleGrpc_ChannelCredentials) - // credential_specifier - switch x := m.CredentialSpecifier.(type) { - case *GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SslCredentials); err != nil { - return err - } - case *GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.GoogleDefault); err != nil { - return err - } - case *GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials: - b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.LocalCredentials); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("GrpcService_GoogleGrpc_ChannelCredentials.CredentialSpecifier has unexpected type %T", x) - } - return nil -} - -func _GrpcService_GoogleGrpc_ChannelCredentials_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*GrpcService_GoogleGrpc_ChannelCredentials) - switch tag { - case 1: // credential_specifier.ssl_credentials - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(GrpcService_GoogleGrpc_SslCredentials) - err := b.DecodeMessage(msg) - m.CredentialSpecifier = &GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials{msg} - return true, err - case 2: // credential_specifier.google_default - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(empty.Empty) - err := b.DecodeMessage(msg) - m.CredentialSpecifier = &GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault{msg} - return true, err - case 3: // credential_specifier.local_credentials - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(GrpcService_GoogleGrpc_GoogleLocalCredentials) - err := b.DecodeMessage(msg) - m.CredentialSpecifier = &GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials{msg} - return true, err - default: - return false, nil - } -} - -func _GrpcService_GoogleGrpc_ChannelCredentials_OneofSizer(msg proto.Message) (n int) { - m := msg.(*GrpcService_GoogleGrpc_ChannelCredentials) - // credential_specifier - switch x := m.CredentialSpecifier.(type) { - case *GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials: - s := proto.Size(x.SslCredentials) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault: - s := proto.Size(x.GoogleDefault) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials: - s := proto.Size(x.LocalCredentials) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type GrpcService_GoogleGrpc_CallCredentials struct { - // Types that are valid to be assigned to CredentialSpecifier: - // *GrpcService_GoogleGrpc_CallCredentials_AccessToken - // *GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine - // *GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken - // *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess - // *GrpcService_GoogleGrpc_CallCredentials_GoogleIam - // *GrpcService_GoogleGrpc_CallCredentials_FromPlugin - CredentialSpecifier isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier `protobuf_oneof:"credential_specifier"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GrpcService_GoogleGrpc_CallCredentials) Reset() { - *m = GrpcService_GoogleGrpc_CallCredentials{} -} -func (m *GrpcService_GoogleGrpc_CallCredentials) String() string { return proto.CompactTextString(m) } -func (*GrpcService_GoogleGrpc_CallCredentials) ProtoMessage() {} -func (*GrpcService_GoogleGrpc_CallCredentials) Descriptor() ([]byte, []int) { - return fileDescriptor_grpc_service_b85549433708d753, []int{0, 1, 3} -} -func (m *GrpcService_GoogleGrpc_CallCredentials) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials.Unmarshal(m, b) -} -func (m *GrpcService_GoogleGrpc_CallCredentials) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials.Marshal(b, m, deterministic) -} -func (dst *GrpcService_GoogleGrpc_CallCredentials) XXX_Merge(src proto.Message) { - xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials.Merge(dst, src) -} -func (m *GrpcService_GoogleGrpc_CallCredentials) XXX_Size() int { - return xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials.Size(m) -} -func (m *GrpcService_GoogleGrpc_CallCredentials) XXX_DiscardUnknown() { - xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials.DiscardUnknown(m) -} - -var xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials proto.InternalMessageInfo - -type isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier interface { - isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() -} - -type GrpcService_GoogleGrpc_CallCredentials_AccessToken struct { - AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3,oneof"` -} - -type GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine struct { - GoogleComputeEngine *empty.Empty `protobuf:"bytes,2,opt,name=google_compute_engine,json=googleComputeEngine,proto3,oneof"` -} - -type GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken struct { - GoogleRefreshToken string `protobuf:"bytes,3,opt,name=google_refresh_token,json=googleRefreshToken,proto3,oneof"` -} - -type GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess struct { - ServiceAccountJwtAccess *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials `protobuf:"bytes,4,opt,name=service_account_jwt_access,json=serviceAccountJwtAccess,proto3,oneof"` -} - -type GrpcService_GoogleGrpc_CallCredentials_GoogleIam struct { - GoogleIam *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials `protobuf:"bytes,5,opt,name=google_iam,json=googleIam,proto3,oneof"` -} - -type GrpcService_GoogleGrpc_CallCredentials_FromPlugin struct { - FromPlugin *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin `protobuf:"bytes,6,opt,name=from_plugin,json=fromPlugin,proto3,oneof"` -} - -func (*GrpcService_GoogleGrpc_CallCredentials_AccessToken) isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() { -} - -func (*GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine) isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() { -} - -func (*GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken) isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() { -} - -func (*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess) isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() { -} - -func (*GrpcService_GoogleGrpc_CallCredentials_GoogleIam) isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() { -} - -func (*GrpcService_GoogleGrpc_CallCredentials_FromPlugin) isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier() { -} - -func (m *GrpcService_GoogleGrpc_CallCredentials) GetCredentialSpecifier() isGrpcService_GoogleGrpc_CallCredentials_CredentialSpecifier { - if m != nil { - return m.CredentialSpecifier - } - return nil -} - -func (m *GrpcService_GoogleGrpc_CallCredentials) GetAccessToken() string { - if x, ok := m.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_CallCredentials_AccessToken); ok { - return x.AccessToken - } - return "" -} - -func (m *GrpcService_GoogleGrpc_CallCredentials) GetGoogleComputeEngine() *empty.Empty { - if x, ok := m.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine); ok { - return x.GoogleComputeEngine - } - return nil -} - -func (m *GrpcService_GoogleGrpc_CallCredentials) GetGoogleRefreshToken() string { - if x, ok := m.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken); ok { - return x.GoogleRefreshToken - } - return "" -} - -func (m *GrpcService_GoogleGrpc_CallCredentials) GetServiceAccountJwtAccess() *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials { - if x, ok := m.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess); ok { - return x.ServiceAccountJwtAccess - } - return nil -} - -func (m *GrpcService_GoogleGrpc_CallCredentials) GetGoogleIam() *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials { - if x, ok := m.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_CallCredentials_GoogleIam); ok { - return x.GoogleIam - } - return nil -} - -func (m *GrpcService_GoogleGrpc_CallCredentials) GetFromPlugin() *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin { - if x, ok := m.GetCredentialSpecifier().(*GrpcService_GoogleGrpc_CallCredentials_FromPlugin); ok { - return x.FromPlugin - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*GrpcService_GoogleGrpc_CallCredentials) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _GrpcService_GoogleGrpc_CallCredentials_OneofMarshaler, _GrpcService_GoogleGrpc_CallCredentials_OneofUnmarshaler, _GrpcService_GoogleGrpc_CallCredentials_OneofSizer, []interface{}{ - (*GrpcService_GoogleGrpc_CallCredentials_AccessToken)(nil), - (*GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine)(nil), - (*GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken)(nil), - (*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess)(nil), - (*GrpcService_GoogleGrpc_CallCredentials_GoogleIam)(nil), - (*GrpcService_GoogleGrpc_CallCredentials_FromPlugin)(nil), - } -} - -func _GrpcService_GoogleGrpc_CallCredentials_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*GrpcService_GoogleGrpc_CallCredentials) - // credential_specifier - switch x := m.CredentialSpecifier.(type) { - case *GrpcService_GoogleGrpc_CallCredentials_AccessToken: - b.EncodeVarint(1<<3 | proto.WireBytes) - b.EncodeStringBytes(x.AccessToken) - case *GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.GoogleComputeEngine); err != nil { - return err - } - case *GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken: - b.EncodeVarint(3<<3 | proto.WireBytes) - b.EncodeStringBytes(x.GoogleRefreshToken) - case *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess: - b.EncodeVarint(4<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ServiceAccountJwtAccess); err != nil { - return err - } - case *GrpcService_GoogleGrpc_CallCredentials_GoogleIam: - b.EncodeVarint(5<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.GoogleIam); err != nil { - return err - } - case *GrpcService_GoogleGrpc_CallCredentials_FromPlugin: - b.EncodeVarint(6<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.FromPlugin); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("GrpcService_GoogleGrpc_CallCredentials.CredentialSpecifier has unexpected type %T", x) - } - return nil -} - -func _GrpcService_GoogleGrpc_CallCredentials_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*GrpcService_GoogleGrpc_CallCredentials) - switch tag { - case 1: // credential_specifier.access_token - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.CredentialSpecifier = &GrpcService_GoogleGrpc_CallCredentials_AccessToken{x} - return true, err - case 2: // credential_specifier.google_compute_engine - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(empty.Empty) - err := b.DecodeMessage(msg) - m.CredentialSpecifier = &GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine{msg} - return true, err - case 3: // credential_specifier.google_refresh_token - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.CredentialSpecifier = &GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken{x} - return true, err - case 4: // credential_specifier.service_account_jwt_access - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) - err := b.DecodeMessage(msg) - m.CredentialSpecifier = &GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess{msg} - return true, err - case 5: // credential_specifier.google_iam - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) - err := b.DecodeMessage(msg) - m.CredentialSpecifier = &GrpcService_GoogleGrpc_CallCredentials_GoogleIam{msg} - return true, err - case 6: // credential_specifier.from_plugin - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) - err := b.DecodeMessage(msg) - m.CredentialSpecifier = &GrpcService_GoogleGrpc_CallCredentials_FromPlugin{msg} - return true, err - default: - return false, nil - } -} - -func _GrpcService_GoogleGrpc_CallCredentials_OneofSizer(msg proto.Message) (n int) { - m := msg.(*GrpcService_GoogleGrpc_CallCredentials) - // credential_specifier - switch x := m.CredentialSpecifier.(type) { - case *GrpcService_GoogleGrpc_CallCredentials_AccessToken: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.AccessToken))) - n += len(x.AccessToken) - case *GrpcService_GoogleGrpc_CallCredentials_GoogleComputeEngine: - s := proto.Size(x.GoogleComputeEngine) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *GrpcService_GoogleGrpc_CallCredentials_GoogleRefreshToken: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.GoogleRefreshToken))) - n += len(x.GoogleRefreshToken) - case *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJwtAccess: - s := proto.Size(x.ServiceAccountJwtAccess) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *GrpcService_GoogleGrpc_CallCredentials_GoogleIam: - s := proto.Size(x.GoogleIam) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *GrpcService_GoogleGrpc_CallCredentials_FromPlugin: - s := proto.Size(x.FromPlugin) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials struct { - JsonKey string `protobuf:"bytes,1,opt,name=json_key,json=jsonKey,proto3" json:"json_key,omitempty"` - TokenLifetimeSeconds uint64 `protobuf:"varint,2,opt,name=token_lifetime_seconds,json=tokenLifetimeSeconds,proto3" json:"token_lifetime_seconds,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) Reset() { - *m = GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials{} -} -func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) String() string { - return proto.CompactTextString(m) -} -func (*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) ProtoMessage() {} -func (*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) Descriptor() ([]byte, []int) { - return fileDescriptor_grpc_service_b85549433708d753, []int{0, 1, 3, 0} -} -func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials.Unmarshal(m, b) -} -func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials.Marshal(b, m, deterministic) -} -func (dst *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) XXX_Merge(src proto.Message) { - xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials.Merge(dst, src) -} -func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) XXX_Size() int { - return xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials.Size(m) -} -func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) XXX_DiscardUnknown() { - xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials.DiscardUnknown(m) -} - -var xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials proto.InternalMessageInfo - -func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) GetJsonKey() string { - if m != nil { - return m.JsonKey - } - return "" -} - -func (m *GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials) GetTokenLifetimeSeconds() uint64 { - if m != nil { - return m.TokenLifetimeSeconds - } - return 0 -} - -type GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials struct { - AuthorizationToken string `protobuf:"bytes,1,opt,name=authorization_token,json=authorizationToken,proto3" json:"authorization_token,omitempty"` - AuthoritySelector string `protobuf:"bytes,2,opt,name=authority_selector,json=authoritySelector,proto3" json:"authority_selector,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) Reset() { - *m = GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials{} -} -func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) String() string { - return proto.CompactTextString(m) -} -func (*GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) ProtoMessage() {} -func (*GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) Descriptor() ([]byte, []int) { - return fileDescriptor_grpc_service_b85549433708d753, []int{0, 1, 3, 1} -} -func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials.Unmarshal(m, b) -} -func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials.Marshal(b, m, deterministic) -} -func (dst *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) XXX_Merge(src proto.Message) { - xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials.Merge(dst, src) -} -func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) XXX_Size() int { - return xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials.Size(m) -} -func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) XXX_DiscardUnknown() { - xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials.DiscardUnknown(m) -} - -var xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials proto.InternalMessageInfo - -func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) GetAuthorizationToken() string { - if m != nil { - return m.AuthorizationToken - } - return "" -} - -func (m *GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials) GetAuthoritySelector() string { - if m != nil { - return m.AuthoritySelector - } - return "" -} - -type GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Types that are valid to be assigned to ConfigType: - // *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_Config - // *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_TypedConfig - ConfigType isGrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_ConfigType `protobuf_oneof:"config_type"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) Reset() { - *m = GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin{} -} -func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) String() string { - return proto.CompactTextString(m) -} -func (*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) ProtoMessage() {} -func (*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) Descriptor() ([]byte, []int) { - return fileDescriptor_grpc_service_b85549433708d753, []int{0, 1, 3, 2} -} -func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin.Unmarshal(m, b) -} -func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin.Marshal(b, m, deterministic) -} -func (dst *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) XXX_Merge(src proto.Message) { - xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin.Merge(dst, src) -} -func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) XXX_Size() int { - return xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin.Size(m) -} -func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) XXX_DiscardUnknown() { - xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin.DiscardUnknown(m) -} - -var xxx_messageInfo_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin proto.InternalMessageInfo - -func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -type isGrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_ConfigType interface { - isGrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_ConfigType() -} - -type GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_Config struct { - Config *_struct.Struct `protobuf:"bytes,2,opt,name=config,proto3,oneof"` -} - -type GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_TypedConfig struct { - TypedConfig *any.Any `protobuf:"bytes,3,opt,name=typed_config,json=typedConfig,proto3,oneof"` -} - -func (*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_Config) isGrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_ConfigType() { -} - -func (*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_TypedConfig) isGrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_ConfigType() { -} - -func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) GetConfigType() isGrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_ConfigType { - if m != nil { - return m.ConfigType - } - return nil -} - -func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) GetConfig() *_struct.Struct { - if x, ok := m.GetConfigType().(*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_Config); ok { - return x.Config - } - return nil -} - -func (m *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) GetTypedConfig() *any.Any { - if x, ok := m.GetConfigType().(*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_TypedConfig); ok { - return x.TypedConfig - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_OneofMarshaler, _GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_OneofUnmarshaler, _GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_OneofSizer, []interface{}{ - (*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_Config)(nil), - (*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_TypedConfig)(nil), - } -} - -func _GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) - // config_type - switch x := m.ConfigType.(type) { - case *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_Config: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Config); err != nil { - return err - } - case *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_TypedConfig: - b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.TypedConfig); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin.ConfigType has unexpected type %T", x) - } - return nil -} - -func _GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) - switch tag { - case 2: // config_type.config - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(_struct.Struct) - err := b.DecodeMessage(msg) - m.ConfigType = &GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_Config{msg} - return true, err - case 3: // config_type.typed_config - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(any.Any) - err := b.DecodeMessage(msg) - m.ConfigType = &GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_TypedConfig{msg} - return true, err - default: - return false, nil - } -} - -func _GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_OneofSizer(msg proto.Message) (n int) { - m := msg.(*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin) - // config_type - switch x := m.ConfigType.(type) { - case *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_Config: - s := proto.Size(x.Config) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_TypedConfig: - s := proto.Size(x.TypedConfig) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -func init() { - proto.RegisterType((*GrpcService)(nil), "envoy.api.v2.core.GrpcService") - proto.RegisterType((*GrpcService_EnvoyGrpc)(nil), "envoy.api.v2.core.GrpcService.EnvoyGrpc") - proto.RegisterType((*GrpcService_GoogleGrpc)(nil), "envoy.api.v2.core.GrpcService.GoogleGrpc") - proto.RegisterType((*GrpcService_GoogleGrpc_SslCredentials)(nil), "envoy.api.v2.core.GrpcService.GoogleGrpc.SslCredentials") - proto.RegisterType((*GrpcService_GoogleGrpc_GoogleLocalCredentials)(nil), "envoy.api.v2.core.GrpcService.GoogleGrpc.GoogleLocalCredentials") - proto.RegisterType((*GrpcService_GoogleGrpc_ChannelCredentials)(nil), "envoy.api.v2.core.GrpcService.GoogleGrpc.ChannelCredentials") - proto.RegisterType((*GrpcService_GoogleGrpc_CallCredentials)(nil), "envoy.api.v2.core.GrpcService.GoogleGrpc.CallCredentials") - proto.RegisterType((*GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials)(nil), "envoy.api.v2.core.GrpcService.GoogleGrpc.CallCredentials.ServiceAccountJWTAccessCredentials") - proto.RegisterType((*GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials)(nil), "envoy.api.v2.core.GrpcService.GoogleGrpc.CallCredentials.GoogleIAMCredentials") - proto.RegisterType((*GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin)(nil), "envoy.api.v2.core.GrpcService.GoogleGrpc.CallCredentials.MetadataCredentialsFromPlugin") -} - -func init() { - proto.RegisterFile("envoy/api/v2/core/grpc_service.proto", fileDescriptor_grpc_service_b85549433708d753) -} - -var fileDescriptor_grpc_service_b85549433708d753 = []byte{ - // 1052 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xb7, 0x63, 0xa7, 0xad, 0xdf, 0xa6, 0x89, 0x33, 0x09, 0x89, 0xb3, 0x34, 0x25, 0x2a, 0x1c, - 0x02, 0x82, 0xb5, 0x70, 0x41, 0x6a, 0xa4, 0x0a, 0x88, 0x9d, 0xb4, 0x4e, 0x49, 0xab, 0x68, 0x5d, - 0xe8, 0x05, 0x69, 0x34, 0x19, 0x8f, 0x9d, 0x69, 0xd7, 0x3b, 0xab, 0xd9, 0x59, 0xb7, 0xee, 0x99, - 0x6f, 0xc1, 0x97, 0xe0, 0x88, 0x38, 0xf5, 0x8c, 0xf8, 0x0e, 0x5c, 0xb8, 0xf4, 0x5b, 0xa0, 0xf9, - 0xe3, 0xc4, 0x6b, 0x47, 0x75, 0xc8, 0x6d, 0xf7, 0xfd, 0xde, 0xef, 0xfd, 0xf9, 0xcd, 0x9b, 0x37, - 0xf0, 0x19, 0x8b, 0x87, 0x62, 0x54, 0x27, 0x09, 0xaf, 0x0f, 0x1b, 0x75, 0x2a, 0x24, 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c, 0x66, 0xe7, 0xaa, - 0x59, 0x9d, 0x18, 0xac, 0x13, 0x5d, 0xd9, 0x49, 0xf1, 0xf4, 0x86, 0x29, 0xf1, 0xfe, 0x7f, 0x01, - 0x00, 0x00, 0xff, 0xff, 0x5c, 0x77, 0x13, 0x9a, 0x8c, 0x0a, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/health_check/health_check.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/health_check/health_check.pb.go deleted file mode 100755 index 4a2f50869d7..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/health_check/health_check.pb.go +++ /dev/null @@ -1,1007 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: envoy/api/v2/core/health_check.proto - -package envoy_api_v2_core - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import any "github.com/golang/protobuf/ptypes/any" -import duration "github.com/golang/protobuf/ptypes/duration" -import _struct "github.com/golang/protobuf/ptypes/struct" -import wrappers "github.com/golang/protobuf/ptypes/wrappers" -import base "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/base" -import _range "google.golang.org/grpc/xds/internal/proto/envoy/type/range" -import _ "google.golang.org/grpc/xds/internal/proto/validate" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type HealthStatus int32 - -const ( - HealthStatus_UNKNOWN HealthStatus = 0 - HealthStatus_HEALTHY HealthStatus = 1 - HealthStatus_UNHEALTHY HealthStatus = 2 - HealthStatus_DRAINING HealthStatus = 3 - HealthStatus_TIMEOUT HealthStatus = 4 - HealthStatus_DEGRADED HealthStatus = 5 -) - -var HealthStatus_name = map[int32]string{ - 0: "UNKNOWN", - 1: "HEALTHY", - 2: "UNHEALTHY", - 3: "DRAINING", - 4: "TIMEOUT", - 5: "DEGRADED", -} -var HealthStatus_value = map[string]int32{ - "UNKNOWN": 0, - "HEALTHY": 1, - "UNHEALTHY": 2, - "DRAINING": 3, - "TIMEOUT": 4, - "DEGRADED": 5, -} - -func (x HealthStatus) String() string { - return proto.EnumName(HealthStatus_name, int32(x)) -} -func (HealthStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_health_check_0d3155ea06758d89, []int{0} -} - -type HealthCheck struct { - Timeout *duration.Duration `protobuf:"bytes,1,opt,name=timeout,proto3" json:"timeout,omitempty"` - Interval *duration.Duration `protobuf:"bytes,2,opt,name=interval,proto3" json:"interval,omitempty"` - InitialJitter *duration.Duration `protobuf:"bytes,20,opt,name=initial_jitter,json=initialJitter,proto3" json:"initial_jitter,omitempty"` - IntervalJitter *duration.Duration `protobuf:"bytes,3,opt,name=interval_jitter,json=intervalJitter,proto3" json:"interval_jitter,omitempty"` - IntervalJitterPercent uint32 `protobuf:"varint,18,opt,name=interval_jitter_percent,json=intervalJitterPercent,proto3" json:"interval_jitter_percent,omitempty"` - UnhealthyThreshold *wrappers.UInt32Value `protobuf:"bytes,4,opt,name=unhealthy_threshold,json=unhealthyThreshold,proto3" json:"unhealthy_threshold,omitempty"` - HealthyThreshold *wrappers.UInt32Value `protobuf:"bytes,5,opt,name=healthy_threshold,json=healthyThreshold,proto3" json:"healthy_threshold,omitempty"` - AltPort *wrappers.UInt32Value `protobuf:"bytes,6,opt,name=alt_port,json=altPort,proto3" json:"alt_port,omitempty"` - ReuseConnection *wrappers.BoolValue `protobuf:"bytes,7,opt,name=reuse_connection,json=reuseConnection,proto3" json:"reuse_connection,omitempty"` - // Types that are valid to be assigned to HealthChecker: - // *HealthCheck_HttpHealthCheck_ - // *HealthCheck_TcpHealthCheck_ - // *HealthCheck_GrpcHealthCheck_ - // *HealthCheck_CustomHealthCheck_ - HealthChecker isHealthCheck_HealthChecker `protobuf_oneof:"health_checker"` - NoTrafficInterval *duration.Duration `protobuf:"bytes,12,opt,name=no_traffic_interval,json=noTrafficInterval,proto3" json:"no_traffic_interval,omitempty"` - UnhealthyInterval *duration.Duration `protobuf:"bytes,14,opt,name=unhealthy_interval,json=unhealthyInterval,proto3" json:"unhealthy_interval,omitempty"` - UnhealthyEdgeInterval *duration.Duration `protobuf:"bytes,15,opt,name=unhealthy_edge_interval,json=unhealthyEdgeInterval,proto3" json:"unhealthy_edge_interval,omitempty"` - HealthyEdgeInterval *duration.Duration `protobuf:"bytes,16,opt,name=healthy_edge_interval,json=healthyEdgeInterval,proto3" json:"healthy_edge_interval,omitempty"` - EventLogPath string `protobuf:"bytes,17,opt,name=event_log_path,json=eventLogPath,proto3" json:"event_log_path,omitempty"` - AlwaysLogHealthCheckFailures bool `protobuf:"varint,19,opt,name=always_log_health_check_failures,json=alwaysLogHealthCheckFailures,proto3" json:"always_log_health_check_failures,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HealthCheck) Reset() { *m = HealthCheck{} } -func (m *HealthCheck) String() string { return proto.CompactTextString(m) } -func (*HealthCheck) ProtoMessage() {} -func (*HealthCheck) Descriptor() ([]byte, []int) { - return fileDescriptor_health_check_0d3155ea06758d89, []int{0} -} -func (m *HealthCheck) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HealthCheck.Unmarshal(m, b) -} -func (m *HealthCheck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HealthCheck.Marshal(b, m, deterministic) -} -func (dst *HealthCheck) XXX_Merge(src proto.Message) { - xxx_messageInfo_HealthCheck.Merge(dst, src) -} -func (m *HealthCheck) XXX_Size() int { - return xxx_messageInfo_HealthCheck.Size(m) -} -func (m *HealthCheck) XXX_DiscardUnknown() { - xxx_messageInfo_HealthCheck.DiscardUnknown(m) -} - -var xxx_messageInfo_HealthCheck proto.InternalMessageInfo - -func (m *HealthCheck) GetTimeout() *duration.Duration { - if m != nil { - return m.Timeout - } - return nil -} - -func (m *HealthCheck) GetInterval() *duration.Duration { - if m != nil { - return m.Interval - } - return nil -} - -func (m *HealthCheck) GetInitialJitter() *duration.Duration { - if m != nil { - return m.InitialJitter - } - return nil -} - -func (m *HealthCheck) GetIntervalJitter() *duration.Duration { - if m != nil { - return m.IntervalJitter - } - return nil -} - -func (m *HealthCheck) GetIntervalJitterPercent() uint32 { - if m != nil { - return m.IntervalJitterPercent - } - return 0 -} - -func (m *HealthCheck) GetUnhealthyThreshold() *wrappers.UInt32Value { - if m != nil { - return m.UnhealthyThreshold - } - return nil -} - -func (m *HealthCheck) GetHealthyThreshold() *wrappers.UInt32Value { - if m != nil { - return m.HealthyThreshold - } - return nil -} - -func (m *HealthCheck) GetAltPort() *wrappers.UInt32Value { - if m != nil { - return m.AltPort - } - return nil -} - -func (m *HealthCheck) GetReuseConnection() *wrappers.BoolValue { - if m != nil { - return m.ReuseConnection - } - return nil -} - -type isHealthCheck_HealthChecker interface { - isHealthCheck_HealthChecker() -} - -type HealthCheck_HttpHealthCheck_ struct { - HttpHealthCheck *HealthCheck_HttpHealthCheck `protobuf:"bytes,8,opt,name=http_health_check,json=httpHealthCheck,proto3,oneof"` -} - -type HealthCheck_TcpHealthCheck_ struct { - TcpHealthCheck *HealthCheck_TcpHealthCheck `protobuf:"bytes,9,opt,name=tcp_health_check,json=tcpHealthCheck,proto3,oneof"` -} - -type HealthCheck_GrpcHealthCheck_ struct { - GrpcHealthCheck *HealthCheck_GrpcHealthCheck `protobuf:"bytes,11,opt,name=grpc_health_check,json=grpcHealthCheck,proto3,oneof"` -} - -type HealthCheck_CustomHealthCheck_ struct { - CustomHealthCheck *HealthCheck_CustomHealthCheck `protobuf:"bytes,13,opt,name=custom_health_check,json=customHealthCheck,proto3,oneof"` -} - -func (*HealthCheck_HttpHealthCheck_) isHealthCheck_HealthChecker() {} - -func (*HealthCheck_TcpHealthCheck_) isHealthCheck_HealthChecker() {} - -func (*HealthCheck_GrpcHealthCheck_) isHealthCheck_HealthChecker() {} - -func (*HealthCheck_CustomHealthCheck_) isHealthCheck_HealthChecker() {} - -func (m *HealthCheck) GetHealthChecker() isHealthCheck_HealthChecker { - if m != nil { - return m.HealthChecker - } - return nil -} - -func (m *HealthCheck) GetHttpHealthCheck() *HealthCheck_HttpHealthCheck { - if x, ok := m.GetHealthChecker().(*HealthCheck_HttpHealthCheck_); ok { - return x.HttpHealthCheck - } - return nil -} - -func (m *HealthCheck) GetTcpHealthCheck() *HealthCheck_TcpHealthCheck { - if x, ok := m.GetHealthChecker().(*HealthCheck_TcpHealthCheck_); ok { - return x.TcpHealthCheck - } - return nil -} - -func (m *HealthCheck) GetGrpcHealthCheck() *HealthCheck_GrpcHealthCheck { - if x, ok := m.GetHealthChecker().(*HealthCheck_GrpcHealthCheck_); ok { - return x.GrpcHealthCheck - } - return nil -} - -func (m *HealthCheck) GetCustomHealthCheck() *HealthCheck_CustomHealthCheck { - if x, ok := m.GetHealthChecker().(*HealthCheck_CustomHealthCheck_); ok { - return x.CustomHealthCheck - } - return nil -} - -func (m *HealthCheck) GetNoTrafficInterval() *duration.Duration { - if m != nil { - return m.NoTrafficInterval - } - return nil -} - -func (m *HealthCheck) GetUnhealthyInterval() *duration.Duration { - if m != nil { - return m.UnhealthyInterval - } - return nil -} - -func (m *HealthCheck) GetUnhealthyEdgeInterval() *duration.Duration { - if m != nil { - return m.UnhealthyEdgeInterval - } - return nil -} - -func (m *HealthCheck) GetHealthyEdgeInterval() *duration.Duration { - if m != nil { - return m.HealthyEdgeInterval - } - return nil -} - -func (m *HealthCheck) GetEventLogPath() string { - if m != nil { - return m.EventLogPath - } - return "" -} - -func (m *HealthCheck) GetAlwaysLogHealthCheckFailures() bool { - if m != nil { - return m.AlwaysLogHealthCheckFailures - } - return false -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*HealthCheck) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _HealthCheck_OneofMarshaler, _HealthCheck_OneofUnmarshaler, _HealthCheck_OneofSizer, []interface{}{ - (*HealthCheck_HttpHealthCheck_)(nil), - (*HealthCheck_TcpHealthCheck_)(nil), - (*HealthCheck_GrpcHealthCheck_)(nil), - (*HealthCheck_CustomHealthCheck_)(nil), - } -} - -func _HealthCheck_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*HealthCheck) - // health_checker - switch x := m.HealthChecker.(type) { - case *HealthCheck_HttpHealthCheck_: - b.EncodeVarint(8<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.HttpHealthCheck); err != nil { - return err - } - case *HealthCheck_TcpHealthCheck_: - b.EncodeVarint(9<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.TcpHealthCheck); err != nil { - return err - } - case *HealthCheck_GrpcHealthCheck_: - b.EncodeVarint(11<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.GrpcHealthCheck); err != nil { - return err - } - case *HealthCheck_CustomHealthCheck_: - b.EncodeVarint(13<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.CustomHealthCheck); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("HealthCheck.HealthChecker has unexpected type %T", x) - } - return nil -} - -func _HealthCheck_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*HealthCheck) - switch tag { - case 8: // health_checker.http_health_check - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(HealthCheck_HttpHealthCheck) - err := b.DecodeMessage(msg) - m.HealthChecker = &HealthCheck_HttpHealthCheck_{msg} - return true, err - case 9: // health_checker.tcp_health_check - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(HealthCheck_TcpHealthCheck) - err := b.DecodeMessage(msg) - m.HealthChecker = &HealthCheck_TcpHealthCheck_{msg} - return true, err - case 11: // health_checker.grpc_health_check - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(HealthCheck_GrpcHealthCheck) - err := b.DecodeMessage(msg) - m.HealthChecker = &HealthCheck_GrpcHealthCheck_{msg} - return true, err - case 13: // health_checker.custom_health_check - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(HealthCheck_CustomHealthCheck) - err := b.DecodeMessage(msg) - m.HealthChecker = &HealthCheck_CustomHealthCheck_{msg} - return true, err - default: - return false, nil - } -} - -func _HealthCheck_OneofSizer(msg proto.Message) (n int) { - m := msg.(*HealthCheck) - // health_checker - switch x := m.HealthChecker.(type) { - case *HealthCheck_HttpHealthCheck_: - s := proto.Size(x.HttpHealthCheck) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *HealthCheck_TcpHealthCheck_: - s := proto.Size(x.TcpHealthCheck) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *HealthCheck_GrpcHealthCheck_: - s := proto.Size(x.GrpcHealthCheck) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *HealthCheck_CustomHealthCheck_: - s := proto.Size(x.CustomHealthCheck) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type HealthCheck_Payload struct { - // Types that are valid to be assigned to Payload: - // *HealthCheck_Payload_Text - // *HealthCheck_Payload_Binary - Payload isHealthCheck_Payload_Payload `protobuf_oneof:"payload"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HealthCheck_Payload) Reset() { *m = HealthCheck_Payload{} } -func (m *HealthCheck_Payload) String() string { return proto.CompactTextString(m) } -func (*HealthCheck_Payload) ProtoMessage() {} -func (*HealthCheck_Payload) Descriptor() ([]byte, []int) { - return fileDescriptor_health_check_0d3155ea06758d89, []int{0, 0} -} -func (m *HealthCheck_Payload) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HealthCheck_Payload.Unmarshal(m, b) -} -func (m *HealthCheck_Payload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HealthCheck_Payload.Marshal(b, m, deterministic) -} -func (dst *HealthCheck_Payload) XXX_Merge(src proto.Message) { - xxx_messageInfo_HealthCheck_Payload.Merge(dst, src) -} -func (m *HealthCheck_Payload) XXX_Size() int { - return xxx_messageInfo_HealthCheck_Payload.Size(m) -} -func (m *HealthCheck_Payload) XXX_DiscardUnknown() { - xxx_messageInfo_HealthCheck_Payload.DiscardUnknown(m) -} - -var xxx_messageInfo_HealthCheck_Payload proto.InternalMessageInfo - -type isHealthCheck_Payload_Payload interface { - isHealthCheck_Payload_Payload() -} - -type HealthCheck_Payload_Text struct { - Text string `protobuf:"bytes,1,opt,name=text,proto3,oneof"` -} - -type HealthCheck_Payload_Binary struct { - Binary []byte `protobuf:"bytes,2,opt,name=binary,proto3,oneof"` -} - -func (*HealthCheck_Payload_Text) isHealthCheck_Payload_Payload() {} - -func (*HealthCheck_Payload_Binary) isHealthCheck_Payload_Payload() {} - -func (m *HealthCheck_Payload) GetPayload() isHealthCheck_Payload_Payload { - if m != nil { - return m.Payload - } - return nil -} - -func (m *HealthCheck_Payload) GetText() string { - if x, ok := m.GetPayload().(*HealthCheck_Payload_Text); ok { - return x.Text - } - return "" -} - -func (m *HealthCheck_Payload) GetBinary() []byte { - if x, ok := m.GetPayload().(*HealthCheck_Payload_Binary); ok { - return x.Binary - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*HealthCheck_Payload) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _HealthCheck_Payload_OneofMarshaler, _HealthCheck_Payload_OneofUnmarshaler, _HealthCheck_Payload_OneofSizer, []interface{}{ - (*HealthCheck_Payload_Text)(nil), - (*HealthCheck_Payload_Binary)(nil), - } -} - -func _HealthCheck_Payload_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*HealthCheck_Payload) - // payload - switch x := m.Payload.(type) { - case *HealthCheck_Payload_Text: - b.EncodeVarint(1<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Text) - case *HealthCheck_Payload_Binary: - b.EncodeVarint(2<<3 | proto.WireBytes) - b.EncodeRawBytes(x.Binary) - case nil: - default: - return fmt.Errorf("HealthCheck_Payload.Payload has unexpected type %T", x) - } - return nil -} - -func _HealthCheck_Payload_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*HealthCheck_Payload) - switch tag { - case 1: // payload.text - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Payload = &HealthCheck_Payload_Text{x} - return true, err - case 2: // payload.binary - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeRawBytes(true) - m.Payload = &HealthCheck_Payload_Binary{x} - return true, err - default: - return false, nil - } -} - -func _HealthCheck_Payload_OneofSizer(msg proto.Message) (n int) { - m := msg.(*HealthCheck_Payload) - // payload - switch x := m.Payload.(type) { - case *HealthCheck_Payload_Text: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Text))) - n += len(x.Text) - case *HealthCheck_Payload_Binary: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Binary))) - n += len(x.Binary) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type HealthCheck_HttpHealthCheck struct { - Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` - Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` - Send *HealthCheck_Payload `protobuf:"bytes,3,opt,name=send,proto3" json:"send,omitempty"` - Receive *HealthCheck_Payload `protobuf:"bytes,4,opt,name=receive,proto3" json:"receive,omitempty"` - ServiceName string `protobuf:"bytes,5,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` - RequestHeadersToAdd []*base.HeaderValueOption `protobuf:"bytes,6,rep,name=request_headers_to_add,json=requestHeadersToAdd,proto3" json:"request_headers_to_add,omitempty"` - RequestHeadersToRemove []string `protobuf:"bytes,8,rep,name=request_headers_to_remove,json=requestHeadersToRemove,proto3" json:"request_headers_to_remove,omitempty"` - UseHttp2 bool `protobuf:"varint,7,opt,name=use_http2,json=useHttp2,proto3" json:"use_http2,omitempty"` - ExpectedStatuses []*_range.Int64Range `protobuf:"bytes,9,rep,name=expected_statuses,json=expectedStatuses,proto3" json:"expected_statuses,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HealthCheck_HttpHealthCheck) Reset() { *m = HealthCheck_HttpHealthCheck{} } -func (m *HealthCheck_HttpHealthCheck) String() string { return proto.CompactTextString(m) } -func (*HealthCheck_HttpHealthCheck) ProtoMessage() {} -func (*HealthCheck_HttpHealthCheck) Descriptor() ([]byte, []int) { - return fileDescriptor_health_check_0d3155ea06758d89, []int{0, 1} -} -func (m *HealthCheck_HttpHealthCheck) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HealthCheck_HttpHealthCheck.Unmarshal(m, b) -} -func (m *HealthCheck_HttpHealthCheck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HealthCheck_HttpHealthCheck.Marshal(b, m, deterministic) -} -func (dst *HealthCheck_HttpHealthCheck) XXX_Merge(src proto.Message) { - xxx_messageInfo_HealthCheck_HttpHealthCheck.Merge(dst, src) -} -func (m *HealthCheck_HttpHealthCheck) XXX_Size() int { - return xxx_messageInfo_HealthCheck_HttpHealthCheck.Size(m) -} -func (m *HealthCheck_HttpHealthCheck) XXX_DiscardUnknown() { - xxx_messageInfo_HealthCheck_HttpHealthCheck.DiscardUnknown(m) -} - -var xxx_messageInfo_HealthCheck_HttpHealthCheck proto.InternalMessageInfo - -func (m *HealthCheck_HttpHealthCheck) GetHost() string { - if m != nil { - return m.Host - } - return "" -} - -func (m *HealthCheck_HttpHealthCheck) GetPath() string { - if m != nil { - return m.Path - } - return "" -} - -func (m *HealthCheck_HttpHealthCheck) GetSend() *HealthCheck_Payload { - if m != nil { - return m.Send - } - return nil -} - -func (m *HealthCheck_HttpHealthCheck) GetReceive() *HealthCheck_Payload { - if m != nil { - return m.Receive - } - return nil -} - -func (m *HealthCheck_HttpHealthCheck) GetServiceName() string { - if m != nil { - return m.ServiceName - } - return "" -} - -func (m *HealthCheck_HttpHealthCheck) GetRequestHeadersToAdd() []*base.HeaderValueOption { - if m != nil { - return m.RequestHeadersToAdd - } - return nil -} - -func (m *HealthCheck_HttpHealthCheck) GetRequestHeadersToRemove() []string { - if m != nil { - return m.RequestHeadersToRemove - } - return nil -} - -func (m *HealthCheck_HttpHealthCheck) GetUseHttp2() bool { - if m != nil { - return m.UseHttp2 - } - return false -} - -func (m *HealthCheck_HttpHealthCheck) GetExpectedStatuses() []*_range.Int64Range { - if m != nil { - return m.ExpectedStatuses - } - return nil -} - -type HealthCheck_TcpHealthCheck struct { - Send *HealthCheck_Payload `protobuf:"bytes,1,opt,name=send,proto3" json:"send,omitempty"` - Receive []*HealthCheck_Payload `protobuf:"bytes,2,rep,name=receive,proto3" json:"receive,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HealthCheck_TcpHealthCheck) Reset() { *m = HealthCheck_TcpHealthCheck{} } -func (m *HealthCheck_TcpHealthCheck) String() string { return proto.CompactTextString(m) } -func (*HealthCheck_TcpHealthCheck) ProtoMessage() {} -func (*HealthCheck_TcpHealthCheck) Descriptor() ([]byte, []int) { - return fileDescriptor_health_check_0d3155ea06758d89, []int{0, 2} -} -func (m *HealthCheck_TcpHealthCheck) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HealthCheck_TcpHealthCheck.Unmarshal(m, b) -} -func (m *HealthCheck_TcpHealthCheck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HealthCheck_TcpHealthCheck.Marshal(b, m, deterministic) -} -func (dst *HealthCheck_TcpHealthCheck) XXX_Merge(src proto.Message) { - xxx_messageInfo_HealthCheck_TcpHealthCheck.Merge(dst, src) -} -func (m *HealthCheck_TcpHealthCheck) XXX_Size() int { - return xxx_messageInfo_HealthCheck_TcpHealthCheck.Size(m) -} -func (m *HealthCheck_TcpHealthCheck) XXX_DiscardUnknown() { - xxx_messageInfo_HealthCheck_TcpHealthCheck.DiscardUnknown(m) -} - -var xxx_messageInfo_HealthCheck_TcpHealthCheck proto.InternalMessageInfo - -func (m *HealthCheck_TcpHealthCheck) GetSend() *HealthCheck_Payload { - if m != nil { - return m.Send - } - return nil -} - -func (m *HealthCheck_TcpHealthCheck) GetReceive() []*HealthCheck_Payload { - if m != nil { - return m.Receive - } - return nil -} - -type HealthCheck_RedisHealthCheck struct { - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HealthCheck_RedisHealthCheck) Reset() { *m = HealthCheck_RedisHealthCheck{} } -func (m *HealthCheck_RedisHealthCheck) String() string { return proto.CompactTextString(m) } -func (*HealthCheck_RedisHealthCheck) ProtoMessage() {} -func (*HealthCheck_RedisHealthCheck) Descriptor() ([]byte, []int) { - return fileDescriptor_health_check_0d3155ea06758d89, []int{0, 3} -} -func (m *HealthCheck_RedisHealthCheck) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HealthCheck_RedisHealthCheck.Unmarshal(m, b) -} -func (m *HealthCheck_RedisHealthCheck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HealthCheck_RedisHealthCheck.Marshal(b, m, deterministic) -} -func (dst *HealthCheck_RedisHealthCheck) XXX_Merge(src proto.Message) { - xxx_messageInfo_HealthCheck_RedisHealthCheck.Merge(dst, src) -} -func (m *HealthCheck_RedisHealthCheck) XXX_Size() int { - return xxx_messageInfo_HealthCheck_RedisHealthCheck.Size(m) -} -func (m *HealthCheck_RedisHealthCheck) XXX_DiscardUnknown() { - xxx_messageInfo_HealthCheck_RedisHealthCheck.DiscardUnknown(m) -} - -var xxx_messageInfo_HealthCheck_RedisHealthCheck proto.InternalMessageInfo - -func (m *HealthCheck_RedisHealthCheck) GetKey() string { - if m != nil { - return m.Key - } - return "" -} - -type HealthCheck_GrpcHealthCheck struct { - ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` - Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HealthCheck_GrpcHealthCheck) Reset() { *m = HealthCheck_GrpcHealthCheck{} } -func (m *HealthCheck_GrpcHealthCheck) String() string { return proto.CompactTextString(m) } -func (*HealthCheck_GrpcHealthCheck) ProtoMessage() {} -func (*HealthCheck_GrpcHealthCheck) Descriptor() ([]byte, []int) { - return fileDescriptor_health_check_0d3155ea06758d89, []int{0, 4} -} -func (m *HealthCheck_GrpcHealthCheck) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HealthCheck_GrpcHealthCheck.Unmarshal(m, b) -} -func (m *HealthCheck_GrpcHealthCheck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HealthCheck_GrpcHealthCheck.Marshal(b, m, deterministic) -} -func (dst *HealthCheck_GrpcHealthCheck) XXX_Merge(src proto.Message) { - xxx_messageInfo_HealthCheck_GrpcHealthCheck.Merge(dst, src) -} -func (m *HealthCheck_GrpcHealthCheck) XXX_Size() int { - return xxx_messageInfo_HealthCheck_GrpcHealthCheck.Size(m) -} -func (m *HealthCheck_GrpcHealthCheck) XXX_DiscardUnknown() { - xxx_messageInfo_HealthCheck_GrpcHealthCheck.DiscardUnknown(m) -} - -var xxx_messageInfo_HealthCheck_GrpcHealthCheck proto.InternalMessageInfo - -func (m *HealthCheck_GrpcHealthCheck) GetServiceName() string { - if m != nil { - return m.ServiceName - } - return "" -} - -func (m *HealthCheck_GrpcHealthCheck) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - -type HealthCheck_CustomHealthCheck struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Types that are valid to be assigned to ConfigType: - // *HealthCheck_CustomHealthCheck_Config - // *HealthCheck_CustomHealthCheck_TypedConfig - ConfigType isHealthCheck_CustomHealthCheck_ConfigType `protobuf_oneof:"config_type"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HealthCheck_CustomHealthCheck) Reset() { *m = HealthCheck_CustomHealthCheck{} } -func (m *HealthCheck_CustomHealthCheck) String() string { return proto.CompactTextString(m) } -func (*HealthCheck_CustomHealthCheck) ProtoMessage() {} -func (*HealthCheck_CustomHealthCheck) Descriptor() ([]byte, []int) { - return fileDescriptor_health_check_0d3155ea06758d89, []int{0, 5} -} -func (m *HealthCheck_CustomHealthCheck) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HealthCheck_CustomHealthCheck.Unmarshal(m, b) -} -func (m *HealthCheck_CustomHealthCheck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HealthCheck_CustomHealthCheck.Marshal(b, m, deterministic) -} -func (dst *HealthCheck_CustomHealthCheck) XXX_Merge(src proto.Message) { - xxx_messageInfo_HealthCheck_CustomHealthCheck.Merge(dst, src) -} -func (m *HealthCheck_CustomHealthCheck) XXX_Size() int { - return xxx_messageInfo_HealthCheck_CustomHealthCheck.Size(m) -} -func (m *HealthCheck_CustomHealthCheck) XXX_DiscardUnknown() { - xxx_messageInfo_HealthCheck_CustomHealthCheck.DiscardUnknown(m) -} - -var xxx_messageInfo_HealthCheck_CustomHealthCheck proto.InternalMessageInfo - -func (m *HealthCheck_CustomHealthCheck) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -type isHealthCheck_CustomHealthCheck_ConfigType interface { - isHealthCheck_CustomHealthCheck_ConfigType() -} - -type HealthCheck_CustomHealthCheck_Config struct { - Config *_struct.Struct `protobuf:"bytes,2,opt,name=config,proto3,oneof"` -} - -type HealthCheck_CustomHealthCheck_TypedConfig struct { - TypedConfig *any.Any `protobuf:"bytes,3,opt,name=typed_config,json=typedConfig,proto3,oneof"` -} - -func (*HealthCheck_CustomHealthCheck_Config) isHealthCheck_CustomHealthCheck_ConfigType() {} - -func (*HealthCheck_CustomHealthCheck_TypedConfig) isHealthCheck_CustomHealthCheck_ConfigType() {} - -func (m *HealthCheck_CustomHealthCheck) GetConfigType() isHealthCheck_CustomHealthCheck_ConfigType { - if m != nil { - return m.ConfigType - } - return nil -} - -func (m *HealthCheck_CustomHealthCheck) GetConfig() *_struct.Struct { - if x, ok := m.GetConfigType().(*HealthCheck_CustomHealthCheck_Config); ok { - return x.Config - } - return nil -} - -func (m *HealthCheck_CustomHealthCheck) GetTypedConfig() *any.Any { - if x, ok := m.GetConfigType().(*HealthCheck_CustomHealthCheck_TypedConfig); ok { - return x.TypedConfig - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*HealthCheck_CustomHealthCheck) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _HealthCheck_CustomHealthCheck_OneofMarshaler, _HealthCheck_CustomHealthCheck_OneofUnmarshaler, _HealthCheck_CustomHealthCheck_OneofSizer, []interface{}{ - (*HealthCheck_CustomHealthCheck_Config)(nil), - (*HealthCheck_CustomHealthCheck_TypedConfig)(nil), - } -} - -func _HealthCheck_CustomHealthCheck_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*HealthCheck_CustomHealthCheck) - // config_type - switch x := m.ConfigType.(type) { - case *HealthCheck_CustomHealthCheck_Config: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Config); err != nil { - return err - } - case *HealthCheck_CustomHealthCheck_TypedConfig: - b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.TypedConfig); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("HealthCheck_CustomHealthCheck.ConfigType has unexpected type %T", x) - } - return nil -} - -func _HealthCheck_CustomHealthCheck_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*HealthCheck_CustomHealthCheck) - switch tag { - case 2: // config_type.config - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(_struct.Struct) - err := b.DecodeMessage(msg) - m.ConfigType = &HealthCheck_CustomHealthCheck_Config{msg} - return true, err - case 3: // config_type.typed_config - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(any.Any) - err := b.DecodeMessage(msg) - m.ConfigType = &HealthCheck_CustomHealthCheck_TypedConfig{msg} - return true, err - default: - return false, nil - } -} - -func _HealthCheck_CustomHealthCheck_OneofSizer(msg proto.Message) (n int) { - m := msg.(*HealthCheck_CustomHealthCheck) - // config_type - switch x := m.ConfigType.(type) { - case *HealthCheck_CustomHealthCheck_Config: - s := proto.Size(x.Config) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *HealthCheck_CustomHealthCheck_TypedConfig: - s := proto.Size(x.TypedConfig) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -func init() { - proto.RegisterType((*HealthCheck)(nil), "envoy.api.v2.core.HealthCheck") - proto.RegisterType((*HealthCheck_Payload)(nil), "envoy.api.v2.core.HealthCheck.Payload") - proto.RegisterType((*HealthCheck_HttpHealthCheck)(nil), "envoy.api.v2.core.HealthCheck.HttpHealthCheck") - proto.RegisterType((*HealthCheck_TcpHealthCheck)(nil), "envoy.api.v2.core.HealthCheck.TcpHealthCheck") - proto.RegisterType((*HealthCheck_RedisHealthCheck)(nil), "envoy.api.v2.core.HealthCheck.RedisHealthCheck") - proto.RegisterType((*HealthCheck_GrpcHealthCheck)(nil), "envoy.api.v2.core.HealthCheck.GrpcHealthCheck") - proto.RegisterType((*HealthCheck_CustomHealthCheck)(nil), "envoy.api.v2.core.HealthCheck.CustomHealthCheck") - proto.RegisterEnum("envoy.api.v2.core.HealthStatus", HealthStatus_name, HealthStatus_value) -} - -func init() { - proto.RegisterFile("envoy/api/v2/core/health_check.proto", fileDescriptor_health_check_0d3155ea06758d89) -} - -var fileDescriptor_health_check_0d3155ea06758d89 = []byte{ - // 1184 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x96, 0xcf, 0x6e, 0xdb, 0xc6, - 0x13, 0xc7, 0x45, 0x4b, 0xb6, 0xa4, 0x91, 0x2c, 0x53, 0xab, 0xc4, 0x66, 0xf4, 0xf3, 0xaf, 0x51, - 0x0b, 0xa3, 0x30, 0x02, 0x54, 0x6a, 0x95, 0x36, 0x45, 0x7a, 0x8a, 0x65, 0x3b, 0x91, 0xd2, 0x44, - 0x31, 0x36, 0x72, 0x8a, 0x00, 0x2d, 0xd8, 0x35, 0x39, 0x96, 0xd8, 0xd0, 0x5c, 0x76, 0xb9, 0x54, - 0xac, 0x97, 0xe8, 0xa1, 0x8f, 0x91, 0x4b, 0xaf, 0x45, 0x4f, 0x79, 0x9c, 0xa6, 0xc7, 0x3e, 0x41, - 0xc1, 0x25, 0x25, 0x4b, 0xa2, 0x0b, 0xdb, 0xe8, 0x8d, 0x9c, 0x99, 0xef, 0x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- 0x30, 0x6a, 0x0d, 0x6d, 0xb7, 0x40, 0xb7, 0xe3, 0xb8, 0x67, 0x7c, 0x38, 0x57, 0xcc, 0xc7, 0x49, - 0x4c, 0xfd, 0x15, 0xe4, 0x8f, 0xd8, 0xc4, 0xe5, 0xcc, 0x26, 0x77, 0x21, 0x27, 0xf1, 0x3c, 0xde, - 0xdb, 0xc5, 0x4e, 0x31, 0xca, 0x33, 0x27, 0x56, 0x1a, 0x5a, 0x37, 0x43, 0x95, 0x83, 0x18, 0xb0, - 0x76, 0xe2, 0x78, 0x4c, 0x4c, 0xd4, 0x5a, 0x2e, 0x77, 0x33, 0x34, 0x79, 0xef, 0xe8, 0x90, 0xf7, - 0x13, 0xca, 0xea, 0xef, 0x1f, 0xde, 0x67, 0xb5, 0xfa, 0x5f, 0x59, 0xd8, 0x58, 0x1a, 0x38, 0x42, - 0x20, 0x37, 0xe2, 0x41, 0x72, 0x00, 0x55, 0xcf, 0xe4, 0xff, 0x90, 0x53, 0x77, 0x5c, 0x59, 0x3a, - 0x94, 0x2a, 0x33, 0xf9, 0x06, 0x72, 0x01, 0x7a, 0x76, 0xb2, 0x79, 0x3f, 0xbd, 0xa2, 0x91, 0x93, - 0x9b, 0x50, 0xa5, 0x21, 0x8f, 0x20, 0x2f, 0xd0, 0x42, 0x67, 0x8c, 0xc9, 0xe2, 0xbc, 0xae, 0x7c, - 0x2a, 0x23, 0x1f, 0x43, 0x39, 0x40, 0x31, 0x76, 0x2c, 0x34, 0x3d, 0x76, 0x86, 0x6a, 0x65, 0x16, - 0x69, 0x29, 0xb1, 0xf5, 0xd9, 0x19, 0x92, 0x53, 0xd8, 0x14, 0xf8, 0x73, 0x88, 0x81, 0x8c, 0x8a, - 0x60, 0xa3, 0x08, 0x4c, 0xc9, 0x4d, 0x66, 0xdb, 0xc6, 0x5a, 0x23, 0xbb, 0x5b, 0x6a, 0xef, 0x5c, - 0x7e, 0xa6, 0x8d, 0x42, 0x2d, 0xb8, 0x17, 0xbe, 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, - 0xbf, 0xb3, 0x95, 0x5a, 0x1f, 0x2f, 0xd5, 0xcf, 0x5a, 0x34, 0x71, 0x71, 0x20, 0x79, 0x08, 0xe5, - 0xa8, 0x2e, 0xb6, 0x99, 0x08, 0xe3, 0x01, 0xb9, 0x95, 0x12, 0xee, 0x79, 0x93, 0x6e, 0x86, 0x96, - 0x54, 0xec, 0xbe, 0x0a, 0xed, 0xac, 0x43, 0x29, 0x16, 0x99, 0x91, 0xb5, 0xb3, 0x05, 0x95, 0xf9, - 0xf5, 0x81, 0x22, 0x19, 0xe1, 0xa7, 0xb9, 0x02, 0xe8, 0x25, 0x4a, 0x44, 0xf4, 0x21, 0x17, 0x36, - 0xcc, 0xbd, 0x1f, 0xa1, 0x1c, 0xdf, 0x2e, 0xee, 0x00, 0x52, 0x82, 0xfc, 0x71, 0xff, 0xdb, 0xfe, - 0x8b, 0xef, 0xfa, 0x7a, 0x26, 0x7a, 0xe9, 0x1e, 0xee, 0x3d, 0x1b, 0x74, 0x5f, 0xeb, 0x1a, 0x59, - 0x87, 0xe2, 0x71, 0x7f, 0xfa, 0xba, 0x42, 0xca, 0x50, 0x38, 0xa0, 0x7b, 0xbd, 0x7e, 0xaf, 0xff, - 0x44, 0xcf, 0x46, 0x91, 0x83, 0xde, 0xf3, 0xc3, 0x17, 0xc7, 0x03, 0x3d, 0xa7, 0x5c, 0x87, 0x4f, - 0xe8, 0xde, 0xc1, 0xe1, 0x81, 0xbe, 0xda, 0xf9, 0x0a, 0xee, 0x3a, 0x3c, 0xae, 0xba, 0x2f, 0xf8, - 0xf9, 0x24, 0xdd, 0x00, 0x1d, 0x7d, 0xee, 0x03, 0x1f, 0x45, 0xd7, 0x3d, 0xd2, 0x4e, 0xd6, 0xd4, - 0xbd, 0xef, 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0xd3, 0xe4, 0xc6, 0x74, 0x97, 0x0b, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/protocol/protocol.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/protocol/protocol.pb.go deleted file mode 100755 index d70628680fd..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/protocol/protocol.pb.go +++ /dev/null @@ -1,311 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: envoy/api/v2/core/protocol.proto - -package envoy_api_v2_core - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import duration "github.com/golang/protobuf/ptypes/duration" -import wrappers "github.com/golang/protobuf/ptypes/wrappers" -import _ "google.golang.org/grpc/xds/internal/proto/validate" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type TcpProtocolOptions struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TcpProtocolOptions) Reset() { *m = TcpProtocolOptions{} } -func (m *TcpProtocolOptions) String() string { return proto.CompactTextString(m) } -func (*TcpProtocolOptions) ProtoMessage() {} -func (*TcpProtocolOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_protocol_2e969372c85b867d, []int{0} -} -func (m *TcpProtocolOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TcpProtocolOptions.Unmarshal(m, b) -} -func (m *TcpProtocolOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TcpProtocolOptions.Marshal(b, m, deterministic) -} -func (dst *TcpProtocolOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_TcpProtocolOptions.Merge(dst, src) -} -func (m *TcpProtocolOptions) XXX_Size() int { - return xxx_messageInfo_TcpProtocolOptions.Size(m) -} -func (m *TcpProtocolOptions) XXX_DiscardUnknown() { - xxx_messageInfo_TcpProtocolOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_TcpProtocolOptions proto.InternalMessageInfo - -type HttpProtocolOptions struct { - IdleTimeout *duration.Duration `protobuf:"bytes,1,opt,name=idle_timeout,json=idleTimeout,proto3" json:"idle_timeout,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HttpProtocolOptions) Reset() { *m = HttpProtocolOptions{} } -func (m *HttpProtocolOptions) String() string { return proto.CompactTextString(m) } -func (*HttpProtocolOptions) ProtoMessage() {} -func (*HttpProtocolOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_protocol_2e969372c85b867d, []int{1} -} -func (m *HttpProtocolOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HttpProtocolOptions.Unmarshal(m, b) -} -func (m *HttpProtocolOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HttpProtocolOptions.Marshal(b, m, deterministic) -} -func (dst *HttpProtocolOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_HttpProtocolOptions.Merge(dst, src) -} -func (m *HttpProtocolOptions) XXX_Size() int { - return xxx_messageInfo_HttpProtocolOptions.Size(m) -} -func (m *HttpProtocolOptions) XXX_DiscardUnknown() { - xxx_messageInfo_HttpProtocolOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_HttpProtocolOptions proto.InternalMessageInfo - -func (m *HttpProtocolOptions) GetIdleTimeout() *duration.Duration { - if m != nil { - return m.IdleTimeout - } - return nil -} - -type Http1ProtocolOptions struct { - AllowAbsoluteUrl *wrappers.BoolValue `protobuf:"bytes,1,opt,name=allow_absolute_url,json=allowAbsoluteUrl,proto3" json:"allow_absolute_url,omitempty"` - AcceptHttp_10 bool `protobuf:"varint,2,opt,name=accept_http_10,json=acceptHttp10,proto3" json:"accept_http_10,omitempty"` - DefaultHostForHttp_10 string `protobuf:"bytes,3,opt,name=default_host_for_http_10,json=defaultHostForHttp10,proto3" json:"default_host_for_http_10,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Http1ProtocolOptions) Reset() { *m = Http1ProtocolOptions{} } -func (m *Http1ProtocolOptions) String() string { return proto.CompactTextString(m) } -func (*Http1ProtocolOptions) ProtoMessage() {} -func (*Http1ProtocolOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_protocol_2e969372c85b867d, []int{2} -} -func (m *Http1ProtocolOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Http1ProtocolOptions.Unmarshal(m, b) -} -func (m *Http1ProtocolOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Http1ProtocolOptions.Marshal(b, m, deterministic) -} -func (dst *Http1ProtocolOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_Http1ProtocolOptions.Merge(dst, src) -} -func (m *Http1ProtocolOptions) XXX_Size() int { - return xxx_messageInfo_Http1ProtocolOptions.Size(m) -} -func (m *Http1ProtocolOptions) XXX_DiscardUnknown() { - xxx_messageInfo_Http1ProtocolOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_Http1ProtocolOptions proto.InternalMessageInfo - -func (m *Http1ProtocolOptions) GetAllowAbsoluteUrl() *wrappers.BoolValue { - if m != nil { - return m.AllowAbsoluteUrl - } - return nil -} - -func (m *Http1ProtocolOptions) GetAcceptHttp_10() bool { - if m != nil { - return m.AcceptHttp_10 - } - return false -} - -func (m *Http1ProtocolOptions) GetDefaultHostForHttp_10() string { - if m != nil { - return m.DefaultHostForHttp_10 - } - return "" -} - -type Http2ProtocolOptions struct { - HpackTableSize *wrappers.UInt32Value `protobuf:"bytes,1,opt,name=hpack_table_size,json=hpackTableSize,proto3" json:"hpack_table_size,omitempty"` - MaxConcurrentStreams *wrappers.UInt32Value `protobuf:"bytes,2,opt,name=max_concurrent_streams,json=maxConcurrentStreams,proto3" json:"max_concurrent_streams,omitempty"` - InitialStreamWindowSize *wrappers.UInt32Value `protobuf:"bytes,3,opt,name=initial_stream_window_size,json=initialStreamWindowSize,proto3" json:"initial_stream_window_size,omitempty"` - InitialConnectionWindowSize *wrappers.UInt32Value `protobuf:"bytes,4,opt,name=initial_connection_window_size,json=initialConnectionWindowSize,proto3" json:"initial_connection_window_size,omitempty"` - AllowConnect bool `protobuf:"varint,5,opt,name=allow_connect,json=allowConnect,proto3" json:"allow_connect,omitempty"` - AllowMetadata bool `protobuf:"varint,6,opt,name=allow_metadata,json=allowMetadata,proto3" json:"allow_metadata,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Http2ProtocolOptions) Reset() { *m = Http2ProtocolOptions{} } -func (m *Http2ProtocolOptions) String() string { return proto.CompactTextString(m) } -func (*Http2ProtocolOptions) ProtoMessage() {} -func (*Http2ProtocolOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_protocol_2e969372c85b867d, []int{3} -} -func (m *Http2ProtocolOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Http2ProtocolOptions.Unmarshal(m, b) -} -func (m *Http2ProtocolOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Http2ProtocolOptions.Marshal(b, m, deterministic) -} -func (dst *Http2ProtocolOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_Http2ProtocolOptions.Merge(dst, src) -} -func (m *Http2ProtocolOptions) XXX_Size() int { - return xxx_messageInfo_Http2ProtocolOptions.Size(m) -} -func (m *Http2ProtocolOptions) XXX_DiscardUnknown() { - xxx_messageInfo_Http2ProtocolOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_Http2ProtocolOptions proto.InternalMessageInfo - -func (m *Http2ProtocolOptions) GetHpackTableSize() *wrappers.UInt32Value { - if m != nil { - return m.HpackTableSize - } - return nil -} - -func (m *Http2ProtocolOptions) GetMaxConcurrentStreams() *wrappers.UInt32Value { - if m != nil { - return m.MaxConcurrentStreams - } - return nil -} - -func (m *Http2ProtocolOptions) GetInitialStreamWindowSize() *wrappers.UInt32Value { - if m != nil { - return m.InitialStreamWindowSize - } - return nil -} - -func (m *Http2ProtocolOptions) GetInitialConnectionWindowSize() *wrappers.UInt32Value { - if m != nil { - return m.InitialConnectionWindowSize - } - return nil -} - -func (m *Http2ProtocolOptions) GetAllowConnect() bool { - if m != nil { - return m.AllowConnect - } - return false -} - -func (m *Http2ProtocolOptions) GetAllowMetadata() bool { - if m != nil { - return m.AllowMetadata - } - return false -} - -type GrpcProtocolOptions struct { - Http2ProtocolOptions *Http2ProtocolOptions `protobuf:"bytes,1,opt,name=http2_protocol_options,json=http2ProtocolOptions,proto3" json:"http2_protocol_options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GrpcProtocolOptions) Reset() { *m = GrpcProtocolOptions{} } -func (m *GrpcProtocolOptions) String() string { return proto.CompactTextString(m) } -func (*GrpcProtocolOptions) ProtoMessage() {} -func (*GrpcProtocolOptions) Descriptor() ([]byte, []int) { - return fileDescriptor_protocol_2e969372c85b867d, []int{4} -} -func (m *GrpcProtocolOptions) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GrpcProtocolOptions.Unmarshal(m, b) -} -func (m *GrpcProtocolOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GrpcProtocolOptions.Marshal(b, m, deterministic) -} -func (dst *GrpcProtocolOptions) XXX_Merge(src proto.Message) { - xxx_messageInfo_GrpcProtocolOptions.Merge(dst, src) -} -func (m *GrpcProtocolOptions) XXX_Size() int { - return xxx_messageInfo_GrpcProtocolOptions.Size(m) -} -func (m *GrpcProtocolOptions) XXX_DiscardUnknown() { - xxx_messageInfo_GrpcProtocolOptions.DiscardUnknown(m) -} - -var xxx_messageInfo_GrpcProtocolOptions proto.InternalMessageInfo - -func (m *GrpcProtocolOptions) GetHttp2ProtocolOptions() *Http2ProtocolOptions { - if m != nil { - return m.Http2ProtocolOptions - } - return nil -} - -func init() { - proto.RegisterType((*TcpProtocolOptions)(nil), "envoy.api.v2.core.TcpProtocolOptions") - proto.RegisterType((*HttpProtocolOptions)(nil), "envoy.api.v2.core.HttpProtocolOptions") - proto.RegisterType((*Http1ProtocolOptions)(nil), "envoy.api.v2.core.Http1ProtocolOptions") - proto.RegisterType((*Http2ProtocolOptions)(nil), "envoy.api.v2.core.Http2ProtocolOptions") - proto.RegisterType((*GrpcProtocolOptions)(nil), "envoy.api.v2.core.GrpcProtocolOptions") -} - -func init() { - proto.RegisterFile("envoy/api/v2/core/protocol.proto", fileDescriptor_protocol_2e969372c85b867d) -} - -var fileDescriptor_protocol_2e969372c85b867d = []byte{ - // 556 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0x4f, 0x6f, 0xd3, 0x4c, - 0x10, 0xc6, 0xe5, 0x37, 0x2f, 0xa5, 0x6c, 0xff, 0xd0, 0xba, 0x51, 0x6b, 0x0a, 0x2a, 0x51, 0x00, - 0x11, 0xf5, 0x60, 0xb7, 0xae, 0xc4, 0x89, 0x0b, 0x29, 0x2a, 0xe5, 0x80, 0xa8, 0xdc, 0x16, 0x4e, - 0x68, 0xb5, 0x59, 0x6f, 0x9a, 0x15, 0x1b, 0xcf, 0x6a, 0x3d, 0x4e, 0xd2, 0x7e, 0x34, 0x0e, 0x88, - 0xaf, 0xc3, 0x99, 0x0f, 0x60, 0x64, 0xef, 0x26, 0x82, 0xa4, 0x12, 0x88, 0x53, 0xac, 0x99, 0xe7, - 0xf9, 0x3d, 0x33, 0xf1, 0x98, 0xb4, 0x44, 0x36, 0x82, 0xeb, 0x88, 0x69, 0x19, 0x8d, 0xe2, 0x88, - 0x83, 0x11, 0x91, 0x36, 0x80, 0xc0, 0x41, 0x85, 0xf5, 0x83, 0xbf, 0x59, 0x2b, 0x42, 0xa6, 0x65, - 0x38, 0x8a, 0xc3, 0x4a, 0xb1, 0xbb, 0x77, 0x05, 0x70, 0xa5, 0x9c, 0xb2, 0x57, 0xf4, 0xa3, 0xb4, - 0x30, 0x0c, 0x25, 0x64, 0xd6, 0xb2, 0xd8, 0x1f, 0x1b, 0xa6, 0xb5, 0x30, 0xb9, 0xeb, 0xef, 0x8c, - 0x98, 0x92, 0x29, 0x43, 0x11, 0x4d, 0x1f, 0x6c, 0xa3, 0xdd, 0x24, 0xfe, 0x05, 0xd7, 0x67, 0x6e, - 0x80, 0xf7, 0xba, 0x62, 0xe6, 0xed, 0x73, 0xb2, 0x75, 0x8a, 0x38, 0x5f, 0xf6, 0x5f, 0x92, 0x55, - 0x99, 0x2a, 0x41, 0x51, 0x0e, 0x05, 0x14, 0x18, 0x78, 0x2d, 0xaf, 0xb3, 0x12, 0x3f, 0x08, 0x6d, - 0x78, 0x38, 0x0d, 0x0f, 0x5f, 0xbb, 0xe1, 0x92, 0x95, 0x4a, 0x7e, 0x61, 0xd5, 0xed, 0xaf, 0x1e, - 0x69, 0x56, 0xd4, 0xc3, 0x79, 0xec, 0x29, 0xf1, 0x99, 0x52, 0x30, 0xa6, 0xac, 0x97, 0x83, 0x2a, - 0x50, 0xd0, 0xc2, 0x28, 0x07, 0xdf, 0x5d, 0x80, 0x77, 0x01, 0xd4, 0x07, 0xa6, 0x0a, 0x91, 0x6c, - 0xd4, 0xae, 0x57, 0xce, 0x74, 0x69, 0x94, 0xff, 0x94, 0xac, 0x33, 0xce, 0x85, 0x46, 0x3a, 0x40, - 0xd4, 0xf4, 0xf0, 0x20, 0xf8, 0xaf, 0xe5, 0x75, 0x96, 0x93, 0x55, 0x5b, 0xad, 0xd3, 0x0f, 0xfc, - 0x17, 0x24, 0x48, 0x45, 0x9f, 0x15, 0x0a,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, 0xdc, 0x71, 0x67, 0x50, 0x15, - 0x9d, 0xc3, 0x7f, 0x46, 0xd6, 0xad, 0x68, 0x28, 0x90, 0xa5, 0x0c, 0x59, 0xb0, 0x54, 0xab, 0xac, - 0xf5, 0x9d, 0x2b, 0xb6, 0x91, 0x6c, 0xbd, 0x31, 0x9a, 0xcf, 0xbf, 0xf3, 0x4f, 0x64, 0xbb, 0xba, - 0x99, 0x98, 0x4e, 0x3f, 0x5e, 0x0a, 0xb6, 0xe3, 0xde, 0xfc, 0xf3, 0x70, 0xe1, 0x2b, 0x0e, 0x6f, - 0x3b, 0x9e, 0xa4, 0x39, 0xb8, 0xa5, 0xda, 0x8d, 0xc9, 0x63, 0x09, 0x16, 0xa1, 0x0d, 0x4c, 0xae, - 0x17, 0x69, 0xdd, 0xb5, 0xa9, 0xa7, 0xfe, 0x3d, 0xf3, 0x7a, 0x4b, 0xf5, 0x28, 0x47, 0x3f, 0x03, - 0x00, 0x00, 0xff, 0xff, 0x8f, 0x72, 0x53, 0x8f, 0x62, 0x04, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/discovery/discovery.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/discovery/discovery.pb.go deleted file mode 100755 index 49e59c38fa5..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/discovery/discovery.pb.go +++ /dev/null @@ -1,455 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: envoy/api/v2/discovery.proto - -package v2 - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import any "github.com/golang/protobuf/ptypes/any" -import status "google.golang.org/genproto/googleapis/rpc/status" -import base "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/base" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type DiscoveryRequest struct { - VersionInfo string `protobuf:"bytes,1,opt,name=version_info,json=versionInfo,proto3" json:"version_info,omitempty"` - Node *base.Node `protobuf:"bytes,2,opt,name=node,proto3" json:"node,omitempty"` - ResourceNames []string `protobuf:"bytes,3,rep,name=resource_names,json=resourceNames,proto3" json:"resource_names,omitempty"` - TypeUrl string `protobuf:"bytes,4,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` - ResponseNonce string `protobuf:"bytes,5,opt,name=response_nonce,json=responseNonce,proto3" json:"response_nonce,omitempty"` - ErrorDetail *status.Status `protobuf:"bytes,6,opt,name=error_detail,json=errorDetail,proto3" json:"error_detail,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DiscoveryRequest) Reset() { *m = DiscoveryRequest{} } -func (m *DiscoveryRequest) String() string { return proto.CompactTextString(m) } -func (*DiscoveryRequest) ProtoMessage() {} -func (*DiscoveryRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_discovery_98b4837c589b3df9, []int{0} -} -func (m *DiscoveryRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DiscoveryRequest.Unmarshal(m, b) -} -func (m *DiscoveryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DiscoveryRequest.Marshal(b, m, deterministic) -} -func (dst *DiscoveryRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DiscoveryRequest.Merge(dst, src) -} -func (m *DiscoveryRequest) XXX_Size() int { - return xxx_messageInfo_DiscoveryRequest.Size(m) -} -func (m *DiscoveryRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DiscoveryRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_DiscoveryRequest proto.InternalMessageInfo - -func (m *DiscoveryRequest) GetVersionInfo() string { - if m != nil { - return m.VersionInfo - } - return "" -} - -func (m *DiscoveryRequest) GetNode() *base.Node { - if m != nil { - return m.Node - } - return nil -} - -func (m *DiscoveryRequest) GetResourceNames() []string { - if m != nil { - return m.ResourceNames - } - return nil -} - -func (m *DiscoveryRequest) GetTypeUrl() string { - if m != nil { - return m.TypeUrl - } - return "" -} - -func (m *DiscoveryRequest) GetResponseNonce() string { - if m != nil { - return m.ResponseNonce - } - return "" -} - -func (m *DiscoveryRequest) GetErrorDetail() *status.Status { - if m != nil { - return m.ErrorDetail - } - return nil -} - -type DiscoveryResponse struct { - VersionInfo string `protobuf:"bytes,1,opt,name=version_info,json=versionInfo,proto3" json:"version_info,omitempty"` - Resources []*any.Any `protobuf:"bytes,2,rep,name=resources,proto3" json:"resources,omitempty"` - Canary bool `protobuf:"varint,3,opt,name=canary,proto3" json:"canary,omitempty"` - TypeUrl string `protobuf:"bytes,4,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` - Nonce string `protobuf:"bytes,5,opt,name=nonce,proto3" json:"nonce,omitempty"` - ControlPlane *base.ControlPlane `protobuf:"bytes,6,opt,name=control_plane,json=controlPlane,proto3" json:"control_plane,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DiscoveryResponse) Reset() { *m = DiscoveryResponse{} } -func (m *DiscoveryResponse) String() string { return proto.CompactTextString(m) } -func (*DiscoveryResponse) ProtoMessage() {} -func (*DiscoveryResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_discovery_98b4837c589b3df9, []int{1} -} -func (m *DiscoveryResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DiscoveryResponse.Unmarshal(m, b) -} -func (m *DiscoveryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DiscoveryResponse.Marshal(b, m, deterministic) -} -func (dst *DiscoveryResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DiscoveryResponse.Merge(dst, src) -} -func (m *DiscoveryResponse) XXX_Size() int { - return xxx_messageInfo_DiscoveryResponse.Size(m) -} -func (m *DiscoveryResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DiscoveryResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_DiscoveryResponse proto.InternalMessageInfo - -func (m *DiscoveryResponse) GetVersionInfo() string { - if m != nil { - return m.VersionInfo - } - return "" -} - -func (m *DiscoveryResponse) GetResources() []*any.Any { - if m != nil { - return m.Resources - } - return nil -} - -func (m *DiscoveryResponse) GetCanary() bool { - if m != nil { - return m.Canary - } - return false -} - -func (m *DiscoveryResponse) GetTypeUrl() string { - if m != nil { - return m.TypeUrl - } - return "" -} - -func (m *DiscoveryResponse) GetNonce() string { - if m != nil { - return m.Nonce - } - return "" -} - -func (m *DiscoveryResponse) GetControlPlane() *base.ControlPlane { - if m != nil { - return m.ControlPlane - } - return nil -} - -type DeltaDiscoveryRequest struct { - Node *base.Node `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` - TypeUrl string `protobuf:"bytes,2,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` - ResourceNamesSubscribe []string `protobuf:"bytes,3,rep,name=resource_names_subscribe,json=resourceNamesSubscribe,proto3" json:"resource_names_subscribe,omitempty"` - ResourceNamesUnsubscribe []string `protobuf:"bytes,4,rep,name=resource_names_unsubscribe,json=resourceNamesUnsubscribe,proto3" json:"resource_names_unsubscribe,omitempty"` - InitialResourceVersions map[string]string `protobuf:"bytes,5,rep,name=initial_resource_versions,json=initialResourceVersions,proto3" json:"initial_resource_versions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - ResponseNonce string `protobuf:"bytes,6,opt,name=response_nonce,json=responseNonce,proto3" json:"response_nonce,omitempty"` - ErrorDetail *status.Status `protobuf:"bytes,7,opt,name=error_detail,json=errorDetail,proto3" json:"error_detail,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeltaDiscoveryRequest) Reset() { *m = DeltaDiscoveryRequest{} } -func (m *DeltaDiscoveryRequest) String() string { return proto.CompactTextString(m) } -func (*DeltaDiscoveryRequest) ProtoMessage() {} -func (*DeltaDiscoveryRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_discovery_98b4837c589b3df9, []int{2} -} -func (m *DeltaDiscoveryRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeltaDiscoveryRequest.Unmarshal(m, b) -} -func (m *DeltaDiscoveryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeltaDiscoveryRequest.Marshal(b, m, deterministic) -} -func (dst *DeltaDiscoveryRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeltaDiscoveryRequest.Merge(dst, src) -} -func (m *DeltaDiscoveryRequest) XXX_Size() int { - return xxx_messageInfo_DeltaDiscoveryRequest.Size(m) -} -func (m *DeltaDiscoveryRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DeltaDiscoveryRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_DeltaDiscoveryRequest proto.InternalMessageInfo - -func (m *DeltaDiscoveryRequest) GetNode() *base.Node { - if m != nil { - return m.Node - } - return nil -} - -func (m *DeltaDiscoveryRequest) GetTypeUrl() string { - if m != nil { - return m.TypeUrl - } - return "" -} - -func (m *DeltaDiscoveryRequest) GetResourceNamesSubscribe() []string { - if m != nil { - return m.ResourceNamesSubscribe - } - return nil -} - -func (m *DeltaDiscoveryRequest) GetResourceNamesUnsubscribe() []string { - if m != nil { - return m.ResourceNamesUnsubscribe - } - return nil -} - -func (m *DeltaDiscoveryRequest) GetInitialResourceVersions() map[string]string { - if m != nil { - return m.InitialResourceVersions - } - return nil -} - -func (m *DeltaDiscoveryRequest) GetResponseNonce() string { - if m != nil { - return m.ResponseNonce - } - return "" -} - -func (m *DeltaDiscoveryRequest) GetErrorDetail() *status.Status { - if m != nil { - return m.ErrorDetail - } - return nil -} - -type DeltaDiscoveryResponse struct { - SystemVersionInfo string `protobuf:"bytes,1,opt,name=system_version_info,json=systemVersionInfo,proto3" json:"system_version_info,omitempty"` - Resources []*Resource `protobuf:"bytes,2,rep,name=resources,proto3" json:"resources,omitempty"` - TypeUrl string `protobuf:"bytes,4,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` - RemovedResources []string `protobuf:"bytes,6,rep,name=removed_resources,json=removedResources,proto3" json:"removed_resources,omitempty"` - Nonce string `protobuf:"bytes,5,opt,name=nonce,proto3" json:"nonce,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeltaDiscoveryResponse) Reset() { *m = DeltaDiscoveryResponse{} } -func (m *DeltaDiscoveryResponse) String() string { return proto.CompactTextString(m) } -func (*DeltaDiscoveryResponse) ProtoMessage() {} -func (*DeltaDiscoveryResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_discovery_98b4837c589b3df9, []int{3} -} -func (m *DeltaDiscoveryResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeltaDiscoveryResponse.Unmarshal(m, b) -} -func (m *DeltaDiscoveryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeltaDiscoveryResponse.Marshal(b, m, deterministic) -} -func (dst *DeltaDiscoveryResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeltaDiscoveryResponse.Merge(dst, src) -} -func (m *DeltaDiscoveryResponse) XXX_Size() int { - return xxx_messageInfo_DeltaDiscoveryResponse.Size(m) -} -func (m *DeltaDiscoveryResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DeltaDiscoveryResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_DeltaDiscoveryResponse proto.InternalMessageInfo - -func (m *DeltaDiscoveryResponse) GetSystemVersionInfo() string { - if m != nil { - return m.SystemVersionInfo - } - return "" -} - -func (m *DeltaDiscoveryResponse) GetResources() []*Resource { - if m != nil { - return m.Resources - } - return nil -} - -func (m *DeltaDiscoveryResponse) GetTypeUrl() string { - if m != nil { - return m.TypeUrl - } - return "" -} - -func (m *DeltaDiscoveryResponse) GetRemovedResources() []string { - if m != nil { - return m.RemovedResources - } - return nil -} - -func (m *DeltaDiscoveryResponse) GetNonce() string { - if m != nil { - return m.Nonce - } - return "" -} - -type Resource struct { - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - Aliases []string `protobuf:"bytes,4,rep,name=aliases,proto3" json:"aliases,omitempty"` - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - Resource *any.Any `protobuf:"bytes,2,opt,name=resource,proto3" json:"resource,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Resource) Reset() { *m = Resource{} } -func (m *Resource) String() string { return proto.CompactTextString(m) } -func (*Resource) ProtoMessage() {} -func (*Resource) Descriptor() ([]byte, []int) { - return fileDescriptor_discovery_98b4837c589b3df9, []int{4} -} -func (m *Resource) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Resource.Unmarshal(m, b) -} -func (m *Resource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Resource.Marshal(b, m, deterministic) -} -func (dst *Resource) XXX_Merge(src proto.Message) { - xxx_messageInfo_Resource.Merge(dst, src) -} -func (m *Resource) XXX_Size() int { - return xxx_messageInfo_Resource.Size(m) -} -func (m *Resource) XXX_DiscardUnknown() { - xxx_messageInfo_Resource.DiscardUnknown(m) -} - -var xxx_messageInfo_Resource proto.InternalMessageInfo - -func (m *Resource) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *Resource) GetAliases() []string { - if m != nil { - return m.Aliases - } - return nil -} - -func (m *Resource) GetVersion() string { - if m != nil { - return m.Version - } - return "" -} - -func (m *Resource) GetResource() *any.Any { - if m != nil { - return m.Resource - } - return nil -} - -func init() { - proto.RegisterType((*DiscoveryRequest)(nil), "envoy.api.v2.DiscoveryRequest") - proto.RegisterType((*DiscoveryResponse)(nil), "envoy.api.v2.DiscoveryResponse") - proto.RegisterType((*DeltaDiscoveryRequest)(nil), "envoy.api.v2.DeltaDiscoveryRequest") - proto.RegisterMapType((map[string]string)(nil), "envoy.api.v2.DeltaDiscoveryRequest.InitialResourceVersionsEntry") - proto.RegisterType((*DeltaDiscoveryResponse)(nil), "envoy.api.v2.DeltaDiscoveryResponse") - proto.RegisterType((*Resource)(nil), "envoy.api.v2.Resource") -} - -func init() { - proto.RegisterFile("envoy/api/v2/discovery.proto", fileDescriptor_discovery_98b4837c589b3df9) -} - -var fileDescriptor_discovery_98b4837c589b3df9 = []byte{ - // 659 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x41, 0x6b, 0xdb, 0x4c, - 0x10, 0x45, 0xb6, 0xe3, 0xd8, 0x63, 0x27, 0x24, 0xfb, 0xe5, 0x73, 0x14, 0x13, 0xa8, 0x6b, 0x28, - 0x18, 0x02, 0x52, 0x51, 0x5b, 0x08, 0xa5, 0x87, 0x36, 0x75, 0x0f, 0xe9, 0x21, 0x04, 0x85, 0xe4, - 0xd0, 0x8b, 0x58, 0xcb, 0x93, 0x20, 0xaa, 0xec, 0xaa, 0xbb, 0x92, 0xa8, 0xa0, 0xa7, 0xd2, 0x9f, - 0xd9, 0x3f, 0xd2, 0x53, 0x8b, 0x56, 0x2b, 0x5b, 0x4a, 0x44, 0xf0, 0x4d, 0xb3, 0xf3, 0xf6, 0xed, - 0xbc, 0x99, 0x37, 0x82, 0x63, 0x64, 0x29, 0xcf, 0x6c, 0x1a, 0x05, 0x76, 0xea, 0xd8, 0xcb, 0x40, - 0xfa, 0x3c, 0x45, 0x91, 0x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x00, 0x00, 0xff, 0xff, 0xce, 0x2c, 0x51, 0x59, 0x23, - 0x06, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/eds/eds.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/eds/eds.pb.go deleted file mode 100755 index 3c00b69c0a1..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/eds/eds.pb.go +++ /dev/null @@ -1,454 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: envoy/api/v2/eds.proto - -package envoy_api_v2 - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import duration "github.com/golang/protobuf/ptypes/duration" -import wrappers "github.com/golang/protobuf/ptypes/wrappers" -import _ "google.golang.org/genproto/googleapis/api/annotations" -import discovery "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/discovery" -import endpoint "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/endpoint/endpoint" -import percent "google.golang.org/grpc/xds/internal/proto/envoy/type/percent" -import _ "google.golang.org/grpc/xds/internal/proto/validate" - -import ( - context "golang.org/x/net/context" - grpc "google.golang.org/grpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type ClusterLoadAssignment struct { - ClusterName string `protobuf:"bytes,1,opt,name=cluster_name,json=clusterName,proto3" json:"cluster_name,omitempty"` - Endpoints []*endpoint.LocalityLbEndpoints `protobuf:"bytes,2,rep,name=endpoints,proto3" json:"endpoints,omitempty"` - NamedEndpoints map[string]*endpoint.Endpoint `protobuf:"bytes,5,rep,name=named_endpoints,json=namedEndpoints,proto3" json:"named_endpoints,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Policy *ClusterLoadAssignment_Policy `protobuf:"bytes,4,opt,name=policy,proto3" json:"policy,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ClusterLoadAssignment) Reset() { *m = ClusterLoadAssignment{} } -func (m *ClusterLoadAssignment) String() string { return proto.CompactTextString(m) } -func (*ClusterLoadAssignment) ProtoMessage() {} -func (*ClusterLoadAssignment) Descriptor() ([]byte, []int) { - return fileDescriptor_eds_061daabadb4e511d, []int{0} -} -func (m *ClusterLoadAssignment) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ClusterLoadAssignment.Unmarshal(m, b) -} -func (m *ClusterLoadAssignment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ClusterLoadAssignment.Marshal(b, m, deterministic) -} -func (dst *ClusterLoadAssignment) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClusterLoadAssignment.Merge(dst, src) -} -func (m *ClusterLoadAssignment) XXX_Size() int { - return xxx_messageInfo_ClusterLoadAssignment.Size(m) -} -func (m *ClusterLoadAssignment) XXX_DiscardUnknown() { - xxx_messageInfo_ClusterLoadAssignment.DiscardUnknown(m) -} - -var xxx_messageInfo_ClusterLoadAssignment proto.InternalMessageInfo - -func (m *ClusterLoadAssignment) GetClusterName() string { - if m != nil { - return m.ClusterName - } - return "" -} - -func (m *ClusterLoadAssignment) GetEndpoints() []*endpoint.LocalityLbEndpoints { - if m != nil { - return m.Endpoints - } - return nil -} - -func (m *ClusterLoadAssignment) GetNamedEndpoints() map[string]*endpoint.Endpoint { - if m != nil { - return m.NamedEndpoints - } - return nil -} - -func (m *ClusterLoadAssignment) GetPolicy() *ClusterLoadAssignment_Policy { - if m != nil { - return m.Policy - } - return nil -} - -type ClusterLoadAssignment_Policy struct { - DropOverloads []*ClusterLoadAssignment_Policy_DropOverload `protobuf:"bytes,2,rep,name=drop_overloads,json=dropOverloads,proto3" json:"drop_overloads,omitempty"` - OverprovisioningFactor *wrappers.UInt32Value `protobuf:"bytes,3,opt,name=overprovisioning_factor,json=overprovisioningFactor,proto3" json:"overprovisioning_factor,omitempty"` - EndpointStaleAfter *duration.Duration `protobuf:"bytes,4,opt,name=endpoint_stale_after,json=endpointStaleAfter,proto3" json:"endpoint_stale_after,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ClusterLoadAssignment_Policy) Reset() { *m = ClusterLoadAssignment_Policy{} } -func (m *ClusterLoadAssignment_Policy) String() string { return proto.CompactTextString(m) } -func (*ClusterLoadAssignment_Policy) ProtoMessage() {} -func (*ClusterLoadAssignment_Policy) Descriptor() ([]byte, []int) { - return fileDescriptor_eds_061daabadb4e511d, []int{0, 1} -} -func (m *ClusterLoadAssignment_Policy) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ClusterLoadAssignment_Policy.Unmarshal(m, b) -} -func (m *ClusterLoadAssignment_Policy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ClusterLoadAssignment_Policy.Marshal(b, m, deterministic) -} -func (dst *ClusterLoadAssignment_Policy) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClusterLoadAssignment_Policy.Merge(dst, src) -} -func (m *ClusterLoadAssignment_Policy) XXX_Size() int { - return xxx_messageInfo_ClusterLoadAssignment_Policy.Size(m) -} -func (m *ClusterLoadAssignment_Policy) XXX_DiscardUnknown() { - xxx_messageInfo_ClusterLoadAssignment_Policy.DiscardUnknown(m) -} - -var xxx_messageInfo_ClusterLoadAssignment_Policy proto.InternalMessageInfo - -func (m *ClusterLoadAssignment_Policy) GetDropOverloads() []*ClusterLoadAssignment_Policy_DropOverload { - if m != nil { - return m.DropOverloads - } - return nil -} - -func (m *ClusterLoadAssignment_Policy) GetOverprovisioningFactor() *wrappers.UInt32Value { - if m != nil { - return m.OverprovisioningFactor - } - return nil -} - -func (m *ClusterLoadAssignment_Policy) GetEndpointStaleAfter() *duration.Duration { - if m != nil { - return m.EndpointStaleAfter - } - return nil -} - -type ClusterLoadAssignment_Policy_DropOverload struct { - Category string `protobuf:"bytes,1,opt,name=category,proto3" json:"category,omitempty"` - DropPercentage *percent.FractionalPercent `protobuf:"bytes,2,opt,name=drop_percentage,json=dropPercentage,proto3" json:"drop_percentage,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ClusterLoadAssignment_Policy_DropOverload) Reset() { - *m = ClusterLoadAssignment_Policy_DropOverload{} -} -func (m *ClusterLoadAssignment_Policy_DropOverload) String() string { return proto.CompactTextString(m) } -func (*ClusterLoadAssignment_Policy_DropOverload) ProtoMessage() {} -func (*ClusterLoadAssignment_Policy_DropOverload) Descriptor() ([]byte, []int) { - return fileDescriptor_eds_061daabadb4e511d, []int{0, 1, 0} -} -func (m *ClusterLoadAssignment_Policy_DropOverload) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ClusterLoadAssignment_Policy_DropOverload.Unmarshal(m, b) -} -func (m *ClusterLoadAssignment_Policy_DropOverload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ClusterLoadAssignment_Policy_DropOverload.Marshal(b, m, deterministic) -} -func (dst *ClusterLoadAssignment_Policy_DropOverload) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClusterLoadAssignment_Policy_DropOverload.Merge(dst, src) -} -func (m *ClusterLoadAssignment_Policy_DropOverload) XXX_Size() int { - return xxx_messageInfo_ClusterLoadAssignment_Policy_DropOverload.Size(m) -} -func (m *ClusterLoadAssignment_Policy_DropOverload) XXX_DiscardUnknown() { - xxx_messageInfo_ClusterLoadAssignment_Policy_DropOverload.DiscardUnknown(m) -} - -var xxx_messageInfo_ClusterLoadAssignment_Policy_DropOverload proto.InternalMessageInfo - -func (m *ClusterLoadAssignment_Policy_DropOverload) GetCategory() string { - if m != nil { - return m.Category - } - return "" -} - -func (m *ClusterLoadAssignment_Policy_DropOverload) GetDropPercentage() *percent.FractionalPercent { - if m != nil { - return m.DropPercentage - } - return nil -} - -func init() { - proto.RegisterType((*ClusterLoadAssignment)(nil), "envoy.api.v2.ClusterLoadAssignment") - proto.RegisterMapType((map[string]*endpoint.Endpoint)(nil), "envoy.api.v2.ClusterLoadAssignment.NamedEndpointsEntry") - proto.RegisterType((*ClusterLoadAssignment_Policy)(nil), "envoy.api.v2.ClusterLoadAssignment.Policy") - proto.RegisterType((*ClusterLoadAssignment_Policy_DropOverload)(nil), "envoy.api.v2.ClusterLoadAssignment.Policy.DropOverload") -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// EndpointDiscoveryServiceClient is the client API for EndpointDiscoveryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type EndpointDiscoveryServiceClient interface { - StreamEndpoints(ctx context.Context, opts ...grpc.CallOption) (EndpointDiscoveryService_StreamEndpointsClient, error) - DeltaEndpoints(ctx context.Context, opts ...grpc.CallOption) (EndpointDiscoveryService_DeltaEndpointsClient, error) - FetchEndpoints(ctx context.Context, in *discovery.DiscoveryRequest, opts ...grpc.CallOption) (*discovery.DiscoveryResponse, error) -} - -type endpointDiscoveryServiceClient struct { - cc *grpc.ClientConn -} - -func NewEndpointDiscoveryServiceClient(cc *grpc.ClientConn) EndpointDiscoveryServiceClient { - return &endpointDiscoveryServiceClient{cc} -} - -func (c *endpointDiscoveryServiceClient) StreamEndpoints(ctx context.Context, opts ...grpc.CallOption) (EndpointDiscoveryService_StreamEndpointsClient, error) { - stream, err := c.cc.NewStream(ctx, &_EndpointDiscoveryService_serviceDesc.Streams[0], "/envoy.api.v2.EndpointDiscoveryService/StreamEndpoints", opts...) - if err != nil { - return nil, err - } - x := &endpointDiscoveryServiceStreamEndpointsClient{stream} - return x, nil -} - -type EndpointDiscoveryService_StreamEndpointsClient interface { - Send(*discovery.DiscoveryRequest) error - Recv() (*discovery.DiscoveryResponse, error) - grpc.ClientStream -} - -type endpointDiscoveryServiceStreamEndpointsClient struct { - grpc.ClientStream -} - -func (x *endpointDiscoveryServiceStreamEndpointsClient) Send(m *discovery.DiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *endpointDiscoveryServiceStreamEndpointsClient) Recv() (*discovery.DiscoveryResponse, error) { - m := new(discovery.DiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *endpointDiscoveryServiceClient) DeltaEndpoints(ctx context.Context, opts ...grpc.CallOption) (EndpointDiscoveryService_DeltaEndpointsClient, error) { - stream, err := c.cc.NewStream(ctx, &_EndpointDiscoveryService_serviceDesc.Streams[1], "/envoy.api.v2.EndpointDiscoveryService/DeltaEndpoints", opts...) - if err != nil { - return nil, err - } - x := &endpointDiscoveryServiceDeltaEndpointsClient{stream} - return x, nil -} - -type EndpointDiscoveryService_DeltaEndpointsClient interface { - Send(*discovery.DeltaDiscoveryRequest) error - Recv() (*discovery.DeltaDiscoveryResponse, error) - grpc.ClientStream -} - -type endpointDiscoveryServiceDeltaEndpointsClient struct { - grpc.ClientStream -} - -func (x *endpointDiscoveryServiceDeltaEndpointsClient) Send(m *discovery.DeltaDiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *endpointDiscoveryServiceDeltaEndpointsClient) Recv() (*discovery.DeltaDiscoveryResponse, error) { - m := new(discovery.DeltaDiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *endpointDiscoveryServiceClient) FetchEndpoints(ctx context.Context, in *discovery.DiscoveryRequest, opts ...grpc.CallOption) (*discovery.DiscoveryResponse, error) { - out := new(discovery.DiscoveryResponse) - err := c.cc.Invoke(ctx, "/envoy.api.v2.EndpointDiscoveryService/FetchEndpoints", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// EndpointDiscoveryServiceServer is the server API for EndpointDiscoveryService service. -type EndpointDiscoveryServiceServer interface { - StreamEndpoints(EndpointDiscoveryService_StreamEndpointsServer) error - DeltaEndpoints(EndpointDiscoveryService_DeltaEndpointsServer) error - FetchEndpoints(context.Context, *discovery.DiscoveryRequest) (*discovery.DiscoveryResponse, error) -} - -func RegisterEndpointDiscoveryServiceServer(s *grpc.Server, srv EndpointDiscoveryServiceServer) { - s.RegisterService(&_EndpointDiscoveryService_serviceDesc, srv) -} - -func _EndpointDiscoveryService_StreamEndpoints_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(EndpointDiscoveryServiceServer).StreamEndpoints(&endpointDiscoveryServiceStreamEndpointsServer{stream}) -} - -type EndpointDiscoveryService_StreamEndpointsServer interface { - Send(*discovery.DiscoveryResponse) error - Recv() (*discovery.DiscoveryRequest, error) - grpc.ServerStream -} - -type endpointDiscoveryServiceStreamEndpointsServer struct { - grpc.ServerStream -} - -func (x *endpointDiscoveryServiceStreamEndpointsServer) Send(m *discovery.DiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *endpointDiscoveryServiceStreamEndpointsServer) Recv() (*discovery.DiscoveryRequest, error) { - m := new(discovery.DiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _EndpointDiscoveryService_DeltaEndpoints_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(EndpointDiscoveryServiceServer).DeltaEndpoints(&endpointDiscoveryServiceDeltaEndpointsServer{stream}) -} - -type EndpointDiscoveryService_DeltaEndpointsServer interface { - Send(*discovery.DeltaDiscoveryResponse) error - Recv() (*discovery.DeltaDiscoveryRequest, error) - grpc.ServerStream -} - -type endpointDiscoveryServiceDeltaEndpointsServer struct { - grpc.ServerStream -} - -func (x *endpointDiscoveryServiceDeltaEndpointsServer) Send(m *discovery.DeltaDiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *endpointDiscoveryServiceDeltaEndpointsServer) Recv() (*discovery.DeltaDiscoveryRequest, error) { - m := new(discovery.DeltaDiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _EndpointDiscoveryService_FetchEndpoints_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(discovery.DiscoveryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(EndpointDiscoveryServiceServer).FetchEndpoints(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/envoy.api.v2.EndpointDiscoveryService/FetchEndpoints", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(EndpointDiscoveryServiceServer).FetchEndpoints(ctx, req.(*discovery.DiscoveryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _EndpointDiscoveryService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "envoy.api.v2.EndpointDiscoveryService", - HandlerType: (*EndpointDiscoveryServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "FetchEndpoints", - Handler: _EndpointDiscoveryService_FetchEndpoints_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "StreamEndpoints", - Handler: _EndpointDiscoveryService_StreamEndpoints_Handler, - ServerStreams: true, - ClientStreams: true, - }, - { - StreamName: "DeltaEndpoints", - Handler: _EndpointDiscoveryService_DeltaEndpoints_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "envoy/api/v2/eds.proto", -} - -func init() { proto.RegisterFile("envoy/api/v2/eds.proto", fileDescriptor_eds_061daabadb4e511d) } - -var fileDescriptor_eds_061daabadb4e511d = []byte{ - // 686 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 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 0x6a, 0xe9, 0x12, 0x7b, 0xe9, 0xbf, 0xe1, 0x08, - 0x8b, 0x80, 0xb8, 0x18, 0xbe, 0x00, 0x2b, 0x47, 0x4a, 0x60, 0x34, 0x99, 0x99, 0x70, 0x23, 0xbf, - 0xb9, 0xac, 0xc4, 0xc1, 0xef, 0xa6, 0x58, 0x2a, 0x6b, 0xf3, 0xc2, 0xb8, 0xe4, 0x8c, 0x4a, 0xdc, - 0x5c, 0xd8, 0x36, 0xee, 0x1a, 0x10, 0x81, 0x6a, 0x0f, 0xfb, 0x0a, 0xcd, 0xc0, 0x37, 0xcf, 0x14, - 0xea, 0xe8, 0x1c, 0x7d, 0xeb, 0xef, 0x49, 0xb9, 0x16, 0x53, 0x50, 0xed, 0x63, 0xe5, 0xbe, 0xf9, - 0x8f, 0xda, 0x9b, 0x9f, 0x7e, 0xfe, 0xfa, 0x62, 0xd6, 0x9b, 0xeb, 0xb9, 0x3f, 0xe9, 0x5e, 0x76, - 0xe3, 0xf7, 0x8c, 0x56, 0xf7, 0x36, 0xb0, 0x08, 0x8b, 0x41, 0x5c, 0xb0, 0x0f, 0x61, 0x8e, 0xd9, - 0x2d, 0x1f, 0x78, 0x72, 0xa0, 0xbd, 0x32, 0x30, 0x3e, 0x1b, 0xc6, 0xa8, 0x14, 0xf9, 0x66, 0xe7, - 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc0, 0xc3, 0x7c, 0xb6, 0xca, 0x05, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/endpoint/endpoint/endpoint.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/endpoint/endpoint/endpoint.pb.go deleted file mode 100755 index 36f851043cf..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/endpoint/endpoint/endpoint.pb.go +++ /dev/null @@ -1,394 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: envoy/api/v2/endpoint/endpoint.proto - -package endpoint - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import wrappers "github.com/golang/protobuf/ptypes/wrappers" -import address "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/address" -import base "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/base" -import health_check "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/health_check" -import _ "google.golang.org/grpc/xds/internal/proto/validate" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type Endpoint struct { - Address *address.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - HealthCheckConfig *Endpoint_HealthCheckConfig `protobuf:"bytes,2,opt,name=health_check_config,json=healthCheckConfig,proto3" json:"health_check_config,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Endpoint) Reset() { *m = Endpoint{} } -func (m *Endpoint) String() string { return proto.CompactTextString(m) } -func (*Endpoint) ProtoMessage() {} -func (*Endpoint) Descriptor() ([]byte, []int) { - return fileDescriptor_endpoint_b466beef426b92ef, []int{0} -} -func (m *Endpoint) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Endpoint.Unmarshal(m, b) -} -func (m *Endpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Endpoint.Marshal(b, m, deterministic) -} -func (dst *Endpoint) XXX_Merge(src proto.Message) { - xxx_messageInfo_Endpoint.Merge(dst, src) -} -func (m *Endpoint) XXX_Size() int { - return xxx_messageInfo_Endpoint.Size(m) -} -func (m *Endpoint) XXX_DiscardUnknown() { - xxx_messageInfo_Endpoint.DiscardUnknown(m) -} - -var xxx_messageInfo_Endpoint proto.InternalMessageInfo - -func (m *Endpoint) GetAddress() *address.Address { - if m != nil { - return m.Address - } - return nil -} - -func (m *Endpoint) GetHealthCheckConfig() *Endpoint_HealthCheckConfig { - if m != nil { - return m.HealthCheckConfig - } - return nil -} - -type Endpoint_HealthCheckConfig struct { - PortValue uint32 `protobuf:"varint,1,opt,name=port_value,json=portValue,proto3" json:"port_value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Endpoint_HealthCheckConfig) Reset() { *m = Endpoint_HealthCheckConfig{} } -func (m *Endpoint_HealthCheckConfig) String() string { return proto.CompactTextString(m) } -func (*Endpoint_HealthCheckConfig) ProtoMessage() {} -func (*Endpoint_HealthCheckConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_endpoint_b466beef426b92ef, []int{0, 0} -} -func (m *Endpoint_HealthCheckConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Endpoint_HealthCheckConfig.Unmarshal(m, b) -} -func (m *Endpoint_HealthCheckConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Endpoint_HealthCheckConfig.Marshal(b, m, deterministic) -} -func (dst *Endpoint_HealthCheckConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_Endpoint_HealthCheckConfig.Merge(dst, src) -} -func (m *Endpoint_HealthCheckConfig) XXX_Size() int { - return xxx_messageInfo_Endpoint_HealthCheckConfig.Size(m) -} -func (m *Endpoint_HealthCheckConfig) XXX_DiscardUnknown() { - xxx_messageInfo_Endpoint_HealthCheckConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_Endpoint_HealthCheckConfig proto.InternalMessageInfo - -func (m *Endpoint_HealthCheckConfig) GetPortValue() uint32 { - if m != nil { - return m.PortValue - } - return 0 -} - -type LbEndpoint struct { - // Types that are valid to be assigned to HostIdentifier: - // *LbEndpoint_Endpoint - // *LbEndpoint_EndpointName - HostIdentifier isLbEndpoint_HostIdentifier `protobuf_oneof:"host_identifier"` - HealthStatus health_check.HealthStatus `protobuf:"varint,2,opt,name=health_status,json=healthStatus,proto3,enum=envoy.api.v2.core.HealthStatus" json:"health_status,omitempty"` - Metadata *base.Metadata `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"` - LoadBalancingWeight *wrappers.UInt32Value `protobuf:"bytes,4,opt,name=load_balancing_weight,json=loadBalancingWeight,proto3" json:"load_balancing_weight,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LbEndpoint) Reset() { *m = LbEndpoint{} } -func (m *LbEndpoint) String() string { return proto.CompactTextString(m) } -func (*LbEndpoint) ProtoMessage() {} -func (*LbEndpoint) Descriptor() ([]byte, []int) { - return fileDescriptor_endpoint_b466beef426b92ef, []int{1} -} -func (m *LbEndpoint) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LbEndpoint.Unmarshal(m, b) -} -func (m *LbEndpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LbEndpoint.Marshal(b, m, deterministic) -} -func (dst *LbEndpoint) XXX_Merge(src proto.Message) { - xxx_messageInfo_LbEndpoint.Merge(dst, src) -} -func (m *LbEndpoint) XXX_Size() int { - return xxx_messageInfo_LbEndpoint.Size(m) -} -func (m *LbEndpoint) XXX_DiscardUnknown() { - xxx_messageInfo_LbEndpoint.DiscardUnknown(m) -} - -var xxx_messageInfo_LbEndpoint proto.InternalMessageInfo - -type isLbEndpoint_HostIdentifier interface { - isLbEndpoint_HostIdentifier() -} - -type LbEndpoint_Endpoint struct { - Endpoint *Endpoint `protobuf:"bytes,1,opt,name=endpoint,proto3,oneof"` -} - -type LbEndpoint_EndpointName struct { - EndpointName string `protobuf:"bytes,5,opt,name=endpoint_name,json=endpointName,proto3,oneof"` -} - -func (*LbEndpoint_Endpoint) isLbEndpoint_HostIdentifier() {} - -func (*LbEndpoint_EndpointName) isLbEndpoint_HostIdentifier() {} - -func (m *LbEndpoint) GetHostIdentifier() isLbEndpoint_HostIdentifier { - if m != nil { - return m.HostIdentifier - } - return nil -} - -func (m *LbEndpoint) GetEndpoint() *Endpoint { - if x, ok := m.GetHostIdentifier().(*LbEndpoint_Endpoint); ok { - return x.Endpoint - } - return nil -} - -func (m *LbEndpoint) GetEndpointName() string { - if x, ok := m.GetHostIdentifier().(*LbEndpoint_EndpointName); ok { - return x.EndpointName - } - return "" -} - -func (m *LbEndpoint) GetHealthStatus() health_check.HealthStatus { - if m != nil { - return m.HealthStatus - } - return health_check.HealthStatus_UNKNOWN -} - -func (m *LbEndpoint) GetMetadata() *base.Metadata { - if m != nil { - return m.Metadata - } - return nil -} - -func (m *LbEndpoint) GetLoadBalancingWeight() *wrappers.UInt32Value { - if m != nil { - return m.LoadBalancingWeight - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*LbEndpoint) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _LbEndpoint_OneofMarshaler, _LbEndpoint_OneofUnmarshaler, _LbEndpoint_OneofSizer, []interface{}{ - (*LbEndpoint_Endpoint)(nil), - (*LbEndpoint_EndpointName)(nil), - } -} - -func _LbEndpoint_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*LbEndpoint) - // host_identifier - switch x := m.HostIdentifier.(type) { - case *LbEndpoint_Endpoint: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Endpoint); err != nil { - return err - } - case *LbEndpoint_EndpointName: - b.EncodeVarint(5<<3 | proto.WireBytes) - b.EncodeStringBytes(x.EndpointName) - case nil: - default: - return fmt.Errorf("LbEndpoint.HostIdentifier has unexpected type %T", x) - } - return nil -} - -func _LbEndpoint_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*LbEndpoint) - switch tag { - case 1: // host_identifier.endpoint - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Endpoint) - err := b.DecodeMessage(msg) - m.HostIdentifier = &LbEndpoint_Endpoint{msg} - return true, err - case 5: // host_identifier.endpoint_name - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.HostIdentifier = &LbEndpoint_EndpointName{x} - return true, err - default: - return false, nil - } -} - -func _LbEndpoint_OneofSizer(msg proto.Message) (n int) { - m := msg.(*LbEndpoint) - // host_identifier - switch x := m.HostIdentifier.(type) { - case *LbEndpoint_Endpoint: - s := proto.Size(x.Endpoint) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *LbEndpoint_EndpointName: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.EndpointName))) - n += len(x.EndpointName) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type LocalityLbEndpoints struct { - Locality *base.Locality `protobuf:"bytes,1,opt,name=locality,proto3" json:"locality,omitempty"` - LbEndpoints []*LbEndpoint `protobuf:"bytes,2,rep,name=lb_endpoints,json=lbEndpoints,proto3" json:"lb_endpoints,omitempty"` - LoadBalancingWeight *wrappers.UInt32Value `protobuf:"bytes,3,opt,name=load_balancing_weight,json=loadBalancingWeight,proto3" json:"load_balancing_weight,omitempty"` - Priority uint32 `protobuf:"varint,5,opt,name=priority,proto3" json:"priority,omitempty"` - Proximity *wrappers.UInt32Value `protobuf:"bytes,6,opt,name=proximity,proto3" json:"proximity,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LocalityLbEndpoints) Reset() { *m = LocalityLbEndpoints{} } -func (m *LocalityLbEndpoints) String() string { return proto.CompactTextString(m) } -func (*LocalityLbEndpoints) ProtoMessage() {} -func (*LocalityLbEndpoints) Descriptor() ([]byte, []int) { - return fileDescriptor_endpoint_b466beef426b92ef, []int{2} -} -func (m *LocalityLbEndpoints) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LocalityLbEndpoints.Unmarshal(m, b) -} -func (m *LocalityLbEndpoints) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LocalityLbEndpoints.Marshal(b, m, deterministic) -} -func (dst *LocalityLbEndpoints) XXX_Merge(src proto.Message) { - xxx_messageInfo_LocalityLbEndpoints.Merge(dst, src) -} -func (m *LocalityLbEndpoints) XXX_Size() int { - return xxx_messageInfo_LocalityLbEndpoints.Size(m) -} -func (m *LocalityLbEndpoints) XXX_DiscardUnknown() { - xxx_messageInfo_LocalityLbEndpoints.DiscardUnknown(m) -} - -var xxx_messageInfo_LocalityLbEndpoints proto.InternalMessageInfo - -func (m *LocalityLbEndpoints) GetLocality() *base.Locality { - if m != nil { - return m.Locality - } - return nil -} - -func (m *LocalityLbEndpoints) GetLbEndpoints() []*LbEndpoint { - if m != nil { - return m.LbEndpoints - } - return nil -} - -func (m *LocalityLbEndpoints) GetLoadBalancingWeight() *wrappers.UInt32Value { - if m != nil { - return m.LoadBalancingWeight - } - return nil -} - -func (m *LocalityLbEndpoints) GetPriority() uint32 { - if m != nil { - return m.Priority - } - return 0 -} - -func (m *LocalityLbEndpoints) GetProximity() *wrappers.UInt32Value { - if m != nil { - return m.Proximity - } - return nil -} - -func init() { - proto.RegisterType((*Endpoint)(nil), "envoy.api.v2.endpoint.Endpoint") - proto.RegisterType((*Endpoint_HealthCheckConfig)(nil), "envoy.api.v2.endpoint.Endpoint.HealthCheckConfig") - proto.RegisterType((*LbEndpoint)(nil), "envoy.api.v2.endpoint.LbEndpoint") - proto.RegisterType((*LocalityLbEndpoints)(nil), "envoy.api.v2.endpoint.LocalityLbEndpoints") -} - -func init() { - proto.RegisterFile("envoy/api/v2/endpoint/endpoint.proto", fileDescriptor_endpoint_b466beef426b92ef) -} - -var fileDescriptor_endpoint_b466beef426b92ef = []byte{ - // 569 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x52, 0x51, 0x6f, 0xd3, 0x3c, - 0x14, 0x5d, 0x9a, 0xad, 0x5f, 0xeb, 0xb6, 0x1f, 0xaa, 0xab, 0x89, 0xa8, 0x4c, 0x6c, 0x94, 0x81, - 0xaa, 0x3e, 0x38, 0xa2, 0x43, 0x42, 0x42, 0x42, 0x40, 0x36, 0xa4, 0x22, 0x0d, 0x34, 0x19, 0x01, - 0x12, 0x3c, 0x44, 0x4e, 0xe2, 0x36, 0x16, 0x69, 0x1c, 0x25, 0x6e, 0x47, 0xdf, 0xf8, 0x5d, 0x3c, - 0xf1, 0x27, 0xf8, 0x01, 0x48, 0xbc, 0xf0, 0x2b, 0x86, 0xec, 0xc4, 0x69, 0xb7, 0x76, 0xda, 0x03, - 0x6f, 0xce, 0xbd, 0xe7, 0xdc, 0x73, 0xcf, 0xc9, 0x05, 0x87, 0x34, 0x9e, 0xf3, 0x85, 0x4d, 0x12, - 0x66, 0xcf, 0x87, 0x36, 0x8d, 0x83, 0x84, 0xb3, 0x58, 0x94, 0x0f, 0x94, 0xa4, 0x5c, 0x70, 0xb8, - 0xab, 0x50, 0x88, 0x24, 0x0c, 0xcd, 0x87, 0x48, 0x37, 0xbb, 0xfb, 0x97, 0xc8, 0x3e, 0x4f, 0xa9, - 0x4d, 0x82, 0x20, 0xa5, 0x59, 0x96, 0xf3, 0xba, 0x7b, 0xeb, 0x00, 0x8f, 0x64, 0xb4, 0xe8, 0x1e, - 0xae, 0x77, 0x43, 0x4a, 0x22, 0x11, 0xba, 0x7e, 0x48, 0xfd, 0x2f, 0x05, 0xea, 0xee, 0x84, 0xf3, - 0x49, 0x44, 0x6d, 0xf5, 0xe5, 0xcd, 0xc6, 0xf6, 0x79, 0x4a, 0x92, 0x84, 0xa6, 0x5a, 0xe3, 0xf6, - 0x9c, 0x44, 0x2c, 0x20, 0x82, 0xda, 0xfa, 0x91, 0x37, 0x7a, 0xbf, 0x0d, 0x50, 0x7b, 0x55, 0xac, - 0x0a, 0x1f, 0x83, 0xff, 0x8a, 0xd5, 0x2c, 0xe3, 0xc0, 0xe8, 0x37, 0x86, 0x5d, 0x74, 0xc9, 0x93, - 0x54, 0x47, 0x2f, 0x73, 0x04, 0xd6, 0x50, 0x48, 0x40, 0x67, 0x75, 0x23, 0xd7, 0xe7, 0xf1, 0x98, - 0x4d, 0xac, 0x8a, 0x9a, 0xf0, 0x08, 0x6d, 0x4c, 0x05, 0x69, 0x4d, 0x34, 0x52, 0xd4, 0x63, 0xc9, - 0x3c, 0x56, 0x44, 0xdc, 0x0e, 0xaf, 0x96, 0xba, 0xcf, 0x41, 0x7b, 0x0d, 0x07, 0x07, 0x00, 0x24, - 0x3c, 0x15, 0xee, 0x9c, 0x44, 0x33, 0xaa, 0x16, 0x6e, 0x39, 0x8d, 0xef, 0x7f, 0x7e, 0x98, 0xd5, - 0xc1, 0xb6, 0x75, 0x71, 0x61, 0xe2, 0xba, 0x6c, 0x7f, 0x90, 0xdd, 0xde, 0xaf, 0x0a, 0x00, 0xa7, - 0x5e, 0x69, 0xf4, 0x19, 0xa8, 0xe9, 0x4d, 0x0a, 0xa7, 0xfb, 0x37, 0xec, 0x39, 0xda, 0xc2, 0x25, - 0x05, 0x3e, 0x00, 0x2d, 0xfd, 0x76, 0x63, 0x32, 0xa5, 0xd6, 0xce, 0x81, 0xd1, 0xaf, 0x8f, 0xb6, - 0x70, 0x53, 0x97, 0xdf, 0x92, 0x29, 0x85, 0x27, 0xa0, 0x55, 0x04, 0x93, 0x09, 0x22, 0x66, 0x99, - 0x8a, 0xe4, 0xff, 0xab, 0x52, 0x2a, 0xd4, 0xdc, 0xdd, 0x3b, 0x05, 0xc3, 0xcd, 0x70, 0xe5, 0x0b, - 0x3e, 0x01, 0xb5, 0x29, 0x15, 0x24, 0x20, 0x82, 0x58,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xe4, 0xbc, 0x33, 0xe3, 0x53, 0x79, 0xaf, 0x5e, 0x55, 0x49, 0x1c, 0xfd, 0x0d, 0x00, 0x00, 0xff, - 0xff, 0xfb, 0x2e, 0x69, 0x4b, 0xc8, 0x04, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/endpoint/load_report/load_report.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/endpoint/load_report/load_report.pb.go deleted file mode 100755 index 5d6217f2591..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/api/v2/endpoint/load_report/load_report.pb.go +++ /dev/null @@ -1,446 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: envoy/api/v2/endpoint/load_report.proto - -package envoy_api_v2_endpoint - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import duration "github.com/golang/protobuf/ptypes/duration" -import _struct "github.com/golang/protobuf/ptypes/struct" -import address "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/address" -import base "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/base" -import _ "google.golang.org/grpc/xds/internal/proto/validate" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type UpstreamLocalityStats struct { - Locality *base.Locality `protobuf:"bytes,1,opt,name=locality,proto3" json:"locality,omitempty"` - TotalSuccessfulRequests uint64 `protobuf:"varint,2,opt,name=total_successful_requests,json=totalSuccessfulRequests,proto3" json:"total_successful_requests,omitempty"` - TotalRequestsInProgress uint64 `protobuf:"varint,3,opt,name=total_requests_in_progress,json=totalRequestsInProgress,proto3" json:"total_requests_in_progress,omitempty"` - TotalErrorRequests uint64 `protobuf:"varint,4,opt,name=total_error_requests,json=totalErrorRequests,proto3" json:"total_error_requests,omitempty"` - TotalIssuedRequests uint64 `protobuf:"varint,8,opt,name=total_issued_requests,json=totalIssuedRequests,proto3" json:"total_issued_requests,omitempty"` - LoadMetricStats []*EndpointLoadMetricStats `protobuf:"bytes,5,rep,name=load_metric_stats,json=loadMetricStats,proto3" json:"load_metric_stats,omitempty"` - UpstreamEndpointStats []*UpstreamEndpointStats `protobuf:"bytes,7,rep,name=upstream_endpoint_stats,json=upstreamEndpointStats,proto3" json:"upstream_endpoint_stats,omitempty"` - Priority uint32 `protobuf:"varint,6,opt,name=priority,proto3" json:"priority,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UpstreamLocalityStats) Reset() { *m = UpstreamLocalityStats{} } -func (m *UpstreamLocalityStats) String() string { return proto.CompactTextString(m) } -func (*UpstreamLocalityStats) ProtoMessage() {} -func (*UpstreamLocalityStats) Descriptor() ([]byte, []int) { - return fileDescriptor_load_report_e278ba272961bcc3, []int{0} -} -func (m *UpstreamLocalityStats) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UpstreamLocalityStats.Unmarshal(m, b) -} -func (m *UpstreamLocalityStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UpstreamLocalityStats.Marshal(b, m, deterministic) -} -func (dst *UpstreamLocalityStats) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpstreamLocalityStats.Merge(dst, src) -} -func (m *UpstreamLocalityStats) XXX_Size() int { - return xxx_messageInfo_UpstreamLocalityStats.Size(m) -} -func (m *UpstreamLocalityStats) XXX_DiscardUnknown() { - xxx_messageInfo_UpstreamLocalityStats.DiscardUnknown(m) -} - -var xxx_messageInfo_UpstreamLocalityStats proto.InternalMessageInfo - -func (m *UpstreamLocalityStats) GetLocality() *base.Locality { - if m != nil { - return m.Locality - } - return nil -} - -func (m *UpstreamLocalityStats) GetTotalSuccessfulRequests() uint64 { - if m != nil { - return m.TotalSuccessfulRequests - } - return 0 -} - -func (m *UpstreamLocalityStats) GetTotalRequestsInProgress() uint64 { - if m != nil { - return m.TotalRequestsInProgress - } - return 0 -} - -func (m *UpstreamLocalityStats) GetTotalErrorRequests() uint64 { - if m != nil { - return m.TotalErrorRequests - } - return 0 -} - -func (m *UpstreamLocalityStats) GetTotalIssuedRequests() uint64 { - if m != nil { - return m.TotalIssuedRequests - } - return 0 -} - -func (m *UpstreamLocalityStats) GetLoadMetricStats() []*EndpointLoadMetricStats { - if m != nil { - return m.LoadMetricStats - } - return nil -} - -func (m *UpstreamLocalityStats) GetUpstreamEndpointStats() []*UpstreamEndpointStats { - if m != nil { - return m.UpstreamEndpointStats - } - return nil -} - -func (m *UpstreamLocalityStats) GetPriority() uint32 { - if m != nil { - return m.Priority - } - return 0 -} - -type UpstreamEndpointStats struct { - Address *address.Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Metadata *_struct.Struct `protobuf:"bytes,6,opt,name=metadata,proto3" json:"metadata,omitempty"` - TotalSuccessfulRequests uint64 `protobuf:"varint,2,opt,name=total_successful_requests,json=totalSuccessfulRequests,proto3" json:"total_successful_requests,omitempty"` - TotalRequestsInProgress uint64 `protobuf:"varint,3,opt,name=total_requests_in_progress,json=totalRequestsInProgress,proto3" json:"total_requests_in_progress,omitempty"` - TotalErrorRequests uint64 `protobuf:"varint,4,opt,name=total_error_requests,json=totalErrorRequests,proto3" json:"total_error_requests,omitempty"` - TotalIssuedRequests uint64 `protobuf:"varint,7,opt,name=total_issued_requests,json=totalIssuedRequests,proto3" json:"total_issued_requests,omitempty"` - LoadMetricStats []*EndpointLoadMetricStats `protobuf:"bytes,5,rep,name=load_metric_stats,json=loadMetricStats,proto3" json:"load_metric_stats,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UpstreamEndpointStats) Reset() { *m = UpstreamEndpointStats{} } -func (m *UpstreamEndpointStats) String() string { return proto.CompactTextString(m) } -func (*UpstreamEndpointStats) ProtoMessage() {} -func (*UpstreamEndpointStats) Descriptor() ([]byte, []int) { - return fileDescriptor_load_report_e278ba272961bcc3, []int{1} -} -func (m *UpstreamEndpointStats) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UpstreamEndpointStats.Unmarshal(m, b) -} -func (m *UpstreamEndpointStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UpstreamEndpointStats.Marshal(b, m, deterministic) -} -func (dst *UpstreamEndpointStats) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpstreamEndpointStats.Merge(dst, src) -} -func (m *UpstreamEndpointStats) XXX_Size() int { - return xxx_messageInfo_UpstreamEndpointStats.Size(m) -} -func (m *UpstreamEndpointStats) XXX_DiscardUnknown() { - xxx_messageInfo_UpstreamEndpointStats.DiscardUnknown(m) -} - -var xxx_messageInfo_UpstreamEndpointStats proto.InternalMessageInfo - -func (m *UpstreamEndpointStats) GetAddress() *address.Address { - if m != nil { - return m.Address - } - return nil -} - -func (m *UpstreamEndpointStats) GetMetadata() *_struct.Struct { - if m != nil { - return m.Metadata - } - return nil -} - -func (m *UpstreamEndpointStats) GetTotalSuccessfulRequests() uint64 { - if m != nil { - return m.TotalSuccessfulRequests - } - return 0 -} - -func (m *UpstreamEndpointStats) GetTotalRequestsInProgress() uint64 { - if m != nil { - return m.TotalRequestsInProgress - } - return 0 -} - -func (m *UpstreamEndpointStats) GetTotalErrorRequests() uint64 { - if m != nil { - return m.TotalErrorRequests - } - return 0 -} - -func (m *UpstreamEndpointStats) GetTotalIssuedRequests() uint64 { - if m != nil { - return m.TotalIssuedRequests - } - return 0 -} - -func (m *UpstreamEndpointStats) GetLoadMetricStats() []*EndpointLoadMetricStats { - if m != nil { - return m.LoadMetricStats - } - return nil -} - -type EndpointLoadMetricStats struct { - MetricName string `protobuf:"bytes,1,opt,name=metric_name,json=metricName,proto3" json:"metric_name,omitempty"` - NumRequestsFinishedWithMetric uint64 `protobuf:"varint,2,opt,name=num_requests_finished_with_metric,json=numRequestsFinishedWithMetric,proto3" json:"num_requests_finished_with_metric,omitempty"` - TotalMetricValue float64 `protobuf:"fixed64,3,opt,name=total_metric_value,json=totalMetricValue,proto3" json:"total_metric_value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EndpointLoadMetricStats) Reset() { *m = EndpointLoadMetricStats{} } -func (m *EndpointLoadMetricStats) String() string { return proto.CompactTextString(m) } -func (*EndpointLoadMetricStats) ProtoMessage() {} -func (*EndpointLoadMetricStats) Descriptor() ([]byte, []int) { - return fileDescriptor_load_report_e278ba272961bcc3, []int{2} -} -func (m *EndpointLoadMetricStats) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EndpointLoadMetricStats.Unmarshal(m, b) -} -func (m *EndpointLoadMetricStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EndpointLoadMetricStats.Marshal(b, m, deterministic) -} -func (dst *EndpointLoadMetricStats) XXX_Merge(src proto.Message) { - xxx_messageInfo_EndpointLoadMetricStats.Merge(dst, src) -} -func (m *EndpointLoadMetricStats) XXX_Size() int { - return xxx_messageInfo_EndpointLoadMetricStats.Size(m) -} -func (m *EndpointLoadMetricStats) XXX_DiscardUnknown() { - xxx_messageInfo_EndpointLoadMetricStats.DiscardUnknown(m) -} - -var xxx_messageInfo_EndpointLoadMetricStats proto.InternalMessageInfo - -func (m *EndpointLoadMetricStats) GetMetricName() string { - if m != nil { - return m.MetricName - } - return "" -} - -func (m *EndpointLoadMetricStats) GetNumRequestsFinishedWithMetric() uint64 { - if m != nil { - return m.NumRequestsFinishedWithMetric - } - return 0 -} - -func (m *EndpointLoadMetricStats) GetTotalMetricValue() float64 { - if m != nil { - return m.TotalMetricValue - } - return 0 -} - -type ClusterStats struct { - ClusterName string `protobuf:"bytes,1,opt,name=cluster_name,json=clusterName,proto3" json:"cluster_name,omitempty"` - ClusterServiceName string `protobuf:"bytes,6,opt,name=cluster_service_name,json=clusterServiceName,proto3" json:"cluster_service_name,omitempty"` - UpstreamLocalityStats []*UpstreamLocalityStats `protobuf:"bytes,2,rep,name=upstream_locality_stats,json=upstreamLocalityStats,proto3" json:"upstream_locality_stats,omitempty"` - TotalDroppedRequests uint64 `protobuf:"varint,3,opt,name=total_dropped_requests,json=totalDroppedRequests,proto3" json:"total_dropped_requests,omitempty"` - DroppedRequests []*ClusterStats_DroppedRequests `protobuf:"bytes,5,rep,name=dropped_requests,json=droppedRequests,proto3" json:"dropped_requests,omitempty"` - LoadReportInterval *duration.Duration `protobuf:"bytes,4,opt,name=load_report_interval,json=loadReportInterval,proto3" json:"load_report_interval,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ClusterStats) Reset() { *m = ClusterStats{} } -func (m *ClusterStats) String() string { return proto.CompactTextString(m) } -func (*ClusterStats) ProtoMessage() {} -func (*ClusterStats) Descriptor() ([]byte, []int) { - return fileDescriptor_load_report_e278ba272961bcc3, []int{3} -} -func (m *ClusterStats) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ClusterStats.Unmarshal(m, b) -} -func (m *ClusterStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ClusterStats.Marshal(b, m, deterministic) -} -func (dst *ClusterStats) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClusterStats.Merge(dst, src) -} -func (m *ClusterStats) XXX_Size() int { - return xxx_messageInfo_ClusterStats.Size(m) -} -func (m *ClusterStats) XXX_DiscardUnknown() { - xxx_messageInfo_ClusterStats.DiscardUnknown(m) -} - -var xxx_messageInfo_ClusterStats proto.InternalMessageInfo - -func (m *ClusterStats) GetClusterName() string { - if m != nil { - return m.ClusterName - } - return "" -} - -func (m *ClusterStats) GetClusterServiceName() string { - if m != nil { - return m.ClusterServiceName - } - return "" -} - -func (m *ClusterStats) GetUpstreamLocalityStats() []*UpstreamLocalityStats { - if m != nil { - return m.UpstreamLocalityStats - } - return nil -} - -func (m *ClusterStats) GetTotalDroppedRequests() uint64 { - if m != nil { - return m.TotalDroppedRequests - } - return 0 -} - -func (m *ClusterStats) GetDroppedRequests() []*ClusterStats_DroppedRequests { - if m != nil { - return m.DroppedRequests - } - return nil -} - -func (m *ClusterStats) GetLoadReportInterval() *duration.Duration { - if m != nil { - return m.LoadReportInterval - } - return nil -} - -type ClusterStats_DroppedRequests struct { - Category string `protobuf:"bytes,1,opt,name=category,proto3" json:"category,omitempty"` - DroppedCount uint64 `protobuf:"varint,2,opt,name=dropped_count,json=droppedCount,proto3" json:"dropped_count,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ClusterStats_DroppedRequests) Reset() { *m = ClusterStats_DroppedRequests{} } -func (m *ClusterStats_DroppedRequests) String() string { return proto.CompactTextString(m) } -func (*ClusterStats_DroppedRequests) ProtoMessage() {} -func (*ClusterStats_DroppedRequests) Descriptor() ([]byte, []int) { - return fileDescriptor_load_report_e278ba272961bcc3, []int{3, 0} -} -func (m *ClusterStats_DroppedRequests) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ClusterStats_DroppedRequests.Unmarshal(m, b) -} -func (m *ClusterStats_DroppedRequests) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ClusterStats_DroppedRequests.Marshal(b, m, deterministic) -} -func (dst *ClusterStats_DroppedRequests) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClusterStats_DroppedRequests.Merge(dst, src) -} -func (m *ClusterStats_DroppedRequests) XXX_Size() int { - return xxx_messageInfo_ClusterStats_DroppedRequests.Size(m) -} -func (m *ClusterStats_DroppedRequests) XXX_DiscardUnknown() { - xxx_messageInfo_ClusterStats_DroppedRequests.DiscardUnknown(m) -} - -var xxx_messageInfo_ClusterStats_DroppedRequests proto.InternalMessageInfo - -func (m *ClusterStats_DroppedRequests) GetCategory() string { - if m != nil { - return m.Category - } - return "" -} - -func (m *ClusterStats_DroppedRequests) GetDroppedCount() uint64 { - if m != nil { - return m.DroppedCount - } - return 0 -} - -func init() { - proto.RegisterType((*UpstreamLocalityStats)(nil), "envoy.api.v2.endpoint.UpstreamLocalityStats") - proto.RegisterType((*UpstreamEndpointStats)(nil), "envoy.api.v2.endpoint.UpstreamEndpointStats") - proto.RegisterType((*EndpointLoadMetricStats)(nil), "envoy.api.v2.endpoint.EndpointLoadMetricStats") - proto.RegisterType((*ClusterStats)(nil), "envoy.api.v2.endpoint.ClusterStats") - proto.RegisterType((*ClusterStats_DroppedRequests)(nil), "envoy.api.v2.endpoint.ClusterStats.DroppedRequests") -} - -func init() { - proto.RegisterFile("envoy/api/v2/endpoint/load_report.proto", fileDescriptor_load_report_e278ba272961bcc3) -} - -var fileDescriptor_load_report_e278ba272961bcc3 = []byte{ - // 759 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x55, 0xcb, 0x6e, 0xd3, 0x4a, - 0x18, 0x96, 0x93, 0xb4, 0x4d, 0x27, 0xad, 0xd2, 0x33, 0xa7, 0x39, 0x49, 0x73, 0xce, 0xa1, 0x21, - 0x15, 0x22, 0x8b, 0xca, 0xae, 0xd2, 0x4a, 0x20, 0x58, 0x91, 0xb6, 0x88, 0x8a, 0x82, 0x2a, 0x47, - 0x80, 0x84, 0x04, 0xd6, 0xd4, 0x9e, 0xa6, 0x23, 0x39, 0x1e, 0x33, 0x97, 0x40, 0x1e, 0x82, 0x0d, - 0x8f, 0xc0, 0x23, 0xb0, 0x44, 0x42, 0xe2, 0x75, 0x78, 0x0b, 0xe4, 0xb9, 0x38, 0xd7, 0x4a, 0xec, - 0x90, 0xd8, 0xd9, 0xff, 0xf7, 0x7d, 0xfe, 0x6f, 0xdf, 0x8c, 0xc1, 0x5d, 0x9c, 0x8c, 0xe8, 0xd8, - 0x43, 0x29, 0xf1, 0x46, 0x5d, 0x0f, 0x27, 0x51, 0x4a, 0x49, 0x22, 0xbc, 0x98, 0xa2, 0x28, 0x60, - 0x38, 0xa5, 0x4c, 0xb8, 0x29, 0xa3, 0x82, 0xc2, 0x9a, 0x22, 0xba, 0x28, 0x25, 0xee, 0xa8, 0xeb, - 0x5a, 0x62, 0x73, 0x77, 0x46, 0x1f, 0x52, 0x86, 0x3d, 0x14, 0x45, 0x0c, 0x73, 0xae, 0x75, 0xcd, - 0xff, 0x16, 0x09, 0x97, 0x88, 0x63, 0x83, 0xde, 0x1a, 0x50, 0x3a, 0x88, 0xb1, 0xa7, 0xde, 0x2e, - 0xe5, 0x95, 0x17, 0x49, 0x86, 0x04, 0xa1, 0x89, 0x55, 0xcf, 0xe3, 0x5c, 0x30, 0x19, 0x9a, 0x9a, - 0x9a, 0xf5, 0x11, 0x8a, 0x49, 0x84, 0x04, 0xf6, 0xec, 0x83, 0x06, 0xda, 0x1f, 0x4b, 0xa0, 0xf6, - 0x22, 0xe5, 0x82, 0x61, 0x34, 0x3c, 0xa7, 0x21, 0x8a, 0x89, 0x18, 0xf7, 0x05, 0x12, 0x1c, 0xde, - 0x03, 0xe5, 0xd8, 0x04, 0x1a, 0x4e, 0xcb, 0xe9, 0x54, 0xba, 0xff, 0xba, 0x33, 0x9d, 0x65, 0x15, - 0xba, 0x56, 0xe3, 0xe7, 0x64, 0xf8, 0x00, 0xec, 0x08, 0x2a, 0x50, 0x1c, 0x70, 0x19, 0x86, 0x98, - 0xf3, 0x2b, 0x19, 0x07, 0x0c, 0xbf, 0x93, 0x98, 0x0b, 0xde, 0x28, 0xb4, 0x9c, 0x4e, 0xc9, 0xaf, - 0x2b, 0x42, 0x3f, 0xc7, 0x7d, 0x03, 0xc3, 0x87, 0xa0, 0xa9, 0xb5, 0x56, 0x10, 0x90, 0x24, 0x48, - 0x19, 0x1d, 0x64, 0x73, 0x6a, 0x14, 0xa7, 0xc4, 0x56, 0x72, 0x96, 0x5c, 0x18, 0x18, 0x1e, 0x80, - 0x6d, 0x2d, 0xc6, 0x8c, 0x51, 0x36, 0xc9, 0x59, 0x52, 0x32, 0xa8, 0xb0, 0xd3, 0x0c, 0xca, 0xd3, - 0x75, 0x41, 0x4d, 0x2b, 0x08, 0xe7, 0x12, 0x47, 0x13, 0x49, 0x59, 0x49, 0xfe, 0x56, 0xe0, 0x99, - 0xc2, 0x72, 0xcd, 0x6b, 0xf0, 0x97, 0xda, 0xf9, 0x10, 0x0b, 0x46, 0xc2, 0x80, 0x67, 0xc3, 0x6a, - 0xac, 0xb4, 0x8a, 0x9d, 0x4a, 0xd7, 0x75, 0x97, 0xae, 0xde, 0x3d, 0x35, 0x0f, 0xe7, 0x14, 0x45, - 0xcf, 0x94, 0x4c, 0x8d, 0xd8, 0xaf, 0xc6, 0xb3, 0x01, 0x18, 0x81, 0xba, 0x34, 0xcb, 0x08, 0xac, - 0xda, 0x64, 0x58, 0x53, 0x19, 0xf6, 0x6f, 0xc8, 0x60, 0x57, 0x68, 0x33, 0xe9, 0xef, 0xd7, 0xe4, - 0xb2, 0x30, 0x6c, 0x82, 0x72, 0xca, 0x08, 0x65, 0xd9, 0x66, 0x57, 0x5b, 0x4e, 0x67, 0xd3, 0xcf, - 0xdf, 0xdb, 0xdf, 0x8a, 0x13, 0x3f, 0xcc, 0xaa, 0x8e, 0xc0, 0x9a, 0xf1, 0xab, 0xb1, 0x43, 0x73, - 0x89, 0x1d, 0x1e, 0x69, 0x86, 0x6f, 0xa9, 0xf0, 0x10, 0x94, 0x87, 0x58, 0xa0, 0x08, 0x09, 0xa4, - 0x72, 0x55, 0xba, 0x75, 0x57, 0x3b, 0xd5, 0xb5, 0x4e, 0x75, 0xfb, 0xca, 0xa9, 0x7e, 0x4e, 0xfc, - 0x23, 0x1c, 0xb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, 0x6f, 0xc1, 0xd6, 0x02, 0x5f, 0x1b, 0xe5, - 0xf0, 0x86, 0x02, 0xa7, 0xc7, 0xe8, 0xce, 0x7d, 0xce, 0xaf, 0x46, 0x73, 0xdf, 0x7f, 0x0a, 0xb6, - 0xa7, 0xfe, 0x5f, 0x01, 0x49, 0x04, 0x66, 0x23, 0x14, 0x2b, 0xbf, 0x57, 0xba, 0x3b, 0x0b, 0x27, - 0xf5, 0xc4, 0xfc, 0x73, 0x7c, 0x98, 0xc9, 0x7c, 0xa5, 0x3a, 0x33, 0xa2, 0xe6, 0x1b, 0x50, 0x9d, - 0xaf, 0xff, 0x0e, 0x28, 0x87, 0x48, 0xe0, 0x01, 0x65, 0xe3, 0xc5, 0x1d, 0xe6, 0x10, 0xdc, 0x03, - 0x9b, 0xb6, 0xcd, 0x90, 0xca, 0x44, 0x18, 0x8f, 0x6d, 0x98, 0xe0, 0x71, 0x16, 0xeb, 0xdd, 0x07, - 0x7b, 0x84, 0xea, 0xae, 0x53, 0x46, 0x3f, 0x8c, 0x97, 0x0f, 0xa0, 0x57, 0x3d, 0xcf, 0x2b, 0xbb, - 0xc8, 0xca, 0xbe, 0x70, 0x2e, 0x57, 0x55, 0xfd, 0x87, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x0f, - 0x69, 0xa4, 0xdd, 0xc2, 0x07, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/service/discovery/v2/ads/ads.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/envoy/service/discovery/v2/ads/ads.pb.go deleted file mode 100755 index afd8083893c..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/service/discovery/v2/ads/ads.pb.go +++ /dev/null @@ -1,251 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: envoy/service/discovery/v2/ads.proto - -package v2 - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import discovery "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/discovery" - -import ( - context "golang.org/x/net/context" - grpc "google.golang.org/grpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type AdsDummy struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AdsDummy) Reset() { *m = AdsDummy{} } -func (m *AdsDummy) String() string { return proto.CompactTextString(m) } -func (*AdsDummy) ProtoMessage() {} -func (*AdsDummy) Descriptor() ([]byte, []int) { - return fileDescriptor_ads_e4cd1a296681dd94, []int{0} -} -func (m *AdsDummy) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AdsDummy.Unmarshal(m, b) -} -func (m *AdsDummy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AdsDummy.Marshal(b, m, deterministic) -} -func (dst *AdsDummy) XXX_Merge(src proto.Message) { - xxx_messageInfo_AdsDummy.Merge(dst, src) -} -func (m *AdsDummy) XXX_Size() int { - return xxx_messageInfo_AdsDummy.Size(m) -} -func (m *AdsDummy) XXX_DiscardUnknown() { - xxx_messageInfo_AdsDummy.DiscardUnknown(m) -} - -var xxx_messageInfo_AdsDummy proto.InternalMessageInfo - -func init() { - proto.RegisterType((*AdsDummy)(nil), "envoy.service.discovery.v2.AdsDummy") -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// AggregatedDiscoveryServiceClient is the client API for AggregatedDiscoveryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type AggregatedDiscoveryServiceClient interface { - StreamAggregatedResources(ctx context.Context, opts ...grpc.CallOption) (AggregatedDiscoveryService_StreamAggregatedResourcesClient, error) - DeltaAggregatedResources(ctx context.Context, opts ...grpc.CallOption) (AggregatedDiscoveryService_DeltaAggregatedResourcesClient, error) -} - -type aggregatedDiscoveryServiceClient struct { - cc *grpc.ClientConn -} - -func NewAggregatedDiscoveryServiceClient(cc *grpc.ClientConn) AggregatedDiscoveryServiceClient { - return &aggregatedDiscoveryServiceClient{cc} -} - -func (c *aggregatedDiscoveryServiceClient) StreamAggregatedResources(ctx context.Context, opts ...grpc.CallOption) (AggregatedDiscoveryService_StreamAggregatedResourcesClient, error) { - stream, err := c.cc.NewStream(ctx, &_AggregatedDiscoveryService_serviceDesc.Streams[0], "/envoy.service.discovery.v2.AggregatedDiscoveryService/StreamAggregatedResources", opts...) - if err != nil { - return nil, err - } - x := &aggregatedDiscoveryServiceStreamAggregatedResourcesClient{stream} - return x, nil -} - -type AggregatedDiscoveryService_StreamAggregatedResourcesClient interface { - Send(*discovery.DiscoveryRequest) error - Recv() (*discovery.DiscoveryResponse, error) - grpc.ClientStream -} - -type aggregatedDiscoveryServiceStreamAggregatedResourcesClient struct { - grpc.ClientStream -} - -func (x *aggregatedDiscoveryServiceStreamAggregatedResourcesClient) Send(m *discovery.DiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *aggregatedDiscoveryServiceStreamAggregatedResourcesClient) Recv() (*discovery.DiscoveryResponse, error) { - m := new(discovery.DiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *aggregatedDiscoveryServiceClient) DeltaAggregatedResources(ctx context.Context, opts ...grpc.CallOption) (AggregatedDiscoveryService_DeltaAggregatedResourcesClient, error) { - stream, err := c.cc.NewStream(ctx, &_AggregatedDiscoveryService_serviceDesc.Streams[1], "/envoy.service.discovery.v2.AggregatedDiscoveryService/DeltaAggregatedResources", opts...) - if err != nil { - return nil, err - } - x := &aggregatedDiscoveryServiceDeltaAggregatedResourcesClient{stream} - return x, nil -} - -type AggregatedDiscoveryService_DeltaAggregatedResourcesClient interface { - Send(*discovery.DeltaDiscoveryRequest) error - Recv() (*discovery.DeltaDiscoveryResponse, error) - grpc.ClientStream -} - -type aggregatedDiscoveryServiceDeltaAggregatedResourcesClient struct { - grpc.ClientStream -} - -func (x *aggregatedDiscoveryServiceDeltaAggregatedResourcesClient) Send(m *discovery.DeltaDiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *aggregatedDiscoveryServiceDeltaAggregatedResourcesClient) Recv() (*discovery.DeltaDiscoveryResponse, error) { - m := new(discovery.DeltaDiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// AggregatedDiscoveryServiceServer is the server API for AggregatedDiscoveryService service. -type AggregatedDiscoveryServiceServer interface { - StreamAggregatedResources(AggregatedDiscoveryService_StreamAggregatedResourcesServer) error - DeltaAggregatedResources(AggregatedDiscoveryService_DeltaAggregatedResourcesServer) error -} - -func RegisterAggregatedDiscoveryServiceServer(s *grpc.Server, srv AggregatedDiscoveryServiceServer) { - s.RegisterService(&_AggregatedDiscoveryService_serviceDesc, srv) -} - -func _AggregatedDiscoveryService_StreamAggregatedResources_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(AggregatedDiscoveryServiceServer).StreamAggregatedResources(&aggregatedDiscoveryServiceStreamAggregatedResourcesServer{stream}) -} - -type AggregatedDiscoveryService_StreamAggregatedResourcesServer interface { - Send(*discovery.DiscoveryResponse) error - Recv() (*discovery.DiscoveryRequest, error) - grpc.ServerStream -} - -type aggregatedDiscoveryServiceStreamAggregatedResourcesServer struct { - grpc.ServerStream -} - -func (x *aggregatedDiscoveryServiceStreamAggregatedResourcesServer) Send(m *discovery.DiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *aggregatedDiscoveryServiceStreamAggregatedResourcesServer) Recv() (*discovery.DiscoveryRequest, error) { - m := new(discovery.DiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _AggregatedDiscoveryService_DeltaAggregatedResources_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(AggregatedDiscoveryServiceServer).DeltaAggregatedResources(&aggregatedDiscoveryServiceDeltaAggregatedResourcesServer{stream}) -} - -type AggregatedDiscoveryService_DeltaAggregatedResourcesServer interface { - Send(*discovery.DeltaDiscoveryResponse) error - Recv() (*discovery.DeltaDiscoveryRequest, error) - grpc.ServerStream -} - -type aggregatedDiscoveryServiceDeltaAggregatedResourcesServer struct { - grpc.ServerStream -} - -func (x *aggregatedDiscoveryServiceDeltaAggregatedResourcesServer) Send(m *discovery.DeltaDiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *aggregatedDiscoveryServiceDeltaAggregatedResourcesServer) Recv() (*discovery.DeltaDiscoveryRequest, error) { - m := new(discovery.DeltaDiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -var _AggregatedDiscoveryService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "envoy.service.discovery.v2.AggregatedDiscoveryService", - HandlerType: (*AggregatedDiscoveryServiceServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "StreamAggregatedResources", - Handler: _AggregatedDiscoveryService_StreamAggregatedResources_Handler, - ServerStreams: true, - ClientStreams: true, - }, - { - StreamName: "DeltaAggregatedResources", - Handler: _AggregatedDiscoveryService_DeltaAggregatedResources_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "envoy/service/discovery/v2/ads.proto", -} - -func init() { - proto.RegisterFile("envoy/service/discovery/v2/ads.proto", fileDescriptor_ads_e4cd1a296681dd94) -} - -var fileDescriptor_ads_e4cd1a296681dd94 = []byte{ - // 236 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0xb1, 0x4e, 0xc3, 0x30, - 0x10, 0x86, 0x31, 0x03, 0x42, 0x1e, 0x33, 0x41, 0x84, 0x40, 0x2a, 0x1d, 0x3a, 0x5d, 0x90, 0x99, - 0x19, 0x5a, 0xe5, 0x01, 0xaa, 0x76, 0x63, 0x73, 0x93, 0x53, 0x64, 0x41, 0x7a, 0xc6, 0xe7, 0x58, - 0xf8, 0x0d, 0x78, 0x59, 0xde, 0x01, 0x39, 0x86, 0x16, 0x01, 0x61, 0xbe, 0xef, 0xff, 0xff, 0xd3, - 0x27, 0xe7, 0xb8, 0x0f, 0x14, 0x2b, 0x46, 0x17, 0x4c, 0x83, 0x55, 0x6b, 0xb8, 0xa1, 0x80, 0x2e, - 0x56, 0x41, 0x55, 0xba, 0x65, 0xb0, 0x8e, 0x3c, 0x15, 0xe5, 0x48, 0xc1, 0x27, 0x05, 0x07, 0x0a, - 0x82, 0x2a, 0xaf, 0x72, 0x83, 0xb6, 0x26, 0x65, 0x8e, 0xa7, 0x31, 0x39, 0x93, 0xf2, 0x7c, 0xd9, - 0x72, 0x3d, 0xf4, 0x7d, 0x54, 0xef, 0x42, 0x96, 0xcb, 0xae, 0x73, 0xd8, 0x69, 0x8f, 0x6d, 0xfd, - 0x45, 0x6e, 0x73, 0x6b, 0xb1, 0x93, 0x97, 0x5b, 0xef, 0x50, 0xf7, 0x47, 0x66, 0x83, 0x4c, 0x83, - 0x6b, 0x90, 0x8b, 0x6b, 0xc8, 0x2f, 0x68, 0x6b, 0x20, 0x28, 0x38, 0x84, 0x37, 0xf8, 0x32, 0x20, - 0xfb, 0xf2, 0x66, 0xf2, 0xce, 0x96, 0xf6, 0x8c, 0xb3, 0x93, 0x85, 0xb8, 0x13, 0xc5, 0x93, 0xbc, - 0xa8, 0xf1, 0xd9, 0xeb, 0xbf, 0x26, 0x6e, 0x7f, 0x54, 0x24, 0xee, 0xd7, 0xce, 0xfc, 0x7f, 0xe8, - 0xfb, 0xd8, 0xea, 0x41, 0x2e, 0x0c, 0x65, 0xde, 0x3a, 0x7a, 0x8d, 0x30, 0x6d, 0x71, 0x95, 0x2c, - 0xad, 0x93, 0xb1, 0xb5, 0x78, 0x3c, 0x0d, 0xea, 0x4d, 0x88, 0xdd, 0xd9, 0x68, 0xf0, 0xfe, 0x23, - 0x00, 0x00, 0xff, 0xff, 0x7e, 0x66, 0x01, 0x47, 0xa3, 0x01, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/service/load_stats/v2/lrs/lrs.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/envoy/service/load_stats/v2/lrs/lrs.pb.go deleted file mode 100755 index b0825d47248..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/service/load_stats/v2/lrs/lrs.pb.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: envoy/service/load_stats/v2/lrs.proto - -package v2 - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import duration "github.com/golang/protobuf/ptypes/duration" -import base "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/core/base" -import load_report "google.golang.org/grpc/xds/internal/proto/envoy/api/v2/endpoint/load_report" -import _ "google.golang.org/grpc/xds/internal/proto/validate" - -import ( - context "golang.org/x/net/context" - grpc "google.golang.org/grpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type LoadStatsRequest struct { - Node *base.Node `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` - ClusterStats []*load_report.ClusterStats `protobuf:"bytes,2,rep,name=cluster_stats,json=clusterStats,proto3" json:"cluster_stats,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LoadStatsRequest) Reset() { *m = LoadStatsRequest{} } -func (m *LoadStatsRequest) String() string { return proto.CompactTextString(m) } -func (*LoadStatsRequest) ProtoMessage() {} -func (*LoadStatsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_lrs_0f8f2c1d40a1b9f7, []int{0} -} -func (m *LoadStatsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LoadStatsRequest.Unmarshal(m, b) -} -func (m *LoadStatsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LoadStatsRequest.Marshal(b, m, deterministic) -} -func (dst *LoadStatsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_LoadStatsRequest.Merge(dst, src) -} -func (m *LoadStatsRequest) XXX_Size() int { - return xxx_messageInfo_LoadStatsRequest.Size(m) -} -func (m *LoadStatsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_LoadStatsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_LoadStatsRequest proto.InternalMessageInfo - -func (m *LoadStatsRequest) GetNode() *base.Node { - if m != nil { - return m.Node - } - return nil -} - -func (m *LoadStatsRequest) GetClusterStats() []*load_report.ClusterStats { - if m != nil { - return m.ClusterStats - } - return nil -} - -type LoadStatsResponse struct { - Clusters []string `protobuf:"bytes,1,rep,name=clusters,proto3" json:"clusters,omitempty"` - LoadReportingInterval *duration.Duration `protobuf:"bytes,2,opt,name=load_reporting_interval,json=loadReportingInterval,proto3" json:"load_reporting_interval,omitempty"` - ReportEndpointGranularity bool `protobuf:"varint,3,opt,name=report_endpoint_granularity,json=reportEndpointGranularity,proto3" json:"report_endpoint_granularity,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LoadStatsResponse) Reset() { *m = LoadStatsResponse{} } -func (m *LoadStatsResponse) String() string { return proto.CompactTextString(m) } -func (*LoadStatsResponse) ProtoMessage() {} -func (*LoadStatsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_lrs_0f8f2c1d40a1b9f7, []int{1} -} -func (m *LoadStatsResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LoadStatsResponse.Unmarshal(m, b) -} -func (m *LoadStatsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LoadStatsResponse.Marshal(b, m, deterministic) -} -func (dst *LoadStatsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_LoadStatsResponse.Merge(dst, src) -} -func (m *LoadStatsResponse) XXX_Size() int { - return xxx_messageInfo_LoadStatsResponse.Size(m) -} -func (m *LoadStatsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_LoadStatsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_LoadStatsResponse proto.InternalMessageInfo - -func (m *LoadStatsResponse) GetClusters() []string { - if m != nil { - return m.Clusters - } - return nil -} - -func (m *LoadStatsResponse) GetLoadReportingInterval() *duration.Duration { - if m != nil { - return m.LoadReportingInterval - } - return nil -} - -func (m *LoadStatsResponse) GetReportEndpointGranularity() bool { - if m != nil { - return m.ReportEndpointGranularity - } - return false -} - -func init() { - proto.RegisterType((*LoadStatsRequest)(nil), "envoy.service.load_stats.v2.LoadStatsRequest") - proto.RegisterType((*LoadStatsResponse)(nil), "envoy.service.load_stats.v2.LoadStatsResponse") -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// LoadReportingServiceClient is the client API for LoadReportingService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type LoadReportingServiceClient interface { - StreamLoadStats(ctx context.Context, opts ...grpc.CallOption) (LoadReportingService_StreamLoadStatsClient, error) -} - -type loadReportingServiceClient struct { - cc *grpc.ClientConn -} - -func NewLoadReportingServiceClient(cc *grpc.ClientConn) LoadReportingServiceClient { - return &loadReportingServiceClient{cc} -} - -func (c *loadReportingServiceClient) StreamLoadStats(ctx context.Context, opts ...grpc.CallOption) (LoadReportingService_StreamLoadStatsClient, error) { - stream, err := c.cc.NewStream(ctx, &_LoadReportingService_serviceDesc.Streams[0], "/envoy.service.load_stats.v2.LoadReportingService/StreamLoadStats", opts...) - if err != nil { - return nil, err - } - x := &loadReportingServiceStreamLoadStatsClient{stream} - return x, nil -} - -type LoadReportingService_StreamLoadStatsClient interface { - Send(*LoadStatsRequest) error - Recv() (*LoadStatsResponse, error) - grpc.ClientStream -} - -type loadReportingServiceStreamLoadStatsClient struct { - grpc.ClientStream -} - -func (x *loadReportingServiceStreamLoadStatsClient) Send(m *LoadStatsRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *loadReportingServiceStreamLoadStatsClient) Recv() (*LoadStatsResponse, error) { - m := new(LoadStatsResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// LoadReportingServiceServer is the server API for LoadReportingService service. -type LoadReportingServiceServer interface { - StreamLoadStats(LoadReportingService_StreamLoadStatsServer) error -} - -func RegisterLoadReportingServiceServer(s *grpc.Server, srv LoadReportingServiceServer) { - s.RegisterService(&_LoadReportingService_serviceDesc, srv) -} - -func _LoadReportingService_StreamLoadStats_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(LoadReportingServiceServer).StreamLoadStats(&loadReportingServiceStreamLoadStatsServer{stream}) -} - -type LoadReportingService_StreamLoadStatsServer interface { - Send(*LoadStatsResponse) error - Recv() (*LoadStatsRequest, error) - grpc.ServerStream -} - -type loadReportingServiceStreamLoadStatsServer struct { - grpc.ServerStream -} - -func (x *loadReportingServiceStreamLoadStatsServer) Send(m *LoadStatsResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *loadReportingServiceStreamLoadStatsServer) Recv() (*LoadStatsRequest, error) { - m := new(LoadStatsRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -var _LoadReportingService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "envoy.service.load_stats.v2.LoadReportingService", - HandlerType: (*LoadReportingServiceServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "StreamLoadStats", - Handler: _LoadReportingService_StreamLoadStats_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "envoy/service/load_stats/v2/lrs.proto", -} - -func init() { - proto.RegisterFile("envoy/service/load_stats/v2/lrs.proto", fileDescriptor_lrs_0f8f2c1d40a1b9f7) -} - -var fileDescriptor_lrs_0f8f2c1d40a1b9f7 = []byte{ - // 429 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0x8e, 0xd3, 0x30, - 0x14, 0x86, 0x71, 0x0b, 0xa8, 0x78, 0x40, 0x80, 0x05, 0x6a, 0xa6, 0x83, 0x50, 0x55, 0x04, 0x04, - 0x21, 0x6c, 0x14, 0xf6, 0xb3, 0x28, 0x20, 0x40, 0xaa, 0xd0, 0x90, 0xee, 0xd8, 0x54, 0x6e, 0xf2, - 0x88, 0x2c, 0x05, 0xbf, 0x60, 0x3b, 0x16, 0xbd, 0x01, 0x6c, 0x58, 0x70, 0x1c, 0x56, 0x9c, 0x80, - 0x7b, 0x70, 0x0b, 0x94, 0x38, 0x99, 0xc9, 0xb0, 0xa8, 0x66, 0x17, 0xeb, 0x7d, 0xff, 0xf3, 0xff, - 0xff, 0x31, 0x7d, 0x08, 0xda, 0xe3, 0x4e, 0x58, 0x30, 0x5e, 0x65, 0x20, 0x4a, 0x94, 0xf9, 0xc6, - 0x3a, 0xe9, 0xac, 0xf0, 0x89, 0x28, 0x8d, 0xe5, 0x95, 0x41, 0x87, 0xec, 0xa8, 0xc5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8c, 0x46, 0x6d, 0x8e, 0x43, 0x1e, 0x4a, 0xe2, 0x7d, 0x49, 0xfc, 0x55, - 0x57, 0x52, 0x7a, 0xb7, 0x51, 0xa6, 0xbd, 0xf0, 0x5d, 0xa7, 0x63, 0xc7, 0xf4, 0x28, 0x6c, 0xdb, - 0xf4, 0xf6, 0x37, 0x85, 0x91, 0xba, 0x2e, 0xa5, 0x51, 0x6e, 0x17, 0x8d, 0xe7, 0x24, 0x9e, 0xa4, - 0x87, 0x01, 0x79, 0xdd, 0x11, 0x6f, 0xce, 0x80, 0xe4, 0x07, 0xa1, 0x77, 0x56, 0xc3, 0xcd, 0xeb, - 0xf0, 0x06, 0x98, 0xa7, 0x37, 0xd7, 0xce, 0x80, 0xfc, 0x7c, 0x1a, 0x97, 0x3d, 0xe3, 0x7b, 0x9e, - 0x09, 0xff, 0xff, 0x17, 0xcd, 0xf8, 0x45, 0xf1, 0xd0, 0xe2, 0xe2, 0x52, 0x4c, 0x9e, 0x93, 0xe5, - 0x31, 0x7d, 0xa2, 0x30, 0x28, 0x2b, 0x83, 0x5f, 0x77, 0xfb, 0x96, 0x2c, 0x27, 0x2b, 0x63, 0x4f, - 0x9a, 0xaa, 0x4e, 0xc8, 0xc7, 0x91, 0x4f, 0xbe, 0x11, 0xb2, 0xbd, 0xda, 0x56, 0xf7, 0xe2, 0x5f, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x44, 0xa2, 0xf5, 0xb3, 0xfa, 0x02, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/type/percent/percent.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/envoy/type/percent/percent.pb.go deleted file mode 100755 index e30f1a5758b..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/type/percent/percent.pb.go +++ /dev/null @@ -1,160 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: envoy/type/percent.proto - -package envoy_type - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "google.golang.org/grpc/xds/internal/proto/validate" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type FractionalPercent_DenominatorType int32 - -const ( - FractionalPercent_HUNDRED FractionalPercent_DenominatorType = 0 - FractionalPercent_TEN_THOUSAND FractionalPercent_DenominatorType = 1 - FractionalPercent_MILLION FractionalPercent_DenominatorType = 2 -) - -var FractionalPercent_DenominatorType_name = map[int32]string{ - 0: "HUNDRED", - 1: "TEN_THOUSAND", - 2: "MILLION", -} -var FractionalPercent_DenominatorType_value = map[string]int32{ - "HUNDRED": 0, - "TEN_THOUSAND": 1, - "MILLION": 2, -} - -func (x FractionalPercent_DenominatorType) String() string { - return proto.EnumName(FractionalPercent_DenominatorType_name, int32(x)) -} -func (FractionalPercent_DenominatorType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_percent_cd85ccaca181f641, []int{1, 0} -} - -type Percent struct { - Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Percent) Reset() { *m = Percent{} } -func (m *Percent) String() string { return proto.CompactTextString(m) } -func (*Percent) ProtoMessage() {} -func (*Percent) Descriptor() ([]byte, []int) { - return fileDescriptor_percent_cd85ccaca181f641, []int{0} -} -func (m *Percent) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Percent.Unmarshal(m, b) -} -func (m *Percent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Percent.Marshal(b, m, deterministic) -} -func (dst *Percent) XXX_Merge(src proto.Message) { - xxx_messageInfo_Percent.Merge(dst, src) -} -func (m *Percent) XXX_Size() int { - return xxx_messageInfo_Percent.Size(m) -} -func (m *Percent) XXX_DiscardUnknown() { - xxx_messageInfo_Percent.DiscardUnknown(m) -} - -var xxx_messageInfo_Percent proto.InternalMessageInfo - -func (m *Percent) GetValue() float64 { - if m != nil { - return m.Value - } - return 0 -} - -type FractionalPercent struct { - Numerator uint32 `protobuf:"varint,1,opt,name=numerator,proto3" json:"numerator,omitempty"` - Denominator FractionalPercent_DenominatorType `protobuf:"varint,2,opt,name=denominator,proto3,enum=envoy.type.FractionalPercent_DenominatorType" json:"denominator,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FractionalPercent) Reset() { *m = FractionalPercent{} } -func (m *FractionalPercent) String() string { return proto.CompactTextString(m) } -func (*FractionalPercent) ProtoMessage() {} -func (*FractionalPercent) Descriptor() ([]byte, []int) { - return fileDescriptor_percent_cd85ccaca181f641, []int{1} -} -func (m *FractionalPercent) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FractionalPercent.Unmarshal(m, b) -} -func (m *FractionalPercent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FractionalPercent.Marshal(b, m, deterministic) -} -func (dst *FractionalPercent) XXX_Merge(src proto.Message) { - xxx_messageInfo_FractionalPercent.Merge(dst, src) -} -func (m *FractionalPercent) XXX_Size() int { - return xxx_messageInfo_FractionalPercent.Size(m) -} -func (m *FractionalPercent) XXX_DiscardUnknown() { - xxx_messageInfo_FractionalPercent.DiscardUnknown(m) -} - -var xxx_messageInfo_FractionalPercent proto.InternalMessageInfo - -func (m *FractionalPercent) GetNumerator() uint32 { - if m != nil { - return m.Numerator - } - return 0 -} - -func (m *FractionalPercent) GetDenominator() FractionalPercent_DenominatorType { - if m != nil { - return m.Denominator - } - return FractionalPercent_HUNDRED -} - -func init() { - proto.RegisterType((*Percent)(nil), "envoy.type.Percent") - proto.RegisterType((*FractionalPercent)(nil), "envoy.type.FractionalPercent") - proto.RegisterEnum("envoy.type.FractionalPercent_DenominatorType", FractionalPercent_DenominatorType_name, FractionalPercent_DenominatorType_value) -} - -func init() { proto.RegisterFile("envoy/type/percent.proto", fileDescriptor_percent_cd85ccaca181f641) } - -var fileDescriptor_percent_cd85ccaca181f641 = []byte{ - // 277 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x48, 0xcd, 0x2b, 0xcb, - 0xaf, 0xd4, 0x2f, 0xa9, 0x2c, 0x48, 0xd5, 0x2f, 0x48, 0x2d, 0x4a, 0x4e, 0xcd, 0x2b, 0xd1, 0x2b, - 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x02, 0xcb, 0xe8, 0x81, 0x64, 0xa4, 0xc4, 0xcb, 0x12, 0x73, - 0x32, 0x53, 0x12, 0x4b, 0x52, 0xf5, 0x61, 0x0c, 0x88, 0x22, 0x25, 0x2b, 0x2e, 0xf6, 0x00, 0x88, - 0x2e, 0x21, 0x7d, 0x2e, 0xd6, 0xb2, 0xc4, 0x9c, 0xd2, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x46, - 0x27, 0xc9, 0x5d, 0x2f, 0x0f, 0x30, 0x8b, 0x08, 0x09, 0x49, 0x32, 0x80, 0x41, 0xa4, 0x83, 0x26, - 0x03, 0x14, 0x04, 0x41, 0xd4, 0x29, 0x9d, 0x65, 0xe4, 0x12, 0x74, 0x2b, 0x4a, 0x4c, 0x2e, 0xc9, - 0xcc, 0xcf, 0x4b, 0xcc, 0x81, 0x19, 0x23, 0xc3, 0xc5, 0x99, 0x57, 0x9a, 0x9b, 0x5a, 0x94, 0x58, - 0x92, 0x5f, 0x04, 0x36, 0x8a, 0x37, 0x08, 0x21, 0x20, 0x14, 0xcd, 0xc5, 0x9d, 0x92, 0x9a, 0x97, - 0x9f, 0x9b, 0x99, 0x07, 0x96, 0x67, 0x52, 0x60, 0xd4, 0xe0, 0x33, 0xd2, 0xd5, 0x43, 0x38, 0x55, - 0x0f, 0xc3, 0x44, 0x3d, 0x17, 0x84, 0x86, 0x90, 0xca, 0x82, 0x54, 0x27, 0x2e, 0x90, 0xcb, 0x58, - 0x9b, 0x18, 0x99, 0x04, 0x18, 0x83, 0x90, 0x4d, 0x53, 0xb2, 0xe5, 0xe2, 0x47, 0x53, 0x2b, 0xc4, - 0xcd, 0xc5, 0xee, 0x11, 0xea, 0xe7, 0x12, 0xe4, 0xea, 0x22, 0xc0, 0x20, 0x24, 0xc0, 0xc5, 0x13, - 0xe2, 0xea, 0x17, 0x1f, 0xe2, 0xe1, 0x1f, 0x1a, 0xec, 0xe8, 0xe7, 0x22, 0xc0, 0x08, 0x92, 0xf6, - 0xf5, 0xf4, 0xf1, 0xf1, 0xf4, 0xf7, 0x13, 0x60, 0x72, 0xd2, 0xe2, 0x92, 0xc8, 0xcc, 0x87, 0x38, - 0xa5, 0xa0, 0x28, 0xbf, 0xa2, 0x12, 0xc9, 0x55, 0x4e, 0x3c, 0x50, 0xc7, 0x04, 0x80, 0x42, 0x2d, - 0x80, 0x31, 0x89, 0x0d, 0x1c, 0x7c, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3d, 0x79, 0xd6, - 0xbb, 0x7f, 0x01, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/type/range/range.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/envoy/type/range/range.pb.go deleted file mode 100755 index feee6ac9b03..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/proto/envoy/type/range/range.pb.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: envoy/type/range.proto - -package envoy_type - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type Int64Range struct { - Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` - End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Int64Range) Reset() { *m = Int64Range{} } -func (m *Int64Range) String() string { return proto.CompactTextString(m) } -func (*Int64Range) ProtoMessage() {} -func (*Int64Range) Descriptor() ([]byte, []int) { - return fileDescriptor_range_b0dd53fd27ccc9b2, []int{0} -} -func (m *Int64Range) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Int64Range.Unmarshal(m, b) -} -func (m *Int64Range) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Int64Range.Marshal(b, m, deterministic) -} -func (dst *Int64Range) XXX_Merge(src proto.Message) { - xxx_messageInfo_Int64Range.Merge(dst, src) -} -func (m *Int64Range) XXX_Size() int { - return xxx_messageInfo_Int64Range.Size(m) -} -func (m *Int64Range) XXX_DiscardUnknown() { - xxx_messageInfo_Int64Range.DiscardUnknown(m) -} - -var xxx_messageInfo_Int64Range proto.InternalMessageInfo - -func (m *Int64Range) GetStart() int64 { - if m != nil { - return m.Start - } - return 0 -} - -func (m *Int64Range) GetEnd() int64 { - if m != nil { - return m.End - } - return 0 -} - -type DoubleRange struct { - Start float64 `protobuf:"fixed64,1,opt,name=start,proto3" json:"start,omitempty"` - End float64 `protobuf:"fixed64,2,opt,name=end,proto3" json:"end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DoubleRange) Reset() { *m = DoubleRange{} } -func (m *DoubleRange) String() string { return proto.CompactTextString(m) } -func (*DoubleRange) ProtoMessage() {} -func (*DoubleRange) Descriptor() ([]byte, []int) { - return fileDescriptor_range_b0dd53fd27ccc9b2, []int{1} -} -func (m *DoubleRange) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DoubleRange.Unmarshal(m, b) -} -func (m *DoubleRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DoubleRange.Marshal(b, m, deterministic) -} -func (dst *DoubleRange) XXX_Merge(src proto.Message) { - xxx_messageInfo_DoubleRange.Merge(dst, src) -} -func (m *DoubleRange) XXX_Size() int { - return xxx_messageInfo_DoubleRange.Size(m) -} -func (m *DoubleRange) XXX_DiscardUnknown() { - xxx_messageInfo_DoubleRange.DiscardUnknown(m) -} - -var xxx_messageInfo_DoubleRange proto.InternalMessageInfo - -func (m *DoubleRange) GetStart() float64 { - if m != nil { - return m.Start - } - return 0 -} - -func (m *DoubleRange) GetEnd() float64 { - if m != nil { - return m.End - } - return 0 -} - -func init() { - proto.RegisterType((*Int64Range)(nil), "envoy.type.Int64Range") - proto.RegisterType((*DoubleRange)(nil), "envoy.type.DoubleRange") -} - -func init() { proto.RegisterFile("envoy/type/range.proto", fileDescriptor_range_b0dd53fd27ccc9b2) } - -var fileDescriptor_range_b0dd53fd27ccc9b2 = []byte{ - // 154 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4b, 0xcd, 0x2b, 0xcb, - 0xaf, 0xd4, 0x2f, 0xa9, 0x2c, 0x48, 0xd5, 0x2f, 0x4a, 0xcc, 0x4b, 0x4f, 0xd5, 0x2b, 0x28, 0xca, - 0x2f, 0xc9, 0x17, 0xe2, 0x02, 0x8b, 0xeb, 0x81, 0xc4, 0x95, 0x4c, 0xb8, 0xb8, 0x3c, 0xf3, 0x4a, - 0xcc, 0x4c, 0x82, 0x40, 0xf2, 0x42, 0x22, 0x5c, 0xac, 0xc5, 0x25, 0x89, 0x45, 0x25, 0x12, 0x8c, - 0x0a, 0x8c, 0x1a, 0xcc, 0x41, 0x10, 0x8e, 0x90, 0x00, 0x17, 0x73, 0x6a, 0x5e, 0x8a, 0x04, 0x13, - 0x58, 0x0c, 0xc4, 0x54, 0x32, 0xe5, 0xe2, 0x76, 0xc9, 0x2f, 0x4d, 0xca, 0x49, 0xc5, 0xa2, 0x8d, - 0x11, 0x8b, 0x36, 0x46, 0xb0, 0x36, 0x27, 0x13, 0x2e, 0x89, 0xcc, 0x7c, 0x3d, 0xb0, 0xed, 0x05, - 0x45, 0xf9, 0x15, 0x95, 0x7a, 0x08, 0x87, 0x38, 0x71, 0x81, 0x8d, 0x0a, 0x00, 0x39, 0x30, 0x80, - 0x31, 0x0a, 0xe2, 0xc4, 0x78, 0x90, 0x4c, 0x12, 0x1b, 0xd8, 0xd5, 0xc6, 0x80, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x7f, 0xad, 0x02, 0xe6, 0xcf, 0x00, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/const.go b/vendor/google.golang.org/grpc/xds/internal/proto/proto.go similarity index 73% rename from vendor/google.golang.org/grpc/xds/internal/const.go rename to vendor/google.golang.org/grpc/xds/internal/proto/proto.go index d67297b93de..198c02c8e14 100644 --- a/vendor/google.golang.org/grpc/xds/internal/const.go +++ b/vendor/google.golang.org/grpc/xds/internal/proto/proto.go @@ -13,13 +13,9 @@ * 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. - * */ -package internal +//go:generate ./regenerate.sh -var ( - // GrpcHostname is the metadata key for specifying the grpc service name when sending xDS requests - // from grpc to the traffic director. - GrpcHostname = "TRAFFICDIRECTOR_GRPC_HOSTNAME" -) +// Package proto is for go generate. +package proto diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/regenerate.sh b/vendor/google.golang.org/grpc/xds/internal/proto/regenerate.sh new file mode 100755 index 00000000000..b5fa0603c6f --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/proto/regenerate.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# 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. + +set -eux -o pipefail + +TMP=$(mktemp -d) + +function finish { + rm -rf "$TMP" +} +trap finish EXIT + +pushd "$TMP" + +UDPA_VERSION=015fc86d90f4045a56f831bcdfa560bc455450e2 +git clone https://github.com/cncf/udpa.git +cd udpa +git checkout ${UDPA_VERSION} + +VALIDATE_VERSION=4f00761ef740eb579cfddcfee3951e13c4fae6f8 +mkdir validate +curl https://raw.githubusercontent.com/envoyproxy/protoc-gen-validate/${VALIDATE_VERSION}/validate/validate.proto > validate/validate.proto + +find udpa -name "*.proto" | xargs -L 1 protoc --go_out=plugins=grpc,paths=source_relative,Mudpa/data/orca/v1/orca_load_report.proto=google.golang.org/grpc/xds/internal/proto/udpa/data/orca/v1:. +popd +rm -rf ./udpa +cp -r "$TMP"/udpa/udpa ./udpa +find udpa -type f -not -name "*.pb.go" | xargs rm diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/udpa/data/orca/v1/orca_load_report.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/udpa/data/orca/v1/orca_load_report.pb.go new file mode 100644 index 00000000000..7abccd10eb7 --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/proto/udpa/data/orca/v1/orca_load_report.pb.go @@ -0,0 +1,139 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: udpa/data/orca/v1/orca_load_report.proto + +package udpa_data_orca_v1 + +import ( + fmt "fmt" + _ "github.com/envoyproxy/protoc-gen-validate/validate" + proto "github.com/golang/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type OrcaLoadReport struct { + // CPU utilization expressed as a fraction of available CPU resources. This + // should be derived from the latest sample or measurement. + CpuUtilization float64 `protobuf:"fixed64,1,opt,name=cpu_utilization,json=cpuUtilization,proto3" json:"cpu_utilization,omitempty"` + // Memory utilization expressed as a fraction of available memory + // resources. This should be derived from the latest sample or measurement. + MemUtilization float64 `protobuf:"fixed64,2,opt,name=mem_utilization,json=memUtilization,proto3" json:"mem_utilization,omitempty"` + // Total RPS being served by an endpoint. This should cover all services that an endpoint is + // responsible for. + Rps uint64 `protobuf:"varint,3,opt,name=rps,proto3" json:"rps,omitempty"` + // Application specific requests costs. Each value is an absolute cost (e.g. 3487 bytes of + // storage) associated with the request. + RequestCost map[string]float64 `protobuf:"bytes,4,rep,name=request_cost,json=requestCost,proto3" json:"request_cost,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` + // Resource utilization values. Each value is expressed as a fraction of total resources + // available, derived from the latest sample or measurement. + Utilization map[string]float64 `protobuf:"bytes,5,rep,name=utilization,proto3" json:"utilization,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OrcaLoadReport) Reset() { *m = OrcaLoadReport{} } +func (m *OrcaLoadReport) String() string { return proto.CompactTextString(m) } +func (*OrcaLoadReport) ProtoMessage() {} +func (*OrcaLoadReport) Descriptor() ([]byte, []int) { + return fileDescriptor_27edb21f16098bf0, []int{0} +} + +func (m *OrcaLoadReport) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OrcaLoadReport.Unmarshal(m, b) +} +func (m *OrcaLoadReport) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OrcaLoadReport.Marshal(b, m, deterministic) +} +func (m *OrcaLoadReport) XXX_Merge(src proto.Message) { + xxx_messageInfo_OrcaLoadReport.Merge(m, src) +} +func (m *OrcaLoadReport) XXX_Size() int { + return xxx_messageInfo_OrcaLoadReport.Size(m) +} +func (m *OrcaLoadReport) XXX_DiscardUnknown() { + xxx_messageInfo_OrcaLoadReport.DiscardUnknown(m) +} + +var xxx_messageInfo_OrcaLoadReport proto.InternalMessageInfo + +func (m *OrcaLoadReport) GetCpuUtilization() float64 { + if m != nil { + return m.CpuUtilization + } + return 0 +} + +func (m *OrcaLoadReport) GetMemUtilization() float64 { + if m != nil { + return m.MemUtilization + } + return 0 +} + +func (m *OrcaLoadReport) GetRps() uint64 { + if m != nil { + return m.Rps + } + return 0 +} + +func (m *OrcaLoadReport) GetRequestCost() map[string]float64 { + if m != nil { + return m.RequestCost + } + return nil +} + +func (m *OrcaLoadReport) GetUtilization() map[string]float64 { + if m != nil { + return m.Utilization + } + return nil +} + +func init() { + proto.RegisterType((*OrcaLoadReport)(nil), "udpa.data.orca.v1.OrcaLoadReport") + proto.RegisterMapType((map[string]float64)(nil), "udpa.data.orca.v1.OrcaLoadReport.RequestCostEntry") + proto.RegisterMapType((map[string]float64)(nil), "udpa.data.orca.v1.OrcaLoadReport.UtilizationEntry") +} + +func init() { + proto.RegisterFile("udpa/data/orca/v1/orca_load_report.proto", fileDescriptor_27edb21f16098bf0) +} + +var fileDescriptor_27edb21f16098bf0 = []byte{ + // 341 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x4f, 0x4b, 0xfb, 0x30, + 0x1c, 0xc6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, 0x14, 0xee, 0x09, 0xfa, 0xa6, 0x68, 0x2e, + 0xc3, 0x88, 0xe5, 0xb2, 0xdb, 0xe8, 0xd7, 0x3d, 0x67, 0x38, 0x44, 0x5b, 0xd4, 0xa8, 0x0a, 0x86, + 0xb0, 0x75, 0x3d, 0xb0, 0x5c, 0x8e, 0xe7, 0x52, 0x2c, 0xb0, 0x23, 0xd6, 0x3b, 0xee, 0x07, 0x74, + 0xca, 0x5d, 0x9b, 0xbb, 0xa6, 0x96, 0xca, 0x9a, 0xd4, 0xe0, 0x72, 0x19, 0x74, 0xbe, 0xc0, 0xfe, + 0x75, 0x15, 0x72, 0xb5, 0xb5, 0x26, 0x2d, 0x1f, 0xd7, 0xbb, 0x83, 0x9d, 0xcd, 0x7a, 0x1a, 0xfd, + 0x95, 0x2e, 0xcc, 0xe5, 0xb7, 0xb0, 0x1e, 0xdd, 0x63, 0xd8, 0x2c, 0x48, 0xaa, 0xa8, 0xbd, 0x49, + 0x6c, 0x17, 0xa3, 0xda, 0x2d, 0xd0, 0xfe, 0xcd, 0x22, 0x7f, 0xf1, 0x07, 0x23, 0x78, 0x1e, 0xb1, + 0x0c, 0x3d, 0x27, 0xf2, 0x45, 0xcd, 0x2c, 0xf4, 0x16, 0x79, 0x70, 0x54, 0x45, 0x9f, 0xe8, 0x17, + 0x34, 0x01, 0xb3, 0xff, 0xe6, 0x29, 0xdd, 0xfc, 0x04, 0x00, 0x00, 0xff, 0xff, 0x71, 0x13, 0xd1, + 0xd4, 0xa2, 0x02, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/udpa/data/orca/v1/orca_load_report/orca_load_report.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/udpa/data/orca/v1/orca_load_report/orca_load_report.pb.go deleted file mode 100755 index 0ab45d8c2d8..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/proto/udpa/data/orca/v1/orca_load_report/orca_load_report.pb.go +++ /dev/null @@ -1,127 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: udpa/data/orca/v1/orca_load_report.proto - -package v1 - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "google.golang.org/grpc/xds/internal/proto/validate" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type OrcaLoadReport struct { - CpuUtilization float64 `protobuf:"fixed64,1,opt,name=cpu_utilization,json=cpuUtilization,proto3" json:"cpu_utilization,omitempty"` - MemUtilization float64 `protobuf:"fixed64,2,opt,name=mem_utilization,json=memUtilization,proto3" json:"mem_utilization,omitempty"` - Rps uint64 `protobuf:"varint,3,opt,name=rps,proto3" json:"rps,omitempty"` - RequestCost map[string]float64 `protobuf:"bytes,4,rep,name=request_cost,json=requestCost,proto3" json:"request_cost,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` - Utilization map[string]float64 `protobuf:"bytes,5,rep,name=utilization,proto3" json:"utilization,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OrcaLoadReport) Reset() { *m = OrcaLoadReport{} } -func (m *OrcaLoadReport) String() string { return proto.CompactTextString(m) } -func (*OrcaLoadReport) ProtoMessage() {} -func (*OrcaLoadReport) Descriptor() ([]byte, []int) { - return fileDescriptor_orca_load_report_f7a8d2b84dee17a7, []int{0} -} -func (m *OrcaLoadReport) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OrcaLoadReport.Unmarshal(m, b) -} -func (m *OrcaLoadReport) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OrcaLoadReport.Marshal(b, m, deterministic) -} -func (dst *OrcaLoadReport) XXX_Merge(src proto.Message) { - xxx_messageInfo_OrcaLoadReport.Merge(dst, src) -} -func (m *OrcaLoadReport) XXX_Size() int { - return xxx_messageInfo_OrcaLoadReport.Size(m) -} -func (m *OrcaLoadReport) XXX_DiscardUnknown() { - xxx_messageInfo_OrcaLoadReport.DiscardUnknown(m) -} - -var xxx_messageInfo_OrcaLoadReport proto.InternalMessageInfo - -func (m *OrcaLoadReport) GetCpuUtilization() float64 { - if m != nil { - return m.CpuUtilization - } - return 0 -} - -func (m *OrcaLoadReport) GetMemUtilization() float64 { - if m != nil { - return m.MemUtilization - } - return 0 -} - -func (m *OrcaLoadReport) GetRps() uint64 { - if m != nil { - return m.Rps - } - return 0 -} - -func (m *OrcaLoadReport) GetRequestCost() map[string]float64 { - if m != nil { - return m.RequestCost - } - return nil -} - -func (m *OrcaLoadReport) GetUtilization() map[string]float64 { - if m != nil { - return m.Utilization - } - return nil -} - -func init() { - proto.RegisterType((*OrcaLoadReport)(nil), "udpa.data.orca.v1.OrcaLoadReport") - proto.RegisterMapType((map[string]float64)(nil), "udpa.data.orca.v1.OrcaLoadReport.RequestCostEntry") - proto.RegisterMapType((map[string]float64)(nil), "udpa.data.orca.v1.OrcaLoadReport.UtilizationEntry") -} - -func init() { - proto.RegisterFile("udpa/data/orca/v1/orca_load_report.proto", fileDescriptor_orca_load_report_f7a8d2b84dee17a7) -} - -var fileDescriptor_orca_load_report_f7a8d2b84dee17a7 = []byte{ - // 354 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x28, 0x4d, 0x29, 0x48, - 0xd4, 0x4f, 0x49, 0x2c, 0x49, 0xd4, 0xcf, 0x2f, 0x4a, 0x4e, 0xd4, 0x2f, 0x33, 0x04, 0xd3, 0xf1, - 0x39, 0xf9, 0x89, 0x29, 0xf1, 0x45, 0xa9, 0x05, 0xf9, 0x45, 0x25, 0x7a, 0x05, 0x45, 0xf9, 0x25, - 0xf9, 0x42, 0x82, 0x20, 0x95, 0x7a, 0x20, 0x95, 0x7a, 0x20, 0x15, 0x7a, 0x65, 0x86, 0x52, 0xe2, - 0x65, 0x89, 0x39, 0x99, 0x29, 0x89, 0x25, 0xa9, 0xfa, 0x30, 0x06, 0x44, 0xad, 0xd2, 0x24, 0x16, - 0x2e, 0x3e, 0xff, 0xa2, 0xe4, 0x44, 0x9f, 0xfc, 0xc4, 0x94, 0x20, 0xb0, 0x21, 0x42, 0x9e, 0x5c, - 0xfc, 0xc9, 0x05, 0xa5, 0xf1, 0xa5, 0x25, 0x99, 0x39, 0x99, 0x55, 0x89, 0x25, 0x99, 0xf9, 0x79, - 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x8c, 0x4e, 0x0a, 0xbb, 0x5e, 0x1e, 0x60, 0xe6, 0x16, 0xe2, 0xd4, - 0x64, 0x80, 0x02, 0x28, 0x5f, 0x12, 0xc2, 0xfb, 0x60, 0x1f, 0xc4, 0x97, 0x5c, 0x50, 0x1a, 0x8a, - 0xd0, 0x07, 0x32, 0x2a, 0x37, 0x35, 0x17, 0xc5, 0x28, 0x26, 0x62, 0x8d, 0xca, 0x4d, 0xcd, 0x45, - 0x36, 0x4a, 0x80, 0x8b, 0xb9, 0xa8, 0xa0, 0x58, 0x82, 0x59, 0x81, 0x51, 0x83, 0x25, 0x08, 0xc4, - 0x14, 0x0a, 0xe5, 0xe2, 0x29, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x89, 0x4f, 0xce, 0x2f, 0x2e, - 0x91, 0x60, 0x51, 0x60, 0xd6, 0xe0, 0x36, 0x32, 0xd2, 0xc3, 0xf0, 0xbd, 0x1e, 0xaa, 0x07, 0xf5, - 0x82, 0x20, 0xba, 0x9c, 0xf3, 0x8b, 0x4b, 0x5c, 0xf3, 0x4a, 0x8a, 0x2a, 0x83, 0xb8, 0x8b, 0x10, - 0x22, 0x42, 0x0d, 0x8c, 0x5c, 0xdc, 0xc8, 0x0e, 0x66, 0x25, 0xd6, 0x58, 0x24, 0xd7, 0x82, 0x8d, - 0x75, 0xd2, 0x02, 0x79, 0x4a, 0x60, 0x16, 0x23, 0xaf, 0x16, 0xba, 0x4f, 0x61, 0x82, 0x08, 0xef, - 0x22, 0x5b, 0x29, 0x65, 0xc7, 0x25, 0x80, 0xee, 0x46, 0x90, 0xff, 0xb3, 0x53, 0x2b, 0xc1, 0x31, - 0xc1, 0x19, 0x04, 0x62, 0x0a, 0x89, 0x70, 0xb1, 0x96, 0x25, 0xe6, 0x94, 0xa6, 0x42, 0x82, 0x34, - 0x08, 0xc2, 0xb1, 0x62, 0xb2, 0x60, 0x04, 0xe9, 0x47, 0x77, 0x0c, 0x29, 0xfa, 0x9d, 0x6c, 0xb8, - 0xe4, 0x33, 0xf3, 0xf5, 0x52, 0xf3, 0xca, 0xf2, 0x2b, 0x0b, 0x8a, 0xf2, 0x2b, 0x2a, 0x31, 0xfd, - 0xee, 0x24, 0x8c, 0xea, 0xf9, 0x00, 0x50, 0x62, 0x0a, 0x60, 0x8c, 0x62, 0x2a, 0x33, 0x4c, 0x62, - 0x03, 0xa7, 0x2c, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4f, 0x12, 0xa0, 0x7f, 0xb1, 0x02, - 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/udpa/service/orca/v1/orca/orca.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/udpa/service/orca/v1/orca.pb.go old mode 100755 new mode 100644 similarity index 55% rename from vendor/google.golang.org/grpc/xds/internal/proto/udpa/service/orca/v1/orca/orca.pb.go rename to vendor/google.golang.org/grpc/xds/internal/proto/udpa/service/orca/v1/orca.pb.go index d7613b6933f..e077e1ba85a --- a/vendor/google.golang.org/grpc/xds/internal/proto/udpa/service/orca/v1/orca/orca.pb.go +++ b/vendor/google.golang.org/grpc/xds/internal/proto/udpa/service/orca/v1/orca.pb.go @@ -1,18 +1,19 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: udpa/service/orca/v1/orca.proto -package v1 - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import duration "github.com/golang/protobuf/ptypes/duration" -import orca_load_report "google.golang.org/grpc/xds/internal/proto/udpa/data/orca/v1/orca_load_report" -import _ "google.golang.org/grpc/xds/internal/proto/validate" +package udpa_service_orca_v1 import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + _ "github.com/envoyproxy/protoc-gen-validate/validate" + proto "github.com/golang/protobuf/proto" + duration "github.com/golang/protobuf/ptypes/duration" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + v1 "google.golang.org/grpc/xds/internal/proto/udpa/data/orca/v1" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -24,30 +25,35 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type OrcaLoadReportRequest struct { - ReportInterval *duration.Duration `protobuf:"bytes,1,opt,name=report_interval,json=reportInterval,proto3" json:"report_interval,omitempty"` - RequestCostNames []string `protobuf:"bytes,2,rep,name=request_cost_names,json=requestCostNames,proto3" json:"request_cost_names,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Interval for generating Open RCA core metric responses. + ReportInterval *duration.Duration `protobuf:"bytes,1,opt,name=report_interval,json=reportInterval,proto3" json:"report_interval,omitempty"` + // Request costs to collect. If this is empty, all known requests costs tracked by + // the load reporting agent will be returned. This provides an opportunity for + // the client to selectively obtain a subset of tracked costs. + RequestCostNames []string `protobuf:"bytes,2,rep,name=request_cost_names,json=requestCostNames,proto3" json:"request_cost_names,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *OrcaLoadReportRequest) Reset() { *m = OrcaLoadReportRequest{} } func (m *OrcaLoadReportRequest) String() string { return proto.CompactTextString(m) } func (*OrcaLoadReportRequest) ProtoMessage() {} func (*OrcaLoadReportRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_orca_ca77e509304795c3, []int{0} + return fileDescriptor_f598b2ec2dba5eee, []int{0} } + func (m *OrcaLoadReportRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrcaLoadReportRequest.Unmarshal(m, b) } func (m *OrcaLoadReportRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_OrcaLoadReportRequest.Marshal(b, m, deterministic) } -func (dst *OrcaLoadReportRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_OrcaLoadReportRequest.Merge(dst, src) +func (m *OrcaLoadReportRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_OrcaLoadReportRequest.Merge(m, src) } func (m *OrcaLoadReportRequest) XXX_Size() int { return xxx_messageInfo_OrcaLoadReportRequest.Size(m) @@ -76,6 +82,31 @@ func init() { proto.RegisterType((*OrcaLoadReportRequest)(nil), "udpa.service.orca.v1.OrcaLoadReportRequest") } +func init() { proto.RegisterFile("udpa/service/orca/v1/orca.proto", fileDescriptor_f598b2ec2dba5eee) } + +var fileDescriptor_f598b2ec2dba5eee = []byte{ + // 295 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0xdd, 0x4a, 0xc3, 0x40, + 0x10, 0x85, 0x89, 0x82, 0xd0, 0x15, 0xaa, 0x06, 0xc5, 0xda, 0x0b, 0xad, 0xe2, 0x45, 0x41, 0xd9, + 0xd8, 0xf6, 0x0d, 0x5a, 0x6f, 0x04, 0xb5, 0x25, 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0x22, + 0x42, 0x54, 0x67, 0x6b, 0x61, 0x84, 0xdd, 0x82, 0x18, 0xdf, 0x50, 0x38, 0x33, 0x36, 0x7c, 0xd0, + 0x5d, 0x65, 0xe9, 0xce, 0x2d, 0x86, 0xb7, 0xde, 0xdc, 0x74, 0xf8, 0x8f, 0xf3, 0x29, 0x98, 0xcf, + 0xd4, 0xbd, 0xa1, 0x9d, 0xde, 0x66, 0xf2, 0x59, 0x6d, 0x3c, 0xd0, 0x15, 0x31, 0xef, 0x35, 0xe4, + 0xaa, 0xd9, 0x7a, 0x15, 0x6c, 0x8e, 0xdc, 0xfa, 0xb3, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1f, + 0xe4, 0x0b, 0x27, 0xdc, 0x01, 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -115,7 +146,7 @@ func (c *openRcaServiceClient) StreamCoreMetrics(ctx context.Context, in *OrcaLo } type OpenRcaService_StreamCoreMetricsClient interface { - Recv() (*orca_load_report.OrcaLoadReport, error) + Recv() (*v1.OrcaLoadReport, error) grpc.ClientStream } @@ -123,8 +154,8 @@ type openRcaServiceStreamCoreMetricsClient struct { grpc.ClientStream } -func (x *openRcaServiceStreamCoreMetricsClient) Recv() (*orca_load_report.OrcaLoadReport, error) { - m := new(orca_load_report.OrcaLoadReport) +func (x *openRcaServiceStreamCoreMetricsClient) Recv() (*v1.OrcaLoadReport, error) { + m := new(v1.OrcaLoadReport) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } @@ -136,6 +167,14 @@ type OpenRcaServiceServer interface { StreamCoreMetrics(*OrcaLoadReportRequest, OpenRcaService_StreamCoreMetricsServer) error } +// UnimplementedOpenRcaServiceServer can be embedded to have forward compatible implementations. +type UnimplementedOpenRcaServiceServer struct { +} + +func (*UnimplementedOpenRcaServiceServer) StreamCoreMetrics(req *OrcaLoadReportRequest, srv OpenRcaService_StreamCoreMetricsServer) error { + return status.Errorf(codes.Unimplemented, "method StreamCoreMetrics not implemented") +} + func RegisterOpenRcaServiceServer(s *grpc.Server, srv OpenRcaServiceServer) { s.RegisterService(&_OpenRcaService_serviceDesc, srv) } @@ -149,7 +188,7 @@ func _OpenRcaService_StreamCoreMetrics_Handler(srv interface{}, stream grpc.Serv } type OpenRcaService_StreamCoreMetricsServer interface { - Send(*orca_load_report.OrcaLoadReport) error + Send(*v1.OrcaLoadReport) error grpc.ServerStream } @@ -157,7 +196,7 @@ type openRcaServiceStreamCoreMetricsServer struct { grpc.ServerStream } -func (x *openRcaServiceStreamCoreMetricsServer) Send(m *orca_load_report.OrcaLoadReport) error { +func (x *openRcaServiceStreamCoreMetricsServer) Send(m *v1.OrcaLoadReport) error { return x.ServerStream.SendMsg(m) } @@ -174,30 +213,3 @@ var _OpenRcaService_serviceDesc = grpc.ServiceDesc{ }, Metadata: "udpa/service/orca/v1/orca.proto", } - -func init() { - proto.RegisterFile("udpa/service/orca/v1/orca.proto", fileDescriptor_orca_ca77e509304795c3) -} - -var fileDescriptor_orca_ca77e509304795c3 = []byte{ - // 300 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0x4f, 0x4b, 0xc3, 0x40, - 0x10, 0xc5, 0x49, 0x05, 0xa1, 0x2b, 0x54, 0x0d, 0x8a, 0xb5, 0x07, 0xad, 0x3d, 0x15, 0x94, 0x8d, - 0xad, 0xf8, 0x05, 0x5a, 0x2f, 0x82, 0xda, 0x92, 0xde, 0xbc, 0x84, 0x69, 0x32, 0x96, 0x85, 0x34, - 0x13, 0x67, 0x37, 0xab, 0xfd, 0x08, 0x7e, 0x6b, 0xc9, 0x6e, 0x7a, 0x10, 0xe2, 0x69, 0xff, 0xbc, - 0xf7, 0x9b, 0xc7, 0x3c, 0x71, 0x5d, 0x65, 0x25, 0x44, 0x1a, 0xd9, 0xaa, 0x14, 0x23, 0xe2, 0x14, - 0x22, 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d, 0xc9, 0xf4, 0xbd, 0x6b, 0x0d, 0x98, 0x75, - 0x6b, 0x6e, 0x59, 0xef, 0xbc, 0x0c, 0xde, 0x3b, 0x76, 0xb2, 0x3e, 0x74, 0x05, 0x3c, 0xfc, 0x06, - 0x00, 0x00, 0xff, 0xff, 0xac, 0x32, 0x62, 0x96, 0xde, 0x01, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/udpa/type/v1/typed_struct.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/udpa/type/v1/typed_struct.pb.go new file mode 100644 index 00000000000..0b91b3146f9 --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/proto/udpa/type/v1/typed_struct.pb.go @@ -0,0 +1,118 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: udpa/type/v1/typed_struct.proto + +package udpa_type_v1 + +import ( + fmt "fmt" + _ "github.com/envoyproxy/protoc-gen-validate/validate" + proto "github.com/golang/protobuf/proto" + _struct "github.com/golang/protobuf/ptypes/struct" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// A TypedStruct contains an arbitrary JSON serialized protocol buffer message with a URL that +// describes the type of the serialized message. This is very similar to google.protobuf.Any, +// instead of having protocol buffer binary, this employs google.protobuf.Struct as value. +// +// This message is intended to be embedded inside Any, so it shouldn't be directly referred +// from other UDPA messages. +// +// When packing an opaque extension config, packing the expected type into Any is preferred +// wherever possible for its efficiency. TypedStruct should be used only if a proto descriptor +// is not available, for example if: +// - A control plane sends opaque message that is originally from external source in human readable +// format such as JSON or YAML. +// - The control plane doesn't have the knowledge of the protocol buffer schema hence it cannot +// serialize the message in protocol buffer binary format. +// - The DPLB doesn't have have the knowledge of the protocol buffer schema its plugin or extension +// uses. This has to be indicated in the DPLB capability negotiation. +// +// When a DPLB receives a TypedStruct in Any, it should: +// - Check if the type_url of the TypedStruct matches the type the extension expects. +// - Convert value to the type described in type_url and perform validation. +// TODO(lizan): Figure out how TypeStruct should be used with DPLB extensions that doesn't link +// protobuf descriptor with DPLB itself, (e.g. gRPC LB Plugin, Envoy WASM extensions). +type TypedStruct struct { + // A URL that uniquely identifies the type of the serialize protocol buffer message. + // This has same semantics and format described in google.protobuf.Any: + // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto + TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` + // A JSON representation of the above specified type. + Value *_struct.Struct `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TypedStruct) Reset() { *m = TypedStruct{} } +func (m *TypedStruct) String() string { return proto.CompactTextString(m) } +func (*TypedStruct) ProtoMessage() {} +func (*TypedStruct) Descriptor() ([]byte, []int) { + return fileDescriptor_098110268becad8a, []int{0} +} + +func (m *TypedStruct) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TypedStruct.Unmarshal(m, b) +} +func (m *TypedStruct) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TypedStruct.Marshal(b, m, deterministic) +} +func (m *TypedStruct) XXX_Merge(src proto.Message) { + xxx_messageInfo_TypedStruct.Merge(m, src) +} +func (m *TypedStruct) XXX_Size() int { + return xxx_messageInfo_TypedStruct.Size(m) +} +func (m *TypedStruct) XXX_DiscardUnknown() { + xxx_messageInfo_TypedStruct.DiscardUnknown(m) +} + +var xxx_messageInfo_TypedStruct proto.InternalMessageInfo + +func (m *TypedStruct) GetTypeUrl() string { + if m != nil { + return m.TypeUrl + } + return "" +} + +func (m *TypedStruct) GetValue() *_struct.Struct { + if m != nil { + return m.Value + } + return nil +} + +func init() { + proto.RegisterType((*TypedStruct)(nil), "udpa.type.v1.TypedStruct") +} + +func init() { proto.RegisterFile("udpa/type/v1/typed_struct.proto", fileDescriptor_098110268becad8a) } + +var fileDescriptor_098110268becad8a = []byte{ + // 192 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2f, 0x4d, 0x29, 0x48, + 0xd4, 0x2f, 0xa9, 0x2c, 0x48, 0xd5, 0x2f, 0x33, 0x04, 0xd3, 0x29, 0xf1, 0xc5, 0x25, 0x45, 0xa5, + 0xc9, 0x25, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x3c, 0x20, 0x05, 0x7a, 0x20, 0x09, 0xbd, + 0x32, 0x43, 0x29, 0xf1, 0xb2, 0xc4, 0x9c, 0xcc, 0x94, 0xc4, 0x92, 0x54, 0x7d, 0x18, 0x03, 0xa2, + 0x4c, 0x4a, 0x26, 0x3d, 0x3f, 0x3f, 0x3d, 0x27, 0x55, 0x1f, 0xcc, 0x4b, 0x2a, 0x4d, 0xd3, 0x47, + 0x36, 0x44, 0x29, 0x9c, 0x8b, 0x3b, 0x04, 0x64, 0x74, 0x30, 0x58, 0x50, 0x48, 0x92, 0x8b, 0x03, + 0x64, 0x60, 0x7c, 0x69, 0x51, 0x8e, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x3b, 0x88, 0x1f, + 0x5a, 0x94, 0x23, 0xa4, 0xcb, 0xc5, 0x5a, 0x96, 0x98, 0x53, 0x9a, 0x2a, 0xc1, 0xa4, 0xc0, 0xa8, + 0xc1, 0x6d, 0x24, 0xae, 0x07, 0x31, 0x57, 0x0f, 0x66, 0xae, 0x1e, 0xc4, 0x88, 0x20, 0x88, 0x2a, + 0x27, 0x23, 0x2e, 0x99, 0xe4, 0xfc, 0x5c, 0xbd, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0x3d, 0xb0, + 0x53, 0x91, 0xdd, 0xeb, 0x24, 0x80, 0x64, 0x6d, 0x00, 0xc8, 0x88, 0x00, 0xc6, 0x24, 0x36, 0xb0, + 0x59, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x68, 0x7c, 0xa9, 0xb5, 0xfb, 0x00, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/grpc/xds/internal/proto/validate/validate.pb.go b/vendor/google.golang.org/grpc/xds/internal/proto/validate/validate.pb.go deleted file mode 100755 index f46210c8ae3..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/proto/validate/validate.pb.go +++ /dev/null @@ -1,3214 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: validate/validate.proto - -package validate // import "google.golang.org/grpc/xds/internal/proto/validate" - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" -import duration "github.com/golang/protobuf/ptypes/duration" -import timestamp "github.com/golang/protobuf/ptypes/timestamp" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type FieldRules struct { - // Types that are valid to be assigned to Type: - // *FieldRules_Float - // *FieldRules_Double - // *FieldRules_Int32 - // *FieldRules_Int64 - // *FieldRules_Uint32 - // *FieldRules_Uint64 - // *FieldRules_Sint32 - // *FieldRules_Sint64 - // *FieldRules_Fixed32 - // *FieldRules_Fixed64 - // *FieldRules_Sfixed32 - // *FieldRules_Sfixed64 - // *FieldRules_Bool - // *FieldRules_String_ - // *FieldRules_Bytes - // *FieldRules_Enum - // *FieldRules_Message - // *FieldRules_Repeated - // *FieldRules_Map - // *FieldRules_Any - // *FieldRules_Duration - // *FieldRules_Timestamp - Type isFieldRules_Type `protobuf_oneof:"type"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FieldRules) Reset() { *m = FieldRules{} } -func (m *FieldRules) String() string { return proto.CompactTextString(m) } -func (*FieldRules) ProtoMessage() {} -func (*FieldRules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{0} -} -func (m *FieldRules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FieldRules.Unmarshal(m, b) -} -func (m *FieldRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FieldRules.Marshal(b, m, deterministic) -} -func (dst *FieldRules) XXX_Merge(src proto.Message) { - xxx_messageInfo_FieldRules.Merge(dst, src) -} -func (m *FieldRules) XXX_Size() int { - return xxx_messageInfo_FieldRules.Size(m) -} -func (m *FieldRules) XXX_DiscardUnknown() { - xxx_messageInfo_FieldRules.DiscardUnknown(m) -} - -var xxx_messageInfo_FieldRules proto.InternalMessageInfo - -type isFieldRules_Type interface { - isFieldRules_Type() -} - -type FieldRules_Float struct { - Float *FloatRules `protobuf:"bytes,1,opt,name=float,oneof"` -} - -type FieldRules_Double struct { - Double *DoubleRules `protobuf:"bytes,2,opt,name=double,oneof"` -} - -type FieldRules_Int32 struct { - Int32 *Int32Rules `protobuf:"bytes,3,opt,name=int32,oneof"` -} - -type FieldRules_Int64 struct { - Int64 *Int64Rules `protobuf:"bytes,4,opt,name=int64,oneof"` -} - -type FieldRules_Uint32 struct { - Uint32 *UInt32Rules `protobuf:"bytes,5,opt,name=uint32,oneof"` -} - -type FieldRules_Uint64 struct { - Uint64 *UInt64Rules `protobuf:"bytes,6,opt,name=uint64,oneof"` -} - -type FieldRules_Sint32 struct { - Sint32 *SInt32Rules `protobuf:"bytes,7,opt,name=sint32,oneof"` -} - -type FieldRules_Sint64 struct { - Sint64 *SInt64Rules `protobuf:"bytes,8,opt,name=sint64,oneof"` -} - -type FieldRules_Fixed32 struct { - Fixed32 *Fixed32Rules `protobuf:"bytes,9,opt,name=fixed32,oneof"` -} - -type FieldRules_Fixed64 struct { - Fixed64 *Fixed64Rules `protobuf:"bytes,10,opt,name=fixed64,oneof"` -} - -type FieldRules_Sfixed32 struct { - Sfixed32 *SFixed32Rules `protobuf:"bytes,11,opt,name=sfixed32,oneof"` -} - -type FieldRules_Sfixed64 struct { - Sfixed64 *SFixed64Rules `protobuf:"bytes,12,opt,name=sfixed64,oneof"` -} - -type FieldRules_Bool struct { - Bool *BoolRules `protobuf:"bytes,13,opt,name=bool,oneof"` -} - -type FieldRules_String_ struct { - String_ *StringRules `protobuf:"bytes,14,opt,name=string,oneof"` -} - -type FieldRules_Bytes struct { - Bytes *BytesRules `protobuf:"bytes,15,opt,name=bytes,oneof"` -} - -type FieldRules_Enum struct { - Enum *EnumRules `protobuf:"bytes,16,opt,name=enum,oneof"` -} - -type FieldRules_Message struct { - Message *MessageRules `protobuf:"bytes,17,opt,name=message,oneof"` -} - -type FieldRules_Repeated struct { - Repeated *RepeatedRules `protobuf:"bytes,18,opt,name=repeated,oneof"` -} - -type FieldRules_Map struct { - Map *MapRules `protobuf:"bytes,19,opt,name=map,oneof"` -} - -type FieldRules_Any struct { - Any *AnyRules `protobuf:"bytes,20,opt,name=any,oneof"` -} - -type FieldRules_Duration struct { - Duration *DurationRules `protobuf:"bytes,21,opt,name=duration,oneof"` -} - -type FieldRules_Timestamp struct { - Timestamp *TimestampRules `protobuf:"bytes,22,opt,name=timestamp,oneof"` -} - -func (*FieldRules_Float) isFieldRules_Type() {} - -func (*FieldRules_Double) isFieldRules_Type() {} - -func (*FieldRules_Int32) isFieldRules_Type() {} - -func (*FieldRules_Int64) isFieldRules_Type() {} - -func (*FieldRules_Uint32) isFieldRules_Type() {} - -func (*FieldRules_Uint64) isFieldRules_Type() {} - -func (*FieldRules_Sint32) isFieldRules_Type() {} - -func (*FieldRules_Sint64) isFieldRules_Type() {} - -func (*FieldRules_Fixed32) isFieldRules_Type() {} - -func (*FieldRules_Fixed64) isFieldRules_Type() {} - -func (*FieldRules_Sfixed32) isFieldRules_Type() {} - -func (*FieldRules_Sfixed64) isFieldRules_Type() {} - -func (*FieldRules_Bool) isFieldRules_Type() {} - -func (*FieldRules_String_) isFieldRules_Type() {} - -func (*FieldRules_Bytes) isFieldRules_Type() {} - -func (*FieldRules_Enum) isFieldRules_Type() {} - -func (*FieldRules_Message) isFieldRules_Type() {} - -func (*FieldRules_Repeated) isFieldRules_Type() {} - -func (*FieldRules_Map) isFieldRules_Type() {} - -func (*FieldRules_Any) isFieldRules_Type() {} - -func (*FieldRules_Duration) isFieldRules_Type() {} - -func (*FieldRules_Timestamp) isFieldRules_Type() {} - -func (m *FieldRules) GetType() isFieldRules_Type { - if m != nil { - return m.Type - } - return nil -} - -func (m *FieldRules) GetFloat() *FloatRules { - if x, ok := m.GetType().(*FieldRules_Float); ok { - return x.Float - } - return nil -} - -func (m *FieldRules) GetDouble() *DoubleRules { - if x, ok := m.GetType().(*FieldRules_Double); ok { - return x.Double - } - return nil -} - -func (m *FieldRules) GetInt32() *Int32Rules { - if x, ok := m.GetType().(*FieldRules_Int32); ok { - return x.Int32 - } - return nil -} - -func (m *FieldRules) GetInt64() *Int64Rules { - if x, ok := m.GetType().(*FieldRules_Int64); ok { - return x.Int64 - } - return nil -} - -func (m *FieldRules) GetUint32() *UInt32Rules { - if x, ok := m.GetType().(*FieldRules_Uint32); ok { - return x.Uint32 - } - return nil -} - -func (m *FieldRules) GetUint64() *UInt64Rules { - if x, ok := m.GetType().(*FieldRules_Uint64); ok { - return x.Uint64 - } - return nil -} - -func (m *FieldRules) GetSint32() *SInt32Rules { - if x, ok := m.GetType().(*FieldRules_Sint32); ok { - return x.Sint32 - } - return nil -} - -func (m *FieldRules) GetSint64() *SInt64Rules { - if x, ok := m.GetType().(*FieldRules_Sint64); ok { - return x.Sint64 - } - return nil -} - -func (m *FieldRules) GetFixed32() *Fixed32Rules { - if x, ok := m.GetType().(*FieldRules_Fixed32); ok { - return x.Fixed32 - } - return nil -} - -func (m *FieldRules) GetFixed64() *Fixed64Rules { - if x, ok := m.GetType().(*FieldRules_Fixed64); ok { - return x.Fixed64 - } - return nil -} - -func (m *FieldRules) GetSfixed32() *SFixed32Rules { - if x, ok := m.GetType().(*FieldRules_Sfixed32); ok { - return x.Sfixed32 - } - return nil -} - -func (m *FieldRules) GetSfixed64() *SFixed64Rules { - if x, ok := m.GetType().(*FieldRules_Sfixed64); ok { - return x.Sfixed64 - } - return nil -} - -func (m *FieldRules) GetBool() *BoolRules { - if x, ok := m.GetType().(*FieldRules_Bool); ok { - return x.Bool - } - return nil -} - -func (m *FieldRules) GetString_() *StringRules { - if x, ok := m.GetType().(*FieldRules_String_); ok { - return x.String_ - } - return nil -} - -func (m *FieldRules) GetBytes() *BytesRules { - if x, ok := m.GetType().(*FieldRules_Bytes); ok { - return x.Bytes - } - return nil -} - -func (m *FieldRules) GetEnum() *EnumRules { - if x, ok := m.GetType().(*FieldRules_Enum); ok { - return x.Enum - } - return nil -} - -func (m *FieldRules) GetMessage() *MessageRules { - if x, ok := m.GetType().(*FieldRules_Message); ok { - return x.Message - } - return nil -} - -func (m *FieldRules) GetRepeated() *RepeatedRules { - if x, ok := m.GetType().(*FieldRules_Repeated); ok { - return x.Repeated - } - return nil -} - -func (m *FieldRules) GetMap() *MapRules { - if x, ok := m.GetType().(*FieldRules_Map); ok { - return x.Map - } - return nil -} - -func (m *FieldRules) GetAny() *AnyRules { - if x, ok := m.GetType().(*FieldRules_Any); ok { - return x.Any - } - return nil -} - -func (m *FieldRules) GetDuration() *DurationRules { - if x, ok := m.GetType().(*FieldRules_Duration); ok { - return x.Duration - } - return nil -} - -func (m *FieldRules) GetTimestamp() *TimestampRules { - if x, ok := m.GetType().(*FieldRules_Timestamp); ok { - return x.Timestamp - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*FieldRules) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _FieldRules_OneofMarshaler, _FieldRules_OneofUnmarshaler, _FieldRules_OneofSizer, []interface{}{ - (*FieldRules_Float)(nil), - (*FieldRules_Double)(nil), - (*FieldRules_Int32)(nil), - (*FieldRules_Int64)(nil), - (*FieldRules_Uint32)(nil), - (*FieldRules_Uint64)(nil), - (*FieldRules_Sint32)(nil), - (*FieldRules_Sint64)(nil), - (*FieldRules_Fixed32)(nil), - (*FieldRules_Fixed64)(nil), - (*FieldRules_Sfixed32)(nil), - (*FieldRules_Sfixed64)(nil), - (*FieldRules_Bool)(nil), - (*FieldRules_String_)(nil), - (*FieldRules_Bytes)(nil), - (*FieldRules_Enum)(nil), - (*FieldRules_Message)(nil), - (*FieldRules_Repeated)(nil), - (*FieldRules_Map)(nil), - (*FieldRules_Any)(nil), - (*FieldRules_Duration)(nil), - (*FieldRules_Timestamp)(nil), - } -} - -func _FieldRules_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*FieldRules) - // type - switch x := m.Type.(type) { - case *FieldRules_Float: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Float); err != nil { - return err - } - case *FieldRules_Double: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Double); err != nil { - return err - } - case *FieldRules_Int32: - b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Int32); err != nil { - return err - } - case *FieldRules_Int64: - b.EncodeVarint(4<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Int64); err != nil { - return err - } - case *FieldRules_Uint32: - b.EncodeVarint(5<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Uint32); err != nil { - return err - } - case *FieldRules_Uint64: - b.EncodeVarint(6<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Uint64); err != nil { - return err - } - case *FieldRules_Sint32: - b.EncodeVarint(7<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Sint32); err != nil { - return err - } - case *FieldRules_Sint64: - b.EncodeVarint(8<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Sint64); err != nil { - return err - } - case *FieldRules_Fixed32: - b.EncodeVarint(9<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Fixed32); err != nil { - return err - } - case *FieldRules_Fixed64: - b.EncodeVarint(10<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Fixed64); err != nil { - return err - } - case *FieldRules_Sfixed32: - b.EncodeVarint(11<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Sfixed32); err != nil { - return err - } - case *FieldRules_Sfixed64: - b.EncodeVarint(12<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Sfixed64); err != nil { - return err - } - case *FieldRules_Bool: - b.EncodeVarint(13<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Bool); err != nil { - return err - } - case *FieldRules_String_: - b.EncodeVarint(14<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.String_); err != nil { - return err - } - case *FieldRules_Bytes: - b.EncodeVarint(15<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Bytes); err != nil { - return err - } - case *FieldRules_Enum: - b.EncodeVarint(16<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Enum); err != nil { - return err - } - case *FieldRules_Message: - b.EncodeVarint(17<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Message); err != nil { - return err - } - case *FieldRules_Repeated: - b.EncodeVarint(18<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Repeated); err != nil { - return err - } - case *FieldRules_Map: - b.EncodeVarint(19<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Map); err != nil { - return err - } - case *FieldRules_Any: - b.EncodeVarint(20<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Any); err != nil { - return err - } - case *FieldRules_Duration: - b.EncodeVarint(21<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Duration); err != nil { - return err - } - case *FieldRules_Timestamp: - b.EncodeVarint(22<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Timestamp); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("FieldRules.Type has unexpected type %T", x) - } - return nil -} - -func _FieldRules_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*FieldRules) - switch tag { - case 1: // type.float - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(FloatRules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Float{msg} - return true, err - case 2: // type.double - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(DoubleRules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Double{msg} - return true, err - case 3: // type.int32 - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Int32Rules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Int32{msg} - return true, err - case 4: // type.int64 - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Int64Rules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Int64{msg} - return true, err - case 5: // type.uint32 - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(UInt32Rules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Uint32{msg} - return true, err - case 6: // type.uint64 - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(UInt64Rules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Uint64{msg} - return true, err - case 7: // type.sint32 - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SInt32Rules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Sint32{msg} - return true, err - case 8: // type.sint64 - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SInt64Rules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Sint64{msg} - return true, err - case 9: // type.fixed32 - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Fixed32Rules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Fixed32{msg} - return true, err - case 10: // type.fixed64 - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Fixed64Rules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Fixed64{msg} - return true, err - case 11: // type.sfixed32 - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SFixed32Rules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Sfixed32{msg} - return true, err - case 12: // type.sfixed64 - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(SFixed64Rules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Sfixed64{msg} - return true, err - case 13: // type.bool - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(BoolRules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Bool{msg} - return true, err - case 14: // type.string - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(StringRules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_String_{msg} - return true, err - case 15: // type.bytes - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(BytesRules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Bytes{msg} - return true, err - case 16: // type.enum - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(EnumRules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Enum{msg} - return true, err - case 17: // type.message - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(MessageRules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Message{msg} - return true, err - case 18: // type.repeated - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RepeatedRules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Repeated{msg} - return true, err - case 19: // type.map - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(MapRules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Map{msg} - return true, err - case 20: // type.any - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(AnyRules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Any{msg} - return true, err - case 21: // type.duration - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(DurationRules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Duration{msg} - return true, err - case 22: // type.timestamp - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(TimestampRules) - err := b.DecodeMessage(msg) - m.Type = &FieldRules_Timestamp{msg} - return true, err - default: - return false, nil - } -} - -func _FieldRules_OneofSizer(msg proto.Message) (n int) { - m := msg.(*FieldRules) - // type - switch x := m.Type.(type) { - case *FieldRules_Float: - s := proto.Size(x.Float) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_Double: - s := proto.Size(x.Double) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_Int32: - s := proto.Size(x.Int32) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_Int64: - s := proto.Size(x.Int64) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_Uint32: - s := proto.Size(x.Uint32) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_Uint64: - s := proto.Size(x.Uint64) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_Sint32: - s := proto.Size(x.Sint32) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_Sint64: - s := proto.Size(x.Sint64) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_Fixed32: - s := proto.Size(x.Fixed32) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_Fixed64: - s := proto.Size(x.Fixed64) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_Sfixed32: - s := proto.Size(x.Sfixed32) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_Sfixed64: - s := proto.Size(x.Sfixed64) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_Bool: - s := proto.Size(x.Bool) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_String_: - s := proto.Size(x.String_) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_Bytes: - s := proto.Size(x.Bytes) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_Enum: - s := proto.Size(x.Enum) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_Message: - s := proto.Size(x.Message) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_Repeated: - s := proto.Size(x.Repeated) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_Map: - s := proto.Size(x.Map) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_Any: - s := proto.Size(x.Any) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_Duration: - s := proto.Size(x.Duration) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *FieldRules_Timestamp: - s := proto.Size(x.Timestamp) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type FloatRules struct { - Const *float32 `protobuf:"fixed32,1,opt,name=const" json:"const,omitempty"` - Lt *float32 `protobuf:"fixed32,2,opt,name=lt" json:"lt,omitempty"` - Lte *float32 `protobuf:"fixed32,3,opt,name=lte" json:"lte,omitempty"` - Gt *float32 `protobuf:"fixed32,4,opt,name=gt" json:"gt,omitempty"` - Gte *float32 `protobuf:"fixed32,5,opt,name=gte" json:"gte,omitempty"` - In []float32 `protobuf:"fixed32,6,rep,name=in" json:"in,omitempty"` - NotIn []float32 `protobuf:"fixed32,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FloatRules) Reset() { *m = FloatRules{} } -func (m *FloatRules) String() string { return proto.CompactTextString(m) } -func (*FloatRules) ProtoMessage() {} -func (*FloatRules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{1} -} -func (m *FloatRules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FloatRules.Unmarshal(m, b) -} -func (m *FloatRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FloatRules.Marshal(b, m, deterministic) -} -func (dst *FloatRules) XXX_Merge(src proto.Message) { - xxx_messageInfo_FloatRules.Merge(dst, src) -} -func (m *FloatRules) XXX_Size() int { - return xxx_messageInfo_FloatRules.Size(m) -} -func (m *FloatRules) XXX_DiscardUnknown() { - xxx_messageInfo_FloatRules.DiscardUnknown(m) -} - -var xxx_messageInfo_FloatRules proto.InternalMessageInfo - -func (m *FloatRules) GetConst() float32 { - if m != nil && m.Const != nil { - return *m.Const - } - return 0 -} - -func (m *FloatRules) GetLt() float32 { - if m != nil && m.Lt != nil { - return *m.Lt - } - return 0 -} - -func (m *FloatRules) GetLte() float32 { - if m != nil && m.Lte != nil { - return *m.Lte - } - return 0 -} - -func (m *FloatRules) GetGt() float32 { - if m != nil && m.Gt != nil { - return *m.Gt - } - return 0 -} - -func (m *FloatRules) GetGte() float32 { - if m != nil && m.Gte != nil { - return *m.Gte - } - return 0 -} - -func (m *FloatRules) GetIn() []float32 { - if m != nil { - return m.In - } - return nil -} - -func (m *FloatRules) GetNotIn() []float32 { - if m != nil { - return m.NotIn - } - return nil -} - -type DoubleRules struct { - Const *float64 `protobuf:"fixed64,1,opt,name=const" json:"const,omitempty"` - Lt *float64 `protobuf:"fixed64,2,opt,name=lt" json:"lt,omitempty"` - Lte *float64 `protobuf:"fixed64,3,opt,name=lte" json:"lte,omitempty"` - Gt *float64 `protobuf:"fixed64,4,opt,name=gt" json:"gt,omitempty"` - Gte *float64 `protobuf:"fixed64,5,opt,name=gte" json:"gte,omitempty"` - In []float64 `protobuf:"fixed64,6,rep,name=in" json:"in,omitempty"` - NotIn []float64 `protobuf:"fixed64,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DoubleRules) Reset() { *m = DoubleRules{} } -func (m *DoubleRules) String() string { return proto.CompactTextString(m) } -func (*DoubleRules) ProtoMessage() {} -func (*DoubleRules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{2} -} -func (m *DoubleRules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DoubleRules.Unmarshal(m, b) -} -func (m *DoubleRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DoubleRules.Marshal(b, m, deterministic) -} -func (dst *DoubleRules) XXX_Merge(src proto.Message) { - xxx_messageInfo_DoubleRules.Merge(dst, src) -} -func (m *DoubleRules) XXX_Size() int { - return xxx_messageInfo_DoubleRules.Size(m) -} -func (m *DoubleRules) XXX_DiscardUnknown() { - xxx_messageInfo_DoubleRules.DiscardUnknown(m) -} - -var xxx_messageInfo_DoubleRules proto.InternalMessageInfo - -func (m *DoubleRules) GetConst() float64 { - if m != nil && m.Const != nil { - return *m.Const - } - return 0 -} - -func (m *DoubleRules) GetLt() float64 { - if m != nil && m.Lt != nil { - return *m.Lt - } - return 0 -} - -func (m *DoubleRules) GetLte() float64 { - if m != nil && m.Lte != nil { - return *m.Lte - } - return 0 -} - -func (m *DoubleRules) GetGt() float64 { - if m != nil && m.Gt != nil { - return *m.Gt - } - return 0 -} - -func (m *DoubleRules) GetGte() float64 { - if m != nil && m.Gte != nil { - return *m.Gte - } - return 0 -} - -func (m *DoubleRules) GetIn() []float64 { - if m != nil { - return m.In - } - return nil -} - -func (m *DoubleRules) GetNotIn() []float64 { - if m != nil { - return m.NotIn - } - return nil -} - -type Int32Rules struct { - Const *int32 `protobuf:"varint,1,opt,name=const" json:"const,omitempty"` - Lt *int32 `protobuf:"varint,2,opt,name=lt" json:"lt,omitempty"` - Lte *int32 `protobuf:"varint,3,opt,name=lte" json:"lte,omitempty"` - Gt *int32 `protobuf:"varint,4,opt,name=gt" json:"gt,omitempty"` - Gte *int32 `protobuf:"varint,5,opt,name=gte" json:"gte,omitempty"` - In []int32 `protobuf:"varint,6,rep,name=in" json:"in,omitempty"` - NotIn []int32 `protobuf:"varint,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Int32Rules) Reset() { *m = Int32Rules{} } -func (m *Int32Rules) String() string { return proto.CompactTextString(m) } -func (*Int32Rules) ProtoMessage() {} -func (*Int32Rules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{3} -} -func (m *Int32Rules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Int32Rules.Unmarshal(m, b) -} -func (m *Int32Rules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Int32Rules.Marshal(b, m, deterministic) -} -func (dst *Int32Rules) XXX_Merge(src proto.Message) { - xxx_messageInfo_Int32Rules.Merge(dst, src) -} -func (m *Int32Rules) XXX_Size() int { - return xxx_messageInfo_Int32Rules.Size(m) -} -func (m *Int32Rules) XXX_DiscardUnknown() { - xxx_messageInfo_Int32Rules.DiscardUnknown(m) -} - -var xxx_messageInfo_Int32Rules proto.InternalMessageInfo - -func (m *Int32Rules) GetConst() int32 { - if m != nil && m.Const != nil { - return *m.Const - } - return 0 -} - -func (m *Int32Rules) GetLt() int32 { - if m != nil && m.Lt != nil { - return *m.Lt - } - return 0 -} - -func (m *Int32Rules) GetLte() int32 { - if m != nil && m.Lte != nil { - return *m.Lte - } - return 0 -} - -func (m *Int32Rules) GetGt() int32 { - if m != nil && m.Gt != nil { - return *m.Gt - } - return 0 -} - -func (m *Int32Rules) GetGte() int32 { - if m != nil && m.Gte != nil { - return *m.Gte - } - return 0 -} - -func (m *Int32Rules) GetIn() []int32 { - if m != nil { - return m.In - } - return nil -} - -func (m *Int32Rules) GetNotIn() []int32 { - if m != nil { - return m.NotIn - } - return nil -} - -type Int64Rules struct { - Const *int64 `protobuf:"varint,1,opt,name=const" json:"const,omitempty"` - Lt *int64 `protobuf:"varint,2,opt,name=lt" json:"lt,omitempty"` - Lte *int64 `protobuf:"varint,3,opt,name=lte" json:"lte,omitempty"` - Gt *int64 `protobuf:"varint,4,opt,name=gt" json:"gt,omitempty"` - Gte *int64 `protobuf:"varint,5,opt,name=gte" json:"gte,omitempty"` - In []int64 `protobuf:"varint,6,rep,name=in" json:"in,omitempty"` - NotIn []int64 `protobuf:"varint,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Int64Rules) Reset() { *m = Int64Rules{} } -func (m *Int64Rules) String() string { return proto.CompactTextString(m) } -func (*Int64Rules) ProtoMessage() {} -func (*Int64Rules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{4} -} -func (m *Int64Rules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Int64Rules.Unmarshal(m, b) -} -func (m *Int64Rules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Int64Rules.Marshal(b, m, deterministic) -} -func (dst *Int64Rules) XXX_Merge(src proto.Message) { - xxx_messageInfo_Int64Rules.Merge(dst, src) -} -func (m *Int64Rules) XXX_Size() int { - return xxx_messageInfo_Int64Rules.Size(m) -} -func (m *Int64Rules) XXX_DiscardUnknown() { - xxx_messageInfo_Int64Rules.DiscardUnknown(m) -} - -var xxx_messageInfo_Int64Rules proto.InternalMessageInfo - -func (m *Int64Rules) GetConst() int64 { - if m != nil && m.Const != nil { - return *m.Const - } - return 0 -} - -func (m *Int64Rules) GetLt() int64 { - if m != nil && m.Lt != nil { - return *m.Lt - } - return 0 -} - -func (m *Int64Rules) GetLte() int64 { - if m != nil && m.Lte != nil { - return *m.Lte - } - return 0 -} - -func (m *Int64Rules) GetGt() int64 { - if m != nil && m.Gt != nil { - return *m.Gt - } - return 0 -} - -func (m *Int64Rules) GetGte() int64 { - if m != nil && m.Gte != nil { - return *m.Gte - } - return 0 -} - -func (m *Int64Rules) GetIn() []int64 { - if m != nil { - return m.In - } - return nil -} - -func (m *Int64Rules) GetNotIn() []int64 { - if m != nil { - return m.NotIn - } - return nil -} - -type UInt32Rules struct { - Const *uint32 `protobuf:"varint,1,opt,name=const" json:"const,omitempty"` - Lt *uint32 `protobuf:"varint,2,opt,name=lt" json:"lt,omitempty"` - Lte *uint32 `protobuf:"varint,3,opt,name=lte" json:"lte,omitempty"` - Gt *uint32 `protobuf:"varint,4,opt,name=gt" json:"gt,omitempty"` - Gte *uint32 `protobuf:"varint,5,opt,name=gte" json:"gte,omitempty"` - In []uint32 `protobuf:"varint,6,rep,name=in" json:"in,omitempty"` - NotIn []uint32 `protobuf:"varint,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UInt32Rules) Reset() { *m = UInt32Rules{} } -func (m *UInt32Rules) String() string { return proto.CompactTextString(m) } -func (*UInt32Rules) ProtoMessage() {} -func (*UInt32Rules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{5} -} -func (m *UInt32Rules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UInt32Rules.Unmarshal(m, b) -} -func (m *UInt32Rules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UInt32Rules.Marshal(b, m, deterministic) -} -func (dst *UInt32Rules) XXX_Merge(src proto.Message) { - xxx_messageInfo_UInt32Rules.Merge(dst, src) -} -func (m *UInt32Rules) XXX_Size() int { - return xxx_messageInfo_UInt32Rules.Size(m) -} -func (m *UInt32Rules) XXX_DiscardUnknown() { - xxx_messageInfo_UInt32Rules.DiscardUnknown(m) -} - -var xxx_messageInfo_UInt32Rules proto.InternalMessageInfo - -func (m *UInt32Rules) GetConst() uint32 { - if m != nil && m.Const != nil { - return *m.Const - } - return 0 -} - -func (m *UInt32Rules) GetLt() uint32 { - if m != nil && m.Lt != nil { - return *m.Lt - } - return 0 -} - -func (m *UInt32Rules) GetLte() uint32 { - if m != nil && m.Lte != nil { - return *m.Lte - } - return 0 -} - -func (m *UInt32Rules) GetGt() uint32 { - if m != nil && m.Gt != nil { - return *m.Gt - } - return 0 -} - -func (m *UInt32Rules) GetGte() uint32 { - if m != nil && m.Gte != nil { - return *m.Gte - } - return 0 -} - -func (m *UInt32Rules) GetIn() []uint32 { - if m != nil { - return m.In - } - return nil -} - -func (m *UInt32Rules) GetNotIn() []uint32 { - if m != nil { - return m.NotIn - } - return nil -} - -type UInt64Rules struct { - Const *uint64 `protobuf:"varint,1,opt,name=const" json:"const,omitempty"` - Lt *uint64 `protobuf:"varint,2,opt,name=lt" json:"lt,omitempty"` - Lte *uint64 `protobuf:"varint,3,opt,name=lte" json:"lte,omitempty"` - Gt *uint64 `protobuf:"varint,4,opt,name=gt" json:"gt,omitempty"` - Gte *uint64 `protobuf:"varint,5,opt,name=gte" json:"gte,omitempty"` - In []uint64 `protobuf:"varint,6,rep,name=in" json:"in,omitempty"` - NotIn []uint64 `protobuf:"varint,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UInt64Rules) Reset() { *m = UInt64Rules{} } -func (m *UInt64Rules) String() string { return proto.CompactTextString(m) } -func (*UInt64Rules) ProtoMessage() {} -func (*UInt64Rules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{6} -} -func (m *UInt64Rules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UInt64Rules.Unmarshal(m, b) -} -func (m *UInt64Rules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UInt64Rules.Marshal(b, m, deterministic) -} -func (dst *UInt64Rules) XXX_Merge(src proto.Message) { - xxx_messageInfo_UInt64Rules.Merge(dst, src) -} -func (m *UInt64Rules) XXX_Size() int { - return xxx_messageInfo_UInt64Rules.Size(m) -} -func (m *UInt64Rules) XXX_DiscardUnknown() { - xxx_messageInfo_UInt64Rules.DiscardUnknown(m) -} - -var xxx_messageInfo_UInt64Rules proto.InternalMessageInfo - -func (m *UInt64Rules) GetConst() uint64 { - if m != nil && m.Const != nil { - return *m.Const - } - return 0 -} - -func (m *UInt64Rules) GetLt() uint64 { - if m != nil && m.Lt != nil { - return *m.Lt - } - return 0 -} - -func (m *UInt64Rules) GetLte() uint64 { - if m != nil && m.Lte != nil { - return *m.Lte - } - return 0 -} - -func (m *UInt64Rules) GetGt() uint64 { - if m != nil && m.Gt != nil { - return *m.Gt - } - return 0 -} - -func (m *UInt64Rules) GetGte() uint64 { - if m != nil && m.Gte != nil { - return *m.Gte - } - return 0 -} - -func (m *UInt64Rules) GetIn() []uint64 { - if m != nil { - return m.In - } - return nil -} - -func (m *UInt64Rules) GetNotIn() []uint64 { - if m != nil { - return m.NotIn - } - return nil -} - -type SInt32Rules struct { - Const *int32 `protobuf:"zigzag32,1,opt,name=const" json:"const,omitempty"` - Lt *int32 `protobuf:"zigzag32,2,opt,name=lt" json:"lt,omitempty"` - Lte *int32 `protobuf:"zigzag32,3,opt,name=lte" json:"lte,omitempty"` - Gt *int32 `protobuf:"zigzag32,4,opt,name=gt" json:"gt,omitempty"` - Gte *int32 `protobuf:"zigzag32,5,opt,name=gte" json:"gte,omitempty"` - In []int32 `protobuf:"zigzag32,6,rep,name=in" json:"in,omitempty"` - NotIn []int32 `protobuf:"zigzag32,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SInt32Rules) Reset() { *m = SInt32Rules{} } -func (m *SInt32Rules) String() string { return proto.CompactTextString(m) } -func (*SInt32Rules) ProtoMessage() {} -func (*SInt32Rules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{7} -} -func (m *SInt32Rules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SInt32Rules.Unmarshal(m, b) -} -func (m *SInt32Rules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SInt32Rules.Marshal(b, m, deterministic) -} -func (dst *SInt32Rules) XXX_Merge(src proto.Message) { - xxx_messageInfo_SInt32Rules.Merge(dst, src) -} -func (m *SInt32Rules) XXX_Size() int { - return xxx_messageInfo_SInt32Rules.Size(m) -} -func (m *SInt32Rules) XXX_DiscardUnknown() { - xxx_messageInfo_SInt32Rules.DiscardUnknown(m) -} - -var xxx_messageInfo_SInt32Rules proto.InternalMessageInfo - -func (m *SInt32Rules) GetConst() int32 { - if m != nil && m.Const != nil { - return *m.Const - } - return 0 -} - -func (m *SInt32Rules) GetLt() int32 { - if m != nil && m.Lt != nil { - return *m.Lt - } - return 0 -} - -func (m *SInt32Rules) GetLte() int32 { - if m != nil && m.Lte != nil { - return *m.Lte - } - return 0 -} - -func (m *SInt32Rules) GetGt() int32 { - if m != nil && m.Gt != nil { - return *m.Gt - } - return 0 -} - -func (m *SInt32Rules) GetGte() int32 { - if m != nil && m.Gte != nil { - return *m.Gte - } - return 0 -} - -func (m *SInt32Rules) GetIn() []int32 { - if m != nil { - return m.In - } - return nil -} - -func (m *SInt32Rules) GetNotIn() []int32 { - if m != nil { - return m.NotIn - } - return nil -} - -type SInt64Rules struct { - Const *int64 `protobuf:"zigzag64,1,opt,name=const" json:"const,omitempty"` - Lt *int64 `protobuf:"zigzag64,2,opt,name=lt" json:"lt,omitempty"` - Lte *int64 `protobuf:"zigzag64,3,opt,name=lte" json:"lte,omitempty"` - Gt *int64 `protobuf:"zigzag64,4,opt,name=gt" json:"gt,omitempty"` - Gte *int64 `protobuf:"zigzag64,5,opt,name=gte" json:"gte,omitempty"` - In []int64 `protobuf:"zigzag64,6,rep,name=in" json:"in,omitempty"` - NotIn []int64 `protobuf:"zigzag64,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SInt64Rules) Reset() { *m = SInt64Rules{} } -func (m *SInt64Rules) String() string { return proto.CompactTextString(m) } -func (*SInt64Rules) ProtoMessage() {} -func (*SInt64Rules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{8} -} -func (m *SInt64Rules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SInt64Rules.Unmarshal(m, b) -} -func (m *SInt64Rules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SInt64Rules.Marshal(b, m, deterministic) -} -func (dst *SInt64Rules) XXX_Merge(src proto.Message) { - xxx_messageInfo_SInt64Rules.Merge(dst, src) -} -func (m *SInt64Rules) XXX_Size() int { - return xxx_messageInfo_SInt64Rules.Size(m) -} -func (m *SInt64Rules) XXX_DiscardUnknown() { - xxx_messageInfo_SInt64Rules.DiscardUnknown(m) -} - -var xxx_messageInfo_SInt64Rules proto.InternalMessageInfo - -func (m *SInt64Rules) GetConst() int64 { - if m != nil && m.Const != nil { - return *m.Const - } - return 0 -} - -func (m *SInt64Rules) GetLt() int64 { - if m != nil && m.Lt != nil { - return *m.Lt - } - return 0 -} - -func (m *SInt64Rules) GetLte() int64 { - if m != nil && m.Lte != nil { - return *m.Lte - } - return 0 -} - -func (m *SInt64Rules) GetGt() int64 { - if m != nil && m.Gt != nil { - return *m.Gt - } - return 0 -} - -func (m *SInt64Rules) GetGte() int64 { - if m != nil && m.Gte != nil { - return *m.Gte - } - return 0 -} - -func (m *SInt64Rules) GetIn() []int64 { - if m != nil { - return m.In - } - return nil -} - -func (m *SInt64Rules) GetNotIn() []int64 { - if m != nil { - return m.NotIn - } - return nil -} - -type Fixed32Rules struct { - Const *uint32 `protobuf:"fixed32,1,opt,name=const" json:"const,omitempty"` - Lt *uint32 `protobuf:"fixed32,2,opt,name=lt" json:"lt,omitempty"` - Lte *uint32 `protobuf:"fixed32,3,opt,name=lte" json:"lte,omitempty"` - Gt *uint32 `protobuf:"fixed32,4,opt,name=gt" json:"gt,omitempty"` - Gte *uint32 `protobuf:"fixed32,5,opt,name=gte" json:"gte,omitempty"` - In []uint32 `protobuf:"fixed32,6,rep,name=in" json:"in,omitempty"` - NotIn []uint32 `protobuf:"fixed32,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Fixed32Rules) Reset() { *m = Fixed32Rules{} } -func (m *Fixed32Rules) String() string { return proto.CompactTextString(m) } -func (*Fixed32Rules) ProtoMessage() {} -func (*Fixed32Rules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{9} -} -func (m *Fixed32Rules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Fixed32Rules.Unmarshal(m, b) -} -func (m *Fixed32Rules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Fixed32Rules.Marshal(b, m, deterministic) -} -func (dst *Fixed32Rules) XXX_Merge(src proto.Message) { - xxx_messageInfo_Fixed32Rules.Merge(dst, src) -} -func (m *Fixed32Rules) XXX_Size() int { - return xxx_messageInfo_Fixed32Rules.Size(m) -} -func (m *Fixed32Rules) XXX_DiscardUnknown() { - xxx_messageInfo_Fixed32Rules.DiscardUnknown(m) -} - -var xxx_messageInfo_Fixed32Rules proto.InternalMessageInfo - -func (m *Fixed32Rules) GetConst() uint32 { - if m != nil && m.Const != nil { - return *m.Const - } - return 0 -} - -func (m *Fixed32Rules) GetLt() uint32 { - if m != nil && m.Lt != nil { - return *m.Lt - } - return 0 -} - -func (m *Fixed32Rules) GetLte() uint32 { - if m != nil && m.Lte != nil { - return *m.Lte - } - return 0 -} - -func (m *Fixed32Rules) GetGt() uint32 { - if m != nil && m.Gt != nil { - return *m.Gt - } - return 0 -} - -func (m *Fixed32Rules) GetGte() uint32 { - if m != nil && m.Gte != nil { - return *m.Gte - } - return 0 -} - -func (m *Fixed32Rules) GetIn() []uint32 { - if m != nil { - return m.In - } - return nil -} - -func (m *Fixed32Rules) GetNotIn() []uint32 { - if m != nil { - return m.NotIn - } - return nil -} - -type Fixed64Rules struct { - Const *uint64 `protobuf:"fixed64,1,opt,name=const" json:"const,omitempty"` - Lt *uint64 `protobuf:"fixed64,2,opt,name=lt" json:"lt,omitempty"` - Lte *uint64 `protobuf:"fixed64,3,opt,name=lte" json:"lte,omitempty"` - Gt *uint64 `protobuf:"fixed64,4,opt,name=gt" json:"gt,omitempty"` - Gte *uint64 `protobuf:"fixed64,5,opt,name=gte" json:"gte,omitempty"` - In []uint64 `protobuf:"fixed64,6,rep,name=in" json:"in,omitempty"` - NotIn []uint64 `protobuf:"fixed64,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Fixed64Rules) Reset() { *m = Fixed64Rules{} } -func (m *Fixed64Rules) String() string { return proto.CompactTextString(m) } -func (*Fixed64Rules) ProtoMessage() {} -func (*Fixed64Rules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{10} -} -func (m *Fixed64Rules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Fixed64Rules.Unmarshal(m, b) -} -func (m *Fixed64Rules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Fixed64Rules.Marshal(b, m, deterministic) -} -func (dst *Fixed64Rules) XXX_Merge(src proto.Message) { - xxx_messageInfo_Fixed64Rules.Merge(dst, src) -} -func (m *Fixed64Rules) XXX_Size() int { - return xxx_messageInfo_Fixed64Rules.Size(m) -} -func (m *Fixed64Rules) XXX_DiscardUnknown() { - xxx_messageInfo_Fixed64Rules.DiscardUnknown(m) -} - -var xxx_messageInfo_Fixed64Rules proto.InternalMessageInfo - -func (m *Fixed64Rules) GetConst() uint64 { - if m != nil && m.Const != nil { - return *m.Const - } - return 0 -} - -func (m *Fixed64Rules) GetLt() uint64 { - if m != nil && m.Lt != nil { - return *m.Lt - } - return 0 -} - -func (m *Fixed64Rules) GetLte() uint64 { - if m != nil && m.Lte != nil { - return *m.Lte - } - return 0 -} - -func (m *Fixed64Rules) GetGt() uint64 { - if m != nil && m.Gt != nil { - return *m.Gt - } - return 0 -} - -func (m *Fixed64Rules) GetGte() uint64 { - if m != nil && m.Gte != nil { - return *m.Gte - } - return 0 -} - -func (m *Fixed64Rules) GetIn() []uint64 { - if m != nil { - return m.In - } - return nil -} - -func (m *Fixed64Rules) GetNotIn() []uint64 { - if m != nil { - return m.NotIn - } - return nil -} - -type SFixed32Rules struct { - Const *int32 `protobuf:"fixed32,1,opt,name=const" json:"const,omitempty"` - Lt *int32 `protobuf:"fixed32,2,opt,name=lt" json:"lt,omitempty"` - Lte *int32 `protobuf:"fixed32,3,opt,name=lte" json:"lte,omitempty"` - Gt *int32 `protobuf:"fixed32,4,opt,name=gt" json:"gt,omitempty"` - Gte *int32 `protobuf:"fixed32,5,opt,name=gte" json:"gte,omitempty"` - In []int32 `protobuf:"fixed32,6,rep,name=in" json:"in,omitempty"` - NotIn []int32 `protobuf:"fixed32,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SFixed32Rules) Reset() { *m = SFixed32Rules{} } -func (m *SFixed32Rules) String() string { return proto.CompactTextString(m) } -func (*SFixed32Rules) ProtoMessage() {} -func (*SFixed32Rules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{11} -} -func (m *SFixed32Rules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SFixed32Rules.Unmarshal(m, b) -} -func (m *SFixed32Rules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SFixed32Rules.Marshal(b, m, deterministic) -} -func (dst *SFixed32Rules) XXX_Merge(src proto.Message) { - xxx_messageInfo_SFixed32Rules.Merge(dst, src) -} -func (m *SFixed32Rules) XXX_Size() int { - return xxx_messageInfo_SFixed32Rules.Size(m) -} -func (m *SFixed32Rules) XXX_DiscardUnknown() { - xxx_messageInfo_SFixed32Rules.DiscardUnknown(m) -} - -var xxx_messageInfo_SFixed32Rules proto.InternalMessageInfo - -func (m *SFixed32Rules) GetConst() int32 { - if m != nil && m.Const != nil { - return *m.Const - } - return 0 -} - -func (m *SFixed32Rules) GetLt() int32 { - if m != nil && m.Lt != nil { - return *m.Lt - } - return 0 -} - -func (m *SFixed32Rules) GetLte() int32 { - if m != nil && m.Lte != nil { - return *m.Lte - } - return 0 -} - -func (m *SFixed32Rules) GetGt() int32 { - if m != nil && m.Gt != nil { - return *m.Gt - } - return 0 -} - -func (m *SFixed32Rules) GetGte() int32 { - if m != nil && m.Gte != nil { - return *m.Gte - } - return 0 -} - -func (m *SFixed32Rules) GetIn() []int32 { - if m != nil { - return m.In - } - return nil -} - -func (m *SFixed32Rules) GetNotIn() []int32 { - if m != nil { - return m.NotIn - } - return nil -} - -type SFixed64Rules struct { - Const *int64 `protobuf:"fixed64,1,opt,name=const" json:"const,omitempty"` - Lt *int64 `protobuf:"fixed64,2,opt,name=lt" json:"lt,omitempty"` - Lte *int64 `protobuf:"fixed64,3,opt,name=lte" json:"lte,omitempty"` - Gt *int64 `protobuf:"fixed64,4,opt,name=gt" json:"gt,omitempty"` - Gte *int64 `protobuf:"fixed64,5,opt,name=gte" json:"gte,omitempty"` - In []int64 `protobuf:"fixed64,6,rep,name=in" json:"in,omitempty"` - NotIn []int64 `protobuf:"fixed64,7,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SFixed64Rules) Reset() { *m = SFixed64Rules{} } -func (m *SFixed64Rules) String() string { return proto.CompactTextString(m) } -func (*SFixed64Rules) ProtoMessage() {} -func (*SFixed64Rules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{12} -} -func (m *SFixed64Rules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SFixed64Rules.Unmarshal(m, b) -} -func (m *SFixed64Rules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SFixed64Rules.Marshal(b, m, deterministic) -} -func (dst *SFixed64Rules) XXX_Merge(src proto.Message) { - xxx_messageInfo_SFixed64Rules.Merge(dst, src) -} -func (m *SFixed64Rules) XXX_Size() int { - return xxx_messageInfo_SFixed64Rules.Size(m) -} -func (m *SFixed64Rules) XXX_DiscardUnknown() { - xxx_messageInfo_SFixed64Rules.DiscardUnknown(m) -} - -var xxx_messageInfo_SFixed64Rules proto.InternalMessageInfo - -func (m *SFixed64Rules) GetConst() int64 { - if m != nil && m.Const != nil { - return *m.Const - } - return 0 -} - -func (m *SFixed64Rules) GetLt() int64 { - if m != nil && m.Lt != nil { - return *m.Lt - } - return 0 -} - -func (m *SFixed64Rules) GetLte() int64 { - if m != nil && m.Lte != nil { - return *m.Lte - } - return 0 -} - -func (m *SFixed64Rules) GetGt() int64 { - if m != nil && m.Gt != nil { - return *m.Gt - } - return 0 -} - -func (m *SFixed64Rules) GetGte() int64 { - if m != nil && m.Gte != nil { - return *m.Gte - } - return 0 -} - -func (m *SFixed64Rules) GetIn() []int64 { - if m != nil { - return m.In - } - return nil -} - -func (m *SFixed64Rules) GetNotIn() []int64 { - if m != nil { - return m.NotIn - } - return nil -} - -type BoolRules struct { - Const *bool `protobuf:"varint,1,opt,name=const" json:"const,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BoolRules) Reset() { *m = BoolRules{} } -func (m *BoolRules) String() string { return proto.CompactTextString(m) } -func (*BoolRules) ProtoMessage() {} -func (*BoolRules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{13} -} -func (m *BoolRules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BoolRules.Unmarshal(m, b) -} -func (m *BoolRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BoolRules.Marshal(b, m, deterministic) -} -func (dst *BoolRules) XXX_Merge(src proto.Message) { - xxx_messageInfo_BoolRules.Merge(dst, src) -} -func (m *BoolRules) XXX_Size() int { - return xxx_messageInfo_BoolRules.Size(m) -} -func (m *BoolRules) XXX_DiscardUnknown() { - xxx_messageInfo_BoolRules.DiscardUnknown(m) -} - -var xxx_messageInfo_BoolRules proto.InternalMessageInfo - -func (m *BoolRules) GetConst() bool { - if m != nil && m.Const != nil { - return *m.Const - } - return false -} - -type StringRules struct { - Const *string `protobuf:"bytes,1,opt,name=const" json:"const,omitempty"` - Len *uint64 `protobuf:"varint,19,opt,name=len" json:"len,omitempty"` - MinLen *uint64 `protobuf:"varint,2,opt,name=min_len,json=minLen" json:"min_len,omitempty"` - MaxLen *uint64 `protobuf:"varint,3,opt,name=max_len,json=maxLen" json:"max_len,omitempty"` - LenBytes *uint64 `protobuf:"varint,20,opt,name=len_bytes,json=lenBytes" json:"len_bytes,omitempty"` - MinBytes *uint64 `protobuf:"varint,4,opt,name=min_bytes,json=minBytes" json:"min_bytes,omitempty"` - MaxBytes *uint64 `protobuf:"varint,5,opt,name=max_bytes,json=maxBytes" json:"max_bytes,omitempty"` - Pattern *string `protobuf:"bytes,6,opt,name=pattern" json:"pattern,omitempty"` - Prefix *string `protobuf:"bytes,7,opt,name=prefix" json:"prefix,omitempty"` - Suffix *string `protobuf:"bytes,8,opt,name=suffix" json:"suffix,omitempty"` - Contains *string `protobuf:"bytes,9,opt,name=contains" json:"contains,omitempty"` - In []string `protobuf:"bytes,10,rep,name=in" json:"in,omitempty"` - NotIn []string `protobuf:"bytes,11,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - // Types that are valid to be assigned to WellKnown: - // *StringRules_Email - // *StringRules_Hostname - // *StringRules_Ip - // *StringRules_Ipv4 - // *StringRules_Ipv6 - // *StringRules_Uri - // *StringRules_UriRef - WellKnown isStringRules_WellKnown `protobuf_oneof:"well_known"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StringRules) Reset() { *m = StringRules{} } -func (m *StringRules) String() string { return proto.CompactTextString(m) } -func (*StringRules) ProtoMessage() {} -func (*StringRules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{14} -} -func (m *StringRules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StringRules.Unmarshal(m, b) -} -func (m *StringRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StringRules.Marshal(b, m, deterministic) -} -func (dst *StringRules) XXX_Merge(src proto.Message) { - xxx_messageInfo_StringRules.Merge(dst, src) -} -func (m *StringRules) XXX_Size() int { - return xxx_messageInfo_StringRules.Size(m) -} -func (m *StringRules) XXX_DiscardUnknown() { - xxx_messageInfo_StringRules.DiscardUnknown(m) -} - -var xxx_messageInfo_StringRules proto.InternalMessageInfo - -func (m *StringRules) GetConst() string { - if m != nil && m.Const != nil { - return *m.Const - } - return "" -} - -func (m *StringRules) GetLen() uint64 { - if m != nil && m.Len != nil { - return *m.Len - } - return 0 -} - -func (m *StringRules) GetMinLen() uint64 { - if m != nil && m.MinLen != nil { - return *m.MinLen - } - return 0 -} - -func (m *StringRules) GetMaxLen() uint64 { - if m != nil && m.MaxLen != nil { - return *m.MaxLen - } - return 0 -} - -func (m *StringRules) GetLenBytes() uint64 { - if m != nil && m.LenBytes != nil { - return *m.LenBytes - } - return 0 -} - -func (m *StringRules) GetMinBytes() uint64 { - if m != nil && m.MinBytes != nil { - return *m.MinBytes - } - return 0 -} - -func (m *StringRules) GetMaxBytes() uint64 { - if m != nil && m.MaxBytes != nil { - return *m.MaxBytes - } - return 0 -} - -func (m *StringRules) GetPattern() string { - if m != nil && m.Pattern != nil { - return *m.Pattern - } - return "" -} - -func (m *StringRules) GetPrefix() string { - if m != nil && m.Prefix != nil { - return *m.Prefix - } - return "" -} - -func (m *StringRules) GetSuffix() string { - if m != nil && m.Suffix != nil { - return *m.Suffix - } - return "" -} - -func (m *StringRules) GetContains() string { - if m != nil && m.Contains != nil { - return *m.Contains - } - return "" -} - -func (m *StringRules) GetIn() []string { - if m != nil { - return m.In - } - return nil -} - -func (m *StringRules) GetNotIn() []string { - if m != nil { - return m.NotIn - } - return nil -} - -type isStringRules_WellKnown interface { - isStringRules_WellKnown() -} - -type StringRules_Email struct { - Email bool `protobuf:"varint,12,opt,name=email,oneof"` -} - -type StringRules_Hostname struct { - Hostname bool `protobuf:"varint,13,opt,name=hostname,oneof"` -} - -type StringRules_Ip struct { - Ip bool `protobuf:"varint,14,opt,name=ip,oneof"` -} - -type StringRules_Ipv4 struct { - Ipv4 bool `protobuf:"varint,15,opt,name=ipv4,oneof"` -} - -type StringRules_Ipv6 struct { - Ipv6 bool `protobuf:"varint,16,opt,name=ipv6,oneof"` -} - -type StringRules_Uri struct { - Uri bool `protobuf:"varint,17,opt,name=uri,oneof"` -} - -type StringRules_UriRef struct { - UriRef bool `protobuf:"varint,18,opt,name=uri_ref,json=uriRef,oneof"` -} - -func (*StringRules_Email) isStringRules_WellKnown() {} - -func (*StringRules_Hostname) isStringRules_WellKnown() {} - -func (*StringRules_Ip) isStringRules_WellKnown() {} - -func (*StringRules_Ipv4) isStringRules_WellKnown() {} - -func (*StringRules_Ipv6) isStringRules_WellKnown() {} - -func (*StringRules_Uri) isStringRules_WellKnown() {} - -func (*StringRules_UriRef) isStringRules_WellKnown() {} - -func (m *StringRules) GetWellKnown() isStringRules_WellKnown { - if m != nil { - return m.WellKnown - } - return nil -} - -func (m *StringRules) GetEmail() bool { - if x, ok := m.GetWellKnown().(*StringRules_Email); ok { - return x.Email - } - return false -} - -func (m *StringRules) GetHostname() bool { - if x, ok := m.GetWellKnown().(*StringRules_Hostname); ok { - return x.Hostname - } - return false -} - -func (m *StringRules) GetIp() bool { - if x, ok := m.GetWellKnown().(*StringRules_Ip); ok { - return x.Ip - } - return false -} - -func (m *StringRules) GetIpv4() bool { - if x, ok := m.GetWellKnown().(*StringRules_Ipv4); ok { - return x.Ipv4 - } - return false -} - -func (m *StringRules) GetIpv6() bool { - if x, ok := m.GetWellKnown().(*StringRules_Ipv6); ok { - return x.Ipv6 - } - return false -} - -func (m *StringRules) GetUri() bool { - if x, ok := m.GetWellKnown().(*StringRules_Uri); ok { - return x.Uri - } - return false -} - -func (m *StringRules) GetUriRef() bool { - if x, ok := m.GetWellKnown().(*StringRules_UriRef); ok { - return x.UriRef - } - return false -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*StringRules) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _StringRules_OneofMarshaler, _StringRules_OneofUnmarshaler, _StringRules_OneofSizer, []interface{}{ - (*StringRules_Email)(nil), - (*StringRules_Hostname)(nil), - (*StringRules_Ip)(nil), - (*StringRules_Ipv4)(nil), - (*StringRules_Ipv6)(nil), - (*StringRules_Uri)(nil), - (*StringRules_UriRef)(nil), - } -} - -func _StringRules_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*StringRules) - // well_known - switch x := m.WellKnown.(type) { - case *StringRules_Email: - t := uint64(0) - if x.Email { - t = 1 - } - b.EncodeVarint(12<<3 | proto.WireVarint) - b.EncodeVarint(t) - case *StringRules_Hostname: - t := uint64(0) - if x.Hostname { - t = 1 - } - b.EncodeVarint(13<<3 | proto.WireVarint) - b.EncodeVarint(t) - case *StringRules_Ip: - t := uint64(0) - if x.Ip { - t = 1 - } - b.EncodeVarint(14<<3 | proto.WireVarint) - b.EncodeVarint(t) - case *StringRules_Ipv4: - t := uint64(0) - if x.Ipv4 { - t = 1 - } - b.EncodeVarint(15<<3 | proto.WireVarint) - b.EncodeVarint(t) - case *StringRules_Ipv6: - t := uint64(0) - if x.Ipv6 { - t = 1 - } - b.EncodeVarint(16<<3 | proto.WireVarint) - b.EncodeVarint(t) - case *StringRules_Uri: - t := uint64(0) - if x.Uri { - t = 1 - } - b.EncodeVarint(17<<3 | proto.WireVarint) - b.EncodeVarint(t) - case *StringRules_UriRef: - t := uint64(0) - if x.UriRef { - t = 1 - } - b.EncodeVarint(18<<3 | proto.WireVarint) - b.EncodeVarint(t) - case nil: - default: - return fmt.Errorf("StringRules.WellKnown has unexpected type %T", x) - } - return nil -} - -func _StringRules_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*StringRules) - switch tag { - case 12: // well_known.email - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.WellKnown = &StringRules_Email{x != 0} - return true, err - case 13: // well_known.hostname - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.WellKnown = &StringRules_Hostname{x != 0} - return true, err - case 14: // well_known.ip - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.WellKnown = &StringRules_Ip{x != 0} - return true, err - case 15: // well_known.ipv4 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.WellKnown = &StringRules_Ipv4{x != 0} - return true, err - case 16: // well_known.ipv6 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.WellKnown = &StringRules_Ipv6{x != 0} - return true, err - case 17: // well_known.uri - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.WellKnown = &StringRules_Uri{x != 0} - return true, err - case 18: // well_known.uri_ref - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.WellKnown = &StringRules_UriRef{x != 0} - return true, err - default: - return false, nil - } -} - -func _StringRules_OneofSizer(msg proto.Message) (n int) { - m := msg.(*StringRules) - // well_known - switch x := m.WellKnown.(type) { - case *StringRules_Email: - n += 1 // tag and wire - n += 1 - case *StringRules_Hostname: - n += 1 // tag and wire - n += 1 - case *StringRules_Ip: - n += 1 // tag and wire - n += 1 - case *StringRules_Ipv4: - n += 1 // tag and wire - n += 1 - case *StringRules_Ipv6: - n += 2 // tag and wire - n += 1 - case *StringRules_Uri: - n += 2 // tag and wire - n += 1 - case *StringRules_UriRef: - n += 2 // tag and wire - n += 1 - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type BytesRules struct { - Const []byte `protobuf:"bytes,1,opt,name=const" json:"const,omitempty"` - Len *uint64 `protobuf:"varint,13,opt,name=len" json:"len,omitempty"` - MinLen *uint64 `protobuf:"varint,2,opt,name=min_len,json=minLen" json:"min_len,omitempty"` - MaxLen *uint64 `protobuf:"varint,3,opt,name=max_len,json=maxLen" json:"max_len,omitempty"` - Pattern *string `protobuf:"bytes,4,opt,name=pattern" json:"pattern,omitempty"` - Prefix []byte `protobuf:"bytes,5,opt,name=prefix" json:"prefix,omitempty"` - Suffix []byte `protobuf:"bytes,6,opt,name=suffix" json:"suffix,omitempty"` - Contains []byte `protobuf:"bytes,7,opt,name=contains" json:"contains,omitempty"` - In [][]byte `protobuf:"bytes,8,rep,name=in" json:"in,omitempty"` - NotIn [][]byte `protobuf:"bytes,9,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - // Types that are valid to be assigned to WellKnown: - // *BytesRules_Ip - // *BytesRules_Ipv4 - // *BytesRules_Ipv6 - WellKnown isBytesRules_WellKnown `protobuf_oneof:"well_known"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BytesRules) Reset() { *m = BytesRules{} } -func (m *BytesRules) String() string { return proto.CompactTextString(m) } -func (*BytesRules) ProtoMessage() {} -func (*BytesRules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{15} -} -func (m *BytesRules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BytesRules.Unmarshal(m, b) -} -func (m *BytesRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BytesRules.Marshal(b, m, deterministic) -} -func (dst *BytesRules) XXX_Merge(src proto.Message) { - xxx_messageInfo_BytesRules.Merge(dst, src) -} -func (m *BytesRules) XXX_Size() int { - return xxx_messageInfo_BytesRules.Size(m) -} -func (m *BytesRules) XXX_DiscardUnknown() { - xxx_messageInfo_BytesRules.DiscardUnknown(m) -} - -var xxx_messageInfo_BytesRules proto.InternalMessageInfo - -func (m *BytesRules) GetConst() []byte { - if m != nil { - return m.Const - } - return nil -} - -func (m *BytesRules) GetLen() uint64 { - if m != nil && m.Len != nil { - return *m.Len - } - return 0 -} - -func (m *BytesRules) GetMinLen() uint64 { - if m != nil && m.MinLen != nil { - return *m.MinLen - } - return 0 -} - -func (m *BytesRules) GetMaxLen() uint64 { - if m != nil && m.MaxLen != nil { - return *m.MaxLen - } - return 0 -} - -func (m *BytesRules) GetPattern() string { - if m != nil && m.Pattern != nil { - return *m.Pattern - } - return "" -} - -func (m *BytesRules) GetPrefix() []byte { - if m != nil { - return m.Prefix - } - return nil -} - -func (m *BytesRules) GetSuffix() []byte { - if m != nil { - return m.Suffix - } - return nil -} - -func (m *BytesRules) GetContains() []byte { - if m != nil { - return m.Contains - } - return nil -} - -func (m *BytesRules) GetIn() [][]byte { - if m != nil { - return m.In - } - return nil -} - -func (m *BytesRules) GetNotIn() [][]byte { - if m != nil { - return m.NotIn - } - return nil -} - -type isBytesRules_WellKnown interface { - isBytesRules_WellKnown() -} - -type BytesRules_Ip struct { - Ip bool `protobuf:"varint,10,opt,name=ip,oneof"` -} - -type BytesRules_Ipv4 struct { - Ipv4 bool `protobuf:"varint,11,opt,name=ipv4,oneof"` -} - -type BytesRules_Ipv6 struct { - Ipv6 bool `protobuf:"varint,12,opt,name=ipv6,oneof"` -} - -func (*BytesRules_Ip) isBytesRules_WellKnown() {} - -func (*BytesRules_Ipv4) isBytesRules_WellKnown() {} - -func (*BytesRules_Ipv6) isBytesRules_WellKnown() {} - -func (m *BytesRules) GetWellKnown() isBytesRules_WellKnown { - if m != nil { - return m.WellKnown - } - return nil -} - -func (m *BytesRules) GetIp() bool { - if x, ok := m.GetWellKnown().(*BytesRules_Ip); ok { - return x.Ip - } - return false -} - -func (m *BytesRules) GetIpv4() bool { - if x, ok := m.GetWellKnown().(*BytesRules_Ipv4); ok { - return x.Ipv4 - } - return false -} - -func (m *BytesRules) GetIpv6() bool { - if x, ok := m.GetWellKnown().(*BytesRules_Ipv6); ok { - return x.Ipv6 - } - return false -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*BytesRules) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _BytesRules_OneofMarshaler, _BytesRules_OneofUnmarshaler, _BytesRules_OneofSizer, []interface{}{ - (*BytesRules_Ip)(nil), - (*BytesRules_Ipv4)(nil), - (*BytesRules_Ipv6)(nil), - } -} - -func _BytesRules_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*BytesRules) - // well_known - switch x := m.WellKnown.(type) { - case *BytesRules_Ip: - t := uint64(0) - if x.Ip { - t = 1 - } - b.EncodeVarint(10<<3 | proto.WireVarint) - b.EncodeVarint(t) - case *BytesRules_Ipv4: - t := uint64(0) - if x.Ipv4 { - t = 1 - } - b.EncodeVarint(11<<3 | proto.WireVarint) - b.EncodeVarint(t) - case *BytesRules_Ipv6: - t := uint64(0) - if x.Ipv6 { - t = 1 - } - b.EncodeVarint(12<<3 | proto.WireVarint) - b.EncodeVarint(t) - case nil: - default: - return fmt.Errorf("BytesRules.WellKnown has unexpected type %T", x) - } - return nil -} - -func _BytesRules_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*BytesRules) - switch tag { - case 10: // well_known.ip - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.WellKnown = &BytesRules_Ip{x != 0} - return true, err - case 11: // well_known.ipv4 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.WellKnown = &BytesRules_Ipv4{x != 0} - return true, err - case 12: // well_known.ipv6 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.WellKnown = &BytesRules_Ipv6{x != 0} - return true, err - default: - return false, nil - } -} - -func _BytesRules_OneofSizer(msg proto.Message) (n int) { - m := msg.(*BytesRules) - // well_known - switch x := m.WellKnown.(type) { - case *BytesRules_Ip: - n += 1 // tag and wire - n += 1 - case *BytesRules_Ipv4: - n += 1 // tag and wire - n += 1 - case *BytesRules_Ipv6: - n += 1 // tag and wire - n += 1 - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type EnumRules struct { - Const *int32 `protobuf:"varint,1,opt,name=const" json:"const,omitempty"` - DefinedOnly *bool `protobuf:"varint,2,opt,name=defined_only,json=definedOnly" json:"defined_only,omitempty"` - In []int32 `protobuf:"varint,3,rep,name=in" json:"in,omitempty"` - NotIn []int32 `protobuf:"varint,4,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *EnumRules) Reset() { *m = EnumRules{} } -func (m *EnumRules) String() string { return proto.CompactTextString(m) } -func (*EnumRules) ProtoMessage() {} -func (*EnumRules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{16} -} -func (m *EnumRules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EnumRules.Unmarshal(m, b) -} -func (m *EnumRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EnumRules.Marshal(b, m, deterministic) -} -func (dst *EnumRules) XXX_Merge(src proto.Message) { - xxx_messageInfo_EnumRules.Merge(dst, src) -} -func (m *EnumRules) XXX_Size() int { - return xxx_messageInfo_EnumRules.Size(m) -} -func (m *EnumRules) XXX_DiscardUnknown() { - xxx_messageInfo_EnumRules.DiscardUnknown(m) -} - -var xxx_messageInfo_EnumRules proto.InternalMessageInfo - -func (m *EnumRules) GetConst() int32 { - if m != nil && m.Const != nil { - return *m.Const - } - return 0 -} - -func (m *EnumRules) GetDefinedOnly() bool { - if m != nil && m.DefinedOnly != nil { - return *m.DefinedOnly - } - return false -} - -func (m *EnumRules) GetIn() []int32 { - if m != nil { - return m.In - } - return nil -} - -func (m *EnumRules) GetNotIn() []int32 { - if m != nil { - return m.NotIn - } - return nil -} - -type MessageRules struct { - Skip *bool `protobuf:"varint,1,opt,name=skip" json:"skip,omitempty"` - Required *bool `protobuf:"varint,2,opt,name=required" json:"required,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MessageRules) Reset() { *m = MessageRules{} } -func (m *MessageRules) String() string { return proto.CompactTextString(m) } -func (*MessageRules) ProtoMessage() {} -func (*MessageRules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{17} -} -func (m *MessageRules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MessageRules.Unmarshal(m, b) -} -func (m *MessageRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MessageRules.Marshal(b, m, deterministic) -} -func (dst *MessageRules) XXX_Merge(src proto.Message) { - xxx_messageInfo_MessageRules.Merge(dst, src) -} -func (m *MessageRules) XXX_Size() int { - return xxx_messageInfo_MessageRules.Size(m) -} -func (m *MessageRules) XXX_DiscardUnknown() { - xxx_messageInfo_MessageRules.DiscardUnknown(m) -} - -var xxx_messageInfo_MessageRules proto.InternalMessageInfo - -func (m *MessageRules) GetSkip() bool { - if m != nil && m.Skip != nil { - return *m.Skip - } - return false -} - -func (m *MessageRules) GetRequired() bool { - if m != nil && m.Required != nil { - return *m.Required - } - return false -} - -type RepeatedRules struct { - MinItems *uint64 `protobuf:"varint,1,opt,name=min_items,json=minItems" json:"min_items,omitempty"` - MaxItems *uint64 `protobuf:"varint,2,opt,name=max_items,json=maxItems" json:"max_items,omitempty"` - Unique *bool `protobuf:"varint,3,opt,name=unique" json:"unique,omitempty"` - Items *FieldRules `protobuf:"bytes,4,opt,name=items" json:"items,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RepeatedRules) Reset() { *m = RepeatedRules{} } -func (m *RepeatedRules) String() string { return proto.CompactTextString(m) } -func (*RepeatedRules) ProtoMessage() {} -func (*RepeatedRules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{18} -} -func (m *RepeatedRules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RepeatedRules.Unmarshal(m, b) -} -func (m *RepeatedRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RepeatedRules.Marshal(b, m, deterministic) -} -func (dst *RepeatedRules) XXX_Merge(src proto.Message) { - xxx_messageInfo_RepeatedRules.Merge(dst, src) -} -func (m *RepeatedRules) XXX_Size() int { - return xxx_messageInfo_RepeatedRules.Size(m) -} -func (m *RepeatedRules) XXX_DiscardUnknown() { - xxx_messageInfo_RepeatedRules.DiscardUnknown(m) -} - -var xxx_messageInfo_RepeatedRules proto.InternalMessageInfo - -func (m *RepeatedRules) GetMinItems() uint64 { - if m != nil && m.MinItems != nil { - return *m.MinItems - } - return 0 -} - -func (m *RepeatedRules) GetMaxItems() uint64 { - if m != nil && m.MaxItems != nil { - return *m.MaxItems - } - return 0 -} - -func (m *RepeatedRules) GetUnique() bool { - if m != nil && m.Unique != nil { - return *m.Unique - } - return false -} - -func (m *RepeatedRules) GetItems() *FieldRules { - if m != nil { - return m.Items - } - return nil -} - -type MapRules struct { - MinPairs *uint64 `protobuf:"varint,1,opt,name=min_pairs,json=minPairs" json:"min_pairs,omitempty"` - MaxPairs *uint64 `protobuf:"varint,2,opt,name=max_pairs,json=maxPairs" json:"max_pairs,omitempty"` - NoSparse *bool `protobuf:"varint,3,opt,name=no_sparse,json=noSparse" json:"no_sparse,omitempty"` - Keys *FieldRules `protobuf:"bytes,4,opt,name=keys" json:"keys,omitempty"` - Values *FieldRules `protobuf:"bytes,5,opt,name=values" json:"values,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MapRules) Reset() { *m = MapRules{} } -func (m *MapRules) String() string { return proto.CompactTextString(m) } -func (*MapRules) ProtoMessage() {} -func (*MapRules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{19} -} -func (m *MapRules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MapRules.Unmarshal(m, b) -} -func (m *MapRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MapRules.Marshal(b, m, deterministic) -} -func (dst *MapRules) XXX_Merge(src proto.Message) { - xxx_messageInfo_MapRules.Merge(dst, src) -} -func (m *MapRules) XXX_Size() int { - return xxx_messageInfo_MapRules.Size(m) -} -func (m *MapRules) XXX_DiscardUnknown() { - xxx_messageInfo_MapRules.DiscardUnknown(m) -} - -var xxx_messageInfo_MapRules proto.InternalMessageInfo - -func (m *MapRules) GetMinPairs() uint64 { - if m != nil && m.MinPairs != nil { - return *m.MinPairs - } - return 0 -} - -func (m *MapRules) GetMaxPairs() uint64 { - if m != nil && m.MaxPairs != nil { - return *m.MaxPairs - } - return 0 -} - -func (m *MapRules) GetNoSparse() bool { - if m != nil && m.NoSparse != nil { - return *m.NoSparse - } - return false -} - -func (m *MapRules) GetKeys() *FieldRules { - if m != nil { - return m.Keys - } - return nil -} - -func (m *MapRules) GetValues() *FieldRules { - if m != nil { - return m.Values - } - return nil -} - -type AnyRules struct { - Required *bool `protobuf:"varint,1,opt,name=required" json:"required,omitempty"` - In []string `protobuf:"bytes,2,rep,name=in" json:"in,omitempty"` - NotIn []string `protobuf:"bytes,3,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AnyRules) Reset() { *m = AnyRules{} } -func (m *AnyRules) String() string { return proto.CompactTextString(m) } -func (*AnyRules) ProtoMessage() {} -func (*AnyRules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{20} -} -func (m *AnyRules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AnyRules.Unmarshal(m, b) -} -func (m *AnyRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AnyRules.Marshal(b, m, deterministic) -} -func (dst *AnyRules) XXX_Merge(src proto.Message) { - xxx_messageInfo_AnyRules.Merge(dst, src) -} -func (m *AnyRules) XXX_Size() int { - return xxx_messageInfo_AnyRules.Size(m) -} -func (m *AnyRules) XXX_DiscardUnknown() { - xxx_messageInfo_AnyRules.DiscardUnknown(m) -} - -var xxx_messageInfo_AnyRules proto.InternalMessageInfo - -func (m *AnyRules) GetRequired() bool { - if m != nil && m.Required != nil { - return *m.Required - } - return false -} - -func (m *AnyRules) GetIn() []string { - if m != nil { - return m.In - } - return nil -} - -func (m *AnyRules) GetNotIn() []string { - if m != nil { - return m.NotIn - } - return nil -} - -type DurationRules struct { - Required *bool `protobuf:"varint,1,opt,name=required" json:"required,omitempty"` - Const *duration.Duration `protobuf:"bytes,2,opt,name=const" json:"const,omitempty"` - Lt *duration.Duration `protobuf:"bytes,3,opt,name=lt" json:"lt,omitempty"` - Lte *duration.Duration `protobuf:"bytes,4,opt,name=lte" json:"lte,omitempty"` - Gt *duration.Duration `protobuf:"bytes,5,opt,name=gt" json:"gt,omitempty"` - Gte *duration.Duration `protobuf:"bytes,6,opt,name=gte" json:"gte,omitempty"` - In []*duration.Duration `protobuf:"bytes,7,rep,name=in" json:"in,omitempty"` - NotIn []*duration.Duration `protobuf:"bytes,8,rep,name=not_in,json=notIn" json:"not_in,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DurationRules) Reset() { *m = DurationRules{} } -func (m *DurationRules) String() string { return proto.CompactTextString(m) } -func (*DurationRules) ProtoMessage() {} -func (*DurationRules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{21} -} -func (m *DurationRules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DurationRules.Unmarshal(m, b) -} -func (m *DurationRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DurationRules.Marshal(b, m, deterministic) -} -func (dst *DurationRules) XXX_Merge(src proto.Message) { - xxx_messageInfo_DurationRules.Merge(dst, src) -} -func (m *DurationRules) XXX_Size() int { - return xxx_messageInfo_DurationRules.Size(m) -} -func (m *DurationRules) XXX_DiscardUnknown() { - xxx_messageInfo_DurationRules.DiscardUnknown(m) -} - -var xxx_messageInfo_DurationRules proto.InternalMessageInfo - -func (m *DurationRules) GetRequired() bool { - if m != nil && m.Required != nil { - return *m.Required - } - return false -} - -func (m *DurationRules) GetConst() *duration.Duration { - if m != nil { - return m.Const - } - return nil -} - -func (m *DurationRules) GetLt() *duration.Duration { - if m != nil { - return m.Lt - } - return nil -} - -func (m *DurationRules) GetLte() *duration.Duration { - if m != nil { - return m.Lte - } - return nil -} - -func (m *DurationRules) GetGt() *duration.Duration { - if m != nil { - return m.Gt - } - return nil -} - -func (m *DurationRules) GetGte() *duration.Duration { - if m != nil { - return m.Gte - } - return nil -} - -func (m *DurationRules) GetIn() []*duration.Duration { - if m != nil { - return m.In - } - return nil -} - -func (m *DurationRules) GetNotIn() []*duration.Duration { - if m != nil { - return m.NotIn - } - return nil -} - -type TimestampRules struct { - Required *bool `protobuf:"varint,1,opt,name=required" json:"required,omitempty"` - Const *timestamp.Timestamp `protobuf:"bytes,2,opt,name=const" json:"const,omitempty"` - Lt *timestamp.Timestamp `protobuf:"bytes,3,opt,name=lt" json:"lt,omitempty"` - Lte *timestamp.Timestamp `protobuf:"bytes,4,opt,name=lte" json:"lte,omitempty"` - Gt *timestamp.Timestamp `protobuf:"bytes,5,opt,name=gt" json:"gt,omitempty"` - Gte *timestamp.Timestamp `protobuf:"bytes,6,opt,name=gte" json:"gte,omitempty"` - LtNow *bool `protobuf:"varint,7,opt,name=lt_now,json=ltNow" json:"lt_now,omitempty"` - GtNow *bool `protobuf:"varint,8,opt,name=gt_now,json=gtNow" json:"gt_now,omitempty"` - Within *duration.Duration `protobuf:"bytes,9,opt,name=within" json:"within,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TimestampRules) Reset() { *m = TimestampRules{} } -func (m *TimestampRules) String() string { return proto.CompactTextString(m) } -func (*TimestampRules) ProtoMessage() {} -func (*TimestampRules) Descriptor() ([]byte, []int) { - return fileDescriptor_validate_943c924e5dee4604, []int{22} -} -func (m *TimestampRules) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TimestampRules.Unmarshal(m, b) -} -func (m *TimestampRules) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TimestampRules.Marshal(b, m, deterministic) -} -func (dst *TimestampRules) XXX_Merge(src proto.Message) { - xxx_messageInfo_TimestampRules.Merge(dst, src) -} -func (m *TimestampRules) XXX_Size() int { - return xxx_messageInfo_TimestampRules.Size(m) -} -func (m *TimestampRules) XXX_DiscardUnknown() { - xxx_messageInfo_TimestampRules.DiscardUnknown(m) -} - -var xxx_messageInfo_TimestampRules proto.InternalMessageInfo - -func (m *TimestampRules) GetRequired() bool { - if m != nil && m.Required != nil { - return *m.Required - } - return false -} - -func (m *TimestampRules) GetConst() *timestamp.Timestamp { - if m != nil { - return m.Const - } - return nil -} - -func (m *TimestampRules) GetLt() *timestamp.Timestamp { - if m != nil { - return m.Lt - } - return nil -} - -func (m *TimestampRules) GetLte() *timestamp.Timestamp { - if m != nil { - return m.Lte - } - return nil -} - -func (m *TimestampRules) GetGt() *timestamp.Timestamp { - if m != nil { - return m.Gt - } - return nil -} - -func (m *TimestampRules) GetGte() *timestamp.Timestamp { - if m != nil { - return m.Gte - } - return nil -} - -func (m *TimestampRules) GetLtNow() bool { - if m != nil && m.LtNow != nil { - return *m.LtNow - } - return false -} - -func (m *TimestampRules) GetGtNow() bool { - if m != nil && m.GtNow != nil { - return *m.GtNow - } - return false -} - -func (m *TimestampRules) GetWithin() *duration.Duration { - if m != nil { - return m.Within - } - return nil -} - -var E_Disabled = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 919191, - Name: "validate.disabled", - Tag: "varint,919191,opt,name=disabled", - Filename: "validate/validate.proto", -} - -var E_Required = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.OneofOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 919191, - Name: "validate.required", - Tag: "varint,919191,opt,name=required", - Filename: "validate/validate.proto", -} - -var E_Rules = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*FieldRules)(nil), - Field: 919191, - Name: "validate.rules", - Tag: "bytes,919191,opt,name=rules", - Filename: "validate/validate.proto", -} - -func init() { - proto.RegisterType((*FieldRules)(nil), "validate.FieldRules") - proto.RegisterType((*FloatRules)(nil), "validate.FloatRules") - proto.RegisterType((*DoubleRules)(nil), "validate.DoubleRules") - proto.RegisterType((*Int32Rules)(nil), "validate.Int32Rules") - proto.RegisterType((*Int64Rules)(nil), "validate.Int64Rules") - proto.RegisterType((*UInt32Rules)(nil), "validate.UInt32Rules") - proto.RegisterType((*UInt64Rules)(nil), "validate.UInt64Rules") - proto.RegisterType((*SInt32Rules)(nil), "validate.SInt32Rules") - proto.RegisterType((*SInt64Rules)(nil), "validate.SInt64Rules") - proto.RegisterType((*Fixed32Rules)(nil), "validate.Fixed32Rules") - proto.RegisterType((*Fixed64Rules)(nil), "validate.Fixed64Rules") - proto.RegisterType((*SFixed32Rules)(nil), "validate.SFixed32Rules") - proto.RegisterType((*SFixed64Rules)(nil), "validate.SFixed64Rules") - proto.RegisterType((*BoolRules)(nil), "validate.BoolRules") - proto.RegisterType((*StringRules)(nil), "validate.StringRules") - proto.RegisterType((*BytesRules)(nil), "validate.BytesRules") - proto.RegisterType((*EnumRules)(nil), "validate.EnumRules") - proto.RegisterType((*MessageRules)(nil), "validate.MessageRules") - proto.RegisterType((*RepeatedRules)(nil), "validate.RepeatedRules") - proto.RegisterType((*MapRules)(nil), "validate.MapRules") - proto.RegisterType((*AnyRules)(nil), "validate.AnyRules") - proto.RegisterType((*DurationRules)(nil), "validate.DurationRules") - proto.RegisterType((*TimestampRules)(nil), "validate.TimestampRules") - proto.RegisterExtension(E_Disabled) - proto.RegisterExtension(E_Required) - proto.RegisterExtension(E_Rules) -} - -func init() { proto.RegisterFile("validate/validate.proto", fileDescriptor_validate_943c924e5dee4604) } - -var fileDescriptor_validate_943c924e5dee4604 = []byte{ - // 1639 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x98, 0x4b, 0x6f, 0xdb, 0xca, - 0x15, 0xc7, 0x2b, 0xbe, 0x44, 0x8d, 0xa5, 0x48, 0x9a, 0x6b, 0x3b, 0xbc, 0xee, 0xe3, 0x3a, 0x5a, - 0x14, 0x4e, 0x1a, 0x58, 0xa9, 0xe3, 0x0a, 0x41, 0x82, 0x16, 0xa8, 0x91, 0x06, 0x0d, 0xda, 0x34, - 0x05, 0xdd, 0x2c, 0xda, 0x8d, 0x40, 0x5b, 0x23, 0x66, 0x60, 0x6a, 0xc8, 0x90, 0x94, 0x2d, 0x7d, - 0x88, 0xb4, 0xdd, 0xf5, 0xb3, 0x74, 0xd5, 0x7d, 0xbf, 0x49, 0xd7, 0xdd, 0x76, 0x51, 0xcc, 0x8b, - 0x8f, 0x43, 0x5a, 0x5e, 0xdc, 0x9d, 0xe6, 0x9c, 0xff, 0x99, 0xf9, 0xe1, 0x3f, 0xe2, 0xcc, 0x21, - 0xd1, 0xe3, 0xdb, 0x20, 0xa2, 0x8b, 0x20, 0x27, 0x53, 0xfd, 0xe3, 0x34, 0x49, 0xe3, 0x3c, 0xc6, - 0xae, 0x1e, 0x1f, 0x1d, 0x87, 0x71, 0x1c, 0x46, 0x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0x68, 0x00, 0x81, - 0x06, 0x10, 0x68, 0x00, 0x81, 0x06, 0x10, 0x68, 0xd0, 0x02, 0x34, 0x80, 0x40, 0xad, 0x0e, 0x59, - 0x4d, 0x20, 0x0b, 0x02, 0x59, 0x10, 0xc8, 0x82, 0x40, 0x16, 0x04, 0xb2, 0x5a, 0x80, 0xac, 0x2a, - 0xd0, 0xe5, 0x7d, 0x0e, 0x8d, 0x9b, 0x40, 0x63, 0x08, 0x34, 0x86, 0x40, 0x63, 0x08, 0x34, 0x86, - 0x40, 0xe3, 0x16, 0xa0, 0x31, 0x04, 0x6a, 0x75, 0x08, 0x37, 0x81, 0x30, 0x04, 0xc2, 0x10, 0x08, - 0x43, 0x20, 0x0c, 0x81, 0x70, 0x0b, 0x10, 0xd6, 0x40, 0x7f, 0xeb, 0xa0, 0x7e, 0xf5, 0x06, 0xab, - 0x13, 0x75, 0x9b, 0x44, 0x5d, 0x48, 0xd4, 0x85, 0x44, 0x5d, 0x48, 0xd4, 0x85, 0x44, 0xdd, 0x16, - 0xa2, 0x6e, 0x83, 0xa8, 0xd5, 0x23, 0xa7, 0x49, 0xe4, 0x40, 0x22, 0x07, 0x12, 0x39, 0x90, 0xc8, - 0x81, 0x44, 0x4e, 0x0b, 0x91, 0xa3, 0x89, 0xfe, 0xde, 0x41, 0x83, 0xcb, 0xfb, 0x4d, 0x1a, 0x36, - 0x91, 0x86, 0x10, 0x69, 0x08, 0x91, 0x86, 0x10, 0x69, 0x08, 0x91, 0x86, 0x2d, 0x48, 0xc3, 0x26, - 0x52, 0xab, 0x4b, 0xa3, 0x26, 0xd2, 0x08, 0x22, 0x8d, 0x20, 0xd2, 0x08, 0x22, 0x8d, 0x20, 0xd2, - 0xa8, 0x05, 0x69, 0xa4, 0x91, 0x9e, 0xa0, 0x5e, 0xd1, 0xa1, 0xd4, 0x69, 0x5c, 0x45, 0x33, 0xf9, - 0x9f, 0x89, 0xf6, 0x2a, 0x8d, 0x49, 0x5d, 0xd5, 0xd3,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- 0xb7, 0x85, 0xfe, 0x2f, 0x6f, 0xd4, 0x02, 0x61, 0x1c, 0x05, 0x2c, 0x3c, 0x8d, 0xd3, 0x70, 0x1a, - 0xa6, 0xc9, 0xf5, 0xf4, 0x2a, 0x88, 0x02, 0x76, 0x4d, 0xd2, 0xe9, 0x66, 0x91, 0x4d, 0x29, 0xe3, - 0x77, 0x5f, 0x10, 0xc9, 0xef, 0x9a, 0xc5, 0x07, 0xd4, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0x09, - 0x25, 0xe8, 0x78, 0x54, 0x15, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/README.md b/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/README.md deleted file mode 100644 index 504770d706f..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/README.md +++ /dev/null @@ -1,23 +0,0 @@ -## Generate new pb.go files - - 1. Update -[DATA_PLANE_API_VERSION](https://github.com/grpc/grpc-go/blob/master/xds/internal/regenerate_scripts/envoy-proto-gen.sh#L3) -to a new commit for -[envoyproxy/data-plane-api](https://github.com/envoyproxy/data-plane-api/commits/master). - 1. Run `./envoy-proto-gen.sh` in __this__ directory (and fingers crossed). - -## It didn't work - - - If applying patch failed, look at the patches, manually apply them, and - generate new patches. - - It might help to see the new changes. To see github diff between two commits - https://github.com/envoyproxy/data-plane-api/compare/sha1..sha2 - - E.g. - https://github.com/envoyproxy/data-plane-api/compare/965c278c10fa90ff34cb4d4890141863f4437b4a..2bcd30b5f4c224a98d1394f4266335ac640f178d - -## It worked, diff we __don't__ want - - 1. `go.mod` shouldn't be changed - - Look for `github.com/envoyproxy/protoc-gen-validate/validate`, it should - __NOT__ be added. Because it depends on gogo proto, and we have a local - validate library to replace it. diff --git a/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/envoy-proto-gen.sh b/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/envoy-proto-gen.sh deleted file mode 100755 index 0b0f1b54c1f..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/envoy-proto-gen.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -set -ex -DATA_PLANE_API_VERSION=965c278c10fa90ff34cb4d4890141863f4437b4a - -git clone git@github.com:envoyproxy/data-plane-api.git -git clone git@github.com:envoyproxy/protoc-gen-validate.git - -cd data-plane-api -git checkout $DATA_PLANE_API_VERSION -cp ../utils/WORKSPACE . -bazel clean --expunge - -# We download a local copy of the protoc-gen-validate repo to be used by bazel -# for customizing proto generated code import path. -# And we do a simple grep here to get the release version of the -# proto-gen-validate that gets used by data-plane-api. -PROTOC_GEN_VALIDATE=$(grep "PGV_GIT_SHA =" ./bazel/repository_locations.bzl | sed -r 's/.*"(.*)".*/\1/') - -cd ../protoc-gen-validate -git checkout $PROTOC_GEN_VALIDATE -git apply ../utils/protoc-gen-validate.patch - -cd ../data-plane-api - -# cleanup.sh remove all gogo proto related imports and labels. -../utils/cleanup.sh - -git apply ../utils/data-plane-api.patch -# proto-gen.sh build all packages required for grpc xds implementation and move -# proto generated code to grpc/xds/internal/proto subdirectory. -../utils/proto-gen.sh - diff --git a/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/README.md b/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/README.md deleted file mode 100644 index 967551547b9..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/README.md +++ /dev/null @@ -1,2 +0,0 @@ -Run ./envoy-proto-gen.sh to generate xds proto generated code for grpc usage. -Make sure your $GOPATH is valid and you have grpc-go repo locally. \ No newline at end of file diff --git a/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/WORKSPACE b/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/WORKSPACE deleted file mode 100644 index decad3080cb..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/WORKSPACE +++ /dev/null @@ -1,67 +0,0 @@ -workspace(name = "envoy_api") - -local_repository( - name = "com_envoyproxy_protoc_gen_validate", - path = "../protoc-gen-validate", -) - -load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "io_bazel_rules_go", - sha256 = "6776d68ebb897625dead17ae510eac3d5f6342367327875210df44dbe2aeeb19", - urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.17.1/rules_go-0.17.1.tar.gz"], -) - -git_repository( - name = "com_github_golang_protobuf", - commit = "aa810b61a9c79d51363740d207bb46cf8e620ed5", - patch_args = ["-p1"], - patches = [ - "@io_bazel_rules_go//third_party:com_github_golang_protobuf-gazelle.patch", - "@io_bazel_rules_go//third_party:com_github_golang_protobuf-extras.patch", - ], - remote = "https://github.com/golang/protobuf", - shallow_since = "1534281267 -0700", -) - -load("//bazel:repositories.bzl", "api_dependencies") - -api_dependencies() - -load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains") - -go_rules_dependencies() - -go_register_toolchains() - -http_archive( - name = "bazel_gazelle", - sha256 = "3c681998538231a2d24d0c07ed5a7658cb72bfb5fd4bf9911157c0e9ac6a2687", - urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.17.0/bazel-gazelle-0.17.0.tar.gz"], -) - -load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") - -gazelle_dependencies() - -bind( - name = "six", - actual = "@six_archive//:six", -) - -http_archive( - name = "six_archive", - build_file = "@com_google_protobuf//:six.BUILD", - sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a", - url = "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55", -) - -http_archive( - name = "com_github_grpc_grpc", - strip_prefix = "grpc-1e7ec75eff60ff74d0c192591a369af0308bca48", - urls = [ - "https://github.com/grpc/grpc/archive/1e7ec75eff60ff74d0c192591a369af0308bca48.tar.gz", - ], -) diff --git a/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/cleanup.sh b/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/cleanup.sh deleted file mode 100755 index fd2893e6364..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/cleanup.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -find . -name '*.proto' -print0 | -while IFS= read -r -d '' f -do - commands=( - # Import mangling. - -e 's#import "gogoproto/gogo.proto";##' - # Remove references to gogo.proto extensions. - -e 's#option (gogoproto\.[a-z_]\+) = \(true\|false\);##' - -e 's#\(, \)\?(gogoproto\.[a-z_]\+) = \(true\|false\),\?##' - # gogoproto removal can result in empty brackets. - -e 's# \[\]##' - # gogoproto removal can result in four spaces on a line by itself. - -e '/^ $/d' - ) - sed -i "${commands[@]}" "$f" - - # gogoproto removal can leave a comma on the last element in a list. - # This needs to run separately after all the commands above have finished - # since it is multi-line and rewrites the output of the above patterns. - sed -i -e '$!N; s#\(.*\),\([[:space:]]*\];\)#\1\2#; t; P; D;' "$f" -done diff --git a/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/data-plane-api.patch b/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/data-plane-api.patch deleted file mode 100644 index a0fc9752c4f..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/data-plane-api.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff --git a/bazel/api_build_system.bzl b/bazel/api_build_system.bzl -index c68ccbd..e6cc8cb 100644 ---- a/bazel/api_build_system.bzl -+++ b/bazel/api_build_system.bzl -@@ -7,7 +7,7 @@ _PY_SUFFIX = "_py" - _CC_SUFFIX = "_cc" - _GO_PROTO_SUFFIX = "_go_proto" - _GO_GRPC_SUFFIX = "_go_grpc" --_GO_IMPORTPATH_PREFIX = "github.com/envoyproxy/data-plane-api/api/" -+_GO_IMPORTPATH_PREFIX = "google.golang.org/grpc/xds/internal/proto/" - - def _Suffix(d, suffix): - return d + suffix -@@ -42,7 +42,7 @@ def api_py_proto_library(name, srcs = [], deps = [], has_services = 0): - def api_go_proto_library(name, proto, deps = []): - go_proto_library( - name = _Suffix(name, _GO_PROTO_SUFFIX), -- importpath = _Suffix(_GO_IMPORTPATH_PREFIX, name), -+ importpath = _Suffix(_GO_IMPORTPATH_PREFIX + native.package_name() + "/", name), - proto = proto, - visibility = ["//visibility:public"], - deps = deps + [ -@@ -60,7 +60,7 @@ def api_go_proto_library(name, proto, deps = []): - def api_go_grpc_library(name, proto, deps = []): - go_grpc_library( - name = _Suffix(name, _GO_GRPC_SUFFIX), -- importpath = _Suffix(_GO_IMPORTPATH_PREFIX, name), -+ importpath = _Suffix(_GO_IMPORTPATH_PREFIX + native.package_name() + "/", name), - proto = proto, - visibility = ["//visibility:public"], - deps = deps + [ diff --git a/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/proto-gen.sh b/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/proto-gen.sh deleted file mode 100755 index b08fcc84183..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/proto-gen.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -# packages is the collection of the packages that are required by xds for grpc. -packages=( - envoy/service/discovery/v2:ads_go_grpc - envoy/api/v2:eds_go_grpc - envoy/api/v2:cds_go_grpc - envoy/api/v2/core:address_go_proto - envoy/api/v2/core:base_go_proto - envoy/api/v2/endpoint:endpoint_go_proto - envoy/type:percent_go_proto - envoy/service/load_stats/v2:lrs_go_grpc - udpa/data/orca/v1:orca_load_report_go_proto - udpa/service/orca/v1:orca_go_grpc -) - -if [ -z $GOPATH ]; then echo 'empty $GOPATH, exiting.'; exit 1 -fi - -for i in ${packages[@]} -do - bazel build "$i" -done - -dest="$PWD/../../proto/" -rm -rf "$dest" -srcs=( - "find -L ./bazel-bin/envoy/ -name *.pb.go -print0" - "find -L ./bazel-bin/udpa/ -name *.pb.go -print0" - "find -L ./bazel-bin/ -name validate.pb.go -print0" -) - -for src in "${srcs[@]}" -do - eval "$src" | - while IFS= read -r -d '' origin - do - target="${origin##*proto/}" - final="$dest$target" - mkdir -p "${final%*/*}" - cp "$origin" "$dest$target" - done -done diff --git a/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/protoc-gen-validate.patch b/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/protoc-gen-validate.patch deleted file mode 100644 index 9ef5cefbda8..00000000000 --- a/vendor/google.golang.org/grpc/xds/internal/regenerate_scripts/utils/protoc-gen-validate.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/validate/BUILD b/validate/BUILD -index 8a3d063..939d997 100644 ---- a/validate/BUILD -+++ b/validate/BUILD -@@ -31,7 +31,7 @@ py_proto_library( - - go_proto_library( - name = "go_default_library", -- importpath = "github.com/envoyproxy/protoc-gen-validate/validate", -+ importpath = "google.golang.org/grpc/xds/internal/proto/validate", - proto = ":validate_proto", - visibility = ["//visibility:public"], - ) -diff --git a/validate/validate.proto b/validate/validate.proto -index 864ad86..6165f39 100644 ---- a/validate/validate.proto -+++ b/validate/validate.proto -@@ -1,7 +1,7 @@ - syntax = "proto2"; - package validate; - --option go_package = "github.com/envoyproxy/protoc-gen-validate/validate"; -+option go_package = "google.golang.org/grpc/xds/internal/proto/validate"; - option java_package = "io.envoyproxy.pgv.validate"; - - import "google/protobuf/descriptor.proto"; diff --git a/vendor/google.golang.org/grpc/xds/internal/resolver/old/xds_resolver_old.go b/vendor/google.golang.org/grpc/xds/internal/resolver/old/xds_resolver_old.go new file mode 100644 index 00000000000..26aa592cde5 --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/resolver/old/xds_resolver_old.go @@ -0,0 +1,86 @@ +/* + * + * 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. + * + */ + +// Package old implements the old xds resolver. +// +// At this point, the resolver is named xds-experimental, and doesn't do very +// much at all, except for returning a hard-coded service config which selects +// the xds_experimental balancer. +package old + +import ( + "fmt" + + "google.golang.org/grpc/resolver" +) + +const ( + // The JSON form of the hard-coded service config which picks the + // xds_experimental balancer with round_robin as the child policy. + jsonSC = `{ + "loadBalancingConfig":[ + { + "xds_experimental":{ + "childPolicy":[ + { + "round_robin": {} + } + ] + } + } + ] + }` + // xDS balancer name is xds_experimental while resolver scheme is + // xds-experimental since "_" is not a valid character in the URL. + xdsScheme = "xds-experimental" +) + +func init() { + resolver.Register(&xdsBuilder{}) +} + +type xdsBuilder struct{} + +// Build helps implement the resolver.Builder interface. +func (b *xdsBuilder) Build(t resolver.Target, cc resolver.ClientConn, o resolver.BuildOptions) (resolver.Resolver, error) { + // The xds balancer must have been registered at this point for the service + // config to be parsed properly. + scpr := cc.ParseServiceConfig(jsonSC) + + if scpr.Err != nil { + panic(fmt.Sprintf("error parsing service config %q: %v", jsonSC, scpr.Err)) + } + + // We return a resolver which bacically does nothing. The hard-coded service + // config returned here picks the xds balancer. + cc.UpdateState(resolver.State{ServiceConfig: scpr}) + return &xdsResolver{}, nil +} + +// Name helps implement the resolver.Builder interface. +func (*xdsBuilder) Scheme() string { + return xdsScheme +} + +type xdsResolver struct{} + +// ResolveNow is a no-op at this point. +func (*xdsResolver) ResolveNow(o resolver.ResolveNowOptions) {} + +// Close is a no-op at this point. +func (*xdsResolver) Close() {} diff --git a/vendor/google.golang.org/grpc/xds/internal/resolver/xds_resolver.go b/vendor/google.golang.org/grpc/xds/internal/resolver/xds_resolver.go new file mode 100644 index 00000000000..564d9d80e37 --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/resolver/xds_resolver.go @@ -0,0 +1,210 @@ +/* + * 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. + * + */ + +// Package resolver implements the xds resolver. +// +// At this point, the resolver is named xds-experimental, and doesn't do very +// much at all, except for returning a hard-coded service config which selects +// the xds_experimental balancer. +package resolver + +import ( + "context" + "errors" + "fmt" + + "google.golang.org/grpc" + "google.golang.org/grpc/attributes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/resolver" + + xdsinternal "google.golang.org/grpc/xds/internal" + xdsclient "google.golang.org/grpc/xds/internal/client" + "google.golang.org/grpc/xds/internal/client/bootstrap" +) + +// xDS balancer name is xds_experimental while resolver scheme is +// xds-experimental since "_" is not a valid character in the URL. +// TODO: Change this scheme name to "xds-experimental" once we delete the old +// resolver implementation in xds_resolver_old.go +const xdsScheme = "xds-experimental-new" + +// For overriding in unittests. +var ( + newXDSClient = func(opts xdsclient.Options) (xdsClientInterface, error) { + return xdsclient.New(opts) + } + newXDSConfig = bootstrap.NewConfig +) + +func init() { + resolver.Register(&xdsResolverBuilder{}) +} + +type xdsResolverBuilder struct{} + +// Build helps implement the resolver.Builder interface. +// +// The xds bootstrap process is performed (and a new xds client is built) every +// time an xds resolver is built. +func (b *xdsResolverBuilder) Build(t resolver.Target, cc resolver.ClientConn, rbo resolver.BuildOptions) (resolver.Resolver, error) { + config := newXDSConfig() + if config.BalancerName == "" { + return nil, errors.New("xds: balancerName not found in bootstrap file") + } + if config.Creds == nil { + // TODO: Once we start supporting a mechanism to register credential + // types, a failure to find the credential type mentioned in the + // bootstrap file should result in a failure, and not in using + // credentials from the parent channel (passed through the + // resolver.BuildOptions). + config.Creds = defaultDialCreds(config.BalancerName, rbo) + } + + var dopts []grpc.DialOption + if rbo.Dialer != nil { + dopts = []grpc.DialOption{grpc.WithContextDialer(rbo.Dialer)} + } + + client, err := newXDSClient(xdsclient.Options{Config: *config, DialOpts: dopts}) + if err != nil { + return nil, err + } + r := &xdsResolver{ + target: t, + cc: cc, + client: client, + updateCh: make(chan suWithError, 1), + } + r.ctx, r.cancelCtx = context.WithCancel(context.Background()) + r.cancelWatch = r.client.WatchService(r.target.Endpoint, r.handleServiceUpdate) + + go r.run() + return r, nil +} + +// defaultDialCreds builds a DialOption containing the credentials to be used +// while talking to the xDS server (this is done only if the xds bootstrap +// process does not return any credentials to use). If the parent channel +// contains DialCreds, we use it as is. If it contains a CredsBundle, we use +// just the transport credentials from the bundle. If we don't find any +// credentials on the parent channel, we resort to using an insecure channel. +func defaultDialCreds(balancerName string, rbo resolver.BuildOptions) grpc.DialOption { + switch { + case rbo.DialCreds != nil: + if err := rbo.DialCreds.OverrideServerName(balancerName); err != nil { + grpclog.Warningf("xds: failed to override server name in credentials: %v, using Insecure", err) + return grpc.WithInsecure() + } + return grpc.WithTransportCredentials(rbo.DialCreds) + case rbo.CredsBundle != nil: + return grpc.WithTransportCredentials(rbo.CredsBundle.TransportCredentials()) + default: + grpclog.Warning("xds: no credentials available, using Insecure") + return grpc.WithInsecure() + } +} + +// Name helps implement the resolver.Builder interface. +func (*xdsResolverBuilder) Scheme() string { + return xdsScheme +} + +// xdsClientInterface contains methods from xdsClient.Client which are used by +// the resolver. This will be faked out in unittests. +type xdsClientInterface interface { + WatchService(string, func(xdsclient.ServiceUpdate, error)) func() + Close() +} + +// suWithError wraps the ServiceUpdate and error received through a watch API +// callback, so that it can pushed onto the update channel as a single entity. +type suWithError struct { + su xdsclient.ServiceUpdate + err error +} + +// xdsResolver implements the resolver.Resolver interface. +// +// It registers a watcher for ServiceConfig updates with the xdsClient object +// (which performs LDS/RDS queries for the same), and passes the received +// updates to the ClientConn. +type xdsResolver struct { + ctx context.Context + cancelCtx context.CancelFunc + target resolver.Target + cc resolver.ClientConn + + // The underlying xdsClient which performs all xDS requests and responses. + client xdsClientInterface + // A channel for the watch API callback to write service updates on to. The + // updates are read by the run goroutine and passed on to the ClientConn. + updateCh chan suWithError + // cancelWatch is the function to cancel the watcher. + cancelWatch func() +} + +const jsonFormatSC = `{ + "loadBalancingConfig":[ + { + "experimental_cds":{ + "Cluster": "%s" + } + } + ] + }` + +// run is a long running goroutine which blocks on receiving service updates +// and passes it on the ClientConn. +func (r *xdsResolver) run() { + for { + select { + case <-r.ctx.Done(): + case update := <-r.updateCh: + if update.err != nil { + r.cc.ReportError(update.err) + return + } + sc := fmt.Sprintf(jsonFormatSC, update.su.Cluster) + r.cc.UpdateState(resolver.State{ + ServiceConfig: r.cc.ParseServiceConfig(sc), + Attributes: attributes.New(xdsinternal.XDSClientID, r.client), + }) + } + } +} + +// handleServiceUpdate is the callback which handles service updates. It writes +// the received update to the update channel, which is picked by the run +// goroutine. +func (r *xdsResolver) handleServiceUpdate(su xdsclient.ServiceUpdate, err error) { + if r.ctx.Err() != nil { + // Do not pass updates to the ClientConn once the resolver is closed. + return + } + r.updateCh <- suWithError{su, err} +} + +// ResolveNow is a no-op at this point. +func (*xdsResolver) ResolveNow(o resolver.ResolveNowOptions) {} + +// Close closes the resolver, and also closes the underlying xdsClient. +func (r *xdsResolver) Close() { + r.cancelWatch() + r.client.Close() + r.cancelCtx() +} diff --git a/vendor/google.golang.org/grpc/xds/internal/resolver/xds_resolver_test.go b/vendor/google.golang.org/grpc/xds/internal/resolver/xds_resolver_test.go new file mode 100644 index 00000000000..7a7b40c1043 --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/resolver/xds_resolver_test.go @@ -0,0 +1,320 @@ +/* + * + * 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. + * + */ + +package resolver + +import ( + "context" + "errors" + "fmt" + "net" + "testing" + + "google.golang.org/grpc" + "google.golang.org/grpc/internal" + "google.golang.org/grpc/resolver" + "google.golang.org/grpc/serviceconfig" + xdsinternal "google.golang.org/grpc/xds/internal" + _ "google.golang.org/grpc/xds/internal/balancer/cdsbalancer" // To parse LB config + xdsclient "google.golang.org/grpc/xds/internal/client" + "google.golang.org/grpc/xds/internal/client/bootstrap" + "google.golang.org/grpc/xds/internal/testutils" + + corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" +) + +const ( + targetStr = "target" + cluster = "cluster" + balancerName = "dummyBalancer" +) + +var ( + validConfig = bootstrap.Config{ + BalancerName: balancerName, + Creds: grpc.WithInsecure(), + NodeProto: &corepb.Node{}, + } + target = resolver.Target{Endpoint: targetStr} +) + +// testClientConn is a fake implemetation of resolver.ClientConn. All is does +// is to store the state received from the resolver locally and signal that +// event through a channel. +type testClientConn struct { + resolver.ClientConn + stateCh *testutils.Channel + errorCh *testutils.Channel +} + +func (t *testClientConn) UpdateState(s resolver.State) { + t.stateCh.Send(s) +} + +func (t *testClientConn) ReportError(err error) { + t.errorCh.Send(err) +} + +func (t *testClientConn) ParseServiceConfig(jsonSC string) *serviceconfig.ParseResult { + return internal.ParseServiceConfigForTesting.(func(string) *serviceconfig.ParseResult)(jsonSC) +} + +func newTestClientConn() *testClientConn { + return &testClientConn{ + stateCh: testutils.NewChannel(), + errorCh: testutils.NewChannel(), + } +} + +func getXDSClientMakerFunc(wantOpts xdsclient.Options) func(xdsclient.Options) (xdsClientInterface, error) { + return func(gotOpts xdsclient.Options) (xdsClientInterface, error) { + if gotOpts.Config.BalancerName != wantOpts.Config.BalancerName { + return nil, fmt.Errorf("got balancerName: %s, want: %s", gotOpts.Config.BalancerName, wantOpts.Config.BalancerName) + } + // We cannot compare two DialOption objects to see if they are equal + // because each of these is a function pointer. So, the only thing we + // can do here is to check if the got option is nil or not based on + // what the want option is. We should be able to do extensive + // credential testing in e2e tests. + if (gotOpts.Config.Creds != nil) != (wantOpts.Config.Creds != nil) { + return nil, fmt.Errorf("got len(creds): %s, want: %s", gotOpts.Config.Creds, wantOpts.Config.Creds) + } + if len(gotOpts.DialOpts) != len(wantOpts.DialOpts) { + return nil, fmt.Errorf("got len(DialOpts): %v, want: %v", len(gotOpts.DialOpts), len(wantOpts.DialOpts)) + } + return testutils.NewXDSClient(), nil + } +} + +func errorDialer(_ context.Context, _ string) (net.Conn, error) { + return nil, errors.New("dial error") +} + +// TestResolverBuilder tests the xdsResolverBuilder's Build method with +// different parameters. +func TestResolverBuilder(t *testing.T) { + tests := []struct { + name string + rbo resolver.BuildOptions + config bootstrap.Config + xdsClientFunc func(xdsclient.Options) (xdsClientInterface, error) + wantErr bool + }{ + { + name: "empty-config", + rbo: resolver.BuildOptions{}, + config: bootstrap.Config{}, + wantErr: true, + }, + { + name: "no-balancer-name-in-config", + rbo: resolver.BuildOptions{}, + config: bootstrap.Config{ + Creds: grpc.WithInsecure(), + NodeProto: &corepb.Node{}, + }, + wantErr: true, + }, + { + name: "no-creds-in-config", + rbo: resolver.BuildOptions{}, + config: bootstrap.Config{ + BalancerName: balancerName, + NodeProto: &corepb.Node{}, + }, + xdsClientFunc: getXDSClientMakerFunc(xdsclient.Options{Config: validConfig}), + wantErr: false, + }, + { + name: "error-dialer-in-rbo", + rbo: resolver.BuildOptions{Dialer: errorDialer}, + config: validConfig, + xdsClientFunc: getXDSClientMakerFunc(xdsclient.Options{ + Config: validConfig, + DialOpts: []grpc.DialOption{grpc.WithContextDialer(errorDialer)}, + }), + wantErr: false, + }, + { + name: "simple-good", + rbo: resolver.BuildOptions{}, + config: validConfig, + xdsClientFunc: getXDSClientMakerFunc(xdsclient.Options{Config: validConfig}), + wantErr: false, + }, + { + name: "newXDSClient-throws-error", + rbo: resolver.BuildOptions{}, + config: validConfig, + xdsClientFunc: func(_ xdsclient.Options) (xdsClientInterface, error) { + return nil, errors.New("newXDSClient-throws-error") + }, + wantErr: true, + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + // Fake out the bootstrap process by providing our own config. + oldConfigMaker := newXDSConfig + newXDSConfig = func() *bootstrap.Config { return &test.config } + // Fake out the xdsClient creation process by providing a fake. + oldClientMaker := newXDSClient + newXDSClient = test.xdsClientFunc + defer func() { + newXDSConfig = oldConfigMaker + newXDSClient = oldClientMaker + }() + + builder := resolver.Get(xdsScheme) + if builder == nil { + t.Fatalf("resolver.Get(%v) returned nil", xdsScheme) + } + + r, err := builder.Build(target, newTestClientConn(), test.rbo) + if (err != nil) != test.wantErr { + t.Fatalf("builder.Build(%v) returned err: %v, wantErr: %v", target, err, test.wantErr) + } + if err != nil { + // This is the case where we expect an error and got it. + return + } + r.Close() + }) + } +} + +type setupOpts struct { + config *bootstrap.Config + xdsClientFunc func(xdsclient.Options) (xdsClientInterface, error) +} + +func testSetup(t *testing.T, opts setupOpts) (*xdsResolver, *testClientConn, func()) { + t.Helper() + + oldConfigMaker := newXDSConfig + newXDSConfig = func() *bootstrap.Config { return opts.config } + oldClientMaker := newXDSClient + newXDSClient = opts.xdsClientFunc + cancel := func() { + newXDSConfig = oldConfigMaker + newXDSClient = oldClientMaker + } + + builder := resolver.Get(xdsScheme) + if builder == nil { + t.Fatalf("resolver.Get(%v) returned nil", xdsScheme) + } + + tcc := newTestClientConn() + r, err := builder.Build(target, tcc, resolver.BuildOptions{}) + if err != nil { + t.Fatalf("builder.Build(%v) returned err: %v", target, err) + } + return r.(*xdsResolver), tcc, cancel +} + +// waitForWatchService waits for the WatchService method to be called on the +// xdsClient within a reasonable amount of time, and also verifies that the +// watch is called with the expected target. +func waitForWatchService(t *testing.T, xdsC *testutils.XDSClient, wantTarget string) { + t.Helper() + + gotTarget, err := xdsC.WaitForWatchService() + if err != nil { + t.Fatalf("xdsClient.WatchService failed with error: %v", err) + } + if gotTarget != wantTarget { + t.Fatalf("xdsClient.WatchService() called with target: %v, want %v", gotTarget, wantTarget) + } +} + +// TestXDSResolverWatchCallbackAfterClose tests the case where a service update +// from the underlying xdsClient is received after the resolver is closed. +func TestXDSResolverWatchCallbackAfterClose(t *testing.T) { + xdsC := testutils.NewXDSClient() + xdsR, tcc, cancel := testSetup(t, setupOpts{ + config: &validConfig, + xdsClientFunc: func(_ xdsclient.Options) (xdsClientInterface, error) { return xdsC, nil }, + }) + defer cancel() + + waitForWatchService(t, xdsC, targetStr) + + // Call the watchAPI callback after closing the resolver, and make sure no + // update is triggerred on the ClientConn. + xdsR.Close() + xdsC.InvokeWatchServiceCb(cluster, nil) + if gotVal, gotErr := tcc.stateCh.Receive(); gotErr != testutils.ErrRecvTimeout { + t.Fatalf("ClientConn.UpdateState called after xdsResolver is closed: %v", gotVal) + } +} + +// TestXDSResolverBadServiceUpdate tests the case the xdsClient returns a bad +// service update. +func TestXDSResolverBadServiceUpdate(t *testing.T) { + xdsC := testutils.NewXDSClient() + xdsR, tcc, cancel := testSetup(t, setupOpts{ + config: &validConfig, + xdsClientFunc: func(_ xdsclient.Options) (xdsClientInterface, error) { return xdsC, nil }, + }) + defer func() { + cancel() + xdsR.Close() + }() + + waitForWatchService(t, xdsC, targetStr) + + // Invoke the watchAPI callback with a bad service update and wait for the + // ReportError method to be called on the ClientConn. + suErr := errors.New("bad serviceupdate") + xdsC.InvokeWatchServiceCb("", suErr) + if gotErrVal, gotErr := tcc.errorCh.Receive(); gotErr != nil || gotErrVal != suErr { + t.Fatalf("ClientConn.ReportError() received %v, want %v", gotErrVal, suErr) + } +} + +// TestXDSResolverGoodServiceUpdate tests the happy case where the resolver +// gets a good service update from the xdsClient. +func TestXDSResolverGoodServiceUpdate(t *testing.T) { + xdsC := testutils.NewXDSClient() + xdsR, tcc, cancel := testSetup(t, setupOpts{ + config: &validConfig, + xdsClientFunc: func(_ xdsclient.Options) (xdsClientInterface, error) { return xdsC, nil }, + }) + defer func() { + cancel() + xdsR.Close() + }() + + waitForWatchService(t, xdsC, targetStr) + + // Invoke the watchAPI callback with a good service update and wait for the + // UpdateState method to be called on the ClientConn. + xdsC.InvokeWatchServiceCb(cluster, nil) + gotState, err := tcc.stateCh.Receive() + if err != nil { + t.Fatalf("ClientConn.UpdateState returned error: %v", err) + } + rState := gotState.(resolver.State) + if gotClient := rState.Attributes.Value(xdsinternal.XDSClientID); gotClient != xdsC { + t.Fatalf("ClientConn.UpdateState got xdsClient: %v, want %v", gotClient, xdsC) + } + if err := rState.ServiceConfig.Err; err != nil { + t.Fatalf("ClientConn.UpdateState received error in service config: %v", rState.ServiceConfig.Err) + } +} diff --git a/vendor/google.golang.org/grpc/xds/internal/testutils/channel.go b/vendor/google.golang.org/grpc/xds/internal/testutils/channel.go new file mode 100644 index 00000000000..a2b34afaf36 --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/testutils/channel.go @@ -0,0 +1,75 @@ +/* + * + * 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. + */ + +// Package testutils provides utility types, for use in xds tests. +package testutils + +import ( + "errors" + "time" +) + +// ErrRecvTimeout is an error to indicate that a receive operation on the +// channel timed out. +var ErrRecvTimeout = errors.New("timed out when waiting for value on channel") + +const ( + // DefaultChanRecvTimeout is the default timeout for receive operations on the + // underlying channel. + DefaultChanRecvTimeout = 1 * time.Second + // DefaultChanBufferSize is the default buffer size of the underlying channel. + DefaultChanBufferSize = 1 +) + +// Channel wraps a generic channel and provides a timed receive operation. +type Channel struct { + ch chan interface{} +} + +// Send sends value on the underlying channel. +func (cwt *Channel) Send(value interface{}) { + cwt.ch <- value +} + +// TimedReceive returns the value received on the underlying channel, or +// ErrRecvTimeout if timeout amount of time elapsed. +func (cwt *Channel) TimedReceive(timeout time.Duration) (interface{}, error) { + timer := time.NewTimer(timeout) + select { + case <-timer.C: + return nil, ErrRecvTimeout + case got := <-cwt.ch: + timer.Stop() + return got, nil + } +} + +// Receive returns the value received on the underlying channel, or +// ErrRecvTimeout if DefaultChanRecvTimeout amount of time elapses. +func (cwt *Channel) Receive() (interface{}, error) { + return cwt.TimedReceive(DefaultChanRecvTimeout) +} + +// NewChannel returns a new Channel. +func NewChannel() *Channel { + return NewChannelWithSize(DefaultChanBufferSize) +} + +// NewChannelWithSize returns a new Channel with a buffer of bufSize. +func NewChannelWithSize(bufSize int) *Channel { + return &Channel{ch: make(chan interface{}, bufSize)} +} diff --git a/vendor/google.golang.org/grpc/xds/internal/testutils/fakexds/client.go b/vendor/google.golang.org/grpc/xds/internal/testutils/fakexds/client.go new file mode 100644 index 00000000000..d0eb97e95d1 --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/testutils/fakexds/client.go @@ -0,0 +1,150 @@ +/* + * + * 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. + * + */ + +// Package fakexds provides fake implementation of multiple types, for use in +// xds tests. +package fakexds + +import ( + "sync" + + "google.golang.org/grpc/xds/internal/balancer/lrs" + xdsclient "google.golang.org/grpc/xds/internal/client" + "google.golang.org/grpc/xds/internal/testutils" +) + +// Client is a fake implementation of an xds client. It exposes a bunch of +// channels to signal the occurrence of various events. +type Client struct { + name string + suWatchCh *testutils.Channel + edsWatchCh *testutils.Channel + suCancelCh *testutils.Channel + edsCancelCh *testutils.Channel + loadReportCh *testutils.Channel + closeCh *testutils.Channel + + mu sync.Mutex + serviceCb func(xdsclient.ServiceUpdate, error) + edsCb func(*xdsclient.EDSUpdate, error) +} + +// WatchService registers a LDS/RDS watch. +func (xdsC *Client) WatchService(target string, callback func(xdsclient.ServiceUpdate, error)) func() { + xdsC.mu.Lock() + defer xdsC.mu.Unlock() + + xdsC.serviceCb = callback + xdsC.suWatchCh.Send(target) + return func() { + xdsC.suCancelCh.Send(nil) + } +} + +// WaitForWatchService waits for WatchService to be invoked on this client +// within a reasonable timeout, and returns the serviceName being watched. +func (xdsC *Client) WaitForWatchService() (string, error) { + val, err := xdsC.suWatchCh.Receive() + return val.(string), err +} + +// InvokeWatchServiceCallback invokes the registered service watch callback. +func (xdsC *Client) InvokeWatchServiceCallback(cluster string, err error) { + xdsC.mu.Lock() + defer xdsC.mu.Unlock() + + xdsC.serviceCb(xdsclient.ServiceUpdate{Cluster: cluster}, err) +} + +// WatchEDS registers an EDS watch for provided clusterName. +func (xdsC *Client) WatchEDS(clusterName string, callback func(*xdsclient.EDSUpdate, error)) (cancel func()) { + xdsC.mu.Lock() + defer xdsC.mu.Unlock() + + xdsC.edsCb = callback + xdsC.edsWatchCh.Send(clusterName) + return func() { + xdsC.edsCancelCh.Send(nil) + } +} + +// WaitForWatchEDS waits for WatchEDS to be invoked on this client within a +// reasonable timeout, and returns the clusterName being watched. +func (xdsC *Client) WaitForWatchEDS() (string, error) { + val, err := xdsC.edsWatchCh.Receive() + return val.(string), err +} + +// InvokeWatchEDSCallback invokes the registered edsWatch callback. +func (xdsC *Client) InvokeWatchEDSCallback(update *xdsclient.EDSUpdate, err error) { + xdsC.mu.Lock() + defer xdsC.mu.Unlock() + + xdsC.edsCb(update, err) +} + +// ReportLoadArgs wraps the arguments passed to ReportLoad. +type ReportLoadArgs struct { + // Server is the name of the server to which the load is reported. + Server string + // Cluster is the name of the cluster for which load is reported. + Cluster string +} + +// ReportLoad starts reporting load about clusterName to server. +func (xdsC *Client) ReportLoad(server string, clusterName string, loadStore lrs.Store) (cancel func()) { + xdsC.loadReportCh.Send(ReportLoadArgs{Server: server, Cluster: clusterName}) + return func() {} +} + +// WaitForReportLoad waits for ReportLoad to be invoked on this client within a +// reasonable timeout, and returns the arguments passed to it. +func (xdsC *Client) WaitForReportLoad() (ReportLoadArgs, error) { + val, err := xdsC.loadReportCh.Receive() + return val.(ReportLoadArgs), err +} + +// Close closes the xds client. +func (xdsC *Client) Close() { + xdsC.closeCh.Send(nil) +} + +// Name returns the name of the xds client. +func (xdsC *Client) Name() string { + return xdsC.name +} + +// NewClient returns a new fake xds client. +func NewClient() *Client { + return NewClientWithName("") +} + +// NewClientWithName returns a new fake xds client with the provided name. This +// is used in cases where multiple clients are created in the tests and we need +// to make sure the client is created for the expected balancer name. +func NewClientWithName(name string) *Client { + return &Client{ + name: name, + suWatchCh: testutils.NewChannel(), + edsWatchCh: testutils.NewChannel(), + suCancelCh: testutils.NewChannel(), + edsCancelCh: testutils.NewChannel(), + loadReportCh: testutils.NewChannel(), + closeCh: testutils.NewChannel(), + } +} diff --git a/vendor/google.golang.org/grpc/xds/internal/testutils/xdsclient.go b/vendor/google.golang.org/grpc/xds/internal/testutils/xdsclient.go new file mode 100644 index 00000000000..566ba8a0a9a --- /dev/null +++ b/vendor/google.golang.org/grpc/xds/internal/testutils/xdsclient.go @@ -0,0 +1,67 @@ +/* + * + * 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. + * + */ + +package testutils + +import ( + xdsclient "google.golang.org/grpc/xds/internal/client" +) + +// XDSClient is a fake implementation of an xds client. It exposes a bunch of +// channels to signal the occurrence of various events. +type XDSClient struct { + serviceCb func(xdsclient.ServiceUpdate, error) + suWatchCh *Channel + closeCh *Channel + suCancelCh *Channel +} + +// WatchService registers a LDS/RDS watch. +func (xdsC *XDSClient) WatchService(target string, callback func(xdsclient.ServiceUpdate, error)) func() { + xdsC.serviceCb = callback + xdsC.suWatchCh.Send(target) + return func() { + xdsC.suCancelCh.Send(nil) + } +} + +// WaitForWatchService waits for WatchService to be invoked on this client +// within a reasonable timeout. +func (xdsC *XDSClient) WaitForWatchService() (string, error) { + val, err := xdsC.suWatchCh.Receive() + return val.(string), err +} + +// InvokeWatchServiceCb invokes the registered service watch callback. +func (xdsC *XDSClient) InvokeWatchServiceCb(cluster string, err error) { + xdsC.serviceCb(xdsclient.ServiceUpdate{Cluster: cluster}, err) +} + +// Close closes the xds client. +func (xdsC *XDSClient) Close() { + xdsC.closeCh.Send(nil) +} + +// NewXDSClient returns a new fake xds client. +func NewXDSClient() *XDSClient { + return &XDSClient{ + suWatchCh: NewChannel(), + closeCh: NewChannel(), + suCancelCh: NewChannel(), + } +}