From 4abb3622b0fb97df222670b189869b44d0c2454d Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Mon, 8 Apr 2019 09:56:02 -0700 Subject: [PATCH 01/34] tls: append h2 to tlsconfig.NextProtos (#2744) --- credentials/credentials.go | 18 ++++++++++++---- credentials/credentials_test.go | 37 +++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/credentials/credentials.go b/credentials/credentials.go index a851560456b4..88aff94596a1 100644 --- a/credentials/credentials.go +++ b/credentials/credentials.go @@ -36,9 +36,6 @@ import ( "google.golang.org/grpc/credentials/internal" ) -// alpnProtoStr are the specified application level protocols for gRPC. -var alpnProtoStr = []string{"h2"} - // PerRPCCredentials defines the common interface for the credentials which need to // attach security information to every RPC (e.g., oauth2). type PerRPCCredentials interface { @@ -208,10 +205,23 @@ func (c *tlsCreds) OverrideServerName(serverNameOverride string) error { 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 = alpnProtoStr + tc.config.NextProtos = appendH2ToNextProtos(tc.config.NextProtos) return tc } diff --git a/credentials/credentials_test.go b/credentials/credentials_test.go index cb091de08092..b15458636f1a 100644 --- a/credentials/credentials_test.go +++ b/credentials/credentials_test.go @@ -22,6 +22,7 @@ import ( "context" "crypto/tls" "net" + "reflect" "testing" "google.golang.org/grpc/testdata" @@ -204,3 +205,39 @@ func tlsClientHandshake(conn net.Conn, _ string) (AuthInfo, error) { } return TLSInfo{State: clientConn.ConnectionState()}, nil } + +func TestAppendH2ToNextProtos(t *testing.T) { + tests := []struct { + name string + ps []string + want []string + }{ + { + name: "empty", + ps: nil, + want: []string{"h2"}, + }, + { + name: "only h2", + ps: []string{"h2"}, + want: []string{"h2"}, + }, + { + name: "with h2", + ps: []string{"alpn", "h2"}, + want: []string{"alpn", "h2"}, + }, + { + name: "no h2", + ps: []string{"alpn"}, + want: []string{"alpn", "h2"}, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := appendH2ToNextProtos(tt.ps); !reflect.DeepEqual(got, tt.want) { + t.Errorf("appendH2ToNextProtos() = %v, want %v", got, tt.want) + } + }) + } +} From 981ad1f9d2381dde0bf21f7fa78c91c806634766 Mon Sep 17 00:00:00 2001 From: Kartik Yadav Date: Tue, 9 Apr 2019 11:33:11 -0700 Subject: [PATCH 02/34] doc: fixing broken link in rpc-error doc (#2753) The link for example in the documentation for RPC errors redirects to the wrong URL. Fixes #2752 --- Documentation/rpc-errors.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/rpc-errors.md b/Documentation/rpc-errors.md index 27e74e05ca53..8bd610d1780e 100644 --- a/Documentation/rpc-errors.md +++ b/Documentation/rpc-errors.md @@ -65,4 +65,4 @@ exit status 1 [details]: https://godoc.org/google.golang.org/grpc/status#Status.Details [status-err]: https://godoc.org/google.golang.org/grpc/status#Status.Err [status-error]: https://godoc.org/google.golang.org/grpc/status#Error -[example]: https://github.com/grpc/grpc-go/blob/master/examples/rpc_errors +[example]: https://github.com/grpc/grpc-go/tree/master/examples/features/errors From bc316a57d4f51e6cc5a3770b4d3f180efa02f44c Mon Sep 17 00:00:00 2001 From: Kartik Yadav Date: Tue, 9 Apr 2019 11:34:45 -0700 Subject: [PATCH 03/34] doc: fixing link in keepalive docs (#2755) The link for enforcement policy in the keepalive docs is wrong. fixes #2754 --- Documentation/keepalive.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/keepalive.md b/Documentation/keepalive.md index 118ac66d14d9..c10168014149 100644 --- a/Documentation/keepalive.md +++ b/Documentation/keepalive.md @@ -35,7 +35,7 @@ for details. ### Enforcement policy [Enforcement -policy](https://godoc.org/google.golang.org/grpc/keepalive#ServerParameters) is +policy](https://godoc.org/google.golang.org/grpc/keepalive#EnforcementPolicy) is a special setting on server side to protect server from malicious or misbehaving clients. From e33051174bc15b756823131f1161f46a4b265c3a Mon Sep 17 00:00:00 2001 From: Doug Fawley Date: Tue, 9 Apr 2019 14:51:00 -0700 Subject: [PATCH 04/34] Change version to 1.21.0-dev (#2759) --- version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.go b/version.go index 07dfdb430c53..6cd59359766e 100644 --- a/version.go +++ b/version.go @@ -19,4 +19,4 @@ package grpc // Version is the current grpc version. -const Version = "1.20.0-dev" +const Version = "1.21.0-dev" From 289eb50d88d6ffa8875e4a33c144c2cf8f1d0c64 Mon Sep 17 00:00:00 2001 From: Doug Fawley Date: Thu, 11 Apr 2019 10:11:17 -0700 Subject: [PATCH 05/34] internal: clean up README (#2764) --- .github/ISSUE_TEMPLATE/bug.md | 3 +- .github/ISSUE_TEMPLATE/feature.md | 2 + .github/ISSUE_TEMPLATE/question.md | 2 + CONTRIBUTING.md | 57 +++++++++++++++------- README.md | 76 +++++++++++++++++++++++++----- examples/README.md | 6 +-- 6 files changed, 114 insertions(+), 32 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md index 036d0b8a5cca..1c4663918c18 100644 --- a/.github/ISSUE_TEMPLATE/bug.md +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -5,7 +5,8 @@ labels: 'Type: Bug' --- -Please answer these questions before submitting your issue. +Please see the FAQ in our main README.md, then answer the questions below before +submitting your issue. ### What version of gRPC are you using? diff --git a/.github/ISSUE_TEMPLATE/feature.md b/.github/ISSUE_TEMPLATE/feature.md index 9b2ffd32a955..2b286911c982 100644 --- a/.github/ISSUE_TEMPLATE/feature.md +++ b/.github/ISSUE_TEMPLATE/feature.md @@ -5,6 +5,8 @@ labels: 'Type: Feature' --- +Please see the FAQ in our main README.md before submitting your issue. + ### Use case(s) - what problem will this feature solve? ### Proposed Solution diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index 98d59e7f1cbe..1d1752a66fc3 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -4,3 +4,5 @@ about: Ask a question about gRPC-Go labels: 'Type: Question' --- + +Please see the FAQ in our main README.md before submitting your issue. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ca34e8aa0dae..6e69b28c2706 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,22 +11,46 @@ In order to protect both you and ourselves, you will need to sign the ## Guidelines for Pull Requests How to get your contributions merged smoothly and quickly. - -- Create **small PRs** that are narrowly focused on **addressing a single concern**. We often times receive PRs that are trying to fix several things at a time, but only one fix is considered acceptable, nothing gets merged and both author's & review's time is wasted. Create more PRs to address different concerns and everyone will be happy. - -- For speculative changes, consider opening an issue and discussing it first. If you are suggesting a behavioral or API change, consider starting with a [gRFC proposal](https://github.com/grpc/proposal). - -- Provide a good **PR description** as a record of **what** change is being made and **why** it was made. Link to a github issue if it exists. - -- Don't fix code style and formatting unless you are already changing that line to address an issue. PRs with irrelevant changes won't be merged. If you do want to fix formatting or style, do that in a separate PR. - -- Unless your PR is trivial, you should expect there will be reviewer comments that you'll need to address before merging. We expect you to be reasonably responsive to those comments, otherwise the PR will be closed after 2-3 weeks of inactivity. - -- Maintain **clean commit history** and use **meaningful commit messages**. PRs with messy commit history are difficult to review and won't be merged. Use `rebase -i upstream/master` to curate your commit history and/or to bring in latest changes from master (but avoid rebasing in the middle of a code review). - -- Keep your PR up to date with upstream/master (if there are merge conflicts, we can't really merge your change). - -- **All tests need to be passing** before your change can be merged. We recommend you **run tests locally** before creating your PR to catch breakages early on. + +- Create **small PRs** that are narrowly focused on **addressing a single + concern**. We often times receive PRs that are trying to fix several things at + a time, but only one fix is considered acceptable, nothing gets merged and + both author's & review's time is wasted. Create more PRs to address different + concerns and everyone will be happy. + +- The grpc package should only depend on standard Go packages and a small number + of exceptions. If your contribution introduces new dependencies which are NOT + in the [list](https://godoc.org/google.golang.org/grpc?imports), you need a + discussion with gRPC-Go authors and consultants. + +- For speculative changes, consider opening an issue and discussing it first. If + you are suggesting a behavioral or API change, consider starting with a [gRFC + proposal](https://github.com/grpc/proposal). + +- Provide a good **PR description** as a record of **what** change is being made + and **why** it was made. Link to a github issue if it exists. + +- Don't fix code style and formatting unless you are already changing that line + to address an issue. PRs with irrelevant changes won't be merged. If you do + want to fix formatting or style, do that in a separate PR. + +- Unless your PR is trivial, you should expect there will be reviewer comments + that you'll need to address before merging. We expect you to be reasonably + responsive to those comments, otherwise the PR will be closed after 2-3 weeks + of inactivity. + +- Maintain **clean commit history** and use **meaningful commit messages**. PRs + with messy commit history are difficult to review and won't be merged. Use + `rebase -i upstream/master` to curate your commit history and/or to bring in + latest changes from master (but avoid rebasing in the middle of a code + review). + +- Keep your PR up to date with upstream/master (if there are merge conflicts, we + can't really merge your change). + +- **All tests need to be passing** before your change can be merged. We + recommend you **run tests locally** before creating your PR to catch breakages + early on. - `make all` to test everything, OR - `make vet` to catch vet errors - `make test` to run the tests @@ -34,4 +58,3 @@ How to get your contributions merged smoothly and quickly. - optional `make testappengine` to run tests with appengine - Exceptions to the rules can be made if there's a compelling reason for doing so. - diff --git a/README.md b/README.md index f5eec6717f31..afbc43db5105 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,96 @@ # gRPC-Go -[![Build Status](https://travis-ci.org/grpc/grpc-go.svg)](https://travis-ci.org/grpc/grpc-go) [![GoDoc](https://godoc.org/google.golang.org/grpc?status.svg)](https://godoc.org/google.golang.org/grpc) [![GoReportCard](https://goreportcard.com/badge/grpc/grpc-go)](https://goreportcard.com/report/github.com/grpc/grpc-go) +[![Build Status](https://travis-ci.org/grpc/grpc-go.svg)](https://travis-ci.org/grpc/grpc-go) +[![GoDoc](https://godoc.org/google.golang.org/grpc?status.svg)](https://godoc.org/google.golang.org/grpc) +[![GoReportCard](https://goreportcard.com/badge/grpc/grpc-go)](https://goreportcard.com/report/github.com/grpc/grpc-go) -The Go implementation of [gRPC](https://grpc.io/): A high performance, open source, general RPC framework that puts mobile and HTTP/2 first. For more information see the [gRPC Quick Start: Go](https://grpc.io/docs/quickstart/go.html) guide. +The Go implementation of [gRPC](https://grpc.io/): A high performance, open +source, general RPC framework that puts mobile and HTTP/2 first. For more +information see the [gRPC Quick Start: +Go](https://grpc.io/docs/quickstart/go.html) guide. Installation ------------ -To install this package, you need to install Go and setup your Go workspace on your computer. The simplest way to install the library is to run: +To install this package, you need to install Go and setup your Go workspace on +your computer. The simplest way to install the library is to run: ``` $ go get -u google.golang.org/grpc ``` +With Go module support (Go 1.11+), simply `import "google.golang.org/grpc"` in +your source code and `go [build|run|test]` will automatically download the +necessary dependencies ([Go modules +ref](https://github.com/golang/go/wiki/Modules)). + +If you are trying to access grpc-go from within China, please see the +[FAQ](#FAQ) below. + Prerequisites ------------- - gRPC-Go requires Go 1.9 or later. -Constraints ------------ -The grpc package should only depend on standard Go packages and a small number of exceptions. If your contribution introduces new dependencies which are NOT in the [list](https://godoc.org/google.golang.org/grpc?imports), you need a discussion with gRPC-Go authors and consultants. - Documentation ------------- -See [API documentation](https://godoc.org/google.golang.org/grpc) for package and API descriptions and find examples in the [examples directory](examples/). +- See [godoc](https://godoc.org/google.golang.org/grpc) for package and API + descriptions. +- Documentation on specific topics can be found in the [Documentation + directory](Documentation/). +- Examples can be found in the [examples directory](examples/). Performance ----------- -See the current benchmarks for some of the languages supported in [this dashboard](https://performance-dot-grpc-testing.appspot.com/explore?dashboard=5652536396611584&widget=490377658&container=1286539696). +Performance benchmark data for grpc-go and other languages is maintained in +[this +dashboard](https://performance-dot-grpc-testing.appspot.com/explore?dashboard=5652536396611584&widget=490377658&container=1286539696). Status ------ -General Availability [Google Cloud Platform Launch Stages](https://cloud.google.com/terms/launch-stages). +General Availability [Google Cloud Platform Launch +Stages](https://cloud.google.com/terms/launch-stages). FAQ --- +#### I/O Timeout Errors + +The `golang.org` domain may be blocked from some countries. `go get` usually +produces an error like the following when this happens: + +``` +$ go get -u google.golang.org/grpc +package google.golang.org/grpc: unrecognized import path "google.golang.org/grpc" (https fetch: Get https://google.golang.org/grpc?go-get=1: dial tcp 216.239.37.1:443: i/o timeout) +``` + +To build Go code, there are several options: + +- Set up a VPN and access google.golang.org through that. + +- Without Go module support: `git clone` the repo manually: + + ``` + git clone https://github.com/grpc/grpc-go.git $GOPATH/src/google.golang.org/grpc + ``` + + You will need to do the same for all of grpc's dependencies in `golang.org`, + e.g. `golang.org/x/net`. + +- With Go module support: it is possible to use the `replace` feature of `go + mod` to create aliases for golang.org packages. In your project's directory: + + ``` + go mod edit -replace=google.golang.org/grpc=github.com/grpc/grpc-go@latest + go mod tidy + go mod vendor + go build -mod=vendor + ``` + + Again, this will need to be done for all transitive dependencies hosted on + golang.org as well. Please refer to [this + issue](https://github.com/golang/go/issues/28652) in the golang repo regarding + this concern. + #### Compiling error, undefined: grpc.SupportPackageIsVersion Please update proto package, gRPC package and rebuild the proto files: diff --git a/examples/README.md b/examples/README.md index 792da243566f..d6fd0fa04e41 100644 --- a/examples/README.md +++ b/examples/README.md @@ -8,7 +8,7 @@ For this sample, we've already generated the server and client stubs from [hello PREREQUISITES ------------- -- This requires Go 1.6 or later +- This requires Go 1.9 or later - Requires that [GOPATH is set](https://golang.org/doc/code.html#GOPATH) ``` @@ -56,9 +56,9 @@ OPTIONAL - Rebuilding the generated code ``` $ go generate google.golang.org/grpc/examples/helloworld/... ``` - + Or run `protoc` command (with the grpc plugin) - + ``` $ protoc -I helloworld/ helloworld/helloworld.proto --go_out=plugins=grpc:helloworld ``` From 3f98697f44e7ecc20474bd9bcecf583c6580929a Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Thu, 11 Apr 2019 11:25:27 -0700 Subject: [PATCH 06/34] grpclb: handle service config and switch to pickfirst (#2719) --- balancer/grpclb/grpclb.go | 53 +++++--- balancer/grpclb/grpclb_config.go | 87 ++++++++++++ balancer/grpclb/grpclb_config_test.go | 154 ++++++++++++++++++++++ balancer/grpclb/grpclb_remote_balancer.go | 30 +++-- balancer/grpclb/grpclb_test.go | 97 +++++++++----- 5 files changed, 362 insertions(+), 59 deletions(-) create mode 100644 balancer/grpclb/grpclb_config.go create mode 100644 balancer/grpclb/grpclb_config_test.go diff --git a/balancer/grpclb/grpclb.go b/balancer/grpclb/grpclb.go index a1123cedc7f8..9c5edc4b622b 100644 --- a/balancer/grpclb/grpclb.go +++ b/balancer/grpclb/grpclb.go @@ -129,19 +129,8 @@ func newLBBuilderWithFallbackTimeout(fallbackTimeout time.Duration) balancer.Bui } } -// newLBBuilderWithPickFirst creates a grpclb builder with pick-first. -func newLBBuilderWithPickFirst() balancer.Builder { - return &lbBuilder{ - usePickFirst: true, - } -} - type lbBuilder struct { fallbackTimeout time.Duration - - // TODO: delete this when balancer can handle service config. This should be - // updated by service config. - usePickFirst bool // Use roundrobin or pickfirst for backends. } func (b *lbBuilder) Name() string { @@ -167,7 +156,6 @@ func (b *lbBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) bal cc: newLBCacheClientConn(cc), target: target, opt: opt, - usePickFirst: b.usePickFirst, fallbackTimeout: b.fallbackTimeout, doneCh: make(chan struct{}), @@ -231,11 +219,14 @@ type lbBalancer struct { // serverList contains anything new. Each generate picker will also have // reference to this list to do the first layer pick. fullServerList []*lbpb.Server + // Backend addresses. It's kept so the addresses are available when + // switching between round_robin and pickfirst. + backendAddrs []resolver.Address // All backends addresses, with metadata set to nil. This list contains all // backend addresses in the same order and with the same duplicates as in // serverlist. When generating picker, a SubConn slice with the same order // but with only READY SCs will be gerenated. - backendAddrs []resolver.Address + backendAddrsWithoutMetadata []resolver.Address // Roundrobin functionalities. state connectivity.State subConns map[resolver.Address]balancer.SubConn // Used to new/remove SubConn. @@ -275,7 +266,7 @@ func (lb *lbBalancer) regeneratePicker(resetDrop bool) { break } } else { - for _, a := range lb.backendAddrs { + for _, a := range lb.backendAddrsWithoutMetadata { if sc, ok := lb.subConns[a]; ok { if st, ok := lb.scStates[sc]; ok && st == connectivity.Ready { readySCs = append(readySCs, sc) @@ -339,6 +330,11 @@ func (lb *lbBalancer) aggregateSubConnStates() connectivity.State { } func (lb *lbBalancer) HandleSubConnStateChange(sc balancer.SubConn, s connectivity.State) { + panic("not used") +} + +func (lb *lbBalancer) UpdateSubConnState(sc balancer.SubConn, scs balancer.SubConnState) { + s := scs.ConnectivityState if grpclog.V(2) { grpclog.Infof("lbBalancer: handle SubConn state change: %p, %v", sc, s) } @@ -371,7 +367,7 @@ func (lb *lbBalancer) HandleSubConnStateChange(sc balancer.SubConn, s connectivi if lb.state != connectivity.Ready { if !lb.inFallback && !lb.remoteBalancerConnected { // Enter fallback. - lb.refreshSubConns(lb.resolvedBackendAddrs, false) + lb.refreshSubConns(lb.resolvedBackendAddrs, true, lb.usePickFirst) } } } @@ -410,7 +406,7 @@ func (lb *lbBalancer) fallbackToBackendsAfter(fallbackTimeout time.Duration) { return } // Enter fallback. - lb.refreshSubConns(lb.resolvedBackendAddrs, false) + lb.refreshSubConns(lb.resolvedBackendAddrs, true, lb.usePickFirst) lb.mu.Unlock() } @@ -418,9 +414,30 @@ func (lb *lbBalancer) fallbackToBackendsAfter(fallbackTimeout time.Duration) { // clientConn. The remoteLB clientConn will handle creating/removing remoteLB // connections. func (lb *lbBalancer) HandleResolvedAddrs(addrs []resolver.Address, err error) { + panic("not used") +} + +func (lb *lbBalancer) handleServiceConfig(sc string) { + lb.mu.Lock() + defer lb.mu.Unlock() + + newUsePickFirst := childIsPickFirst(sc) + if lb.usePickFirst == newUsePickFirst { + return + } if grpclog.V(2) { - grpclog.Infof("lbBalancer: handleResolvedResult: %+v", addrs) + grpclog.Infof("lbBalancer: switching mode, new usePickFirst: %+v", newUsePickFirst) } + lb.refreshSubConns(lb.backendAddrs, lb.inFallback, newUsePickFirst) +} + +func (lb *lbBalancer) UpdateResolverState(rs resolver.State) { + if grpclog.V(2) { + grpclog.Infof("lbBalancer: UpdateResolverState: %+v", rs) + } + lb.handleServiceConfig(rs.ServiceConfig) + + addrs := rs.Addresses if len(addrs) <= 0 { return } @@ -457,7 +474,7 @@ func (lb *lbBalancer) HandleResolvedAddrs(addrs []resolver.Address, err error) { // 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. - lb.refreshSubConns(lb.resolvedBackendAddrs, false) + lb.refreshSubConns(lb.resolvedBackendAddrs, true, lb.usePickFirst) } lb.mu.Unlock() } diff --git a/balancer/grpclb/grpclb_config.go b/balancer/grpclb/grpclb_config.go new file mode 100644 index 000000000000..91458862551c --- /dev/null +++ b/balancer/grpclb/grpclb_config.go @@ -0,0 +1,87 @@ +/* + * + * 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 grpclb + +import ( + "encoding/json" + + "google.golang.org/grpc" + "google.golang.org/grpc/balancer/roundrobin" +) + +type serviceConfig struct { + LoadBalancingConfig *[]map[string]*grpclbServiceConfig +} + +type grpclbServiceConfig struct { + ChildPolicy *[]map[string]json.RawMessage +} + +func parseFullServiceConfig(s string) *serviceConfig { + var ret serviceConfig + err := json.Unmarshal([]byte(s), &ret) + if err != nil { + return nil + } + return &ret +} + +func parseServiceConfig(s string) *grpclbServiceConfig { + parsedSC := parseFullServiceConfig(s) + if parsedSC == nil { + return nil + } + lbConfigs := parsedSC.LoadBalancingConfig + if lbConfigs == nil { + return nil + } + for _, lbC := range *lbConfigs { + if v, ok := lbC[grpclbName]; ok { + return v + } + } + return nil +} + +const ( + roundRobinName = roundrobin.Name + pickFirstName = grpc.PickFirstBalancerName +) + +func childIsPickFirst(s string) bool { + parsedSC := parseServiceConfig(s) + if parsedSC == nil { + return false + } + childConfigs := parsedSC.ChildPolicy + if childConfigs == nil { + return false + } + for _, childC := range *childConfigs { + // If round_robin exists before pick_first, return false + if _, ok := childC[roundRobinName]; ok { + return false + } + // If pick_first is before round_robin, return true + if _, ok := childC[pickFirstName]; ok { + return true + } + } + return false +} diff --git a/balancer/grpclb/grpclb_config_test.go b/balancer/grpclb/grpclb_config_test.go new file mode 100644 index 000000000000..e7ed82d3076e --- /dev/null +++ b/balancer/grpclb/grpclb_config_test.go @@ -0,0 +1,154 @@ +/* + * + * 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 grpclb + +import ( + "encoding/json" + "reflect" + "testing" +) + +func Test_parseFullServiceConfig(t *testing.T) { + tests := []struct { + name string + s string + want *serviceConfig + }{ + { + name: "empty", + s: "", + want: nil, + }, + { + name: "success1", + s: `{"loadBalancingConfig":[{"grpclb":{"childPolicy":[{"pick_first":{}}]}}]}`, + want: &serviceConfig{ + LoadBalancingConfig: &[]map[string]*grpclbServiceConfig{ + {"grpclb": &grpclbServiceConfig{ + ChildPolicy: &[]map[string]json.RawMessage{ + {"pick_first": json.RawMessage("{}")}, + }, + }}, + }, + }, + }, + { + name: "success2", + s: `{"loadBalancingConfig":[{"grpclb":{"childPolicy":[{"round_robin":{}},{"pick_first":{}}]}}]}`, + want: &serviceConfig{ + LoadBalancingConfig: &[]map[string]*grpclbServiceConfig{ + {"grpclb": &grpclbServiceConfig{ + ChildPolicy: &[]map[string]json.RawMessage{ + {"round_robin": json.RawMessage("{}")}, + {"pick_first": json.RawMessage("{}")}, + }, + }}, + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := parseFullServiceConfig(tt.s); !reflect.DeepEqual(got, tt.want) { + t.Errorf("parseFullServiceConfig() = %+v, want %+v", got, tt.want) + } + }) + } +} + +func Test_parseServiceConfig(t *testing.T) { + tests := []struct { + name string + s string + want *grpclbServiceConfig + }{ + { + name: "empty", + s: "", + want: nil, + }, + { + name: "success1", + s: `{"loadBalancingConfig":[{"grpclb":{"childPolicy":[{"pick_first":{}}]}}]}`, + want: &grpclbServiceConfig{ + ChildPolicy: &[]map[string]json.RawMessage{ + {"pick_first": json.RawMessage("{}")}, + }, + }, + }, + { + name: "success2", + s: `{"loadBalancingConfig":[{"grpclb":{"childPolicy":[{"round_robin":{}},{"pick_first":{}}]}}]}`, + want: &grpclbServiceConfig{ + ChildPolicy: &[]map[string]json.RawMessage{ + {"round_robin": json.RawMessage("{}")}, + {"pick_first": json.RawMessage("{}")}, + }, + }, + }, + { + name: "no_grpclb", + s: `{"loadBalancingConfig":[{"notgrpclb":{"childPolicy":[{"round_robin":{}},{"pick_first":{}}]}}]}`, + want: nil, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := parseServiceConfig(tt.s); !reflect.DeepEqual(got, tt.want) { + t.Errorf("parseFullServiceConfig() = %+v, want %+v", got, tt.want) + } + }) + } +} + +func Test_childIsPickFirst(t *testing.T) { + tests := []struct { + name string + s string + want bool + }{ + { + name: "invalid", + s: "", + want: false, + }, + { + name: "pickfirst_only", + s: `{"loadBalancingConfig":[{"grpclb":{"childPolicy":[{"pick_first":{}}]}}]}`, + want: true, + }, + { + name: "pickfirst_before_rr", + s: `{"loadBalancingConfig":[{"grpclb":{"childPolicy":[{"pick_first":{}},{"round_robin":{}}]}}]}`, + want: true, + }, + { + name: "rr_before_pickfirst", + s: `{"loadBalancingConfig":[{"grpclb":{"childPolicy":[{"round_robin":{}},{"pick_first":{}}]}}]}`, + want: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := childIsPickFirst(tt.s); got != tt.want { + t.Errorf("childIsPickFirst() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/balancer/grpclb/grpclb_remote_balancer.go b/balancer/grpclb/grpclb_remote_balancer.go index 7ed886f060af..90513160822c 100644 --- a/balancer/grpclb/grpclb_remote_balancer.go +++ b/balancer/grpclb/grpclb_remote_balancer.go @@ -87,14 +87,14 @@ func (lb *lbBalancer) processServerList(l *lbpb.ServerList) { // Call refreshSubConns to create/remove SubConns. If we are in fallback, // this is also exiting fallback. - lb.refreshSubConns(backendAddrs, true) + lb.refreshSubConns(backendAddrs, false, lb.usePickFirst) } // refreshSubConns creates/removes SubConns with backendAddrs, and refreshes // balancer state and picker. // // Caller must hold lb.mu. -func (lb *lbBalancer) refreshSubConns(backendAddrs []resolver.Address, fromGRPCLBServer bool) { +func (lb *lbBalancer) refreshSubConns(backendAddrs []resolver.Address, fallback bool, pickFirst bool) { defer func() { // Regenerate and update picker after refreshing subconns because with // cache, even if SubConn was newed/removed, there might be no state @@ -103,14 +103,28 @@ func (lb *lbBalancer) refreshSubConns(backendAddrs []resolver.Address, fromGRPCL lb.updateStateAndPicker(true, true) }() - lb.inFallback = !fromGRPCLBServer + lb.inFallback = fallback opts := balancer.NewSubConnOptions{} - if fromGRPCLBServer { + if !fallback { opts.CredsBundle = lb.grpclbBackendCreds } - lb.backendAddrs = nil + lb.backendAddrs = backendAddrs + lb.backendAddrsWithoutMetadata = nil + + if lb.usePickFirst != pickFirst { + // Remove all SubConns when switching modes. + for a, sc := range lb.subConns { + if lb.usePickFirst { + lb.cc.cc.RemoveSubConn(sc) + } else { + lb.cc.RemoveSubConn(sc) + } + delete(lb.subConns, a) + } + lb.usePickFirst = pickFirst + } if lb.usePickFirst { var sc balancer.SubConn @@ -134,7 +148,7 @@ func (lb *lbBalancer) refreshSubConns(backendAddrs []resolver.Address, fromGRPCL return } - // addrsSet is the set converted from backendAddrs, it's used to quick + // addrsSet is the set converted from backendAddrsWithoutMetadata, it's used to quick // lookup for an address. addrsSet := make(map[resolver.Address]struct{}) // Create new SubConns. @@ -142,7 +156,7 @@ func (lb *lbBalancer) refreshSubConns(backendAddrs []resolver.Address, fromGRPCL addrWithoutMD := addr addrWithoutMD.Metadata = nil addrsSet[addrWithoutMD] = struct{}{} - lb.backendAddrs = append(lb.backendAddrs, addrWithoutMD) + lb.backendAddrsWithoutMetadata = append(lb.backendAddrsWithoutMetadata, addrWithoutMD) if _, ok := lb.subConns[addrWithoutMD]; !ok { // Use addrWithMD to create the SubConn. @@ -282,7 +296,7 @@ func (lb *lbBalancer) watchRemoteBalancer() { // aggregated state is not Ready. if !lb.inFallback && lb.state != connectivity.Ready { // Entering fallback. - lb.refreshSubConns(lb.resolvedBackendAddrs, false) + lb.refreshSubConns(lb.resolvedBackendAddrs, true, lb.usePickFirst) } lb.mu.Unlock() diff --git a/balancer/grpclb/grpclb_test.go b/balancer/grpclb/grpclb_test.go index 2f4e3e01eede..740060fd4f73 100644 --- a/balancer/grpclb/grpclb_test.go +++ b/balancer/grpclb/grpclb_test.go @@ -807,10 +807,8 @@ func TestFallback(t *testing.T) { } } -// The remote balancer sends response with duplicates to grpclb client. func TestGRPCLBPickFirst(t *testing.T) { - balancer.Register(newLBBuilderWithPickFirst()) - defer balancer.Register(newLBBuilder()) + const grpclbServiceConfigWithPickFirst = `{"loadBalancingConfig":[{"grpclb":{"childPolicy":[{"pick_first":{}}]}}]}` defer leakcheck.Check(t) @@ -854,57 +852,90 @@ func TestGRPCLBPickFirst(t *testing.T) { defer cc.Close() testC := testpb.NewTestServiceClient(cc) - r.UpdateState(resolver.State{Addresses: []resolver.Address{{ - Addr: tss.lbAddr, - Type: resolver.GRPCLB, - ServerName: lbServerName, - }}}) + var ( + p peer.Peer + result string + ) + tss.ls.sls <- &lbpb.ServerList{Servers: beServers[0:3]} - var p peer.Peer + // Start with sub policy pick_first. - portPicked1 := 0 - tss.ls.sls <- &lbpb.ServerList{Servers: beServers[1:2]} + r.UpdateState(resolver.State{ + Addresses: []resolver.Address{{ + Addr: tss.lbAddr, + Type: resolver.GRPCLB, + ServerName: lbServerName, + }}, + ServiceConfig: grpclbServiceConfigWithPickFirst, + }) + + result = "" for i := 0; i < 1000; i++ { if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}, grpc.WaitForReady(true), grpc.Peer(&p)); err != nil { t.Fatalf("_.EmptyCall(_, _) = _, %v, want _, ", err) } - if portPicked1 == 0 { - portPicked1 = p.Addr.(*net.TCPAddr).Port - continue - } - if portPicked1 != p.Addr.(*net.TCPAddr).Port { - t.Fatalf("Different backends are picked for RPCs: %v vs %v", portPicked1, p.Addr.(*net.TCPAddr).Port) - } + result += strconv.Itoa(portsToIndex[p.Addr.(*net.TCPAddr).Port]) + } + if seq := "00000"; !strings.Contains(result, strings.Repeat(seq, 100)) { + t.Errorf("got result sequence %q, want patten %q", result, seq) } - portPicked2 := portPicked1 - tss.ls.sls <- &lbpb.ServerList{Servers: beServers[:1]} + tss.ls.sls <- &lbpb.ServerList{Servers: beServers[2:]} + result = "" for i := 0; i < 1000; i++ { if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}, grpc.WaitForReady(true), grpc.Peer(&p)); err != nil { t.Fatalf("_.EmptyCall(_, _) = _, %v, want _, ", err) } - if portPicked2 == portPicked1 { - portPicked2 = p.Addr.(*net.TCPAddr).Port - continue - } - if portPicked2 != p.Addr.(*net.TCPAddr).Port { - t.Fatalf("Different backends are picked for RPCs: %v vs %v", portPicked2, p.Addr.(*net.TCPAddr).Port) - } + result += strconv.Itoa(portsToIndex[p.Addr.(*net.TCPAddr).Port]) + } + if seq := "22222"; !strings.Contains(result, strings.Repeat(seq, 100)) { + t.Errorf("got result sequence %q, want patten %q", result, seq) } - portPicked := portPicked2 tss.ls.sls <- &lbpb.ServerList{Servers: beServers[1:]} + result = "" for i := 0; i < 1000; i++ { if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}, grpc.WaitForReady(true), grpc.Peer(&p)); err != nil { t.Fatalf("_.EmptyCall(_, _) = _, %v, want _, ", err) } - if portPicked == portPicked2 { - portPicked = p.Addr.(*net.TCPAddr).Port - continue + result += strconv.Itoa(portsToIndex[p.Addr.(*net.TCPAddr).Port]) + } + if seq := "22222"; !strings.Contains(result, strings.Repeat(seq, 100)) { + t.Errorf("got result sequence %q, want patten %q", result, seq) + } + + // Switch sub policy to roundrobin. + + r.UpdateState(resolver.State{ + Addresses: []resolver.Address{{ + Addr: tss.lbAddr, + Type: resolver.GRPCLB, + ServerName: lbServerName, + }}, + ServiceConfig: `{}`, + }) + + result = "" + for i := 0; i < 1000; i++ { + if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}, grpc.WaitForReady(true), grpc.Peer(&p)); err != nil { + t.Fatalf("_.EmptyCall(_, _) = _, %v, want _, ", err) } - if portPicked != p.Addr.(*net.TCPAddr).Port { - t.Fatalf("Different backends are picked for RPCs: %v vs %v", portPicked, p.Addr.(*net.TCPAddr).Port) + result += strconv.Itoa(portsToIndex[p.Addr.(*net.TCPAddr).Port]) + } + if seq := "121212"; !strings.Contains(result, strings.Repeat(seq, 100)) { + t.Errorf("got result sequence %q, want patten %q", result, seq) + } + + tss.ls.sls <- &lbpb.ServerList{Servers: beServers[0:3]} + result = "" + 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) } + result += strconv.Itoa(portsToIndex[p.Addr.(*net.TCPAddr).Port]) + } + if seq := "012012012"; !strings.Contains(result, strings.Repeat(seq, 2)) { + t.Errorf("got result sequence %q, want patten %q", result, seq) } } From ee9f7f0c9ac14d8e413a6a2971ba61bc14b2f4bf Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Thu, 11 Apr 2019 14:22:58 -0700 Subject: [PATCH 07/34] interop: add test case for "pick_first" (#2762) --- interop/client/client.go | 6 +- interop/grpc_testing/test.pb.go | 145 ++++++++++++++++++-------------- interop/grpc_testing/test.proto | 9 +- interop/test_utils.go | 34 ++++++++ 4 files changed, 130 insertions(+), 64 deletions(-) diff --git a/interop/client/client.go b/interop/client/client.go index ce14e56358ca..e30081b55bed 100644 --- a/interop/client/client.go +++ b/interop/client/client.go @@ -76,7 +76,8 @@ var ( special_status_message: Unicode and whitespace is correctly processed in status message; custom_metadata: server will echo custom metadata; unimplemented_method: client attempts to call unimplemented method; - unimplemented_service: client attempts to call unimplemented service.`) + unimplemented_service: client attempts to call unimplemented service; + pick_first_unary: all requests are sent to one server despite multiple servers are resolved.`) ) type credsMode uint8 @@ -270,6 +271,9 @@ func main() { case "unimplemented_service": interop.DoUnimplementedService(testpb.NewUnimplementedServiceClient(conn)) grpclog.Infoln("UnimplementedService done") + case "pick_first_unary": + interop.DoPickFirstUnary(tc) + grpclog.Infoln("PickFirstUnary done") default: grpclog.Fatal("Unsupported test case: ", *testCase) } diff --git a/interop/grpc_testing/test.pb.go b/interop/grpc_testing/test.pb.go index bb5e2eeb3c87..051d0089f9c1 100644 --- a/interop/grpc_testing/test.pb.go +++ b/interop/grpc_testing/test.pb.go @@ -50,7 +50,7 @@ func (x PayloadType) String() string { return proto.EnumName(PayloadType_name, int32(x)) } func (PayloadType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_test_4001f755b984bb27, []int{0} + return fileDescriptor_test_56dd6f68792c8a57, []int{0} } type Empty struct { @@ -63,7 +63,7 @@ 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_4001f755b984bb27, []int{0} + return fileDescriptor_test_56dd6f68792c8a57, []int{0} } func (m *Empty) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Empty.Unmarshal(m, b) @@ -98,7 +98,7 @@ 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_4001f755b984bb27, []int{1} + return fileDescriptor_test_56dd6f68792c8a57, []int{1} } func (m *Payload) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Payload.Unmarshal(m, b) @@ -146,7 +146,7 @@ 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_4001f755b984bb27, []int{2} + return fileDescriptor_test_56dd6f68792c8a57, []int{2} } func (m *EchoStatus) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_EchoStatus.Unmarshal(m, b) @@ -195,17 +195,19 @@ type SimpleRequest struct { // Whether SimpleResponse should include OAuth scope. FillOauthScope bool `protobuf:"varint,5,opt,name=fill_oauth_scope,json=fillOauthScope,proto3" json:"fill_oauth_scope,omitempty"` // Whether server should return a given status - ResponseStatus *EchoStatus `protobuf:"bytes,7,opt,name=response_status,json=responseStatus,proto3" json:"response_status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + 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"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } 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_4001f755b984bb27, []int{3} + return fileDescriptor_test_56dd6f68792c8a57, []int{3} } func (m *SimpleRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SimpleRequest.Unmarshal(m, b) @@ -267,6 +269,13 @@ func (m *SimpleRequest) GetResponseStatus() *EchoStatus { return nil } +func (m *SimpleRequest) GetFillServerId() bool { + if m != nil { + return m.FillServerId + } + return false +} + // Unary response, as configured by the request. type SimpleResponse struct { // Payload to increase message size. @@ -275,7 +284,10 @@ type SimpleResponse struct { // successful when the client expected it. Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` // OAuth scope. - OauthScope string `protobuf:"bytes,3,opt,name=oauth_scope,json=oauthScope,proto3" json:"oauth_scope,omitempty"` + 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:"-"` @@ -285,7 +297,7 @@ 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_4001f755b984bb27, []int{4} + return fileDescriptor_test_56dd6f68792c8a57, []int{4} } func (m *SimpleResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SimpleResponse.Unmarshal(m, b) @@ -326,6 +338,13 @@ func (m *SimpleResponse) GetOauthScope() string { return "" } +func (m *SimpleResponse) GetServerId() string { + if m != nil { + return m.ServerId + } + return "" +} + // Client-streaming request. type StreamingInputCallRequest struct { // Optional input payload sent along with the request. @@ -339,7 +358,7 @@ 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_4001f755b984bb27, []int{5} + return fileDescriptor_test_56dd6f68792c8a57, []int{5} } func (m *StreamingInputCallRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StreamingInputCallRequest.Unmarshal(m, b) @@ -379,7 +398,7 @@ 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_4001f755b984bb27, []int{6} + return fileDescriptor_test_56dd6f68792c8a57, []int{6} } func (m *StreamingInputCallResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StreamingInputCallResponse.Unmarshal(m, b) @@ -423,7 +442,7 @@ 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_4001f755b984bb27, []int{7} + return fileDescriptor_test_56dd6f68792c8a57, []int{7} } func (m *ResponseParameters) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResponseParameters.Unmarshal(m, b) @@ -479,7 +498,7 @@ 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_4001f755b984bb27, []int{8} + return fileDescriptor_test_56dd6f68792c8a57, []int{8} } func (m *StreamingOutputCallRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StreamingOutputCallRequest.Unmarshal(m, b) @@ -540,7 +559,7 @@ 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_4001f755b984bb27, []int{9} + return fileDescriptor_test_56dd6f68792c8a57, []int{9} } func (m *StreamingOutputCallResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_StreamingOutputCallResponse.Unmarshal(m, b) @@ -1038,50 +1057,52 @@ var _UnimplementedService_serviceDesc = grpc.ServiceDesc{ Metadata: "grpc_testing/test.proto", } -func init() { proto.RegisterFile("grpc_testing/test.proto", fileDescriptor_test_4001f755b984bb27) } - -var fileDescriptor_test_4001f755b984bb27 = []byte{ - // 664 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0xdd, 0x6e, 0xd3, 0x4c, - 0x10, 0xfd, 0x9c, 0x26, 0x4d, 0x3b, 0x49, 0xfd, 0x85, 0x2d, 0x55, 0xdd, 0x14, 0x89, 0xc8, 0x5c, - 0x60, 0x90, 0x48, 0x51, 0x10, 0x5c, 0x20, 0x01, 0x2a, 0x6d, 0x2a, 0x2a, 0xb5, 0x4d, 0xb1, 0x9b, - 0xeb, 0x68, 0x9b, 0x4c, 0x5d, 0x4b, 0xfe, 0xc3, 0xbb, 0xae, 0x48, 0x2f, 0x78, 0x19, 0x1e, 0x82, - 0x0b, 0x5e, 0x0e, 0xed, 0xda, 0x4e, 0x9c, 0xd4, 0x15, 0x0d, 0x7f, 0x57, 0xf1, 0x9e, 0x39, 0x33, - 0x3b, 0x67, 0xe6, 0xd8, 0x81, 0x4d, 0x3b, 0x0a, 0x87, 0x03, 0x8e, 0x8c, 0x3b, 0xbe, 0xbd, 0x23, - 0x7e, 0xdb, 0x61, 0x14, 0xf0, 0x80, 0xd4, 0x45, 0xa0, 0x9d, 0x06, 0xf4, 0x2a, 0x54, 0xba, 0x5e, - 0xc8, 0xc7, 0xfa, 0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00, +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, 0xf6, 0xad, 0x54, 0x60, 0x38, + 0x88, 0xf9, 0x9c, 0xe0, 0xfb, 0x3a, 0xff, 0x13, 0xac, 0x4d, 0xeb, 0xc3, 0x29, 0x55, 0xb5, 0xd4, + 0x59, 0xd2, 0xeb, 0xbd, 0xce, 0x6c, 0x97, 0xeb, 0x92, 0x0c, 0x12, 0x5d, 0x97, 0x79, 0xe7, 0x7b, + 0x72, 0x7f, 0x63, 0x6b, 0xc7, 0xb0, 0xb5, 0x70, 0x49, 0xbf, 0x69, 0xdf, 0x67, 0xef, 0xa1, 0x5e, + 0xd8, 0x19, 0x69, 0x41, 0x63, 0x77, 0x70, 0x74, 0x62, 0xf4, 0x4d, 0x73, 0xe7, 0xc3, 0x61, 0xbf, + 0xf5, 0x0f, 0x21, 0xd0, 0x1c, 0x1e, 0xcf, 0xc4, 0x14, 0x02, 0xb0, 0x6c, 0xec, 0x1c, 0xef, 0x0d, + 0x8e, 0x5a, 0xa5, 0xde, 0xf7, 0x32, 0xd4, 0x4f, 0x91, 0x71, 0x71, 0xa9, 0x9c, 0x31, 0x92, 0x57, + 0x50, 0x93, 0x9f, 0x51, 0x41, 0x8b, 0xac, 0xcd, 0xe9, 0x12, 0x89, 0xf6, 0xa2, 0x20, 0xd9, 0x87, + 0xda, 0xd0, 0xa7, 0x51, 0x52, 0xb6, 0x35, 0x8b, 0x98, 0xf9, 0x04, 0xb6, 0x1f, 0x2c, 0x4e, 0xa6, + 0x0b, 0x70, 0x61, 0x6d, 0xc1, 0x7e, 0x88, 0x3e, 0x57, 0x74, 0xa3, 0xcf, 0xda, 0x4f, 0x6f, 0x81, + 0x4c, 0x66, 0xbd, 0x50, 0x88, 0x03, 0xe4, 0xfa, 0xa5, 0x22, 0x4f, 0x6e, 0x68, 0x31, 0x7f, 0x89, + 0xdb, 0xfa, 0xaf, 0x81, 0xc9, 0x28, 0x5d, 0x8c, 0x6a, 0xee, 0xc7, 0xae, 0xbb, 0x17, 0x87, 0x2e, + 0x7e, 0xf9, 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/interop/grpc_testing/test.proto b/interop/grpc_testing/test.proto index f9f303dbb97f..f6fbdf8db5ad 100644 --- a/interop/grpc_testing/test.proto +++ b/interop/grpc_testing/test.proto @@ -68,6 +68,9 @@ message SimpleRequest { // Whether server should return a given status EchoStatus response_status = 7; + + // Whether SimpleResponse should include server_id. + bool fill_server_id = 9; } // Unary response, as configured by the request. @@ -78,9 +81,13 @@ message SimpleResponse { // The user the request came from, for verifying authentication was // successful when the client expected it. string username = 2; - + // OAuth scope. string oauth_scope = 3; + + // 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; } // Client-streaming request. diff --git a/interop/test_utils.go b/interop/test_utils.go index da57fbfb55d2..d8402319b483 100644 --- a/interop/test_utils.go +++ b/interop/test_utils.go @@ -638,6 +638,40 @@ func DoUnimplementedMethod(cc *grpc.ClientConn) { } } +// DoPickFirstUnary runs multiple RPCs (rpcCount) and checks that all requests +// are sent to the same backend. +func DoPickFirstUnary(tc testpb.TestServiceClient) { + const rpcCount = 100 + + pl := ClientNewPayload(testpb.PayloadType_COMPRESSABLE, 1) + req := &testpb.SimpleRequest{ + ResponseType: testpb.PayloadType_COMPRESSABLE, + ResponseSize: int32(1), + Payload: pl, + FillServerId: true, + } + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + var serverID string + for i := 0; i < rpcCount; i++ { + resp, err := tc.UnaryCall(ctx, req) + if err != nil { + grpclog.Fatalf("iteration %d, failed to do UnaryCall: %v", i, err) + } + id := resp.ServerId + if id == "" { + grpclog.Fatalf("iteration %d, got empty server ID", i) + } + if i == 0 { + serverID = id + continue + } + if serverID != id { + grpclog.Fatalf("iteration %d, got different server ids: %q vs %q", i, serverID, id) + } + } +} + type testServer struct { } From 597a4aa0270ff47b1e7e74cd3ef75579c63d20bb Mon Sep 17 00:00:00 2001 From: Can Guler Date: Thu, 11 Apr 2019 14:31:07 -0700 Subject: [PATCH 08/34] grpc: remove excess new line from the log statement (#2766) --- balancer_v1_wrapper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/balancer_v1_wrapper.go b/balancer_v1_wrapper.go index 29bda6353dd5..c23ea16893cc 100644 --- a/balancer_v1_wrapper.go +++ b/balancer_v1_wrapper.go @@ -120,7 +120,7 @@ func (bw *balancerWrapper) lbWatcher() { } for addrs := range notifyCh { - grpclog.Infof("balancerWrapper: got update addr from Notify: %v\n", addrs) + grpclog.Infof("balancerWrapper: got update addr from Notify: %v", addrs) if bw.pickfirst { var ( oldA resolver.Address From e1d95c39ad578195b745b113d07c2cf401cfbc3d Mon Sep 17 00:00:00 2001 From: Cesar Ghali Date: Thu, 11 Apr 2019 16:49:01 -0700 Subject: [PATCH 09/34] credentials/alts: Support UDS addresses in ALTS interop test server (#2763) * Support UDS addresses in ALTS interop test server * Fix flag description * Fixed comment * Fix comment --- interop/alts/server/server.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/interop/alts/server/server.go b/interop/alts/server/server.go index c70a20b6e4c6..005e58188486 100644 --- a/interop/alts/server/server.go +++ b/interop/alts/server/server.go @@ -22,6 +22,7 @@ package main import ( "flag" "net" + "strings" grpc "google.golang.org/grpc" "google.golang.org/grpc/credentials/alts" @@ -30,17 +31,28 @@ import ( testpb "google.golang.org/grpc/interop/grpc_testing" ) +const ( + udsAddrPrefix = "unix:" +) + var ( hsAddr = flag.String("alts_handshaker_service_address", "", "ALTS handshaker gRPC service address") - serverAddr = flag.String("server_address", ":8080", "The port on which the server is listening") + serverAddr = flag.String("server_address", ":8080", "The address on which the server is listening. Only two types of addresses are supported, 'host:port' and 'unix:/path'.") ) func main() { flag.Parse() - lis, err := net.Listen("tcp", *serverAddr) + // If the server address starts with `unix:`, then we have a UDS address. + network := "tcp" + address := *serverAddr + if strings.HasPrefix(address, udsAddrPrefix) { + network = "unix" + address = strings.TrimPrefix(address, udsAddrPrefix) + } + lis, err := net.Listen(network, address) if err != nil { - grpclog.Fatalf("gRPC Server: failed to start the server at %v: %v", *serverAddr, err) + grpclog.Fatalf("gRPC Server: failed to start the server at %v: %v", address, err) } opts := alts.DefaultServerOptions() if *hsAddr != "" { From a9de79b9c399bac5cdcd8714b935f00eab61c8b4 Mon Sep 17 00:00:00 2001 From: Easwar Swaminathan Date: Fri, 12 Apr 2019 10:08:23 -0700 Subject: [PATCH 10/34] Use 'go vet' and not 'go tool vet'. (#2768) From [release notes](https://golang.org/doc/go1.12#vet): The go vet command has been rewritten to serve as the base for a range of different source code analysis tools. See the golang.org/x/tools/go/analysis package for details. A side-effect is that go tool vet is no longer supported. External tools that use go tool vet must be changed to use go vet. Using go vet instead of go tool vet should work with all supported versions of Go. --- vet.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vet.sh b/vet.sh index 5b1f36bef0f4..2042133f7101 100755 --- a/vet.sh +++ b/vet.sh @@ -88,7 +88,7 @@ go list -f {{.Dir}} ./... | xargs go run test/go_vet/vet.go gofmt -s -d -l . 2>&1 | fail_on_output goimports -l . 2>&1 | fail_on_output golint ./... 2>&1 | (! grep -vE "(_mock|\.pb)\.go:") -go tool vet -all . +go vet -all . # - Check that generated proto files are up to date. if [[ -z "${VET_SKIP_PROTO}" ]]; then From 776edd3ba1f9c75bd87e7131639d1815df428aa1 Mon Sep 17 00:00:00 2001 From: Weiran Fang <8175562+WeiranFang@users.noreply.github.com> Date: Mon, 15 Apr 2019 11:13:34 -0700 Subject: [PATCH 11/34] interceptor: new APIs for chaining client interceptors. (#2696) --- call_test.go | 204 ++++++++++++++++++++++++++++++++++++++++++++++++- clientconn.go | 65 ++++++++++++++++ dialoptions.go | 30 +++++++- 3 files changed, 296 insertions(+), 3 deletions(-) diff --git a/call_test.go b/call_test.go index a51108d50ebe..78760ba5297a 100644 --- a/call_test.go +++ b/call_test.go @@ -123,6 +123,8 @@ type server struct { conns map[transport.ServerTransport]bool } +type ctxKey string + func newTestServer() *server { return &server{startedErr: make(chan error, 1)} } @@ -202,17 +204,217 @@ func (s *server) stop() { } func setUp(t *testing.T, port int, maxStreams uint32) (*server, *ClientConn) { + return setUpWithOptions(t, port, maxStreams) +} + +func setUpWithOptions(t *testing.T, port int, maxStreams uint32, dopts ...DialOption) (*server, *ClientConn) { server := newTestServer() go server.start(t, port, maxStreams) server.wait(t, 2*time.Second) addr := "localhost:" + server.port - cc, err := Dial(addr, WithBlock(), WithInsecure(), WithCodec(testCodec{})) + dopts = append(dopts, WithBlock(), WithInsecure(), WithCodec(testCodec{})) + cc, err := Dial(addr, dopts...) if err != nil { t.Fatalf("Failed to create ClientConn: %v", err) } return server, cc } +func (s) TestUnaryClientInterceptor(t *testing.T) { + parentKey := ctxKey("parentKey") + + interceptor := func(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, invoker UnaryInvoker, opts ...CallOption) error { + if ctx.Value(parentKey) == nil { + t.Fatalf("interceptor should have %v in context", parentKey) + } + return invoker(ctx, method, req, reply, cc, opts...) + } + + server, cc := setUpWithOptions(t, 0, math.MaxUint32, WithUnaryInterceptor(interceptor)) + defer func() { + cc.Close() + server.stop() + }() + + var reply string + ctx := context.Background() + parentCtx := context.WithValue(ctx, ctxKey("parentKey"), 0) + if err := cc.Invoke(parentCtx, "/foo/bar", &expectedRequest, &reply); err != nil || reply != expectedResponse { + t.Fatalf("grpc.Invoke(_, _, _, _, _) = %v, want ", err) + } +} + +func (s) TestChainUnaryClientInterceptor(t *testing.T) { + var ( + parentKey = ctxKey("parentKey") + firstIntKey = ctxKey("firstIntKey") + secondIntKey = ctxKey("secondIntKey") + ) + + firstInt := func(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, invoker UnaryInvoker, opts ...CallOption) error { + if ctx.Value(parentKey) == nil { + t.Fatalf("first interceptor should have %v in context", parentKey) + } + if ctx.Value(firstIntKey) != nil { + t.Fatalf("first interceptor should not have %v in context", firstIntKey) + } + if ctx.Value(secondIntKey) != nil { + t.Fatalf("first interceptor should not have %v in context", secondIntKey) + } + firstCtx := context.WithValue(ctx, firstIntKey, 1) + err := invoker(firstCtx, method, req, reply, cc, opts...) + *(reply.(*string)) += "1" + return err + } + + secondInt := func(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, invoker UnaryInvoker, opts ...CallOption) error { + if ctx.Value(parentKey) == nil { + t.Fatalf("second interceptor should have %v in context", parentKey) + } + if ctx.Value(firstIntKey) == nil { + t.Fatalf("second interceptor should have %v in context", firstIntKey) + } + if ctx.Value(secondIntKey) != nil { + t.Fatalf("second interceptor should not have %v in context", secondIntKey) + } + secondCtx := context.WithValue(ctx, secondIntKey, 2) + err := invoker(secondCtx, method, req, reply, cc, opts...) + *(reply.(*string)) += "2" + return err + } + + lastInt := func(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, invoker UnaryInvoker, opts ...CallOption) error { + if ctx.Value(parentKey) == nil { + t.Fatalf("last interceptor should have %v in context", parentKey) + } + if ctx.Value(firstIntKey) == nil { + t.Fatalf("last interceptor should have %v in context", firstIntKey) + } + if ctx.Value(secondIntKey) == nil { + t.Fatalf("last interceptor should have %v in context", secondIntKey) + } + err := invoker(ctx, method, req, reply, cc, opts...) + *(reply.(*string)) += "3" + return err + } + + server, cc := setUpWithOptions(t, 0, math.MaxUint32, WithChainUnaryInterceptor(firstInt, secondInt, lastInt)) + defer func() { + cc.Close() + server.stop() + }() + + var reply string + ctx := context.Background() + parentCtx := context.WithValue(ctx, ctxKey("parentKey"), 0) + if err := cc.Invoke(parentCtx, "/foo/bar", &expectedRequest, &reply); err != nil || reply != expectedResponse+"321" { + t.Fatalf("grpc.Invoke(_, _, _, _, _) = %v, want ", err) + } +} + +func (s) TestChainOnBaseUnaryClientInterceptor(t *testing.T) { + var ( + parentKey = ctxKey("parentKey") + baseIntKey = ctxKey("baseIntKey") + ) + + baseInt := func(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, invoker UnaryInvoker, opts ...CallOption) error { + if ctx.Value(parentKey) == nil { + t.Fatalf("base interceptor should have %v in context", parentKey) + } + if ctx.Value(baseIntKey) != nil { + t.Fatalf("base interceptor should not have %v in context", baseIntKey) + } + baseCtx := context.WithValue(ctx, baseIntKey, 1) + return invoker(baseCtx, method, req, reply, cc, opts...) + } + + chainInt := func(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, invoker UnaryInvoker, opts ...CallOption) error { + if ctx.Value(parentKey) == nil { + t.Fatalf("chain interceptor should have %v in context", parentKey) + } + if ctx.Value(baseIntKey) == nil { + t.Fatalf("chain interceptor should have %v in context", baseIntKey) + } + return invoker(ctx, method, req, reply, cc, opts...) + } + + server, cc := setUpWithOptions(t, 0, math.MaxUint32, WithUnaryInterceptor(baseInt), WithChainUnaryInterceptor(chainInt)) + defer func() { + cc.Close() + server.stop() + }() + + var reply string + ctx := context.Background() + parentCtx := context.WithValue(ctx, ctxKey("parentKey"), 0) + if err := cc.Invoke(parentCtx, "/foo/bar", &expectedRequest, &reply); err != nil || reply != expectedResponse { + t.Fatalf("grpc.Invoke(_, _, _, _, _) = %v, want ", err) + } +} + +func (s) TestChainStreamClientInterceptor(t *testing.T) { + var ( + parentKey = ctxKey("parentKey") + firstIntKey = ctxKey("firstIntKey") + secondIntKey = ctxKey("secondIntKey") + ) + + firstInt := func(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, streamer Streamer, opts ...CallOption) (ClientStream, error) { + if ctx.Value(parentKey) == nil { + t.Fatalf("first interceptor should have %v in context", parentKey) + } + if ctx.Value(firstIntKey) != nil { + t.Fatalf("first interceptor should not have %v in context", firstIntKey) + } + if ctx.Value(secondIntKey) != nil { + t.Fatalf("first interceptor should not have %v in context", secondIntKey) + } + firstCtx := context.WithValue(ctx, firstIntKey, 1) + return streamer(firstCtx, desc, cc, method, opts...) + } + + secondInt := func(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, streamer Streamer, opts ...CallOption) (ClientStream, error) { + if ctx.Value(parentKey) == nil { + t.Fatalf("second interceptor should have %v in context", parentKey) + } + if ctx.Value(firstIntKey) == nil { + t.Fatalf("second interceptor should have %v in context", firstIntKey) + } + if ctx.Value(secondIntKey) != nil { + t.Fatalf("second interceptor should not have %v in context", secondIntKey) + } + secondCtx := context.WithValue(ctx, secondIntKey, 2) + return streamer(secondCtx, desc, cc, method, opts...) + } + + lastInt := func(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, streamer Streamer, opts ...CallOption) (ClientStream, error) { + if ctx.Value(parentKey) == nil { + t.Fatalf("last interceptor should have %v in context", parentKey) + } + if ctx.Value(firstIntKey) == nil { + t.Fatalf("last interceptor should have %v in context", firstIntKey) + } + if ctx.Value(secondIntKey) == nil { + t.Fatalf("last interceptor should have %v in context", secondIntKey) + } + return streamer(ctx, desc, cc, method, opts...) + } + + server, cc := setUpWithOptions(t, 0, math.MaxUint32, WithChainStreamInterceptor(firstInt, secondInt, lastInt)) + defer func() { + cc.Close() + server.stop() + }() + + ctx := context.Background() + parentCtx := context.WithValue(ctx, ctxKey("parentKey"), 0) + _, err := cc.NewStream(parentCtx, &StreamDesc{}, "/foo/bar") + if err != nil { + t.Fatalf("grpc.NewStream(_, _, _) = %v, want ", err) + } +} + func (s) TestInvoke(t *testing.T) { server, cc := setUp(t, 0, math.MaxUint32) var reply string diff --git a/clientconn.go b/clientconn.go index bd2d2b317798..8255caef929b 100644 --- a/clientconn.go +++ b/clientconn.go @@ -137,6 +137,9 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * opt.apply(&cc.dopts) } + chainUnaryClientInterceptors(cc) + chainStreamClientInterceptors(cc) + defer func() { if err != nil { cc.Close() @@ -327,6 +330,68 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * return cc, nil } +// chainUnaryClientInterceptors chains all unary client interceptors into one. +func chainUnaryClientInterceptors(cc *ClientConn) { + interceptors := cc.dopts.chainUnaryInts + // Prepend dopts.unaryInt to the chaining interceptors if it exists, since unaryInt will + // be executed before any other chained interceptors. + if cc.dopts.unaryInt != nil { + interceptors = append([]UnaryClientInterceptor{cc.dopts.unaryInt}, interceptors...) + } + var chainedInt UnaryClientInterceptor + if len(interceptors) == 0 { + chainedInt = nil + } else if len(interceptors) == 1 { + chainedInt = interceptors[0] + } else { + chainedInt = func(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, invoker UnaryInvoker, opts ...CallOption) error { + return interceptors[0](ctx, method, req, reply, cc, getChainUnaryInvoker(interceptors, 0, invoker), opts...) + } + } + cc.dopts.unaryInt = chainedInt +} + +// getChainUnaryInvoker recursively generate the chained unary invoker. +func getChainUnaryInvoker(interceptors []UnaryClientInterceptor, curr int, finalInvoker UnaryInvoker) UnaryInvoker { + if curr == len(interceptors)-1 { + return finalInvoker + } + return func(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, opts ...CallOption) error { + return interceptors[curr+1](ctx, method, req, reply, cc, getChainUnaryInvoker(interceptors, curr+1, finalInvoker), opts...) + } +} + +// chainStreamClientInterceptors chains all stream client interceptors into one. +func chainStreamClientInterceptors(cc *ClientConn) { + interceptors := cc.dopts.chainStreamInts + // Prepend dopts.streamInt to the chaining interceptors if it exists, since streamInt will + // be executed before any other chained interceptors. + if cc.dopts.streamInt != nil { + interceptors = append([]StreamClientInterceptor{cc.dopts.streamInt}, interceptors...) + } + var chainedInt StreamClientInterceptor + if len(interceptors) == 0 { + chainedInt = nil + } else if len(interceptors) == 1 { + chainedInt = interceptors[0] + } else { + chainedInt = func(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, streamer Streamer, opts ...CallOption) (ClientStream, error) { + return interceptors[0](ctx, desc, cc, method, getChainStreamer(interceptors, 0, streamer), opts...) + } + } + cc.dopts.streamInt = chainedInt +} + +// getChainStreamer recursively generate the chained client stream constructor. +func getChainStreamer(interceptors []StreamClientInterceptor, curr int, finalStreamer Streamer) Streamer { + if curr == len(interceptors)-1 { + return finalStreamer + } + return func(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (ClientStream, error) { + return interceptors[curr+1](ctx, desc, cc, method, getChainStreamer(interceptors, curr+1, finalStreamer), opts...) + } +} + // connectivityStateManager keeps the connectivity.State of ClientConn. // This struct will eventually be exported so the balancers can access it. type connectivityStateManager struct { diff --git a/dialoptions.go b/dialoptions.go index e114fecbb7b4..1fdc619d1730 100644 --- a/dialoptions.go +++ b/dialoptions.go @@ -39,8 +39,12 @@ import ( // dialOptions configure a Dial call. dialOptions are set by the DialOption // values passed to Dial. type dialOptions struct { - unaryInt UnaryClientInterceptor - streamInt StreamClientInterceptor + unaryInt UnaryClientInterceptor + streamInt StreamClientInterceptor + + chainUnaryInts []UnaryClientInterceptor + chainStreamInts []StreamClientInterceptor + cp Compressor dc Decompressor bs backoff.Strategy @@ -414,6 +418,17 @@ func WithUnaryInterceptor(f UnaryClientInterceptor) DialOption { }) } +// WithChainUnaryInterceptor returns a DialOption that specifies the chained +// interceptor for unary RPCs. The first interceptor will be the outer most, +// while the last interceptor will be the inner most wrapper around the real call. +// All interceptors added by this method will be chained, and the interceptor +// defined by WithUnaryInterceptor will always be prepended to the chain. +func WithChainUnaryInterceptor(interceptors ...UnaryClientInterceptor) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.chainUnaryInts = append(o.chainUnaryInts, interceptors...) + }) +} + // WithStreamInterceptor returns a DialOption that specifies the interceptor for // streaming RPCs. func WithStreamInterceptor(f StreamClientInterceptor) DialOption { @@ -422,6 +437,17 @@ func WithStreamInterceptor(f StreamClientInterceptor) DialOption { }) } +// WithChainStreamInterceptor returns a DialOption that specifies the chained +// interceptor for unary RPCs. The first interceptor will be the outer most, +// while the last interceptor will be the inner most wrapper around the real call. +// All interceptors added by this method will be chained, and the interceptor +// defined by WithStreamInterceptor will always be prepended to the chain. +func WithChainStreamInterceptor(interceptors ...StreamClientInterceptor) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.chainStreamInts = append(o.chainStreamInts, interceptors...) + }) +} + // WithAuthority returns a DialOption that specifies the value to be used as the // :authority pseudo-header. This value only works with WithInsecure and has no // effect if TransportCredentials are present. From 9d8d97a245af2d4bc743585418e1b4aebada0637 Mon Sep 17 00:00:00 2001 From: Jean de Klerk Date: Mon, 15 Apr 2019 14:59:43 -0600 Subject: [PATCH 12/34] docs: add note about retrying UNAVAILABLE (#2774) --- codes/codes.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/codes/codes.go b/codes/codes.go index d9b9d5782e08..02738839dd98 100644 --- a/codes/codes.go +++ b/codes/codes.go @@ -132,7 +132,8 @@ const ( // Unavailable indicates the service is currently unavailable. // This is a most likely a transient condition and may be corrected - // by retrying with a backoff. + // by retrying with a backoff. Note that it is not always safe to retry + // non-idempotent operations. // // See litmus test above for deciding between FailedPrecondition, // Aborted, and Unavailable. From 3fc743058b25bc974180a7a61656554e31f92635 Mon Sep 17 00:00:00 2001 From: Can Guler Date: Mon, 15 Apr 2019 14:20:22 -0700 Subject: [PATCH 13/34] transport: fix a race that could lead to memory leaks (#2765) * When a RST_STREAM is received by the server transport, a cleanupStream item is placed into controlbuf no matter what. * Updates comments. * Replaces getCleanupStream with inline struct initialization. --- internal/transport/http2_server.go | 106 ++++++++++++++--------------- 1 file changed, 52 insertions(+), 54 deletions(-) diff --git a/internal/transport/http2_server.go b/internal/transport/http2_server.go index 7fbbf59726df..435092e5c853 100644 --- a/internal/transport/http2_server.go +++ b/internal/transport/http2_server.go @@ -437,7 +437,7 @@ func (t *http2Server) HandleStreams(handle func(*Stream), traceCtx func(context. s := t.activeStreams[se.StreamID] t.mu.Unlock() if s != nil { - t.closeStream(s, true, se.Code, nil, false) + t.closeStream(s, true, se.Code, false) } else { t.controlBuf.put(&cleanupStream{ streamID: se.StreamID, @@ -579,7 +579,7 @@ func (t *http2Server) handleData(f *http2.DataFrame) { } if size > 0 { if err := s.fc.onData(size); err != nil { - t.closeStream(s, true, http2.ErrCodeFlowControl, nil, false) + t.closeStream(s, true, http2.ErrCodeFlowControl, false) return } if f.Header().Flags.Has(http2.FlagDataPadded) { @@ -604,11 +604,18 @@ func (t *http2Server) handleData(f *http2.DataFrame) { } func (t *http2Server) handleRSTStream(f *http2.RSTStreamFrame) { - s, ok := t.getStream(f) - if !ok { + // If the stream is not deleted from the transport's active streams map, then do a regular close stream. + if s, ok := t.getStream(f); ok { + t.closeStream(s, false, 0, false) return } - t.closeStream(s, false, 0, nil, false) + // If the stream is already deleted from the active streams map, then put a cleanupStream item into controlbuf to delete the stream from loopy writer's established streams map. + t.controlBuf.put(&cleanupStream{ + streamID: f.Header().StreamID, + rst: false, + rstCode: 0, + onWrite: func() {}, + }) } func (t *http2Server) handleSettings(f *http2.SettingsFrame) { @@ -772,7 +779,7 @@ func (t *http2Server) writeHeaderLocked(s *Stream) error { if err != nil { return err } - t.closeStream(s, true, http2.ErrCodeInternal, nil, false) + t.closeStream(s, true, http2.ErrCodeInternal, false) return ErrHeaderListSizeLimitViolation } if t.stats != nil { @@ -836,12 +843,12 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { if err != nil { return err } - t.closeStream(s, true, http2.ErrCodeInternal, nil, false) + t.closeStream(s, true, http2.ErrCodeInternal, false) return ErrHeaderListSizeLimitViolation } // Send a RST_STREAM after the trailers if the client has not already half-closed. rst := s.getState() == streamActive - t.closeStream(s, rst, http2.ErrCodeNo, trailingHeader, true) + t.finishStream(s, rst, http2.ErrCodeNo, trailingHeader, true) if t.stats != nil { t.stats.HandleRPC(s.Context(), &stats.OutTrailer{}) } @@ -1012,16 +1019,24 @@ func (t *http2Server) Close() error { } // deleteStream deletes the stream s from transport's active streams. -func (t *http2Server) deleteStream(s *Stream, eosReceived bool) { - t.mu.Lock() - if _, ok := t.activeStreams[s.id]; !ok { - t.mu.Unlock() - return +func (t *http2Server) deleteStream(s *Stream, eosReceived bool) (oldState streamState) { + oldState = s.swapState(streamDone) + if oldState == streamDone { + // If the stream was already done, return. + return oldState } - delete(t.activeStreams, s.id) - if len(t.activeStreams) == 0 { - t.idle = time.Now() + // In case stream sending and receiving are invoked in separate + // goroutines (e.g., bi-directional streaming), cancel needs to be + // called to interrupt the potential blocking on other goroutines. + s.cancel() + + t.mu.Lock() + if _, ok := t.activeStreams[s.id]; ok { + delete(t.activeStreams, s.id) + if len(t.activeStreams) == 0 { + t.idle = time.Now() + } } t.mu.Unlock() @@ -1032,55 +1047,38 @@ func (t *http2Server) deleteStream(s *Stream, eosReceived bool) { atomic.AddInt64(&t.czData.streamsFailed, 1) } } -} -// closeStream clears the footprint of a stream when the stream is not needed -// any more. -func (t *http2Server) closeStream(s *Stream, rst bool, rstCode http2.ErrCode, hdr *headerFrame, eosReceived bool) { - // Mark the stream as done - oldState := s.swapState(streamDone) - - // In case stream sending and receiving are invoked in separate - // goroutines (e.g., bi-directional streaming), cancel needs to be - // called to interrupt the potential blocking on other goroutines. - s.cancel() + return oldState +} - // Deletes the stream from active streams - t.deleteStream(s, eosReceived) +// finishStream closes the stream and puts the trailing headerFrame into controlbuf. +func (t *http2Server) finishStream(s *Stream, rst bool, rstCode http2.ErrCode, hdr *headerFrame, eosReceived bool) { + oldState := t.deleteStream(s, eosReceived) + // If the stream is already closed, then don't put trailing header to controlbuf. + if oldState == streamDone { + return + } - cleanup := &cleanupStream{ + hdr.cleanup = &cleanupStream{ streamID: s.id, rst: rst, rstCode: rstCode, onWrite: func() {}, } - - // No trailer. Puts cleanupFrame into transport's control buffer. - if hdr == nil { - t.controlBuf.put(cleanup) - return - } - - // We do the check here, because of the following scenario: - // 1. closeStream is called first with a trailer. A trailer item with a piggybacked cleanup item - // is put to control buffer. - // 2. Loopy writer is waiting on a stream quota. It will never get it because client errored at - // some point. So loopy can't act on trailer - // 3. Client sends a RST_STREAM due to the error. Then closeStream is called without a trailer as - // the result of the received RST_STREAM. - // If we do this check at the beginning of the closeStream, then we won't put a cleanup item in - // response to received RST_STREAM into the control buffer and outStream in loopy writer will - // never get cleaned up. - - // If the stream is already done, don't send the trailer. - if oldState == streamDone { - return - } - - hdr.cleanup = cleanup t.controlBuf.put(hdr) } +// closeStream clears the footprint of a stream when the stream is not needed any more. +func (t *http2Server) closeStream(s *Stream, rst bool, rstCode http2.ErrCode, eosReceived bool) { + t.deleteStream(s, eosReceived) + t.controlBuf.put(&cleanupStream{ + streamID: s.id, + rst: rst, + rstCode: rstCode, + onWrite: func() {}, + }) +} + func (t *http2Server) RemoteAddr() net.Addr { return t.remoteAddr } From 5b263177f251e299a28f4728483976864a08e509 Mon Sep 17 00:00:00 2001 From: lyuxuan Date: Tue, 16 Apr 2019 13:35:16 -0700 Subject: [PATCH 14/34] xds: make local proto generated files (#2750) --- balancer/xds/edsbalancer/edsbalancer.go | 14 +- balancer/xds/edsbalancer/edsbalancer_test.go | 45 +- .../proto/envoy/api/v2/auth/cert/cert.pb.go | 1144 ++++++ .../internal/proto/envoy/api/v2/cds/cds.pb.go | 1771 +++++++++ .../circuit_breaker/circuit_breaker.pb.go | 185 + .../outlier_detection/outlier_detection.pb.go | 185 + .../envoy/api/v2/core/address/address.pb.go | 610 ++++ .../proto/envoy/api/v2/core/base/base.pb.go | 1121 ++++++ .../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 | 998 +++++ .../envoy/api/v2/core/protocol/protocol.pb.go | 311 ++ .../envoy/api/v2/discovery/discovery.pb.go | 446 +++ .../internal/proto/envoy/api/v2/eds/eds.pb.go | 376 ++ .../api/v2/endpoint/endpoint/endpoint.pb.go | 385 ++ .../envoy/service/discovery/v2/ads/ads.pb.go | 251 ++ .../proto/envoy/type/percent/percent.pb.go | 160 + .../proto/envoy/type/range/range.pb.go | 132 + .../internal/proto/validate/validate.pb.go | 3214 +++++++++++++++++ balancer/xds/xds.go | 20 +- balancer/xds/xds_client.go | 49 +- balancer/xds/xds_client_test.go | 135 +- balancer/xds/xds_test.go | 19 +- go.mod | 4 - go.sum | 8 - vet.sh | 2 +- 26 files changed, 13079 insertions(+), 148 deletions(-) create mode 100755 balancer/xds/internal/proto/envoy/api/v2/auth/cert/cert.pb.go create mode 100755 balancer/xds/internal/proto/envoy/api/v2/cds/cds.pb.go create mode 100755 balancer/xds/internal/proto/envoy/api/v2/cluster/circuit_breaker/circuit_breaker.pb.go create mode 100755 balancer/xds/internal/proto/envoy/api/v2/cluster/outlier_detection/outlier_detection.pb.go create mode 100755 balancer/xds/internal/proto/envoy/api/v2/core/address/address.pb.go create mode 100755 balancer/xds/internal/proto/envoy/api/v2/core/base/base.pb.go create mode 100755 balancer/xds/internal/proto/envoy/api/v2/core/config_source/config_source.pb.go create mode 100755 balancer/xds/internal/proto/envoy/api/v2/core/grpc_service/grpc_service.pb.go create mode 100755 balancer/xds/internal/proto/envoy/api/v2/core/health_check/health_check.pb.go create mode 100755 balancer/xds/internal/proto/envoy/api/v2/core/protocol/protocol.pb.go create mode 100755 balancer/xds/internal/proto/envoy/api/v2/discovery/discovery.pb.go create mode 100755 balancer/xds/internal/proto/envoy/api/v2/eds/eds.pb.go create mode 100755 balancer/xds/internal/proto/envoy/api/v2/endpoint/endpoint/endpoint.pb.go create mode 100755 balancer/xds/internal/proto/envoy/service/discovery/v2/ads/ads.pb.go create mode 100755 balancer/xds/internal/proto/envoy/type/percent/percent.pb.go create mode 100755 balancer/xds/internal/proto/envoy/type/range/range.pb.go create mode 100755 balancer/xds/internal/proto/validate/validate.pb.go diff --git a/balancer/xds/edsbalancer/edsbalancer.go b/balancer/xds/edsbalancer/edsbalancer.go index 8e4efcb7c02c..67e39260c876 100644 --- a/balancer/xds/edsbalancer/edsbalancer.go +++ b/balancer/xds/edsbalancer/edsbalancer.go @@ -28,10 +28,10 @@ import ( "strconv" "sync" - xdspb "github.com/envoyproxy/go-control-plane/envoy/api/v2" - xdstypepb "github.com/envoyproxy/go-control-plane/envoy/type" "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/roundrobin" + edspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/eds" + percentpb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/type/percent" "google.golang.org/grpc/codes" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/grpclog" @@ -119,7 +119,7 @@ func (xdsB *EDSBalancer) updateSubBalancerName(subBalancerName string) { // 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 []*xdspb.ClusterLoadAssignment_Policy_DropOverload) { +func (xdsB *EDSBalancer) updateDrops(dropPolicies []*edspb.ClusterLoadAssignment_Policy_DropOverload) { var ( newDrops []*dropper dropsChanged bool @@ -131,11 +131,11 @@ func (xdsB *EDSBalancer) updateDrops(dropPolicies []*xdspb.ClusterLoadAssignment denominator uint32 ) switch percentage.GetDenominator() { - case xdstypepb.FractionalPercent_HUNDRED: + case percentpb.FractionalPercent_HUNDRED: denominator = 100 - case xdstypepb.FractionalPercent_TEN_THOUSAND: + case percentpb.FractionalPercent_TEN_THOUSAND: denominator = 10000 - case xdstypepb.FractionalPercent_MILLION: + case percentpb.FractionalPercent_MILLION: denominator = 1000000 } newDrops = append(newDrops, newDropper(numerator, denominator)) @@ -168,7 +168,7 @@ func (xdsB *EDSBalancer) updateDrops(dropPolicies []*xdspb.ClusterLoadAssignment // SubConns. It also handles drops. // // HandleCDSResponse and HandleEDSResponse must be called by the same goroutine. -func (xdsB *EDSBalancer) HandleEDSResponse(edsResp *xdspb.ClusterLoadAssignment) { +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 { diff --git a/balancer/xds/edsbalancer/edsbalancer_test.go b/balancer/xds/edsbalancer/edsbalancer_test.go index 592d95da2915..19a8da739fd6 100644 --- a/balancer/xds/edsbalancer/edsbalancer_test.go +++ b/balancer/xds/edsbalancer/edsbalancer_test.go @@ -26,13 +26,14 @@ import ( "strconv" "testing" - 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" - xdstypepb "github.com/envoyproxy/go-control-plane/envoy/type" - typespb "github.com/gogo/protobuf/types" + typespb "github.com/golang/protobuf/ptypes/wrappers" "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/roundrobin" + addresspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/address" + basepb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/base" + edspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/eds" + endpointpb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/endpoint/endpoint" + percentpb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/type/percent" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/resolver" ) @@ -44,25 +45,25 @@ var ( ) type clusterLoadAssignmentBuilder struct { - v *xdspb.ClusterLoadAssignment + v *edspb.ClusterLoadAssignment } func newClusterLoadAssignmentBuilder(clusterName string, dropPercents []uint32) *clusterLoadAssignmentBuilder { - var drops []*xdspb.ClusterLoadAssignment_Policy_DropOverload + var drops []*edspb.ClusterLoadAssignment_Policy_DropOverload for i, d := range dropPercents { - drops = append(drops, &xdspb.ClusterLoadAssignment_Policy_DropOverload{ + drops = append(drops, &edspb.ClusterLoadAssignment_Policy_DropOverload{ Category: fmt.Sprintf("test-drop-%d", i), - DropPercentage: &xdstypepb.FractionalPercent{ + DropPercentage: &percentpb.FractionalPercent{ Numerator: d, - Denominator: xdstypepb.FractionalPercent_HUNDRED, + Denominator: percentpb.FractionalPercent_HUNDRED, }, }) } return &clusterLoadAssignmentBuilder{ - v: &xdspb.ClusterLoadAssignment{ + v: &edspb.ClusterLoadAssignment{ ClusterName: clusterName, - Policy: &xdspb.ClusterLoadAssignment_Policy{ + Policy: &edspb.ClusterLoadAssignment_Policy{ DropOverloads: drops, }, }, @@ -70,7 +71,7 @@ func newClusterLoadAssignmentBuilder(clusterName string, dropPercents []uint32) } func (clab *clusterLoadAssignmentBuilder) addLocality(subzone string, weight uint32, addrsWithPort []string) { - var lbEndPoints []endpointpb.LbEndpoint + var lbEndPoints []*endpointpb.LbEndpoint for _, a := range addrsWithPort { host, portStr, err := net.SplitHostPort(a) if err != nil { @@ -81,21 +82,21 @@ func (clab *clusterLoadAssignmentBuilder) addLocality(subzone string, weight uin panic("failed to atoi " + portStr) } - lbEndPoints = append(lbEndPoints, endpointpb.LbEndpoint{ + lbEndPoints = append(lbEndPoints, &endpointpb.LbEndpoint{ HostIdentifier: &endpointpb.LbEndpoint_Endpoint{ Endpoint: &endpointpb.Endpoint{ - Address: &corepb.Address{ - Address: &corepb.Address_SocketAddress{ - SocketAddress: &corepb.SocketAddress{ - Protocol: corepb.TCP, + Address: &addresspb.Address{ + Address: &addresspb.Address_SocketAddress{ + SocketAddress: &addresspb.SocketAddress{ + Protocol: addresspb.SocketAddress_TCP, Address: host, - PortSpecifier: &corepb.SocketAddress_PortValue{ + PortSpecifier: &addresspb.SocketAddress_PortValue{ PortValue: uint32(port)}}}}}}}, ) } - clab.v.Endpoints = append(clab.v.Endpoints, endpointpb.LocalityLbEndpoints{ - Locality: &corepb.Locality{ + clab.v.Endpoints = append(clab.v.Endpoints, &endpointpb.LocalityLbEndpoints{ + Locality: &basepb.Locality{ Region: "", Zone: "", SubZone: subzone, @@ -105,7 +106,7 @@ func (clab *clusterLoadAssignmentBuilder) addLocality(subzone string, weight uin }) } -func (clab *clusterLoadAssignmentBuilder) build() *xdspb.ClusterLoadAssignment { +func (clab *clusterLoadAssignmentBuilder) build() *edspb.ClusterLoadAssignment { return clab.v } diff --git a/balancer/xds/internal/proto/envoy/api/v2/auth/cert/cert.pb.go b/balancer/xds/internal/proto/envoy/api/v2/auth/cert/cert.pb.go new file mode 100755 index 000000000000..8c774248b2f5 --- /dev/null +++ b/balancer/xds/internal/proto/envoy/api/v2/auth/cert/cert.pb.go @@ -0,0 +1,1144 @@ +// 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/balancer/xds/internal/proto/envoy/api/v2/core/base" +import config_source "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/config_source" +import _ "google.golang.org/grpc/balancer/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, 0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f, 0xb0, 0x27, 0x85, 0x7e, 0x89, 0x91, 0x6f, 0xc7, 0x94, 0x11, 0x3b, 0xad, 0x94, 0x55, 0x15, + 0x91, 0x46, 0x2b, 0xea, 0x78, 0xad, 0xa4, 0xe3, 0xb5, 0xba, 0x41, 0xe0, 0x3e, 0xc1, 0xee, 0x98, + 0x58, 0x1b, 0xb1, 0xdb, 0xa3, 0x99, 0x5a, 0x8e, 0xe1, 0x46, 0x82, 0xf5, 0x52, 0xd5, 0x54, 0x17, + 0x82, 0x5f, 0x8b, 0x71, 0xfa, 0x2f, 0x54, 0x0e, 0x6a, 0x43, 0xd9, 0x61, 0xae, 0x71, 0x6e, 0x99, + 0xd4, 0xc9, 0x93, 0xe8, 0x1d, 0xd8, 0xc2, 0xae, 0x1b, 0x9c, 0xd8, 0xe4, 0x34, 0xa4, 0x2c, 0x7b, + 0x39, 0xa3, 0xd6, 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, 0x1b, 0xfa, 0x67, 0x13, 0x3b, + 0x99, 0x8d, 0x17, 0xe4, 0x6e, 0x32, 0x0e, 0x79, 0xe3, 0xa7, 0x12, 0xdc, 0x58, 0x86, 0x0c, 0x4d, + 0xa1, 0x31, 0x24, 0x87, 0x78, 0xec, 0x8a, 0xa2, 0xa7, 0x69, 0xff, 0x2a, 0x79, 0xb1, 0x6a, 0x9e, + 0x2a, 0xd5, 0x18, 0x31, 0x7c, 0x9e, 0xfa, 0xfb, 0x25, 0xb3, 0x59, 0x5a, 0x36, 0x9b, 0x19, 0xde, + 0x85, 0x79, 0xed, 0x6e, 0xc1, 0x66, 0x01, 0xbf, 0x98, 0x86, 0xe4, 0x41, 0xa5, 0xb6, 0xaa, 0x57, + 0xcd, 0x3f, 0x35, 0x40, 0xfb, 0x21, 0x17, 0x8c, 0x60, 0x2f, 0x55, 0xf2, 0x9f, 0x03, 0x72, 0x54, + 0x62, 0x6d, 0x55, 0x6a, 0x99, 0x50, 0x5d, 0x5f, 0x42, 0x05, 0x96, 0xee, 0xcc, 0x77, 0x91, 0x6d, + 0x28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05, 0x90, 0xb7, 0xcc, 0xd4, 0xe7, 0xd5, 0x82, 0xe9, + 0x1b, 0x41, 0x24, 0xbf, 0x4e, 0x7c, 0xc8, 0xa3, 0x0d, 0xf3, 0xe7, 0x12, 0x54, 0x23, 0x92, 0x42, + 0xf8, 0x3d, 0xb8, 0x38, 0x37, 0xc4, 0x62, 0x8e, 0xc5, 0x13, 0x71, 0x77, 0xc5, 0x5a, 0xcf, 0x8e, + 0xa9, 0x17, 0x65, 0xb0, 0xfc, 0x0a, 0x32, 0x58, 0x3c, 0xf1, 0x2a, 0xaf, 0x6e, 0xe2, 0x75, 0xab, + 0x50, 0x91, 0x89, 0xe9, 0xbe, 0x09, 0x57, 0x69, 0x10, 0x21, 0x86, 0x2c, 0x38, 0x9d, 0xe6, 0xc1, + 0xbb, 0x6b, 0x12, 0x5d, 0x4d, 0x80, 0xc7, 0xda, 0x57, 0x15, 0xb9, 0x75, 0x50, 0x55, 0xe2, 0xbe, + 0xf3, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3c, 0x5e, 0x86, 0x05, 0x2a, 0x0f, 0x00, 0x00, +} diff --git a/balancer/xds/internal/proto/envoy/api/v2/cds/cds.pb.go b/balancer/xds/internal/proto/envoy/api/v2/cds/cds.pb.go new file mode 100755 index 000000000000..f3ec0c4ed8c4 --- /dev/null +++ b/balancer/xds/internal/proto/envoy/api/v2/cds/cds.pb.go @@ -0,0 +1,1771 @@ +// 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/balancer/xds/internal/proto/envoy/api/v2/auth/cert" +import circuit_breaker "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/cluster/circuit_breaker" +import outlier_detection "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/cluster/outlier_detection" +import address "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/address" +import base "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/base" +import config_source "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/config_source" +import health_check "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/health_check" +import protocol "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/protocol" +import discovery "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/discovery" +import eds "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/eds" +import percent "google.golang.org/grpc/balancer/xds/internal/proto/envoy/type/percent" +import _ "google.golang.org/grpc/balancer/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_1dff7e464f9f9a10, []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 +) + +var Cluster_LbPolicy_name = map[int32]string{ + 0: "ROUND_ROBIN", + 1: "LEAST_REQUEST", + 2: "RING_HASH", + 3: "RANDOM", + 4: "ORIGINAL_DST_LB", + 5: "MAGLEV", +} +var Cluster_LbPolicy_value = map[string]int32{ + "ROUND_ROBIN": 0, + "LEAST_REQUEST": 1, + "RING_HASH": 2, + "RANDOM": 3, + "ORIGINAL_DST_LB": 4, + "MAGLEV": 5, +} + +func (x Cluster_LbPolicy) String() string { + return proto.EnumName(Cluster_LbPolicy_name, int32(x)) +} +func (Cluster_LbPolicy) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_cds_1dff7e464f9f9a10, []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_1dff7e464f9f9a10, []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_1dff7e464f9f9a10, []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_1dff7e464f9f9a10, []int{0, 4, 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_1dff7e464f9f9a10, []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"` + 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_1dff7e464f9f9a10, []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) 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_1dff7e464f9f9a10, []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_1dff7e464f9f9a10, []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"` + 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_1dff7e464f9f9a10, []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 +} + +type Cluster_LbSubsetConfig_LbSubsetSelector struct { + Keys []string `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,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_1dff7e464f9f9a10, []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 +} + +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_1dff7e464f9f9a10, []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_1dff7e464f9f9a10, []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_1dff7e464f9f9a10, []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"` + 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_1dff7e464f9f9a10, []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 +} + +// 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_1dff7e464f9f9a10, []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_1dff7e464f9f9a10, []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_1dff7e464f9f9a10, []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_1dff7e464f9f9a10, []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_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_1dff7e464f9f9a10) } + +var fileDescriptor_cds_1dff7e464f9f9a10 = []byte{ + // 2531 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x59, 0x4b, 0x77, 0x1b, 0xb7, + 0x15, 0xd6, 0x50, 0x74, 0x4c, 0x43, 0x7c, 0x8c, 0x20, 0x59, 0x1a, 0x53, 0x96, 0x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ef, 0x39, 0xb6, 0x39, 0x32, 0xde, 0x11, 0xfb, 0x74, 0x2f, 0xd9, 0x09, 0xcd, 0xde, 0x89, 0x40, + 0x4d, 0x6e, 0x11, 0xca, 0x38, 0x6a, 0x16, 0xbe, 0x0f, 0x6e, 0x0c, 0x3c, 0xc6, 0x99, 0x71, 0x73, + 0x67, 0x79, 0x77, 0x65, 0xbf, 0x38, 0x4d, 0x12, 0x1d, 0xd4, 0x72, 0x45, 0x26, 0x9c, 0x6a, 0xca, + 0xd0, 0x90, 0x04, 0xc3, 0x26, 0x28, 0x38, 0x1e, 0xb1, 0x30, 0x61, 0xcc, 0x3e, 0x77, 0x87, 0xd4, + 0xe5, 0xc6, 0x03, 0xf1, 0x51, 0xc9, 0xc1, 0xd2, 0xf4, 0x88, 0x55, 0x19, 0x43, 0x51, 0xde, 0x99, + 0x1a, 0xc3, 0x1a, 0xc8, 0x4d, 0xa6, 0x0c, 0x66, 0x64, 0xc4, 0x5a, 0xee, 0x25, 0xac, 0xe5, 0x50, + 0xe0, 0x6a, 0x11, 0x0c, 0x65, 0x07, 0x57, 0x03, 0x06, 0xbf, 0x02, 0x5b, 0x43, 0xf2, 0x0a, 0x07, + 0xf4, 0xdb, 0x90, 0x32, 0xce, 0xf0, 0xf4, 0x36, 0x18, 0xb7, 0xde, 0xc2, 0xe7, 0xc6, 0x90, 0xbc, + 0x42, 0x4a, 0xff, 0x64, 0xd2, 0xfd, 0xf0, 0x04, 0xe8, 0x33, 0x99, 0x88, 0x19, 0x40, 0x30, 0x3e, + 0x9a, 0x59, 0x64, 0x1c, 0xce, 0x12, 0x5d, 0x55, 0x60, 0x54, 0x30, 0xa7, 0x27, 0xe0, 0x01, 0x58, + 0xe1, 0x0e, 0x8b, 0x56, 0xc8, 0xe9, 0x2b, 0x6e, 0xac, 0x24, 0x91, 0x45, 0xd9, 0xbc, 0x7c, 0xea, + 0x33, 0x1e, 0x50, 0x32, 0xec, 0x3a, 0xac, 0x26, 0xc1, 0x08, 0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 0x75, 0x64, 0x2f, 0x07, 0xcf, 0x40, 0xbe, 0x23, 0x8d, 0x4b, 0x00, 0x83, + 0x33, 0x0f, 0x73, 0x63, 0x0d, 0x55, 0xed, 0x8a, 0xf7, 0xaf, 0x95, 0x33, 0xdf, 0x73, 0x19, 0x2d, + 0x2d, 0xed, 0x6a, 0x3f, 0xd3, 0xe0, 0x37, 0x20, 0x57, 0xa7, 0x0e, 0x27, 0x63, 0xde, 0x99, 0xc7, + 0x43, 0x21, 0x9c, 0x23, 0x7f, 0xb8, 0x18, 0x34, 0x65, 0x81, 0x81, 0xdc, 0x01, 0xe5, 0xe6, 0xe0, + 0xff, 0xb7, 0xf2, 0x07, 0xdf, 0xff, 0xe3, 0x5f, 0x7f, 0x4c, 0x6d, 0x95, 0x36, 0xa6, 0xfe, 0x15, + 0xf2, 0x89, 0x8a, 0x15, 0xf6, 0x89, 0xf6, 0xa4, 0xfa, 0x1e, 0x28, 0xda, 0x9e, 0xe4, 0xf1, 0x03, + 0xef, 0xd5, 0x68, 0x8a, 0xb2, 0x9a, 0xa9, 0x59, 0x4c, 0x04, 0xea, 0x89, 0xf6, 0x07, 0x4d, 0xeb, + 0xbd, 0x23, 0x12, 0xc3, 0xd3, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xe0, 0x16, 0x40, 0xfc, 0x0e, + 0x1a, 0x00, 0x00, +} diff --git a/balancer/xds/internal/proto/envoy/api/v2/cluster/circuit_breaker/circuit_breaker.pb.go b/balancer/xds/internal/proto/envoy/api/v2/cluster/circuit_breaker/circuit_breaker.pb.go new file mode 100755 index 000000000000..da52dc0506cb --- /dev/null +++ b/balancer/xds/internal/proto/envoy/api/v2/cluster/circuit_breaker/circuit_breaker.pb.go @@ -0,0 +1,185 @@ +// 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/balancer/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_dc7392708e718eb5, []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_dc7392708e718eb5, []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_dc7392708e718eb5) +} + +var fileDescriptor_circuit_breaker_dc7392708e718eb5 = []byte{ + // 417 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0x86, 0xe5, 0xa6, 0xb4, 0xd5, 0x06, 0x25, 0xd2, 0x52, 0x21, 0x2b, 0xaa, 0x50, 0x94, 0x0b, + 0x11, 0x87, 0x35, 0x72, 0xcf, 0x80, 0x48, 0xd4, 0x03, 0x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9, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xae, 0xe0, 0x40, 0x7b, 0x2c, 0x03, 0x00, + 0x00, +} diff --git a/balancer/xds/internal/proto/envoy/api/v2/cluster/outlier_detection/outlier_detection.pb.go b/balancer/xds/internal/proto/envoy/api/v2/cluster/outlier_detection/outlier_detection.pb.go new file mode 100755 index 000000000000..5ce5b6d6c68e --- /dev/null +++ b/balancer/xds/internal/proto/envoy/api/v2/cluster/outlier_detection/outlier_detection.pb.go @@ -0,0 +1,185 @@ +// 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/balancer/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"` + 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_c374e0b25113dd85, []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 init() { + proto.RegisterType((*OutlierDetection)(nil), "envoy.api.v2.cluster.OutlierDetection") +} + +func init() { + proto.RegisterFile("envoy/api/v2/cluster/outlier_detection.proto", fileDescriptor_outlier_detection_c374e0b25113dd85) +} + +var fileDescriptor_outlier_detection_c374e0b25113dd85 = []byte{ + // 526 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xed, 0x6a, 0x13, 0x4d, + 0x14, 0xc7, 0x9f, 0xa4, 0xef, 0x53, 0x78, 0x2c, 0x43, 0x4d, 0x26, 0xad, 0x88, 0x04, 0x04, 0x29, + 0x32, 0x0b, 0x29, 0xbd, 0x80, 0xa6, 0x4d, 0xd5, 0x0f, 0x6a, 0x48, 0x34, 0x22, 0x2a, 0xc3, 0x64, + 0x73, 0x12, 0x47, 0x76, 0x77, 0xd6, 0x79, 0xd9, 0x6e, 0xbc, 0xa4, 0x5e, 0x82, 0x9f, 0xbc, 0x1d, + 0xaf, 0xc1, 0x2f, 0xb2, 0x3b, 0x79, 0xd9, 0xa4, 0x01, 0x93, 0x6f, 0x0b, 0x73, 0x7e, 0xbf, 0xff, + 0xd9, 0x99, 0xc3, 0x41, 0xcf, 0x21, 0x4a, 0xe4, 0xd8, 0xe3, 0xb1, 0xf0, 0x92, 0x86, 0xe7, 0x07, + 0x56, 0x1b, 0x50, 0x9e, 0xb4, 0x26, 0x10, 0xa0, 0xd8, 0x00, 0x0c, 0xf8, 0x46, 0xc8, 0x88, 0xc6, + 0x4a, 0x1a, 0x89, 0x8f, 0xf3, 0x6a, 0xca, 0x63, 0x41, 0x93, 0x06, 0x9d, 0x54, 0x9f, 0x3c, 0x1e, + 0x49, 0x39, 0x0a, 0xc0, 0xcb, 0x6b, 0xfa, 0x76, 0xe8, 0x0d, 0xac, 0xe2, 0x73, 0xea, 0xfe, 0xf9, + 0xad, 0xe2, 0x71, 0x0c, 0x4a, 0x4f, 0xce, 0xab, 0x09, 0x0f, 0xc4, 0x80, 0x1b, 0xf0, 0xa6, 0x1f, + 0xee, 0xa0, 0xfe, 0x67, 0x0f, 0x1d, 0xbd, 0x75, 0xad, 0x5c, 0x4f, 0x3b, 0xc1, 0x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da, 0x90, 0x7d, 0x95, 0xda, 0x68, 0xb2, 0xb7, 0xc6, 0x20, 0x54, 0xf5, + 0x5c, 0xf7, 0xda, 0xd1, 0x2f, 0x33, 0x18, 0x7f, 0x42, 0xa7, 0x0b, 0x6a, 0x05, 0xdf, 0x2d, 0x68, + 0xc3, 0x12, 0x19, 0xd8, 0x10, 0xc8, 0xfe, 0x1a, 0x6e, 0x52, 0x70, 0x77, 0x1c, 0xde, 0xcb, 0x69, + 0xfc, 0x01, 0xd5, 0x16, 0xe4, 0xda, 0x0c, 0x20, 0x61, 0x43, 0xee, 0x1b, 0xa9, 0xc8, 0xc1, 0x1a, + 0xea, 0x4a, 0x41, 0xdd, 0xcd, 0xe0, 0x9b, 0x9c, 0xc5, 0x9f, 0xd1, 0x69, 0xf1, 0x29, 0x47, 0xdc, + 0xc0, 0x2d, 0x1f, 0xb3, 0x21, 0x17, 0x81, 0x55, 0x40, 0xd0, 0x1a, 0xea, 0x5a, 0x41, 0xf0, 0xc2, + 0xf1, 0x37, 0x0e, 0xc7, 0x3f, 0xd0, 0xd3, 0xd5, 0x23, 0xb3, 0x9c, 0x73, 0xb8, 0xd9, 0xe3, 0xd6, + 0x57, 0x8d, 0xcf, 0x62, 0x76, 0xb3, 0x87, 0xea, 0x42, 0xd2, 0x7c, 0xe3, 0xc4, 0x4a, 0xa6, 0x63, + 0xba, 0x6a, 0xf9, 0x34, 0x1f, 0x2e, 0x2f, 0x88, 0x76, 0x16, 0xdd, 0x2e, 0xdd, 0x95, 0x2b, 0xad, + 0xbc, 0xfe, 0x32, 0x16, 0xb4, 0xd7, 0xa0, 0x57, 0xae, 0xfe, 0x4d, 0xb7, 0xbf, 0x9b, 0x37, 0x77, + 0xfe, 0x37, 0x00, 0x00, 0xff, 0xff, 0xfa, 0xbc, 0x0f, 0x9b, 0xfb, 0x04, 0x00, 0x00, +} diff --git a/balancer/xds/internal/proto/envoy/api/v2/core/address/address.pb.go b/balancer/xds/internal/proto/envoy/api/v2/core/address/address.pb.go new file mode 100755 index 000000000000..85e7fa0b7857 --- /dev/null +++ b/balancer/xds/internal/proto/envoy/api/v2/core/address/address.pb.go @@ -0,0 +1,610 @@ +// 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/balancer/xds/internal/proto/envoy/api/v2/core/base" +import _ "google.golang.org/grpc/balancer/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, 0x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, + 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/balancer/xds/internal/proto/envoy/api/v2/core/base/base.pb.go b/balancer/xds/internal/proto/envoy/api/v2/core/base/base.pb.go new file mode 100755 index 000000000000..3345eb0a9d46 --- /dev/null +++ b/balancer/xds/internal/proto/envoy/api/v2/core/base/base.pb.go @@ -0,0 +1,1121 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: envoy/api/v2/core/base.proto + +package 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/balancer/xds/internal/proto/envoy/type/percent" +import _ "google.golang.org/grpc/balancer/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_33c58439b08f821d, []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 +) + +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", +} +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, +} + +func (x RequestMethod) String() string { + return proto.EnumName(RequestMethod_name, int32(x)) +} +func (RequestMethod) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_base_33c58439b08f821d, []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_33c58439b08f821d, []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_33c58439b08f821d, []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_33c58439b08f821d, []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_33c58439b08f821d, []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_33c58439b08f821d, []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_33c58439b08f821d, []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_33c58439b08f821d, []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_33c58439b08f821d, []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_33c58439b08f821d, []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_33c58439b08f821d, []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_33c58439b08f821d, []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_33c58439b08f821d, []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_33c58439b08f821d, []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_33c58439b08f821d) } + +var fileDescriptor_base_33c58439b08f821d = []byte{ + // 1117 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xcd, 0x6e, 0xdb, 0x46, + 0x10, 0x36, 0xf5, 0x67, 0x69, 0x28, 0xd9, 0xcc, 0x26, 0x48, 0x14, 0x37, 0x4e, 0x5c, 0xf5, 0x50, + 0x23, 0x45, 0xa9, 0x56, 0x29, 0xd0, 0xb4, 0x37, 0xd3, 0xa2, 0x23, 0xa1, 0xb6, 0xa4, 0x50, 0x74, + 0x5a, 0xe4, 0xa2, 0xae, 0xc4, 0x95, 0xb3, 0x08, 0xc3, 0x65, 0x97, 0x4b, 0xb5, 0xca, 0xa1, 0x08, + 0x7a, 0x6c, 0x1e, 0xa5, 0xe8, 0xbd, 0xe8, 0x29, 0x40, 0x4f, 0x7d, 0x94, 0xbc, 0x45, 0xb1, 0x3f, + 0x72, 0xe4, 0xd8, 0x68, 0x6e, 0xbb, 0xdf, 0x7c, 0xdf, 0x70, 0x66, 0x76, 0x66, 0x08, 0x77, 0x48, + 0xb2, 0x60, 0xcb, 0x36, 0x4e, 0x69, 0x7b, 0xd1, 0x69, 0xcf, 0x18, 0x27, 0xed, 0x29, 0xce, 0x88, + 0x9b, 0x72, 0x26, 0x18, 0xba, 0xa6, 0xac, 0x2e, 0x4e, 0xa9, 0xbb, 0xe8, 0xb8, 0xd2, 0xba, 0x73, + 0xfb, 0x8c, 0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b, 0xb5, 0x05, 0xd7, 0xd6, 0x7c, 0x0e, 0x53, 0x21, 0x5b, 0xd0, 0x83, 0xca, 0x33, 0x05, 0x2a, + 0xe7, 0x76, 0xe7, 0xee, 0x15, 0x75, 0x5f, 0x53, 0x79, 0x20, 0x3d, 0x97, 0x7f, 0xb7, 0x0a, 0x8e, + 0x15, 0x18, 0x25, 0xea, 0x40, 0x45, 0x4e, 0x4b, 0x12, 0x99, 0x12, 0xee, 0x5c, 0x2a, 0xa1, 0xc7, + 0x58, 0xac, 0xf4, 0x81, 0x61, 0xb6, 0x7c, 0xa8, 0x69, 0xb7, 0x27, 0x38, 0x45, 0x0f, 0x61, 0x53, + 0xbb, 0xca, 0xcc, 0xeb, 0x7f, 0x20, 0x8a, 0x60, 0x45, 0x6f, 0xfd, 0x61, 0x01, 0x74, 0xb1, 0xc0, + 0x63, 0x96, 0xf3, 0x19, 0x41, 0x9f, 0x42, 0x75, 0x4e, 0x63, 0x92, 0xe0, 0x17, 0xc4, 0x14, 0xeb, + 0x5d, 0x7d, 0x7b, 0x1b, 0xc1, 0xb9, 0x11, 0xb9, 0x50, 0xa7, 0x49, 0x4c, 0x13, 0x32, 0x99, 0x2e, + 0x05, 0xc9, 0x54, 0xe0, 0x75, 0x43, 0x7e, 0x59, 0x70, 0x24, 0xd9, 0xd6, 0x04, 0x4f, 0xda, 0xd1, + 0x17, 0xd0, 0x30, 0xfc, 0x4c, 0x70, 0x9a, 0x9c, 0x5d, 0x7a, 0xbd, 0xde, 0x46, 0x60, 0x3c, 0x8e, + 0x15, 0xc1, 0x43, 0x50, 0xcb, 0x52, 0x32, 0xa3, 0x73, 0x4a, 0x38, 0x2a, 0xff, 0xf5, 0xf6, 0x4d, + 0xd1, 0x6a, 0xfd, 0x69, 0xc1, 0x76, 0xc8, 0x71, 0x92, 0xa5, 0x8c, 0x8b, 0x31, 0x9b, 0x3d, 0x27, + 0x02, 0xed, 0x42, 0xe9, 0xca, 0x70, 0x03, 0x05, 0xa3, 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 0x3c, 0x1c, 0x0e, 0x06, 0xfe, 0x61, 0xe8, 0x54, 0xe4, 0x65, + 0x38, 0x0a, 0xfb, 0xc3, 0xc1, 0xd8, 0xd9, 0x44, 0x35, 0x28, 0x87, 0xc1, 0xc1, 0xa1, 0xef, 0x54, + 0xbd, 0xaf, 0xe0, 0x1e, 0x65, 0xba, 0x6e, 0x29, 0x67, 0xbf, 0x2c, 0x2f, 0x37, 0x86, 0x57, 0xf3, + 0x70, 0x46, 0x46, 0x72, 0x0c, 0x46, 0xd6, 0xd3, 0x92, 0x84, 0xa6, 0x15, 0x35, 0x15, 0x0f, 0xfe, + 0x0b, 0x00, 0x00, 0xff, 0xff, 0x42, 0xb6, 0x68, 0xfe, 0x73, 0x08, 0x00, 0x00, +} diff --git a/balancer/xds/internal/proto/envoy/api/v2/core/config_source/config_source.pb.go b/balancer/xds/internal/proto/envoy/api/v2/core/config_source/config_source.pb.go new file mode 100755 index 000000000000..d8b71b6caa39 --- /dev/null +++ b/balancer/xds/internal/proto/envoy/api/v2/core/config_source/config_source.pb.go @@ -0,0 +1,446 @@ +// 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/balancer/xds/internal/proto/envoy/api/v2/core/grpc_service" +import _ "google.golang.org/grpc/balancer/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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 0x6a, 0x4f, 0xe5, 0x04, 0x00, 0x00, +} diff --git a/balancer/xds/internal/proto/envoy/api/v2/core/grpc_service/grpc_service.pb.go b/balancer/xds/internal/proto/envoy/api/v2/core/grpc_service/grpc_service.pb.go new file mode 100755 index 000000000000..832c2ca26e0c --- /dev/null +++ b/balancer/xds/internal/proto/envoy/api/v2/core/grpc_service/grpc_service.pb.go @@ -0,0 +1,1196 @@ +// 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/balancer/xds/internal/proto/envoy/api/v2/core/base" +import _ "google.golang.org/grpc/balancer/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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0x96, 0xd4, 0x28, 0x61, 0x5d, 0xec, 0x88, 0x76, 0x51, 0xac, + 0xcf, 0x10, 0xf7, 0x63, 0x7d, 0xb3, 0x3c, 0xe3, 0xdb, 0x32, 0xae, 0xcd, 0xdb, 0xe0, 0x59, 0x12, + 0xd6, 0xd6, 0x39, 0x6b, 0xa0, 0xb9, 0x05, 0x55, 0xf7, 0xa4, 0x4f, 0x43, 0x4f, 0xca, 0xb7, 0xca, + 0xd5, 0xc5, 0xe6, 0xb7, 0xf0, 0x09, 0x17, 0x76, 0x98, 0x12, 0x29, 0xde, 0x8c, 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/balancer/xds/internal/proto/envoy/api/v2/core/health_check/health_check.pb.go b/balancer/xds/internal/proto/envoy/api/v2/core/health_check/health_check.pb.go new file mode 100755 index 000000000000..e7df297afde4 --- /dev/null +++ b/balancer/xds/internal/proto/envoy/api/v2/core/health_check/health_check.pb.go @@ -0,0 +1,998 @@ +// 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/balancer/xds/internal/proto/envoy/api/v2/core/base" +import _range "google.golang.org/grpc/balancer/xds/internal/proto/envoy/type/range" +import _ "google.golang.org/grpc/balancer/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_96ed99a3bbe98749, []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"` + 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_96ed99a3bbe98749, []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) 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_96ed99a3bbe98749, []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_96ed99a3bbe98749, []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_96ed99a3bbe98749, []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_96ed99a3bbe98749, []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_96ed99a3bbe98749, []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_96ed99a3bbe98749, []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_96ed99a3bbe98749) +} + +var fileDescriptor_health_check_96ed99a3bbe98749 = []byte{ + // 1166 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x96, 0xdf, 0x72, 0xdb, 0xc4, + 0x17, 0xc7, 0xad, 0xd8, 0x89, 0xed, 0x63, 0x27, 0x91, 0xd7, 0xbf, 0x26, 0xaa, 0x7f, 0x81, 0x1a, + 0x26, 0xc3, 0x64, 0x3a, 0x83, 0x0c, 0x2e, 0x94, 0x29, 0x57, 0xc4, 0x49, 0x5a, 0xbb, 0xb4, 0x6e, + 0x66, 0xeb, 0x94, 0xe9, 0x0c, 0x8c, 0xd8, 0x48, 0x27, 0xb6, 0xa8, 0xa2, 0x15, 0xab, 0x95, 0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ff, 0x31, 0x86, 0x71, 0x0b, 0x55, 0x0b, 0x00, 0x00, +} diff --git a/balancer/xds/internal/proto/envoy/api/v2/core/protocol/protocol.pb.go b/balancer/xds/internal/proto/envoy/api/v2/core/protocol/protocol.pb.go new file mode 100755 index 000000000000..1c07ca5463b0 --- /dev/null +++ b/balancer/xds/internal/proto/envoy/api/v2/core/protocol/protocol.pb.go @@ -0,0 +1,311 @@ +// 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/balancer/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, 0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0x33, 0xea, 0x2f, 0xa9, 0x4f, 0xc8, 0x9a, 0xbd, 0x28, 0x97, 0x19, 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/balancer/xds/internal/proto/envoy/api/v2/discovery/discovery.pb.go b/balancer/xds/internal/proto/envoy/api/v2/discovery/discovery.pb.go new file mode 100755 index 000000000000..629c77017bc2 --- /dev/null +++ b/balancer/xds/internal/proto/envoy/api/v2/discovery/discovery.pb.go @@ -0,0 +1,446 @@ +// 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/balancer/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_a1ffda4a09a0e500, []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_a1ffda4a09a0e500, []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_a1ffda4a09a0e500, []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"` + 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_a1ffda4a09a0e500, []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) 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_a1ffda4a09a0e500, []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_a1ffda4a09a0e500) +} + +var fileDescriptor_discovery_a1ffda4a09a0e500 = []byte{ + // 656 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, 0x3f, + 0xd6, 0x9f, 0xd5, 0x53, 0x8b, 0x56, 0x2b, 0x5b, 0x4a, 0x44, 0xf0, 0x4d, 0x33, 0xf3, 0x66, 0x76, + 0xde, 0xcc, 0x1b, 0xc1, 0x31, 0xb2, 0x94, 0x67, 0x36, 0x8d, 0x02, 0x3b, 0x75, 0xec, 0x65, 0x20, + 0x7d, 0x9e, 0xa2, 0xc8, 0xac, 0x48, 0xf0, 0x98, 0x93, 0xa1, 0x8a, 0x5a, 0x34, 0x0a, 0xac, 0xd4, + 0x19, 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 0x51, 0xec, + 0xf6, 0x46, 0x8a, 0x1d, 0x7f, 0x86, 0xe3, 0xa7, 0xda, 0x22, 0x7b, 0xd0, 0xfe, 0x8a, 0x99, 0x96, + 0x6c, 0xfe, 0x99, 0x6b, 0x28, 0xa5, 0x61, 0x82, 0x7a, 0x3b, 0x85, 0xf1, 0xb6, 0x75, 0x6a, 0x4c, + 0x7f, 0x1b, 0x30, 0x7a, 0xc8, 0x5c, 0x9f, 0x80, 0x05, 0xff, 0xc9, 0x4c, 0xc6, 0x78, 0xef, 0x35, + 0x5c, 0xc2, 0x7e, 0x11, 0xba, 0xa9, 0xdc, 0xc3, 0xeb, 0xc7, 0xf7, 0x30, 0xaa, 0x8f, 0xb8, 0x6c, + 0xb7, 0x7a, 0x11, 0x27, 0xb0, 0x2f, 0xf0, 0x9e, 0xa7, 0xb8, 0xf4, 0xd6, 0xd9, 0x5d, 0xb5, 0xdd, + 0x3d, 0x1d, 0x70, 0x57, 0xe0, 0xc6, 0x5b, 0x98, 0xfe, 0x32, 0xa0, 0x57, 0x62, 0x08, 0x81, 0x4e, + 0xae, 0x16, 0x75, 0x5f, 0x7d, 0x57, 0x7d, 0x13, 0x13, 0xb6, 0x69, 0x18, 0x50, 0x89, 0x52, 0xeb, + 0xa6, 0x34, 0xf3, 0x88, 0x26, 0xa7, 0x79, 0x95, 0x26, 0x79, 0x09, 0xbd, 0xb2, 0x1f, 0xfd, 0x9f, + 0x6b, 0x3e, 0xee, 0x15, 0xea, 0xcc, 0x81, 0x71, 0xc0, 0x0b, 0xc2, 0x91, 0xe0, 0xdf, 0xb3, 0x1a, + 0xf7, 0xb3, 0xdd, 0xd5, 0x80, 0x2f, 0xf3, 0xf4, 0x4b, 0xe3, 0x4b, 0x2b, 0x75, 0x16, 0x5d, 0x55, + 0xeb, 0xd5, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x98, 0x91, 0xb2, 0x9f, 0x08, 0x06, 0x00, 0x00, +} diff --git a/balancer/xds/internal/proto/envoy/api/v2/eds/eds.pb.go b/balancer/xds/internal/proto/envoy/api/v2/eds/eds.pb.go new file mode 100755 index 000000000000..aa66cc72563e --- /dev/null +++ b/balancer/xds/internal/proto/envoy/api/v2/eds/eds.pb.go @@ -0,0 +1,376 @@ +// 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 wrappers "github.com/golang/protobuf/ptypes/wrappers" +import _ "google.golang.org/genproto/googleapis/api/annotations" +import discovery "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/discovery" +import endpoint "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/endpoint/endpoint" +import percent "google.golang.org/grpc/balancer/xds/internal/proto/envoy/type/percent" +import _ "google.golang.org/grpc/balancer/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_fb0a999149ff4153, []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"` + 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_fb0a999149ff4153, []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 +} + +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_fb0a999149ff4153, []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) + 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) 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 + 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_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, + }, + }, + Metadata: "envoy/api/v2/eds.proto", +} + +func init() { proto.RegisterFile("envoy/api/v2/eds.proto", fileDescriptor_eds_fb0a999149ff4153) } + +var fileDescriptor_eds_fb0a999149ff4153 = []byte{ + // 612 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xee, 0x3a, 0x6d, 0xd5, 0x6e, 0x43, 0x52, 0x2d, 0xa2, 0xb1, 0xac, 0xd0, 0x46, 0x11, 0x48, + 0x51, 0x40, 0x36, 0x4a, 0x85, 0x8a, 0x72, 0x23, 0x34, 0x11, 0xa0, 0x08, 0x22, 0x57, 0x20, 0x4e, + 0x84, 0x8d, 0xbd, 0x35, 0x2b, 0x9c, 0xdd, 0x65, 0xbd, 0x31, 0xf8, 0xc0, 0x85, 0x13, 0x77, 0xde, + 0x86, 0x13, 0x6f, 0xc0, 0x81, 0x57, 0xe0, 0x82, 0xfa, 0x12, 0xc8, 0xbf, 0x89, 0x69, 0x2a, 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 0x5d, 0x15, 0x80, 0x6e, + 0xc3, 0x1d, 0x07, 0x2b, 0xe2, 0x71, 0x19, 0x5d, 0x1e, 0xad, 0x22, 0x84, 0x46, 0xb0, 0x9e, 0x34, + 0x9e, 0x2d, 0x03, 0xf6, 0x72, 0x23, 0x6f, 0x66, 0x9d, 0xc7, 0xab, 0x62, 0x8e, 0x24, 0x76, 0xe2, + 0x75, 0xc0, 0xfe, 0x24, 0xcd, 0xb3, 0x13, 0xbb, 0x26, 0x05, 0xe8, 0xe9, 0xe6, 0x0e, 0xd8, 0xd7, + 0x7a, 0x17, 0x00, 0xea, 0xb9, 0xd3, 0xa7, 0xf9, 0x82, 0x9e, 0x11, 0x19, 0x52, 0x87, 0xa0, 0x57, + 0xb0, 0x7e, 0xa6, 0x24, 0xc1, 0xf3, 0xe5, 0xa4, 0x1c, 0x96, 0xed, 0x2d, 0x20, 0x36, 0x79, 0xbf, + 0x20, 0x81, 0x32, 0x8e, 0xae, 0x8c, 0x07, 0x82, 0xb3, 0x80, 0xb4, 0x37, 0x3a, 0xe0, 0x1e, 0x40, + 0x0b, 0x58, 0x1b, 0x11, 0xe5, 0xbc, 0xfd, 0x8f, 0xc4, 0xed, 0xcf, 0x3f, 0x7f, 0x7d, 0xd5, 0x9a, + 0xed, 0x46, 0xe9, 0x5f, 0xd3, 0x2f, 0x76, 0xa6, 0x0f, 0xba, 0x83, 0x3b, 0xd0, 0xa0, 0x3c, 0x25, + 0x12, 0x92, 0x7f, 0x8c, 0x4a, 0x9c, 0x83, 0x9d, 0xa1, 0x1b, 0x4c, 0xe2, 0xc7, 0x9c, 0x80, 0x2f, + 0x00, 0xcc, 0xb6, 0x93, 0x87, 0x3d, 0xfe, 0x13, 0x00, 0x00, 0xff, 0xff, 0xe7, 0x56, 0x21, 0x69, + 0xec, 0x04, 0x00, 0x00, +} diff --git a/balancer/xds/internal/proto/envoy/api/v2/endpoint/endpoint/endpoint.pb.go b/balancer/xds/internal/proto/envoy/api/v2/endpoint/endpoint/endpoint.pb.go new file mode 100755 index 000000000000..2ae03d6aa404 --- /dev/null +++ b/balancer/xds/internal/proto/envoy/api/v2/endpoint/endpoint/endpoint.pb.go @@ -0,0 +1,385 @@ +// 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/balancer/xds/internal/proto/envoy/api/v2/core/address" +import base "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/base" +import health_check "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/health_check" +import _ "google.golang.org/grpc/balancer/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_2d1a533d75f3064c, []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_2d1a533d75f3064c, []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_2d1a533d75f3064c, []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"` + 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_2d1a533d75f3064c, []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 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_2d1a533d75f3064c) +} + +var fileDescriptor_endpoint_2d1a533d75f3064c = []byte{ + // 556 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0xc1, 0x6e, 0xd3, 0x4c, + 0x18, 0xac, 0xe3, 0xa6, 0x4d, 0x37, 0xc9, 0xff, 0x2b, 0x8e, 0x2a, 0xac, 0x50, 0xd1, 0x12, 0x0a, + 0x8a, 0x72, 0x58, 0x8b, 0x14, 0x89, 0x13, 0x02, 0xdc, 0x22, 0x05, 0xa9, 0xa0, 0x6a, 0x11, 0x20, + 0x71, 0xc0, 0xfa, 0x6c, 0x6f, 0xe2, 0x15, 0x8e, 0xd7, 0xb2, 0x37, 0x2e, 0xb9, 0xf5, 0x41, 0x78, + 0x12, 0x4e, 0x3c, 0x4c, 0x2f, 0x3c, 0x45, 0x91, 0xd7, 0x5e, 0x37, 0x6d, 0x52, 0x71, 0xe1, 0xb6, + 0xde, 0x99, 0xf9, 0xbe, 0x99, 0xf1, 0xa2, 0x43, 0x1a, 0x65, 0x7c, 0x61, 0x41, 0xcc, 0xac, 0x6c, + 0x64, 0xd1, 0xc8, 0x8f, 0x39, 0x8b, 0x44, 0x75, 0xc0, 0x71, 0xc2, 0x05, 0x37, 0x76, 0x25, 0x0b, + 0x43, 0xcc, 0x70, 0x36, 0xc2, 0x0a, 0xec, 0xed, 0xdf, 0x10, 0x7b, 0x3c, 0xa1, 0x16, 0xf8, 0x7e, + 0x42, 0xd3, 0xb4, 0xd0, 0xf5, 0xf6, 0x56, 0x09, 0x2e, 0xa4, 0xb4, 0x44, 0x0f, 0x57, 0xd1, 0x80, + 0x42, 0x28, 0x02, 0xc7, 0x0b, 0xa8, 0xf7, 0xad, 0x64, 0x3d, 0x98, 0x72, 0x3e, 0x0d, 0xa9, 0x25, + 0xbf, 0xdc, 0xf9, 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xbb, 0xad, + 0x9c, 0x9f, 0xe5, 0x7e, 0xce, 0xb4, 0x2f, 0xd5, 0xcb, 0x73, 0xb7, 0xa4, 0xc5, 0xa3, 0x3f, 0x01, + 0x00, 0x00, 0xff, 0xff, 0x6b, 0xdf, 0xf4, 0xe1, 0x92, 0x04, 0x00, 0x00, +} diff --git a/balancer/xds/internal/proto/envoy/service/discovery/v2/ads/ads.pb.go b/balancer/xds/internal/proto/envoy/service/discovery/v2/ads/ads.pb.go new file mode 100755 index 000000000000..2efdb00eb522 --- /dev/null +++ b/balancer/xds/internal/proto/envoy/service/discovery/v2/ads/ads.pb.go @@ -0,0 +1,251 @@ +// 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/balancer/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/balancer/xds/internal/proto/envoy/type/percent/percent.pb.go b/balancer/xds/internal/proto/envoy/type/percent/percent.pb.go new file mode 100755 index 000000000000..423dbdcf55d3 --- /dev/null +++ b/balancer/xds/internal/proto/envoy/type/percent/percent.pb.go @@ -0,0 +1,160 @@ +// 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/balancer/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/balancer/xds/internal/proto/envoy/type/range/range.pb.go b/balancer/xds/internal/proto/envoy/type/range/range.pb.go new file mode 100755 index 000000000000..feee6ac9b036 --- /dev/null +++ b/balancer/xds/internal/proto/envoy/type/range/range.pb.go @@ -0,0 +1,132 @@ +// 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/balancer/xds/internal/proto/validate/validate.pb.go b/balancer/xds/internal/proto/validate/validate.pb.go new file mode 100755 index 000000000000..1495d52e0174 --- /dev/null +++ b/balancer/xds/internal/proto/validate/validate.pb.go @@ -0,0 +1,3214 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: validate/validate.proto + +package validate // import "google.golang.org/grpc/balancer/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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34, []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_4e427f48c21fab34) } + +var fileDescriptor_validate_4e427f48c21fab34 = []byte{ + // 1634 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x98, 0xcb, 0x6e, 0xdb, 0xce, + 0x15, 0xc6, 0x2b, 0xde, 0x44, 0x8d, 0xa5, 0x48, 0x9a, 0xd8, 0x0e, 0xe3, 0x5e, 0xe2, 0x68, 0x51, + 0x38, 0x69, 0x60, 0xa5, 0x8e, 0x2b, 0x04, 0x09, 0x5a, 0xa0, 0x46, 0x1a, 0x34, 0x68, 0xd3, 0x14, + 0x74, 0xb2, 0xe9, 0x46, 0xa0, 0xad, 0x11, 0x33, 0x30, 0x35, 0x64, 0x48, 0xca, 0xb6, 0x1e, 0x22, + 0x6d, 0x77, 0x7d, 0x96, 0xae, 0xba, 0xef, 0x9b, 0x74, 0xdd, 0x6d, 0x17, 0xc5, 0xdc, 0x78, 0x39, + 0xa4, 0xe5, 0xc5, 0x7f, 0xa7, 0x39, 0x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xc1, 0x79, 0x7d, + 0x85, 0xac, 0x58, 0x21, 0x93, 0x2b, 0xb8, 0x6d, 0x05, 0x95, 0x15, 0xa4, 0x0c, 0x9f, 0xa0, 0xee, + 0x92, 0xde, 0x92, 0xc5, 0xab, 0x13, 0xaf, 0x27, 0x2a, 0xf6, 0x2b, 0x1b, 0x20, 0x13, 0xba, 0x44, + 0x0b, 0x8b, 0x9a, 0xd9, 0xa9, 0x87, 0x5a, 0x6b, 0xca, 0x65, 0xb4, 0x10, 0xff, 0x0a, 0xb9, 0x99, + 0x5e, 0x68, 0x47, 0x14, 0x3d, 0xaa, 0xa0, 0x81, 0x95, 0x0a, 0x69, 0x59, 0x36, 0x3b, 0xf5, 0xfa, + 0xed, 0x65, 0xe5, 0x62, 0x85, 0x14, 0x3f, 0x43, 0xd6, 0x45, 0x1c, 0x47, 0xde, 0x40, 0x94, 0x3c, + 0x2c, 0x4b, 0xce, 0xe2, 0x38, 0xd2, 0x72, 0x21, 0x11, 0x8e, 0xe5, 0x29, 0x65, 0xa1, 0xf7, 0xa0, + 0xe1, 0x98, 0x88, 0x97, 0x8e, 0x89, 0x21, 0xff, 0x8f, 0x5c, 0x6c, 0x72, 0x92, 0x79, 0x43, 0xf8, + 0x1f, 0x39, 0xe3, 0xe1, 0xe2, 0x3f, 0x22, 0x44, 0x9c, 0x84, 0xb0, 0xf5, 0xca, 0x1b, 0x41, 0x92, + 0xdf, 0xb1, 0xf5, 0xaa, 0x20, 0xe1, 0x12, 0x6e, 0xeb, 0x8a, 0x64, 0x59, 0x10, 0x12, 0x6f, 0x0c, + 0x6d, 0xfd, 0x28, 0x13, 0x85, 0xad, 0x4a, 0xc8, 0xfd, 0x49, 0x49, 0x42, 0x82, 0x9c, 0x2c, 0x3c, + 0x0c, 0xfd, 0xf1, 0x55, 0xa6, 0xf0, 0x47, 0x4b, 0xf1, 0xcf, 0x91, 0xb9, 0x0a, 0x12, 0xef, 0xa1, + 0xa8, 0xc0, 0x95, 0x65, 0x82, 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, 0xc7, 0x06, 0x3c, 0xea, + 0xa1, 0xad, 0xf3, 0x98, 0x4d, 0x1e, 0x13, 0xf2, 0x98, 0x90, 0xc7, 0x84, 0x3c, 0x26, 0xe4, 0x31, + 0x5b, 0x78, 0xcc, 0xea, 0x86, 0x7d, 0xb9, 0xcb, 0xa0, 0x41, 0x13, 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, 0xf9, + 0x5d, 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, 0xf3, 0xbb, 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, 0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3f, 0x20, 0x3b, + 0x15, 0xfb, 0xdc, 0xac, 0x14, 0x8f, 0x76, 0xbd, 0xf2, 0xce, 0x53, 0x4b, 0xcc, 0x71, 0xf6, 0x19, + 0xed, 0x5d, 0xc6, 0xab, 0xe3, 0x68, 0xb3, 0xcc, 0x8f, 0x93, 0xf0, 0xba, 0x90, 0xfe, 0xe5, 0xad, + 0x9a, 0x3b, 0x8c, 0xa3, 0x80, 0x85, 0xc7, 0x71, 0x1a, 0x4e, 0xc3, 0x34, 0xb9, 0x9c, 0x5e, 0x04, + 0x51, 0xc0, 0x2e, 0x49, 0x3a, 0xbd, 0x5d, 0x64, 0x53, 0xca, 0xf8, 0xb5, 0x17, 0x44, 0xf2, 0x93, + 0x66, 0xf1, 0xed, 0xf4, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xdc, 0xca, 0x84, 0x71, 0x4f, 0x15, + 0x00, 0x00, +} diff --git a/balancer/xds/xds.go b/balancer/xds/xds.go index 1097920b84af..7795724f4114 100644 --- a/balancer/xds/xds.go +++ b/balancer/xds/xds.go @@ -31,10 +31,12 @@ import ( "sync" "time" - xdspb "github.com/envoyproxy/go-control-plane/envoy/api/v2" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/xds/edsbalancer" + cdspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/cds" + edspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/eds" + "google.golang.org/grpc/connectivity" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/resolver" @@ -96,7 +98,7 @@ func (b *xdsBalancerBuilder) Name() string { // It's implemented by the real eds balancer and a fake testing eds balancer. type edsBalancerInterface interface { // HandleEDSResponse passes the received EDS message from traffic director to eds balancer. - HandleEDSResponse(edsResp *xdspb.ClusterLoadAssignment) + HandleEDSResponse(edsResp *edspb.ClusterLoadAssignment) // HandleChildPolicy updates the eds balancer the intra-cluster load balancing policy to use. HandleChildPolicy(name string, config json.RawMessage) // HandleSubConnStateChange handles state change for SubConn. @@ -387,26 +389,26 @@ func (x *xdsBalancer) HandleBalancerConfig(config json.RawMessage) error { type cdsResp struct { ctx context.Context - resp *xdspb.Cluster + resp *cdspb.Cluster } type edsResp struct { ctx context.Context - resp *xdspb.ClusterLoadAssignment + resp *edspb.ClusterLoadAssignment } func (x *xdsBalancer) newADSResponse(ctx context.Context, resp proto.Message) error { var update interface{} switch u := resp.(type) { - case *xdspb.Cluster: + case *cdspb.Cluster: if u.GetName() != x.cc.Target() { return fmt.Errorf("unmatched service name, got %s, want %s", u.GetName(), x.cc.Target()) } - if u.GetType() != xdspb.Cluster_EDS { - return fmt.Errorf("unexpected service discovery type, got %v, want %v", u.GetType(), xdspb.Cluster_EDS) + if u.GetType() != cdspb.Cluster_EDS { + return fmt.Errorf("unexpected service discovery type, got %v, want %v", u.GetType(), cdspb.Cluster_EDS) } update = &cdsResp{ctx: ctx, resp: u} - case *xdspb.ClusterLoadAssignment: + case *edspb.ClusterLoadAssignment: // nothing to check update = &edsResp{ctx: ctx, resp: u} default: diff --git a/balancer/xds/xds_client.go b/balancer/xds/xds_client.go index 181bc3827209..0cc8d4c02b6a 100644 --- a/balancer/xds/xds_client.go +++ b/balancer/xds/xds_client.go @@ -25,13 +25,16 @@ import ( "sync" "time" - xdspb "github.com/envoyproxy/go-control-plane/envoy/api/v2" - xdscorepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" - xdsdiscoverypb "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2" - "github.com/gogo/protobuf/proto" - "github.com/gogo/protobuf/types" + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + structpb "github.com/golang/protobuf/ptypes/struct" "google.golang.org/grpc" "google.golang.org/grpc/balancer" + cdspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/cds" + basepb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/base" + discoverypb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/discovery" + edspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/eds" + adspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/discovery/v2/ads" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal/backoff" "google.golang.org/grpc/internal/channelz" @@ -56,7 +59,7 @@ var ( type client struct { ctx context.Context cancel context.CancelFunc - cli xdsdiscoverypb.AggregatedDiscoveryServiceClient + cli adspb.AggregatedDiscoveryServiceClient opts balancer.BuildOptions balancerName string // the traffic director name serviceName string // the user dial target name @@ -123,13 +126,13 @@ func (c *client) dial() { c.mu.Unlock() } -func (c *client) newCDSRequest() *xdspb.DiscoveryRequest { - cdsReq := &xdspb.DiscoveryRequest{ - Node: &xdscorepb.Node{ - Metadata: &types.Struct{ - Fields: map[string]*types.Value{ +func (c *client) newCDSRequest() *discoverypb.DiscoveryRequest { + cdsReq := &discoverypb.DiscoveryRequest{ + Node: &basepb.Node{ + Metadata: &structpb.Struct{ + Fields: map[string]*structpb.Value{ grpcHostname: { - Kind: &types.Value_StringValue{StringValue: c.serviceName}, + Kind: &structpb.Value_StringValue{StringValue: c.serviceName}, }, }, }, @@ -139,13 +142,13 @@ func (c *client) newCDSRequest() *xdspb.DiscoveryRequest { return cdsReq } -func (c *client) newEDSRequest() *xdspb.DiscoveryRequest { - edsReq := &xdspb.DiscoveryRequest{ - Node: &xdscorepb.Node{ - Metadata: &types.Struct{ - Fields: map[string]*types.Value{ +func (c *client) newEDSRequest() *discoverypb.DiscoveryRequest { + edsReq := &discoverypb.DiscoveryRequest{ + Node: &basepb.Node{ + Metadata: &structpb.Struct{ + Fields: map[string]*structpb.Value{ endpointRequired: { - Kind: &types.Value_BoolValue{BoolValue: c.enableCDS}, + Kind: &structpb.Value_BoolValue{BoolValue: c.enableCDS}, }, }, }, @@ -157,7 +160,7 @@ func (c *client) newEDSRequest() *xdspb.DiscoveryRequest { } func (c *client) makeADSCall() { - c.cli = xdsdiscoverypb.NewAggregatedDiscoveryServiceClient(c.cc) + c.cli = adspb.NewAggregatedDiscoveryServiceClient(c.cc) retryCount := 0 var doRetry bool @@ -228,15 +231,15 @@ func (c *client) adsCallAttempt() (firstRespReceived bool) { // start a new call as we receive CDS response when in EDS-only mode. return } - var adsResp types.DynamicAny - if err := types.UnmarshalAny(&resources[0], &adsResp); err != nil { + var adsResp ptypes.DynamicAny + if err := ptypes.UnmarshalAny(resources[0], &adsResp); err != nil { grpclog.Warningf("xds: failed to unmarshal resources due to %v.", err) return } switch adsResp.Message.(type) { - case *xdspb.Cluster: + case *cdspb.Cluster: expectCDS = false - case *xdspb.ClusterLoadAssignment: + case *edspb.ClusterLoadAssignment: if expectCDS { grpclog.Warningf("xds: expecting CDS response, got EDS response instead.") return diff --git a/balancer/xds/xds_client_test.go b/balancer/xds/xds_client_test.go index 409ee099ad4a..416a97fd176d 100644 --- a/balancer/xds/xds_client_test.go +++ b/balancer/xds/xds_client_test.go @@ -28,38 +28,43 @@ import ( "testing" "time" - xdspb "github.com/envoyproxy/go-control-plane/envoy/api/v2" - xdscorepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" - xdsendpointpb "github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint" - xdsdiscoverypb "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2" - "github.com/gogo/protobuf/proto" - "github.com/gogo/protobuf/types" + "github.com/golang/protobuf/proto" + anypb "github.com/golang/protobuf/ptypes/any" + structpb "github.com/golang/protobuf/ptypes/struct" + wrpb "github.com/golang/protobuf/ptypes/wrappers" "google.golang.org/grpc" "google.golang.org/grpc/balancer" + cdspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/cds" + addresspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/address" + basepb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/base" + discoverypb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/discovery" + edspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/eds" + endpointpb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/endpoint/endpoint" + adspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/discovery/v2/ads" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) var ( testServiceName = "test/foo" - testCDSReq = &xdspb.DiscoveryRequest{ - Node: &xdscorepb.Node{ - Metadata: &types.Struct{ - Fields: map[string]*types.Value{ + testCDSReq = &discoverypb.DiscoveryRequest{ + Node: &basepb.Node{ + Metadata: &structpb.Struct{ + Fields: map[string]*structpb.Value{ grpcHostname: { - Kind: &types.Value_StringValue{StringValue: testServiceName}, + Kind: &structpb.Value_StringValue{StringValue: testServiceName}, }, }, }, }, TypeUrl: cdsType, } - testEDSReq = &xdspb.DiscoveryRequest{ - Node: &xdscorepb.Node{ - Metadata: &types.Struct{ - Fields: map[string]*types.Value{ + testEDSReq = &discoverypb.DiscoveryRequest{ + Node: &basepb.Node{ + Metadata: &structpb.Struct{ + Fields: map[string]*structpb.Value{ endpointRequired: { - Kind: &types.Value_BoolValue{BoolValue: true}, + Kind: &structpb.Value_BoolValue{BoolValue: true}, }, }, }, @@ -67,12 +72,12 @@ var ( ResourceNames: []string{testServiceName}, TypeUrl: edsType, } - testEDSReqWithoutEndpoints = &xdspb.DiscoveryRequest{ - Node: &xdscorepb.Node{ - Metadata: &types.Struct{ - Fields: map[string]*types.Value{ + testEDSReqWithoutEndpoints = &discoverypb.DiscoveryRequest{ + Node: &basepb.Node{ + Metadata: &structpb.Struct{ + Fields: map[string]*structpb.Value{ endpointRequired: { - Kind: &types.Value_BoolValue{BoolValue: false}, + Kind: &structpb.Value_BoolValue{BoolValue: false}, }, }, }, @@ -80,14 +85,14 @@ var ( ResourceNames: []string{testServiceName}, TypeUrl: edsType, } - testCluster = &xdspb.Cluster{ + testCluster = &cdspb.Cluster{ Name: testServiceName, - ClusterDiscoveryType: &xdspb.Cluster_Type{Type: xdspb.Cluster_EDS}, - LbPolicy: xdspb.Cluster_ROUND_ROBIN, + ClusterDiscoveryType: &cdspb.Cluster_Type{Type: cdspb.Cluster_EDS}, + LbPolicy: cdspb.Cluster_ROUND_ROBIN, } marshaledCluster, _ = proto.Marshal(testCluster) - testCDSResp = &xdspb.DiscoveryResponse{ - Resources: []types.Any{ + testCDSResp = &discoverypb.DiscoveryResponse{ + Resources: []*anypb.Any{ { TypeUrl: cdsType, Value: marshaledCluster, @@ -95,24 +100,24 @@ var ( }, TypeUrl: cdsType, } - testClusterLoadAssignment = &xdspb.ClusterLoadAssignment{ + testClusterLoadAssignment = &edspb.ClusterLoadAssignment{ ClusterName: testServiceName, - Endpoints: []xdsendpointpb.LocalityLbEndpoints{ + Endpoints: []*endpointpb.LocalityLbEndpoints{ { - Locality: &xdscorepb.Locality{ + Locality: &basepb.Locality{ Region: "asia-east1", Zone: "1", SubZone: "sa", }, - LbEndpoints: []xdsendpointpb.LbEndpoint{ + LbEndpoints: []*endpointpb.LbEndpoint{ { - HostIdentifier: &xdsendpointpb.LbEndpoint_Endpoint{ - Endpoint: &xdsendpointpb.Endpoint{ - Address: &xdscorepb.Address{ - Address: &xdscorepb.Address_SocketAddress{ - SocketAddress: &xdscorepb.SocketAddress{ + HostIdentifier: &endpointpb.LbEndpoint_Endpoint{ + Endpoint: &endpointpb.Endpoint{ + Address: &addresspb.Address{ + Address: &addresspb.Address_SocketAddress{ + SocketAddress: &addresspb.SocketAddress{ Address: "1.1.1.1", - PortSpecifier: &xdscorepb.SocketAddress_PortValue{ + PortSpecifier: &addresspb.SocketAddress_PortValue{ PortValue: 10001, }, ResolverName: "dns", @@ -122,12 +127,12 @@ var ( HealthCheckConfig: nil, }, }, - Metadata: &xdscorepb.Metadata{ - FilterMetadata: map[string]*types.Struct{ + Metadata: &basepb.Metadata{ + FilterMetadata: map[string]*structpb.Struct{ "xx.lb": { - Fields: map[string]*types.Value{ + Fields: map[string]*structpb.Value{ "endpoint_name": { - Kind: &types.Value_StringValue{ + Kind: &structpb.Value_StringValue{ StringValue: "some.endpoint.name", }, }, @@ -137,7 +142,7 @@ var ( }, }, }, - LoadBalancingWeight: &types.UInt32Value{ + LoadBalancingWeight: &wrpb.UInt32Value{ Value: 1, }, Priority: 0, @@ -145,8 +150,8 @@ var ( }, } marshaledClusterLoadAssignment, _ = proto.Marshal(testClusterLoadAssignment) - testEDSResp = &xdspb.DiscoveryResponse{ - Resources: []types.Any{ + testEDSResp = &discoverypb.DiscoveryResponse{ + Resources: []*anypb.Any{ { TypeUrl: edsType, Value: marshaledClusterLoadAssignment, @@ -154,14 +159,14 @@ var ( }, TypeUrl: edsType, } - testClusterLoadAssignmentWithoutEndpoints = &xdspb.ClusterLoadAssignment{ + testClusterLoadAssignmentWithoutEndpoints = &edspb.ClusterLoadAssignment{ ClusterName: testServiceName, - Endpoints: []xdsendpointpb.LocalityLbEndpoints{ + Endpoints: []*endpointpb.LocalityLbEndpoints{ { - Locality: &xdscorepb.Locality{ + Locality: &basepb.Locality{ SubZone: "sa", }, - LoadBalancingWeight: &types.UInt32Value{ + LoadBalancingWeight: &wrpb.UInt32Value{ Value: 128, }, Priority: 0, @@ -170,8 +175,8 @@ var ( Policy: nil, } marshaledClusterLoadAssignmentWithoutEndpoints, _ = proto.Marshal(testClusterLoadAssignmentWithoutEndpoints) - testEDSRespWithoutEndpoints = &xdspb.DiscoveryResponse{ - Resources: []types.Any{ + testEDSRespWithoutEndpoints = &discoverypb.DiscoveryResponse{ + Resources: []*anypb.Any{ { TypeUrl: edsType, Value: marshaledClusterLoadAssignmentWithoutEndpoints, @@ -187,16 +192,16 @@ type testTrafficDirector struct { } type request struct { - req *xdspb.DiscoveryRequest + req *discoverypb.DiscoveryRequest err error } type response struct { - resp *xdspb.DiscoveryResponse + resp *discoverypb.DiscoveryResponse err error } -func (ttd *testTrafficDirector) StreamAggregatedResources(s xdsdiscoverypb.AggregatedDiscoveryService_StreamAggregatedResourcesServer) error { +func (ttd *testTrafficDirector) StreamAggregatedResources(s adspb.AggregatedDiscoveryService_StreamAggregatedResourcesServer) error { for { req, err := s.Recv() if err != nil { @@ -233,7 +238,7 @@ func (ttd *testTrafficDirector) StreamAggregatedResources(s xdsdiscoverypb.Aggre } } -func (ttd *testTrafficDirector) DeltaAggregatedResources(xdsdiscoverypb.AggregatedDiscoveryService_DeltaAggregatedResourcesServer) error { +func (ttd *testTrafficDirector) DeltaAggregatedResources(adspb.AggregatedDiscoveryService_DeltaAggregatedResourcesServer) error { return status.Error(codes.Unimplemented, "") } @@ -254,8 +259,8 @@ func newTestTrafficDirector() *testTrafficDirector { type testConfig struct { doCDS bool - expectedRequests []*xdspb.DiscoveryRequest - responsesToSend []*xdspb.DiscoveryResponse + expectedRequests []*discoverypb.DiscoveryRequest + responsesToSend []*discoverypb.DiscoveryResponse expectedADSResponses []proto.Message adsErr error svrErr error @@ -268,7 +273,7 @@ func setupServer(t *testing.T) (addr string, td *testTrafficDirector, cleanup fu } svr := grpc.NewServer() td = newTestTrafficDirector() - xdsdiscoverypb.RegisterAggregatedDiscoveryServiceServer(svr, td) + adspb.RegisterAggregatedDiscoveryServiceServer(svr, td) go svr.Serve(lis) return lis.Addr().String(), td, func() { svr.Stop() @@ -280,14 +285,14 @@ func (s) TestXdsClientResponseHandling(t *testing.T) { for _, test := range []*testConfig{ { doCDS: true, - expectedRequests: []*xdspb.DiscoveryRequest{testCDSReq, testEDSReq}, - responsesToSend: []*xdspb.DiscoveryResponse{testCDSResp, testEDSResp}, + expectedRequests: []*discoverypb.DiscoveryRequest{testCDSReq, testEDSReq}, + responsesToSend: []*discoverypb.DiscoveryResponse{testCDSResp, testEDSResp}, expectedADSResponses: []proto.Message{testCluster, testClusterLoadAssignment}, }, { doCDS: false, - expectedRequests: []*xdspb.DiscoveryRequest{testEDSReqWithoutEndpoints}, - responsesToSend: []*xdspb.DiscoveryResponse{testEDSRespWithoutEndpoints}, + expectedRequests: []*discoverypb.DiscoveryRequest{testEDSReqWithoutEndpoints}, + responsesToSend: []*discoverypb.DiscoveryResponse{testEDSRespWithoutEndpoints}, expectedADSResponses: []proto.Message{testClusterLoadAssignmentWithoutEndpoints}, }, } { @@ -330,11 +335,11 @@ func (s) TestXdsClientLoseContact(t *testing.T) { for _, test := range []*testConfig{ { doCDS: true, - responsesToSend: []*xdspb.DiscoveryResponse{}, + responsesToSend: []*discoverypb.DiscoveryResponse{}, }, { doCDS: false, - responsesToSend: []*xdspb.DiscoveryResponse{testEDSRespWithoutEndpoints}, + responsesToSend: []*discoverypb.DiscoveryResponse{testEDSRespWithoutEndpoints}, }, } { testXdsClientLoseContactRemoteClose(t, test) @@ -343,15 +348,15 @@ func (s) TestXdsClientLoseContact(t *testing.T) { for _, test := range []*testConfig{ { doCDS: false, - responsesToSend: []*xdspb.DiscoveryResponse{testCDSResp}, // CDS response when in custom mode. + responsesToSend: []*discoverypb.DiscoveryResponse{testCDSResp}, // CDS response when in custom mode. }, { doCDS: true, - responsesToSend: []*xdspb.DiscoveryResponse{{}}, // response with 0 resources is an error case. + responsesToSend: []*discoverypb.DiscoveryResponse{{}}, // response with 0 resources is an error case. }, { doCDS: true, - responsesToSend: []*xdspb.DiscoveryResponse{testCDSResp}, + responsesToSend: []*discoverypb.DiscoveryResponse{testCDSResp}, adsErr: errors.New("some ads parsing error from xdsBalancer"), }, } { diff --git a/balancer/xds/xds_test.go b/balancer/xds/xds_test.go index c175f086bc36..abe2e1b301ea 100644 --- a/balancer/xds/xds_test.go +++ b/balancer/xds/xds_test.go @@ -27,12 +27,13 @@ import ( "testing" "time" - "google.golang.org/grpc/internal/grpctest" - "google.golang.org/grpc/internal/leakcheck" - - xdspb "github.com/envoyproxy/go-control-plane/envoy/api/v2" + "github.com/golang/protobuf/proto" "google.golang.org/grpc/balancer" + discoverypb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/discovery" + edspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/eds" "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/internal/grpctest" + "google.golang.org/grpc/internal/leakcheck" "google.golang.org/grpc/resolver" ) @@ -195,7 +196,7 @@ type scStateChange struct { type fakeEDSBalancer struct { cc balancer.ClientConn - edsChan chan *xdspb.ClusterLoadAssignment + edsChan chan *edspb.ClusterLoadAssignment childPolicy chan *loadBalancingConfig fallbackPolicy chan *loadBalancingConfig subconnStateChange chan *scStateChange @@ -211,7 +212,7 @@ func (f *fakeEDSBalancer) Close() { latestFakeEdsBalancer = nil } -func (f *fakeEDSBalancer) HandleEDSResponse(edsResp *xdspb.ClusterLoadAssignment) { +func (f *fakeEDSBalancer) HandleEDSResponse(edsResp *edspb.ClusterLoadAssignment) { f.edsChan <- edsResp } @@ -225,7 +226,7 @@ func (f *fakeEDSBalancer) HandleChildPolicy(name string, config json.RawMessage) func newFakeEDSBalancer(cc balancer.ClientConn) edsBalancerInterface { lb := &fakeEDSBalancer{ cc: cc, - edsChan: make(chan *xdspb.ClusterLoadAssignment, 10), + edsChan: make(chan *edspb.ClusterLoadAssignment, 10), childPolicy: make(chan *loadBalancingConfig, 10), fallbackPolicy: make(chan *loadBalancingConfig, 10), subconnStateChange: make(chan *scStateChange, 10), @@ -340,7 +341,7 @@ func (s) TestXdsBalanceHandleBalancerConfigBalancerNameUpdate(t *testing.T) { if edsLB := getLatestEdsBalancer(); edsLB != nil { // edsLB won't change between the two iterations select { case gotEDS := <-edsLB.edsChan: - if !reflect.DeepEqual(gotEDS, testClusterLoadAssignmentWithoutEndpoints) { + if !proto.Equal(gotEDS, testClusterLoadAssignmentWithoutEndpoints) { t.Fatalf("edsBalancer got eds: %v, want %v", gotEDS, testClusterLoadAssignmentWithoutEndpoints) } case <-time.After(time.Second): @@ -381,7 +382,7 @@ func (s) TestXdsBalanceHandleBalancerConfigChildPolicyUpdate(t *testing.T) { }() for _, test := range []struct { cfg *testBalancerConfig - responseToSend *xdspb.DiscoveryResponse + responseToSend *discoverypb.DiscoveryResponse expectedChildPolicy *loadBalancingConfig }{ { diff --git a/go.mod b/go.mod index e5c9b4df6fbb..9f3ef3a539c6 100644 --- a/go.mod +++ b/go.mod @@ -4,13 +4,9 @@ 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.6.9 - github.com/gogo/googleapis v1.1.0 // indirect - github.com/gogo/protobuf v1.2.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/lyft/protoc-gen-validate v0.0.13 // indirect 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 diff --git a/go.sum b/go.sum index 37d3dbadc77f..b8638ce769dd 100644 --- a/go.sum +++ b/go.sum @@ -4,20 +4,12 @@ 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/envoyproxy/go-control-plane v0.6.9 h1:deEH9W8ZAUGNbCdX+9iNzBOGrAOrnpJGoy0PcTqk/tE= -github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= -github.com/gogo/googleapis v1.1.0 h1:kFkMAZBNAn4j7K0GiZr8cRYzejq68VbheufiV3YuyFI= -github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= -github.com/gogo/protobuf v1.2.0 h1:xU6/SpYbvkNYiptHJYEDRseDLvYE7wSqhYYNy0QSUzI= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= 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/lyft/protoc-gen-validate v0.0.13 h1:KNt/RhmQTOLr7Aj8PsJ7mTronaFyx80mRTT9qF261dA= -github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= 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= diff --git a/vet.sh b/vet.sh index 2042133f7101..7e6ce5eb4907 100755 --- a/vet.sh +++ b/vet.sh @@ -86,7 +86,7 @@ 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 | fail_on_output +goimports -l . 2>&1 | (! grep -vE "(_mock|\.pb)\.go:") | fail_on_output golint ./... 2>&1 | (! grep -vE "(_mock|\.pb)\.go:") go vet -all . From d7af56a5e494ceb44a0749ca576c83cfd3a42bd2 Mon Sep 17 00:00:00 2001 From: Jean de Klerk Date: Tue, 16 Apr 2019 16:54:26 -0600 Subject: [PATCH 15/34] internal: tweak ClientTransport.GracefulClose documentation (#2772) * internal: tweak ClientTransport.GracefulClose documentation * address menghanl@ review comment --- internal/transport/transport.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/transport/transport.go b/internal/transport/transport.go index 7f82cbb080df..0600e5042da9 100644 --- a/internal/transport/transport.go +++ b/internal/transport/transport.go @@ -578,8 +578,11 @@ type ClientTransport interface { // is called only once. Close() error - // GracefulClose starts to tear down the transport. It stops accepting - // new RPCs and wait the completion of the pending RPCs. + // GracefulClose starts to tear down the transport: the transport will stop + // accepting new RPCs and NewStream will return error. Once all streams are + // finished, the transport will close. + // + // It does not block. GracefulClose() error // Write sends the data for the given stream. A nil stream indicates From 8260df7a615398b7d72fa0c431e8acb1cf993606 Mon Sep 17 00:00:00 2001 From: Prannay Khosla Date: Sat, 20 Apr 2019 02:38:08 +0530 Subject: [PATCH 16/34] grpc: implementation of PreparedMsg API grpc: implementation of PreparedMsg API --- benchmark/benchmain/main.go | 100 ++++++++++++++++++++++++++++++------ benchmark/stats/stats.go | 14 +++-- preloader.go | 66 ++++++++++++++++++++++++ rpc_util.go | 26 ++++++++-- stream.go | 53 ++++++++++++------- test/end2end_test.go | 74 ++++++++++++++++++++++++++ 6 files changed, 291 insertions(+), 42 deletions(-) create mode 100644 preloader.go diff --git a/benchmark/benchmain/main.go b/benchmark/benchmain/main.go index 36570a49056d..05aef43a4570 100644 --- a/benchmark/benchmain/main.go +++ b/benchmark/benchmain/main.go @@ -22,7 +22,7 @@ Package main provides benchmark with setting flags. An example to run some benchmarks with profiling enabled: go run benchmark/benchmain/main.go -benchtime=10s -workloads=all \ - -compression=on -maxConcurrentCalls=1 -trace=off \ + -compression=gzip -maxConcurrentCalls=1 -trace=off \ -reqSizeBytes=1,1048576 -respSizeBytes=1,1048576 -networkMode=Local \ -cpuProfile=cpuProf -memProfile=memProf -memProfileRate=10000 -resultFile=result @@ -74,10 +74,16 @@ const ( modeOn = "on" modeOff = "off" modeBoth = "both" + + // compression modes + modeAll = "all" + modeGzip = "gzip" + modeNop = "nop" ) -var allCompressionModes = []string{modeOn, modeOff, modeBoth} +var allCompressionModes = []string{modeOff, modeGzip, modeNop, modeAll} var allTraceModes = []string{modeOn, modeOff, modeBoth} +var allPreloaderModes = []string{modeOn, modeOff, modeBoth} const ( workloadsUnary = "unary" @@ -102,7 +108,8 @@ var ( benchtime time.Duration memProfile, cpuProfile string memProfileRate int - enableCompressor []bool + modeCompressor []string + enablePreloader []bool enableChannelz []bool networkMode string benchmarkResultFile string @@ -127,7 +134,13 @@ func streamBenchmark(startTimer func(), stopTimer func(uint64), benchFeatures st } func unconstrainedStreamBenchmark(benchFeatures stats.Features, warmuptime, benchtime time.Duration) (uint64, uint64) { - sender, recver, cleanup := makeFuncUnconstrainedStream(benchFeatures) + var sender, recver func(int) + var cleanup func() + if benchFeatures.EnablePreloader { + sender, recver, cleanup = makeFuncUnconstrainedStreamPreloaded(benchFeatures) + } else { + sender, recver, cleanup = makeFuncUnconstrainedStream(benchFeatures) + } defer cleanup() var ( @@ -177,7 +190,7 @@ func makeClient(benchFeatures stats.Features) (testpb.BenchmarkServiceClient, fu nw := &latency.Network{Kbps: benchFeatures.Kbps, Latency: benchFeatures.Latency, MTU: benchFeatures.Mtu} opts := []grpc.DialOption{} sopts := []grpc.ServerOption{} - if benchFeatures.EnableCompressor { + if benchFeatures.ModeCompressor == "nop" { sopts = append(sopts, grpc.RPCCompressor(nopCompressor{}), grpc.RPCDecompressor(nopDecompressor{}), @@ -187,6 +200,16 @@ func makeClient(benchFeatures stats.Features) (testpb.BenchmarkServiceClient, fu grpc.WithDecompressor(nopDecompressor{}), ) } + if benchFeatures.ModeCompressor == "gzip" { + sopts = append(sopts, + grpc.RPCCompressor(grpc.NewGZIPCompressor()), + grpc.RPCDecompressor(grpc.NewGZIPDecompressor()), + ) + opts = append(opts, + grpc.WithCompressor(grpc.NewGZIPCompressor()), + grpc.WithDecompressor(grpc.NewGZIPDecompressor()), + ) + } sopts = append(sopts, grpc.MaxConcurrentStreams(uint32(benchFeatures.MaxConcurrentCalls+1))) opts = append(opts, grpc.WithInsecure()) @@ -242,7 +265,36 @@ func makeFuncStream(benchFeatures stats.Features) (func(int), func()) { }, cleanup } +func makeFuncUnconstrainedStreamPreloaded(benchFeatures stats.Features) (func(int), func(int), func()) { + streams, req, cleanup := setupUnconstrainedStream(benchFeatures) + + preparedMsg := make([]*grpc.PreparedMsg, len(streams)) + for i, stream := range streams { + preparedMsg[i] = &grpc.PreparedMsg{} + err := preparedMsg[i].Encode(stream, req) + if err != nil { + grpclog.Fatalf("%v.Encode(%v, %v) = %v", preparedMsg[i], req, stream, err) + } + } + + return func(pos int) { + streams[pos].SendMsg(preparedMsg[pos]) + }, func(pos int) { + streams[pos].Recv() + }, cleanup +} + func makeFuncUnconstrainedStream(benchFeatures stats.Features) (func(int), func(int), func()) { + streams, req, cleanup := setupUnconstrainedStream(benchFeatures) + + return func(pos int) { + streams[pos].Send(req) + }, func(pos int) { + streams[pos].Recv() + }, cleanup +} + +func setupUnconstrainedStream(benchFeatures stats.Features) ([]testpb.BenchmarkService_StreamingCallClient, *testpb.SimpleRequest, func()) { tc, cleanup := makeClient(benchFeatures) streams := make([]testpb.BenchmarkService_StreamingCallClient, benchFeatures.MaxConcurrentCalls) @@ -261,11 +313,7 @@ func makeFuncUnconstrainedStream(benchFeatures stats.Features) (func(int), func( Payload: pl, } - return func(pos int) { - streams[pos].Send(req) - }, func(pos int) { - streams[pos].Recv() - }, cleanup + return streams, req, cleanup } func unaryCaller(client testpb.BenchmarkServiceClient, reqSize, respSize int) { @@ -323,6 +371,7 @@ var useBufconn = flag.Bool("bufconn", false, "Use in-memory connection instead o func init() { var ( workloads, traceMode, compressorMode, readLatency, channelzOn string + preloaderMode string readKbps, readMtu, readMaxConcurrentCalls intSliceType readReqSizeBytes, readRespSizeBytes intSliceType ) @@ -345,6 +394,8 @@ func init() { flag.StringVar(&cpuProfile, "cpuProfile", "", "Enables CPU profiling output to the filename provided") flag.StringVar(&compressorMode, "compression", modeOff, fmt.Sprintf("Compression mode - One of: %v", strings.Join(allCompressionModes, ", "))) + flag.StringVar(&preloaderMode, "preloader", modeOff, + fmt.Sprintf("Preloader mode - One of: %v", strings.Join(allPreloaderModes, ", "))) flag.StringVar(&benchmarkResultFile, "resultFile", "", "Save the benchmark result into a binary file") flag.StringVar(&networkMode, "networkMode", "", "Network mode includes LAN, WAN, Local and Longhaul") flag.Parse() @@ -372,7 +423,8 @@ func init() { log.Fatalf("Unknown workloads setting: %v (want one of: %v)", workloads, strings.Join(allWorkloads, ", ")) } - enableCompressor = setMode(compressorMode) + modeCompressor = setModeCompressor(compressorMode) + enablePreloader = setMode(preloaderMode) enableTrace = setMode(traceMode) enableChannelz = setMode(channelzOn) // Time input formats as (time + unit). @@ -400,11 +452,28 @@ func setMode(name string) []bool { return []bool{false, true} default: log.Fatalf("Unknown %s setting: %v (want one of: %v)", - name, name, strings.Join(allCompressionModes, ", ")) + name, name, strings.Join(allTraceModes, ", ")) return []bool{} } } +func setModeCompressor(name string) []string { + switch name { + case modeNop: + return []string{"nop"} + case modeGzip: + return []string{"gzip"} + case modeAll: + return []string{"off", "nop", "gzip"} + case modeOff: + return []string{"off"} + default: + log.Fatalf("Unknown %s setting: %v (want one of: %v)", + name, name, strings.Join(allCompressionModes, ", ")) + return []string{} + } +} + type intSliceType []int func (intSlice *intSliceType) String() string { @@ -456,10 +525,10 @@ func printThroughput(requestCount uint64, requestSize int, responseCount uint64, func main() { before() - featuresPos := make([]int, 9) + featuresPos := make([]int, 10) // 0:enableTracing 1:ltc 2:kbps 3:mtu 4:maxC 5:reqSize 6:respSize featuresNum := []int{len(enableTrace), len(ltc), len(kbps), len(mtu), - len(maxConcurrentCalls), len(reqSizeBytes), len(respSizeBytes), len(enableCompressor), len(enableChannelz)} + len(maxConcurrentCalls), len(reqSizeBytes), len(respSizeBytes), len(modeCompressor), len(enableChannelz), len(enablePreloader)} initalPos := make([]int, len(featuresPos)) s := stats.NewStats(10) s.SortLatency() @@ -499,8 +568,9 @@ func main() { MaxConcurrentCalls: maxConcurrentCalls[featuresPos[4]], ReqSizeBytes: reqSizeBytes[featuresPos[5]], RespSizeBytes: respSizeBytes[featuresPos[6]], - EnableCompressor: enableCompressor[featuresPos[7]], + ModeCompressor: modeCompressor[featuresPos[7]], EnableChannelz: enableChannelz[featuresPos[8]], + EnablePreloader: enablePreloader[featuresPos[9]], } grpc.EnableTracing = enableTrace[featuresPos[0]] diff --git a/benchmark/stats/stats.go b/benchmark/stats/stats.go index 20c96b8686d2..64a17cf3a2ed 100644 --- a/benchmark/stats/stats.go +++ b/benchmark/stats/stats.go @@ -39,21 +39,22 @@ type Features struct { MaxConcurrentCalls int ReqSizeBytes int RespSizeBytes int - EnableCompressor bool + ModeCompressor string EnableChannelz bool + EnablePreloader bool } // String returns the textual output of the Features as string. func (f Features) String() string { return fmt.Sprintf("traceMode_%t-latency_%s-kbps_%#v-MTU_%#v-maxConcurrentCalls_"+ - "%#v-reqSize_%#vB-respSize_%#vB-Compressor_%t", f.EnableTrace, - f.Latency.String(), f.Kbps, f.Mtu, f.MaxConcurrentCalls, f.ReqSizeBytes, f.RespSizeBytes, f.EnableCompressor) + "%#v-reqSize_%#vB-respSize_%#vB-Compressor_%s-Preloader_%t", f.EnableTrace, + f.Latency.String(), f.Kbps, f.Mtu, f.MaxConcurrentCalls, f.ReqSizeBytes, f.RespSizeBytes, f.ModeCompressor, f.EnablePreloader) } // ConciseString returns the concise textual output of the Features as string, skipping // setting with default value. func (f Features) ConciseString() string { - noneEmptyPos := []bool{f.EnableTrace, f.Latency != 0, f.Kbps != 0, f.Mtu != 0, true, true, true, f.EnableCompressor, f.EnableChannelz} + noneEmptyPos := []bool{f.EnableTrace, f.Latency != 0, f.Kbps != 0, f.Mtu != 0, true, true, true, f.ModeCompressor != "off", f.EnableChannelz, f.EnablePreloader} return PartialPrintString(noneEmptyPos, f, false) } @@ -99,11 +100,14 @@ func PartialPrintString(noneEmptyPos []bool, f Features, shared bool) string { s += fmt.Sprintf("%srespSize%s%#vB%s", prefix, linker, f.RespSizeBytes, suffix) } if noneEmptyPos[7] { - s += fmt.Sprintf("%sCompressor%s%t%s", prefix, linker, f.EnableCompressor, suffix) + s += fmt.Sprintf("%sCompressor%s%s%s", prefix, linker, f.ModeCompressor, suffix) } if noneEmptyPos[8] { s += fmt.Sprintf("%sChannelz%s%t%s", prefix, linker, f.EnableChannelz, suffix) } + if noneEmptyPos[9] { + s += fmt.Sprintf("%sPreloader%s%t%s", prefix, linker, f.EnablePreloader, suffix) + } return s } diff --git a/preloader.go b/preloader.go new file mode 100644 index 000000000000..db701e9d736a --- /dev/null +++ b/preloader.go @@ -0,0 +1,66 @@ +/* + * + * 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 ( + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// PreparedMsg is responsible for creating a Marshalled and Compressed object +type PreparedMsg struct { + // Struct for preparing msg before sending them + encodedData []byte + hdr []byte + payload []byte +} + +// Encode is responsible for preprocessing the data using relevant information +// from the stream's Context +// TODO(prannayk) : if something changes then mark prepared msg as old +// Encode : marshal and compresses data based on stream context +// Returns error in case of error +func (p *PreparedMsg) Encode(s Stream, msg interface{}) error { + ctx := s.Context() + rpcInfo, ok := rpcInfoFromContext(ctx) + if !ok { + return status.Errorf(codes.Internal, "grpc: unable to get rpcInfo") + } + + // check if the context has the relevant information to prepareMsg + if rpcInfo.preloaderInfo == nil { + return status.Errorf(codes.Internal, "grpc: rpcInfo.preloaderInfo is nil") + } + if rpcInfo.preloaderInfo.codec == nil { + return status.Errorf(codes.Internal, "grpc: rpcInfo.preloaderInfo.codec is nil") + } + + // prepare the msg + data, err := encode(rpcInfo.preloaderInfo.codec, msg) + if err != nil { + return err + } + p.encodedData = data + compData, err := compress(data, rpcInfo.preloaderInfo.cp, rpcInfo.preloaderInfo.comp) + if err != nil { + return err + } + p.hdr, p.payload = msgHeader(data, compData) + return nil +} diff --git a/rpc_util.go b/rpc_util.go index 2a595622d3cc..088c3f1b2528 100644 --- a/rpc_util.go +++ b/rpc_util.go @@ -694,14 +694,34 @@ func recv(p *parser, c baseCodec, s *transport.Stream, dc Decompressor, m interf return nil } +// Information about RPC type rpcInfo struct { - failfast bool + failfast bool + preloaderInfo *compressorInfo +} + +// Information about Preloader +// Responsible for storing codec, and compressors +// If stream (s) has context s.Context which stores rpcInfo that has non nil +// pointers to codec, and compressors, then we can use preparedMsg for Async message prep +// and reuse marshalled bytes +type compressorInfo struct { + codec baseCodec + cp Compressor + comp encoding.Compressor } type rpcInfoContextKey struct{} -func newContextWithRPCInfo(ctx context.Context, failfast bool) context.Context { - return context.WithValue(ctx, rpcInfoContextKey{}, &rpcInfo{failfast: failfast}) +func newContextWithRPCInfo(ctx context.Context, failfast bool, codec baseCodec, cp Compressor, comp encoding.Compressor) context.Context { + return context.WithValue(ctx, rpcInfoContextKey{}, &rpcInfo{ + failfast: failfast, + preloaderInfo: &compressorInfo{ + codec: codec, + cp: cp, + comp: comp, + }, + }) } func rpcInfoFromContext(ctx context.Context) (s *rpcInfo, ok bool) { diff --git a/stream.go b/stream.go index 6e2bf51e0a09..e10e62317dfd 100644 --- a/stream.go +++ b/stream.go @@ -245,7 +245,7 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth trInfo.tr.LazyLog(&trInfo.firstLine, false) ctx = trace.NewContext(ctx, trInfo.tr) } - ctx = newContextWithRPCInfo(ctx, c.failFast) + ctx = newContextWithRPCInfo(ctx, c.failFast, c.codec, cp, comp) sh := cc.dopts.copts.StatsHandler var beginTime time.Time if sh != nil { @@ -677,15 +677,13 @@ func (cs *clientStream) SendMsg(m interface{}) (err error) { if !cs.desc.ClientStreams { cs.sentLast = true } - data, err := encode(cs.codec, m) - if err != nil { - return err - } - compData, err := compress(data, cs.cp, cs.comp) + + // load hdr, payload, data + hdr, payload, data, err := prepareMsg(m, cs.codec, cs.cp, cs.comp) if err != nil { return err } - hdr, payload := msgHeader(data, compData) + // TODO(dfawley): should we be checking len(data) instead? if len(payload) > *cs.callInfo.maxSendMessageSize { return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(payload), *cs.callInfo.maxSendMessageSize) @@ -1150,15 +1148,13 @@ func (as *addrConnStream) SendMsg(m interface{}) (err error) { if !as.desc.ClientStreams { as.sentLast = true } - data, err := encode(as.codec, m) - if err != nil { - return err - } - compData, err := compress(data, as.cp, as.comp) + + // load hdr, payload, data + hdr, payld, _, err := prepareMsg(m, as.codec, as.cp, as.comp) if err != nil { return err } - hdr, payld := msgHeader(data, compData) + // TODO(dfawley): should we be checking len(data) instead? if len(payld) > *as.callInfo.maxSendMessageSize { return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(payld), *as.callInfo.maxSendMessageSize) @@ -1395,15 +1391,13 @@ func (ss *serverStream) SendMsg(m interface{}) (err error) { ss.t.IncrMsgSent() } }() - data, err := encode(ss.codec, m) - if err != nil { - return err - } - compData, err := compress(data, ss.cp, ss.comp) + + // load hdr, payload, data + hdr, payload, data, err := prepareMsg(m, ss.codec, ss.cp, ss.comp) if err != nil { return err } - hdr, payload := msgHeader(data, compData) + // TODO(dfawley): should we be checking len(data) instead? if len(payload) > ss.maxSendMessageSize { return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(payload), ss.maxSendMessageSize) @@ -1496,3 +1490,24 @@ func (ss *serverStream) RecvMsg(m interface{}) (err error) { func MethodFromServerStream(stream ServerStream) (string, bool) { return Method(stream.Context()) } + +// prepareMsg returns the hdr, payload and data +// using the compressors passed or using the +// passed preparedmsg +func prepareMsg(m interface{}, codec baseCodec, cp Compressor, comp encoding.Compressor) (hdr, payload, data []byte, err error) { + if preparedMsg, ok := m.(*PreparedMsg); ok { + return preparedMsg.hdr, preparedMsg.payload, preparedMsg.encodedData, nil + } + // The input interface is not a prepared msg. + // Marshal and Compress the data at this point + data, err = encode(codec, m) + if err != nil { + return nil, nil, nil, err + } + compData, err := compress(data, cp, comp) + if err != nil { + return nil, nil, nil, err + } + hdr, payload = msgHeader(data, compData) + return hdr, payload, data, nil +} diff --git a/test/end2end_test.go b/test/end2end_test.go index 6d81b2d22f15..acbd096633b3 100644 --- a/test/end2end_test.go +++ b/test/end2end_test.go @@ -2076,6 +2076,80 @@ func (s) TestStreamingRPCWithTimeoutInServiceConfigRecv(t *testing.T) { } } +func (s) TestPreloaderClientSend(t *testing.T) { + for _, e := range listTestEnv() { + testPreloaderClientSend(t, e) + } +} + +func testPreloaderClientSend(t *testing.T, e env) { + te := newTest(t, e) + te.userAgent = testAppUA + te.declareLogNoise( + "transport: http2Client.notifyError got notified that the client transport was broken EOF", + "grpc: addrConn.transportMonitor exits due to: grpc: the connection is closing", + "grpc: addrConn.resetTransport failed to create client transport: connection error", + "Failed to dial : context canceled; please retry.", + ) + te.startServer(&testServer{security: e.security}) + + defer te.tearDown() + tc := testpb.NewTestServiceClient(te.clientConn()) + + // Test for streaming RPC recv. + // Set context for send with proper RPC Information + stream, err := tc.FullDuplexCall(te.ctx, grpc.UseCompressor("gzip")) + if err != nil { + t.Fatalf("%v.FullDuplexCall(_) = _, %v, want ", tc, err) + } + var index int + for index < len(reqSizes) { + respParam := []*testpb.ResponseParameters{ + { + Size: int32(respSizes[index]), + }, + } + + payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, int32(reqSizes[index])) + if err != nil { + t.Fatal(err) + } + + req := &testpb.StreamingOutputCallRequest{ + ResponseType: testpb.PayloadType_COMPRESSABLE, + ResponseParameters: respParam, + Payload: payload, + } + preparedMsg := &grpc.PreparedMsg{} + err = preparedMsg.Encode(stream, req) + if err != nil { + t.Fatalf("PrepareMsg failed for size %d : %v", reqSizes[index], err) + } + if err := stream.SendMsg(preparedMsg); err != nil { + t.Fatalf("%v.Send(%v) = %v, want ", stream, req, err) + } + reply, err := stream.Recv() + if err != nil { + t.Fatalf("%v.Recv() = %v, want ", stream, err) + } + pt := reply.GetPayload().GetType() + if pt != testpb.PayloadType_COMPRESSABLE { + t.Fatalf("Got the reply of type %d, want %d", pt, testpb.PayloadType_COMPRESSABLE) + } + size := len(reply.GetPayload().GetBody()) + if size != int(respSizes[index]) { + t.Fatalf("Got reply body of length %d, want %d", size, respSizes[index]) + } + index++ + } + if err := stream.CloseSend(); err != nil { + t.Fatalf("%v.CloseSend() got %v, want %v", stream, err, nil) + } + if _, err := stream.Recv(); err != io.EOF { + t.Fatalf("%v failed to complele the ping pong test: %v", stream, err) + } +} + func (s) TestMaxMsgSizeClientDefault(t *testing.T) { for _, e := range listTestEnv() { testMaxMsgSizeClientDefault(t, e) From 4dfb34b0d447b428f2a526e4bfc3b93e8a0cafcc Mon Sep 17 00:00:00 2001 From: Can Guler Date: Mon, 22 Apr 2019 13:07:07 -0700 Subject: [PATCH 17/34] Mark PreparedMsg as EXPERIMENTAL (#2783) --- preloader.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/preloader.go b/preloader.go index db701e9d736a..76acbbcc93b9 100644 --- a/preloader.go +++ b/preloader.go @@ -23,7 +23,9 @@ import ( "google.golang.org/grpc/status" ) -// PreparedMsg is responsible for creating a Marshalled and Compressed object +// PreparedMsg is responsible for creating a Marshalled and Compressed object. +// +// This API is EXPERIMENTAL. type PreparedMsg struct { // Struct for preparing msg before sending them encodedData []byte @@ -31,11 +33,7 @@ type PreparedMsg struct { payload []byte } -// Encode is responsible for preprocessing the data using relevant information -// from the stream's Context -// TODO(prannayk) : if something changes then mark prepared msg as old -// Encode : marshal and compresses data based on stream context -// Returns error in case of error +// Encode marshalls and compresses the message using the codec and compressor for the stream. func (p *PreparedMsg) Encode(s Stream, msg interface{}) error { ctx := s.Context() rpcInfo, ok := rpcInfoFromContext(ctx) From a8b5bd3c39ac82177c7bad36e1dd695096cd0ef5 Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Tue, 23 Apr 2019 13:48:02 -0700 Subject: [PATCH 18/34] xds: wrr with random (#2745) --- balancer/internal/wrr/random.go | 59 ++++++++++++++ balancer/internal/wrr/wrr.go | 28 +++++++ balancer/internal/wrr/wrr_test.go | 99 +++++++++++++++++++++++ balancer/xds/edsbalancer/balancergroup.go | 33 ++++---- balancer/xds/edsbalancer/edsbalancer.go | 11 +-- balancer/xds/edsbalancer/util.go | 30 ++----- balancer/xds/edsbalancer/util_test.go | 49 +++++++++++ go.mod | 1 + go.sum | 2 + 9 files changed, 264 insertions(+), 48 deletions(-) create mode 100644 balancer/internal/wrr/random.go create mode 100644 balancer/internal/wrr/wrr.go create mode 100644 balancer/internal/wrr/wrr_test.go diff --git a/balancer/internal/wrr/random.go b/balancer/internal/wrr/random.go new file mode 100644 index 000000000000..fe345f781b8c --- /dev/null +++ b/balancer/internal/wrr/random.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. + */ + +package wrr + +import "google.golang.org/grpc/internal/grpcrand" + +// weightedItem is a wrapped weighted item that is used to implement weighted random algorithm. +type weightedItem struct { + Item interface{} + Weight int64 +} + +// randomWRR is a struct that contains weighted items implement weighted random algorithm. +type randomWRR struct { + items []*weightedItem + sumOfWeights int64 +} + +// NewRandom creates a new WRR with random. +func NewRandom() WRR { + return &randomWRR{} +} + +func (rw *randomWRR) Next() (item interface{}) { + if rw.sumOfWeights == 0 { + return nil + } + // Random number in [0, sum). + randomWeight := grpcrand.Int63n(rw.sumOfWeights) + for _, item := range rw.items { + randomWeight = randomWeight - item.Weight + if randomWeight < 0 { + return item.Item + } + } + + return rw.items[len(rw.items)-1].Item +} + +func (rw *randomWRR) Add(item interface{}, weight int64) { + rItem := &weightedItem{Item: item, Weight: weight} + rw.items = append(rw.items, rItem) + rw.sumOfWeights += weight +} diff --git a/balancer/internal/wrr/wrr.go b/balancer/internal/wrr/wrr.go new file mode 100644 index 000000000000..7b9cdc7334dd --- /dev/null +++ b/balancer/internal/wrr/wrr.go @@ -0,0 +1,28 @@ +/* + * + * 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 wrr + +// WRR defines an interface that implements weighted round robin. +type WRR interface { + // Add adds an item with weight to the WRR set. + Add(item interface{}, weight int64) + // Next returns the next picked item. + // + // Next needs to be thread safe. + Next() interface{} +} diff --git a/balancer/internal/wrr/wrr_test.go b/balancer/internal/wrr/wrr_test.go new file mode 100644 index 000000000000..03c2b9002ac8 --- /dev/null +++ b/balancer/internal/wrr/wrr_test.go @@ -0,0 +1,99 @@ +/* + * + * 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 wrr + +import ( + "errors" + "math" + "testing" + + "github.com/google/go-cmp/cmp" +) + +const iterCount = 10000 + +func equalApproximate(a, b float64) error { + opt := cmp.Comparer(func(x, y float64) bool { + delta := math.Abs(x - y) + mean := math.Abs(x+y) / 2.0 + return delta/mean < 0.05 + }) + if !cmp.Equal(a, b, opt) { + return errors.New(cmp.Diff(a, b)) + } + return nil +} + +func testWRRNext(t *testing.T, newWRR func() WRR) { + tests := []struct { + name string + weights []int64 + }{ + { + name: "1-1-1", + weights: []int64{1, 1, 1}, + }, + { + name: "1-2-3", + weights: []int64{1, 2, 3}, + }, + { + name: "5-3-2", + weights: []int64{5, 3, 2}, + }, + { + name: "17-23-37", + weights: []int64{17, 23, 37}, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + var sumOfWeights int64 + + w := newWRR() + for i, weight := range tt.weights { + w.Add(i, weight) + sumOfWeights += weight + } + + results := make(map[int]int) + for i := 0; i < iterCount; i++ { + results[w.Next().(int)]++ + } + + wantRatio := make([]float64, len(tt.weights)) + for i, weight := range tt.weights { + wantRatio[i] = float64(weight) / float64(sumOfWeights) + } + gotRatio := make([]float64, len(tt.weights)) + for i, count := range results { + gotRatio[i] = float64(count) / iterCount + } + + for i := range wantRatio { + if err := equalApproximate(gotRatio[i], wantRatio[i]); err != nil { + t.Errorf("%v not equal %v", i, err) + } + } + }) + } +} + +func TestRandomWRRNext(t *testing.T) { + testWRRNext(t, NewRandom) +} diff --git a/balancer/xds/edsbalancer/balancergroup.go b/balancer/xds/edsbalancer/balancergroup.go index 77b185c8b543..5367dee8fc38 100644 --- a/balancer/xds/edsbalancer/balancergroup.go +++ b/balancer/xds/edsbalancer/balancergroup.go @@ -24,6 +24,7 @@ import ( "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/base" + "google.golang.org/grpc/balancer/internal/wrr" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/resolver" @@ -279,13 +280,12 @@ func buildPickerAndState(m map[string]*pickerState) (connectivity.State, balance return aggregatedState, newPickerGroup(readyPickerWithWeights) } -type pickerGroup struct { - readyPickerWithWeights []pickerState - length int +// RandomWRR constructor, to be modified in tests. +var newRandomWRR = wrr.NewRandom - mu sync.Mutex - idx int // The index of the picker that will be picked - count uint32 // The number of times the current picker has been picked. +type pickerGroup struct { + length int + w wrr.WRR } // newPickerGroup takes pickers with weights, and group them into one picker. @@ -296,9 +296,14 @@ type pickerGroup struct { // TODO: (bg) confirm this is the expected behavior: non-ready balancers should // be ignored when picking. Only ready balancers are picked. func newPickerGroup(readyPickerWithWeights []pickerState) *pickerGroup { + w := newRandomWRR() + for _, ps := range readyPickerWithWeights { + w.Add(ps.picker, int64(ps.weight)) + } + return &pickerGroup{ - readyPickerWithWeights: readyPickerWithWeights, - length: len(readyPickerWithWeights), + length: len(readyPickerWithWeights), + w: w, } } @@ -306,17 +311,7 @@ func (pg *pickerGroup) Pick(ctx context.Context, opts balancer.PickOptions) (con if pg.length <= 0 { return nil, nil, balancer.ErrNoSubConnAvailable } - // TODO: the WRR algorithm needs a design. - // MAYBE: move WRR implmentation to util.go as a separate struct. - pg.mu.Lock() - pickerSt := pg.readyPickerWithWeights[pg.idx] - p := pickerSt.picker - pg.count++ - if pg.count >= pickerSt.weight { - pg.idx = (pg.idx + 1) % pg.length - pg.count = 0 - } - pg.mu.Unlock() + p := pg.w.Next().(balancer.Picker) return p.Pick(ctx, opts) } diff --git a/balancer/xds/edsbalancer/edsbalancer.go b/balancer/xds/edsbalancer/edsbalancer.go index 67e39260c876..789d6d86e670 100644 --- a/balancer/xds/edsbalancer/edsbalancer.go +++ b/balancer/xds/edsbalancer/edsbalancer.go @@ -292,13 +292,10 @@ func newDropPicker(p balancer.Picker, drops []*dropper) *dropPicker { func (d *dropPicker) Pick(ctx context.Context, opts balancer.PickOptions) (conn balancer.SubConn, done func(balancer.DoneInfo), err error) { var drop bool for _, dp := range d.drops { - // It's necessary to call drop on all droppers if the droppers are - // stateful. For example, if the second drop only drops 1/2, and only - // drops even number picks, we need to call it's drop() even if the - // first dropper already returned true. - // - // It won't be necessary if droppers are stateless, like toss a coin. - drop = drop || dp.drop() + if dp.drop() { + drop = true + break + } } if drop { return nil, nil, status.Errorf(codes.Unavailable, "RPC is dropped") diff --git a/balancer/xds/edsbalancer/util.go b/balancer/xds/edsbalancer/util.go index 0b1a397f2ccd..dfae1b514985 100644 --- a/balancer/xds/edsbalancer/util.go +++ b/balancer/xds/edsbalancer/util.go @@ -18,41 +18,27 @@ package edsbalancer -import ( - "sync" -) +import "google.golang.org/grpc/balancer/internal/wrr" type dropper struct { // Drop rate will be numerator/denominator. numerator uint32 denominator uint32 - - mu sync.Mutex - i uint32 + w wrr.WRR } func newDropper(numerator, denominator uint32) *dropper { + w := newRandomWRR() + w.Add(true, int64(numerator)) + w.Add(false, int64(denominator-numerator)) + return &dropper{ numerator: numerator, denominator: denominator, + w: w, } } func (d *dropper) drop() (ret bool) { - d.mu.Lock() - defer d.mu.Unlock() - - // TODO: the drop algorithm needs a design. - // Currently, for drop rate 3/5: - // 0 1 2 3 4 - // d d d n n - if d.i < d.numerator { - ret = true - } - d.i++ - if d.i >= d.denominator { - d.i = 0 - } - - return + return d.w.Next().(bool) } diff --git a/balancer/xds/edsbalancer/util_test.go b/balancer/xds/edsbalancer/util_test.go index 68471b6c19c8..318b97848a12 100644 --- a/balancer/xds/edsbalancer/util_test.go +++ b/balancer/xds/edsbalancer/util_test.go @@ -19,9 +19,58 @@ package edsbalancer import ( + "sync" "testing" + + "google.golang.org/grpc/balancer/internal/wrr" ) +// testWRR is a deterministic WRR implementation. +// +// The real implementation does random WRR. testWRR makes the balancer behavior +// deterministic and easier to test. +// +// With {a: 2, b: 3}, the Next() results will be {a, a, b, b, b}. +type testWRR struct { + itemsWithWeight []struct { + item interface{} + weight int64 + } + length int + + mu sync.Mutex + idx int // The index of the item that will be picked + count int64 // The number of times the current item has been picked. +} + +func newTestWRR() wrr.WRR { + return &testWRR{} +} + +func (twrr *testWRR) Add(item interface{}, weight int64) { + twrr.itemsWithWeight = append(twrr.itemsWithWeight, struct { + item interface{} + weight int64 + }{item: item, weight: weight}) + twrr.length++ +} + +func (twrr *testWRR) Next() interface{} { + twrr.mu.Lock() + iww := twrr.itemsWithWeight[twrr.idx] + twrr.count++ + if twrr.count >= iww.weight { + twrr.idx = (twrr.idx + 1) % twrr.length + twrr.count = 0 + } + twrr.mu.Unlock() + return iww.item +} + +func init() { + newRandomWRR = newTestWRR +} + func TestDropper(t *testing.T) { const repeat = 2 diff --git a/go.mod b/go.mod index 9f3ef3a539c6..b75c069aacd8 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( 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/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 diff --git a/go.sum b/go.sum index b8638ce769dd..2a17234748d0 100644 --- a/go.sum +++ b/go.sum @@ -10,6 +10,8 @@ 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/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 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= From 1e6ab1e96e7e4a876f32437d29511873b4d14cf0 Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Fri, 26 Apr 2019 10:33:22 -0700 Subject: [PATCH 19/34] server: define ServerOption as interfaces (#2784) Instead of functions. So custom server options can be made by wrapping an EmptyServerOption. --- server.go | 116 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 71 insertions(+), 45 deletions(-) diff --git a/server.go b/server.go index 8115828fdf00..495a4f9b825e 100644 --- a/server.go +++ b/server.go @@ -86,7 +86,7 @@ type service struct { // Server is a gRPC server to serve RPC requests. type Server struct { - opts options + opts serverOptions mu sync.Mutex // guards following lis map[net.Listener]bool @@ -108,7 +108,7 @@ type Server struct { czData *channelzData } -type options struct { +type serverOptions struct { creds credentials.TransportCredentials codec baseCodec cp Compressor @@ -131,7 +131,7 @@ type options struct { maxHeaderListSize *uint32 } -var defaultServerOptions = options{ +var defaultServerOptions = serverOptions{ maxReceiveMessageSize: defaultServerMaxReceiveMessageSize, maxSendMessageSize: defaultServerMaxSendMessageSize, connectionTimeout: 120 * time.Second, @@ -140,7 +140,33 @@ var defaultServerOptions = options{ } // A ServerOption sets options such as credentials, codec and keepalive parameters, etc. -type ServerOption func(*options) +type ServerOption interface { + apply(*serverOptions) +} + +// EmptyServerOption does not alter the server configuration. It can be embedded +// in another structure to build custom server options. +// +// This API is EXPERIMENTAL. +type EmptyServerOption struct{} + +func (EmptyServerOption) apply(*serverOptions) {} + +// funcServerOption wraps a function that modifies serverOptions into an +// implementation of the ServerOption interface. +type funcServerOption struct { + f func(*serverOptions) +} + +func (fdo *funcServerOption) apply(do *serverOptions) { + fdo.f(do) +} + +func newFuncServerOption(f func(*serverOptions)) *funcServerOption { + return &funcServerOption{ + f: f, + } +} // WriteBufferSize determines how much data can be batched before doing a write on the wire. // The corresponding memory allocation for this buffer will be twice the size to keep syscalls low. @@ -148,9 +174,9 @@ type ServerOption func(*options) // Zero will disable the write buffer such that each write will be on underlying connection. // Note: A Send call may not directly translate to a write. func WriteBufferSize(s int) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.writeBufferSize = s - } + }) } // ReadBufferSize lets you set the size of read buffer, this determines how much data can be read at most @@ -159,25 +185,25 @@ func WriteBufferSize(s int) ServerOption { // Zero will disable read buffer for a connection so data framer can access the underlying // conn directly. func ReadBufferSize(s int) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.readBufferSize = s - } + }) } // InitialWindowSize returns a ServerOption that sets window size for stream. // The lower bound for window size is 64K and any value smaller than that will be ignored. func InitialWindowSize(s int32) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.initialWindowSize = s - } + }) } // InitialConnWindowSize returns a ServerOption that sets window size for a connection. // The lower bound for window size is 64K and any value smaller than that will be ignored. func InitialConnWindowSize(s int32) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.initialConnWindowSize = s - } + }) } // KeepaliveParams returns a ServerOption that sets keepalive and max-age parameters for the server. @@ -187,25 +213,25 @@ func KeepaliveParams(kp keepalive.ServerParameters) ServerOption { kp.Time = time.Second } - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.keepaliveParams = kp - } + }) } // KeepaliveEnforcementPolicy returns a ServerOption that sets keepalive enforcement policy for the server. func KeepaliveEnforcementPolicy(kep keepalive.EnforcementPolicy) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.keepalivePolicy = kep - } + }) } // CustomCodec returns a ServerOption that sets a codec for message marshaling and unmarshaling. // // This will override any lookups by content-subtype for Codecs registered with RegisterCodec. func CustomCodec(codec Codec) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.codec = codec - } + }) } // RPCCompressor returns a ServerOption that sets a compressor for outbound @@ -216,9 +242,9 @@ func CustomCodec(codec Codec) ServerOption { // // Deprecated: use encoding.RegisterCompressor instead. func RPCCompressor(cp Compressor) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.cp = cp - } + }) } // RPCDecompressor returns a ServerOption that sets a decompressor for inbound @@ -227,9 +253,9 @@ func RPCCompressor(cp Compressor) ServerOption { // // Deprecated: use encoding.RegisterCompressor instead. func RPCDecompressor(dc Decompressor) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.dc = dc - } + }) } // MaxMsgSize returns a ServerOption to set the max message size in bytes the server can receive. @@ -243,73 +269,73 @@ func MaxMsgSize(m int) ServerOption { // MaxRecvMsgSize returns a ServerOption to set the max message size in bytes the server can receive. // If this is not set, gRPC uses the default 4MB. func MaxRecvMsgSize(m int) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.maxReceiveMessageSize = m - } + }) } // MaxSendMsgSize returns a ServerOption to set the max message size in bytes the server can send. // If this is not set, gRPC uses the default `math.MaxInt32`. func MaxSendMsgSize(m int) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.maxSendMessageSize = m - } + }) } // MaxConcurrentStreams returns a ServerOption that will apply a limit on the number // of concurrent streams to each ServerTransport. func MaxConcurrentStreams(n uint32) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.maxConcurrentStreams = n - } + }) } // Creds returns a ServerOption that sets credentials for server connections. func Creds(c credentials.TransportCredentials) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.creds = c - } + }) } // UnaryInterceptor returns a ServerOption that sets the UnaryServerInterceptor for the // server. Only one unary interceptor can be installed. The construction of multiple // interceptors (e.g., chaining) can be implemented at the caller. func UnaryInterceptor(i UnaryServerInterceptor) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { if o.unaryInt != nil { panic("The unary server interceptor was already set and may not be reset.") } o.unaryInt = i - } + }) } // StreamInterceptor returns a ServerOption that sets the StreamServerInterceptor for the // server. Only one stream interceptor can be installed. func StreamInterceptor(i StreamServerInterceptor) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { if o.streamInt != nil { panic("The stream server interceptor was already set and may not be reset.") } o.streamInt = i - } + }) } // InTapHandle returns a ServerOption that sets the tap handle for all the server // transport to be created. Only one can be installed. func InTapHandle(h tap.ServerInHandle) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { if o.inTapHandle != nil { panic("The tap handle was already set and may not be reset.") } o.inTapHandle = h - } + }) } // StatsHandler returns a ServerOption that sets the stats handler for the server. func StatsHandler(h stats.Handler) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.statsHandler = h - } + }) } // UnknownServiceHandler returns a ServerOption that allows for adding a custom @@ -319,7 +345,7 @@ func StatsHandler(h stats.Handler) ServerOption { // The handling function has full access to the Context of the request and the // stream, and the invocation bypasses interceptors. func UnknownServiceHandler(streamHandler StreamHandler) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.unknownStreamDesc = &StreamDesc{ StreamName: "unknown_service_handler", Handler: streamHandler, @@ -327,7 +353,7 @@ func UnknownServiceHandler(streamHandler StreamHandler) ServerOption { ClientStreams: true, ServerStreams: true, } - } + }) } // ConnectionTimeout returns a ServerOption that sets the timeout for @@ -337,17 +363,17 @@ func UnknownServiceHandler(streamHandler StreamHandler) ServerOption { // // This API is EXPERIMENTAL. func ConnectionTimeout(d time.Duration) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.connectionTimeout = d - } + }) } // MaxHeaderListSize returns a ServerOption that sets the max (uncompressed) size // of header list that the server is prepared to accept. func MaxHeaderListSize(s uint32) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.maxHeaderListSize = &s - } + }) } // NewServer creates a gRPC server which has no service registered and has not @@ -355,7 +381,7 @@ func MaxHeaderListSize(s uint32) ServerOption { func NewServer(opt ...ServerOption) *Server { opts := defaultServerOptions for _, o := range opt { - o(&opts) + o.apply(&opts) } s := &Server{ lis: make(map[net.Listener]bool), From b78962e50338aee2188fb992dd6cc756c321cdba Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Fri, 26 Apr 2019 10:39:49 -0700 Subject: [PATCH 20/34] xds: save category in dropper (#2780) --- balancer/xds/edsbalancer/edsbalancer.go | 2 +- balancer/xds/edsbalancer/edsbalancer_test.go | 12 ++++++------ balancer/xds/edsbalancer/util.go | 4 +++- balancer/xds/edsbalancer/util_test.go | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/balancer/xds/edsbalancer/edsbalancer.go b/balancer/xds/edsbalancer/edsbalancer.go index 789d6d86e670..97e329d66e58 100644 --- a/balancer/xds/edsbalancer/edsbalancer.go +++ b/balancer/xds/edsbalancer/edsbalancer.go @@ -138,7 +138,7 @@ func (xdsB *EDSBalancer) updateDrops(dropPolicies []*edspb.ClusterLoadAssignment case percentpb.FractionalPercent_MILLION: denominator = 1000000 } - newDrops = append(newDrops, newDropper(numerator, denominator)) + newDrops = append(newDrops, newDropper(numerator, denominator, dropPolicy.GetCategory())) // The following reading xdsB.drops doesn't need mutex because it can only // be updated by the code following. diff --git a/balancer/xds/edsbalancer/edsbalancer_test.go b/balancer/xds/edsbalancer/edsbalancer_test.go index 19a8da739fd6..b9b037f3833c 100644 --- a/balancer/xds/edsbalancer/edsbalancer_test.go +++ b/balancer/xds/edsbalancer/edsbalancer_test.go @@ -480,22 +480,22 @@ func TestDropPicker(t *testing.T) { { name: "one drop", drops: []*dropper{ - newDropper(1, 2), + newDropper(1, 2, ""), }, }, { name: "two drops", drops: []*dropper{ - newDropper(1, 3), - newDropper(1, 2), + newDropper(1, 3, ""), + newDropper(1, 2, ""), }, }, { name: "three drops", drops: []*dropper{ - newDropper(1, 3), - newDropper(1, 4), - newDropper(1, 2), + newDropper(1, 3, ""), + newDropper(1, 4, ""), + newDropper(1, 2, ""), }, }, } diff --git a/balancer/xds/edsbalancer/util.go b/balancer/xds/edsbalancer/util.go index dfae1b514985..a271cf5a792e 100644 --- a/balancer/xds/edsbalancer/util.go +++ b/balancer/xds/edsbalancer/util.go @@ -25,9 +25,10 @@ type dropper struct { numerator uint32 denominator uint32 w wrr.WRR + category string } -func newDropper(numerator, denominator uint32) *dropper { +func newDropper(numerator, denominator uint32, category string) *dropper { w := newRandomWRR() w.Add(true, int64(numerator)) w.Add(false, int64(denominator-numerator)) @@ -36,6 +37,7 @@ func newDropper(numerator, denominator uint32) *dropper { numerator: numerator, denominator: denominator, w: w, + category: category, } } diff --git a/balancer/xds/edsbalancer/util_test.go b/balancer/xds/edsbalancer/util_test.go index 318b97848a12..f20825eadd71 100644 --- a/balancer/xds/edsbalancer/util_test.go +++ b/balancer/xds/edsbalancer/util_test.go @@ -106,7 +106,7 @@ func TestDropper(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - d := newDropper(tt.args.numerator, tt.args.denominator) + d := newDropper(tt.args.numerator, tt.args.denominator, "") var ( dCount int wantCount = int(tt.args.numerator) * repeat From a90198c718cf1e4c69867c118b00a0d9e5659f58 Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Fri, 26 Apr 2019 14:47:55 -0700 Subject: [PATCH 21/34] internal: seed random for wrr tests (#2791) --- balancer/internal/wrr/random.go | 4 +++- balancer/internal/wrr/wrr_test.go | 6 ++++++ vet.sh | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/balancer/internal/wrr/random.go b/balancer/internal/wrr/random.go index fe345f781b8c..ec724f2e7289 100644 --- a/balancer/internal/wrr/random.go +++ b/balancer/internal/wrr/random.go @@ -36,12 +36,14 @@ func NewRandom() WRR { return &randomWRR{} } +var grpcrandInt63n = grpcrand.Int63n + func (rw *randomWRR) Next() (item interface{}) { if rw.sumOfWeights == 0 { return nil } // Random number in [0, sum). - randomWeight := grpcrand.Int63n(rw.sumOfWeights) + randomWeight := grpcrandInt63n(rw.sumOfWeights) for _, item := range rw.items { randomWeight = randomWeight - item.Weight if randomWeight < 0 { diff --git a/balancer/internal/wrr/wrr_test.go b/balancer/internal/wrr/wrr_test.go index 03c2b9002ac8..2e32b9b6f6ba 100644 --- a/balancer/internal/wrr/wrr_test.go +++ b/balancer/internal/wrr/wrr_test.go @@ -20,6 +20,7 @@ package wrr import ( "errors" "math" + "math/rand" "testing" "github.com/google/go-cmp/cmp" @@ -97,3 +98,8 @@ func testWRRNext(t *testing.T, newWRR func() WRR) { func TestRandomWRRNext(t *testing.T) { testWRRNext(t, NewRandom) } + +func init() { + r := rand.New(rand.NewSource(0)) + grpcrandInt63n = r.Int63n +} diff --git a/vet.sh b/vet.sh index 7e6ce5eb4907..11037b94dc8b 100755 --- a/vet.sh +++ b/vet.sh @@ -75,7 +75,7 @@ git ls-files "*.go" | xargs grep -L "\(Copyright [0-9]\{4,\} gRPC authors\)\|DO # - 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') +git ls-files "*.go" | xargs grep -l '"math/rand"' 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/") From 47e1ebe575df3e712691b4415f96ff3ab4db6a06 Mon Sep 17 00:00:00 2001 From: Qitao Yu Date: Tue, 30 Apr 2019 03:42:19 +0800 Subject: [PATCH 22/34] client: return helpful error message when wait-for-ready RPCs fail with timeout (#2777) --- picker_wrapper.go | 8 ++++++++ test/end2end_test.go | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/picker_wrapper.go b/picker_wrapper.go index f9625496c403..45baa2ae13da 100644 --- a/picker_wrapper.go +++ b/picker_wrapper.go @@ -120,6 +120,14 @@ func (bp *pickerWrapper) pick(ctx context.Context, failfast bool, opts balancer. bp.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) + } + } return nil, nil, ctx.Err() case <-ch: } diff --git a/test/end2end_test.go b/test/end2end_test.go index acbd096633b3..f90509f5a6bf 100644 --- a/test/end2end_test.go +++ b/test/end2end_test.go @@ -6716,6 +6716,29 @@ func (s) TestFailFastRPCErrorOnBadCertificates(t *testing.T) { te.t.Fatalf("TestService/EmptyCall(_, _) = _, %v, want err.Error() contains %q", err, clientAlwaysFailCredErrorMsg) } +func (s) TestWaitForReadyRPCErrorOnBadCertificates(t *testing.T) { + te := newTest(t, env{name: "bad-cred", network: "tcp", security: "clientAlwaysFailCred", balancer: "round_robin"}) + te.startServer(&testServer{security: te.e.security}) + defer te.tearDown() + + opts := []grpc.DialOption{grpc.WithTransportCredentials(clientAlwaysFailCred{})} + dctx, dcancel := context.WithTimeout(context.Background(), 10*time.Second) + defer dcancel() + cc, err := grpc.DialContext(dctx, te.srvAddr, opts...) + if err != nil { + t.Fatalf("Dial(_) = %v, want %v", err, nil) + } + defer cc.Close() + + tc := testpb.NewTestServiceClient(cc) + ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second) + defer cancel() + if _, err = tc.EmptyCall(ctx, &testpb.Empty{}, grpc.WaitForReady(true)); strings.Contains(err.Error(), clientAlwaysFailCredErrorMsg) { + return + } + te.t.Fatalf("TestService/EmptyCall(_, _) = _, %v, want err.Error() contains %q", err, clientAlwaysFailCredErrorMsg) +} + func (s) TestRPCTimeout(t *testing.T) { for _, e := range listTestEnv() { testRPCTimeout(t, e) From d5973a91700d6143b4c45366641bd3911034e10f Mon Sep 17 00:00:00 2001 From: lyuxuan Date: Mon, 29 Apr 2019 15:50:08 -0700 Subject: [PATCH 23/34] xds: support BalancerV2 API (#2781) --- balancer/xds/xds.go | 173 ++++++++++++++++++++++++------------ balancer/xds/xds_test.go | 187 +++++++++++++++++++++++++++++---------- 2 files changed, 253 insertions(+), 107 deletions(-) diff --git a/balancer/xds/xds.go b/balancer/xds/xds.go index 7795724f4114..ba8485a9ddbe 100644 --- a/balancer/xds/xds.go +++ b/balancer/xds/xds.go @@ -25,7 +25,6 @@ package xds import ( "context" "encoding/json" - "errors" "fmt" "reflect" "sync" @@ -130,7 +129,7 @@ type xdsBalancer struct { config *xdsConfig // may change when passed a different service config xdsLB edsBalancerInterface fallbackLB balancer.Balancer - fallbackInitData *addressUpdate // may change when HandleResolved address is called + fallbackInitData *resolver.State // may change when HandleResolved address is called } func (x *xdsBalancer) startNewXDSClient(u *xdsConfig) { @@ -218,43 +217,93 @@ func (x *xdsBalancer) run() { } } +func getBalancerConfig(serviceConfig string) *xdsConfig { + sc := parseFullServiceConfig(serviceConfig) + if sc == nil { + return nil + } + var xdsConfigRaw json.RawMessage + for _, lbcfg := range sc.LoadBalancingConfig { + if lbcfg.Name == xdsName { + xdsConfigRaw = lbcfg.Config + break + } + } + var cfg xdsConfig + if err := json.Unmarshal(xdsConfigRaw, &cfg); err != nil { + grpclog.Warningf("unable to unmarshal balancer config %s into xds config", string(xdsConfigRaw)) + return nil + } + return &cfg +} + func (x *xdsBalancer) handleGRPCUpdate(update interface{}) { switch u := update.(type) { - case *addressUpdate: - if x.fallbackLB != nil { - x.fallbackLB.HandleResolvedAddrs(u.addrs, u.err) - } - x.fallbackInitData = u case *subConnStateUpdate: if x.xdsLB != nil { - x.xdsLB.HandleSubConnStateChange(u.sc, u.state) + x.xdsLB.HandleSubConnStateChange(u.sc, u.state.ConnectivityState) } if x.fallbackLB != nil { - x.fallbackLB.HandleSubConnStateChange(u.sc, u.state) + if lb, ok := x.fallbackLB.(balancer.V2Balancer); ok { + lb.UpdateSubConnState(u.sc, u.state) + } else { + x.fallbackLB.HandleSubConnStateChange(u.sc, u.state.ConnectivityState) + } } - case *xdsConfig: - if x.config == nil { - // The first time we get config, we just need to start the xdsClient. - x.startNewXDSClient(u) - x.config = u + case *resolver.State: + cfg := getBalancerConfig(u.ServiceConfig) + if cfg == nil { + // service config parsing failed. should never happen. And this parsing will be removed, once + // we support service config validation. return } - // With a different BalancerName, we need to create a new xdsClient. - // If current or previous ChildPolicy is nil, then we also need to recreate a new xdsClient. - // This is because with nil ChildPolicy xdsClient will do CDS request, while non-nil won't. - if u.BalancerName != x.config.BalancerName || (u.ChildPolicy == nil) != (x.config.ChildPolicy == nil) { - x.startNewXDSClient(u) + + var fallbackChanged bool + // service config has been updated. + if !reflect.DeepEqual(cfg, x.config) { + if x.config == nil { + // The first time we get config, we just need to start the xdsClient. + x.startNewXDSClient(cfg) + x.config = cfg + x.fallbackInitData = &resolver.State{ + Addresses: u.Addresses, + // TODO(yuxuanli): get the fallback balancer config once the validation change completes, where + // we can pass along the config struct. + } + return + } + + // With a different BalancerName, we need to create a new xdsClient. + // If current or previous ChildPolicy is nil, then we also need to recreate a new xdsClient. + // This is because with nil ChildPolicy xdsClient will do CDS request, while non-nil won't. + if cfg.BalancerName != x.config.BalancerName || (cfg.ChildPolicy == nil) != (x.config.ChildPolicy == nil) { + x.startNewXDSClient(cfg) + } + // We will update the xdsLB with the new child policy, if we got a different one and it's not nil. + // The nil case will be handled when the CDS response gets processed, we will update xdsLB at that time. + if x.xdsLB != nil && !reflect.DeepEqual(cfg.ChildPolicy, x.config.ChildPolicy) && cfg.ChildPolicy != nil { + x.xdsLB.HandleChildPolicy(cfg.ChildPolicy.Name, cfg.ChildPolicy.Config) + } + + if x.fallbackLB != nil && !reflect.DeepEqual(cfg.FallBackPolicy, x.config.FallBackPolicy) { + x.fallbackLB.Close() + x.buildFallBackBalancer(cfg) + fallbackChanged = true + } } - // We will update the xdsLB with the new child policy, if we got a different one and it's not nil. - // The nil case will be handled when the CDS response gets processed, we will update xdsLB at that time. - if !reflect.DeepEqual(u.ChildPolicy, x.config.ChildPolicy) && u.ChildPolicy != nil && x.xdsLB != nil { - x.xdsLB.HandleChildPolicy(u.ChildPolicy.Name, u.ChildPolicy.Config) + + if x.fallbackLB != nil && (!reflect.DeepEqual(x.fallbackInitData.Addresses, u.Addresses) || fallbackChanged) { + x.updateFallbackWithResolverState(&resolver.State{ + Addresses: u.Addresses, + }) } - if !reflect.DeepEqual(u.FallBackPolicy, x.config.FallBackPolicy) && x.fallbackLB != nil { - x.fallbackLB.Close() - x.startFallBackBalancer(u) + + x.config = cfg + x.fallbackInitData = &resolver.State{ + Addresses: u.Addresses, + // TODO(yuxuanli): get the fallback balancer config once the validation change completes, where + // we can pass along the config struct. } - x.config = u default: // unreachable path panic("wrong update type") @@ -341,17 +390,20 @@ func (w *xdsClientConn) UpdateBalancerState(s connectivity.State, p balancer.Pic w.ClientConn.UpdateBalancerState(s, p) } -type addressUpdate struct { - addrs []resolver.Address - err error -} - type subConnStateUpdate struct { sc balancer.SubConn - state connectivity.State + state balancer.SubConnState } func (x *xdsBalancer) HandleSubConnStateChange(sc balancer.SubConn, state connectivity.State) { + grpclog.Error("UpdateSubConnState should be called instead of HandleSubConnStateChange") +} + +func (x *xdsBalancer) HandleResolvedAddrs(addrs []resolver.Address, err error) { + grpclog.Error("UpdateResolverState should be called instead of HandleResolvedAddrs") +} + +func (x *xdsBalancer) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState) { update := &subConnStateUpdate{ sc: sc, state: state, @@ -362,29 +414,24 @@ func (x *xdsBalancer) HandleSubConnStateChange(sc balancer.SubConn, state connec } } -func (x *xdsBalancer) HandleResolvedAddrs(addrs []resolver.Address, err error) { - update := &addressUpdate{ - addrs: addrs, - err: err, - } - select { - case x.grpcUpdate <- update: - case <-x.ctx.Done(): - } +type serviceConfig struct { + LoadBalancingConfig []*loadBalancingConfig } -// TODO: once the API is merged, check whether we need to change the function name/signature here. -func (x *xdsBalancer) HandleBalancerConfig(config json.RawMessage) error { - var cfg xdsConfig - if err := json.Unmarshal(config, &cfg); err != nil { - return errors.New("unable to unmarshal balancer config into xds config") +func parseFullServiceConfig(s string) *serviceConfig { + var ret serviceConfig + err := json.Unmarshal([]byte(s), &ret) + if err != nil { + return nil } + return &ret +} +func (x *xdsBalancer) UpdateResolverState(s resolver.State) { select { - case x.grpcUpdate <- &cfg: + case x.grpcUpdate <- &s: case <-x.ctx.Done(): } - return nil } type cdsResp struct { @@ -441,10 +488,23 @@ func (x *xdsBalancer) switchFallback() { x.xdsLB.Close() x.xdsLB = nil } - x.startFallBackBalancer(x.config) + x.buildFallBackBalancer(x.config) + x.updateFallbackWithResolverState(x.fallbackInitData) x.cancelFallbackMonitoring() } +func (x *xdsBalancer) updateFallbackWithResolverState(s *resolver.State) { + if lb, ok := x.fallbackLB.(balancer.V2Balancer); ok { + lb.UpdateResolverState(resolver.State{ + Addresses: s.Addresses, + // TODO(yuxuanli): get the fallback balancer config once the validation change completes, where + // we can pass along the config struct. + }) + } else { + x.fallbackLB.HandleResolvedAddrs(s.Addresses, nil) + } +} + // x.cancelFallbackAndSwitchEDSBalancerIfNecessary() will be no-op if we have a working xds client. // It will cancel fallback monitoring if we are in fallback monitoring stage. // If there's no running edsBalancer currently, it will create one and initialize it. Also, it will @@ -466,9 +526,9 @@ func (x *xdsBalancer) cancelFallbackAndSwitchEDSBalancerIfNecessary() { } } -func (x *xdsBalancer) startFallBackBalancer(c *xdsConfig) { +func (x *xdsBalancer) buildFallBackBalancer(c *xdsConfig) { if c.FallBackPolicy == nil { - x.startFallBackBalancer(&xdsConfig{ + x.buildFallBackBalancer(&xdsConfig{ FallBackPolicy: &loadBalancingConfig{ Name: "round_robin", }, @@ -479,11 +539,6 @@ func (x *xdsBalancer) startFallBackBalancer(c *xdsConfig) { // balancer is registered or not. builder := balancer.Get(c.FallBackPolicy.Name) x.fallbackLB = builder.Build(x.cc, x.buildOpts) - if x.fallbackInitData != nil { - // TODO: uncomment when HandleBalancerConfig API is merged. - //x.fallbackLB.HandleBalancerConfig(c.FallBackPolicy.Config) - x.fallbackLB.HandleResolvedAddrs(x.fallbackInitData.addrs, x.fallbackInitData.err) - } } // There are three ways that could lead to fallback: @@ -596,7 +651,9 @@ type loadBalancingConfig struct { } func (l *loadBalancingConfig) MarshalJSON() ([]byte, error) { - return nil, nil + m := make(map[string]json.RawMessage) + m[l.Name] = l.Config + return json.Marshal(m) } func (l *loadBalancingConfig) UnmarshalJSON(data []byte) error { diff --git a/balancer/xds/xds_test.go b/balancer/xds/xds_test.go index abe2e1b301ea..be9c4e2fb2aa 100644 --- a/balancer/xds/xds_test.go +++ b/balancer/xds/xds_test.go @@ -64,12 +64,13 @@ const ( ) var ( - testBalancerNameFooBar = "foo.bar" - testBalancerConfigFooBar, _ = json.Marshal(&testBalancerConfig{ + testBalancerNameFooBar = "foo.bar" + testServiceConfigFooBar = constructServiceConfigFromXdsConfig(&testBalancerConfig{ BalancerName: testBalancerNameFooBar, ChildPolicy: []lbPolicy{fakeBalancerA}, FallbackPolicy: []lbPolicy{fakeBalancerA}, }) + specialAddrForBalancerA = resolver.Address{Addr: "this.is.balancer.A"} specialAddrForBalancerB = resolver.Address{Addr: "this.is.balancer.B"} @@ -95,6 +96,19 @@ func (l lbPolicy) MarshalJSON() ([]byte, error) { return json.Marshal(m) } +func constructServiceConfigFromXdsConfig(xdsCfg *testBalancerConfig) string { + cfgRaw, _ := json.Marshal(xdsCfg) + sc, _ := json.Marshal(&serviceConfig{ + LoadBalancingConfig: []*loadBalancingConfig{ + { + Name: xdsName, + Config: cfgRaw, + }, + }, + }) + return string(sc) +} + type balancerABuilder struct { mu sync.Mutex lastBalancer *balancerA @@ -264,19 +278,19 @@ func (s) TestXdsBalanceHandleResolvedAddrs(t *testing.T) { t.Fatalf("unable to type assert to *xdsBalancer") } defer lb.Close() - if err := lb.HandleBalancerConfig(json.RawMessage(testBalancerConfigFooBar)); err != nil { - t.Fatalf("failed to HandleBalancerConfig(%v), due to err: %v", string(testBalancerConfigFooBar), err) - } 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.HandleResolvedAddrs(addrs, nil) + lb.UpdateResolverState(resolver.State{ + Addresses: addrs, + ServiceConfig: string(testServiceConfigFooBar), + }) 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") + t.Fatal("timeout when geting new subconn result") } addrs = addrs[:2-i] } @@ -298,11 +312,11 @@ func (s) TestXdsBalanceHandleBalancerConfigBalancerNameUpdate(t *testing.T) { t.Fatalf("unable to type assert to *xdsBalancer") } defer lb.Close() - if err := lb.HandleBalancerConfig(json.RawMessage(testBalancerConfigFooBar)); err != nil { - t.Fatalf("failed to HandleBalancerConfig(%v), due to err: %v", string(testBalancerConfigFooBar), err) - } addrs := []resolver.Address{{Addr: "1.1.1.1:10001"}, {Addr: "2.2.2.2:10002"}, {Addr: "3.3.3.3:10003"}} - lb.HandleResolvedAddrs(addrs, nil) + lb.UpdateResolverState(resolver.State{ + Addresses: addrs, + ServiceConfig: string(testServiceConfigFooBar), + }) // verify fallback takes over select { @@ -325,15 +339,15 @@ func (s) TestXdsBalanceHandleBalancerConfigBalancerNameUpdate(t *testing.T) { for i := 0; i < 2; i++ { addr, td, cleanup := setupServer(t) cleanups = append(cleanups, cleanup) - workingBalancerConfig, _ := json.Marshal(&testBalancerConfig{ + workingServiceConfig := constructServiceConfigFromXdsConfig(&testBalancerConfig{ BalancerName: addr, ChildPolicy: []lbPolicy{fakeBalancerA}, FallbackPolicy: []lbPolicy{fakeBalancerA}, }) - - if err := lb.HandleBalancerConfig(json.RawMessage(workingBalancerConfig)); err != nil { - t.Fatalf("failed to HandleBalancerConfig(%v), due to err: %v", string(workingBalancerConfig), err) - } + lb.UpdateResolverState(resolver.State{ + Addresses: addrs, + ServiceConfig: string(workingServiceConfig), + }) td.sendResp(&response{resp: testEDSRespWithoutEndpoints}) var j int @@ -415,11 +429,10 @@ func (s) TestXdsBalanceHandleBalancerConfigChildPolicyUpdate(t *testing.T) { addr, td, cleanup := setupServer(t) cleanups = append(cleanups, cleanup) test.cfg.BalancerName = addr - workingBalancerConfig, _ := json.Marshal(test.cfg) - if err := lb.HandleBalancerConfig(json.RawMessage(workingBalancerConfig)); err != nil { - t.Fatalf("failed to HandleBalancerConfig(%v), due to err: %v", string(workingBalancerConfig), err) - } + lb.UpdateResolverState(resolver.State{ + ServiceConfig: constructServiceConfigFromXdsConfig(test.cfg), + }) if test.responseToSend != nil { td.sendResp(&response{resp: test.responseToSend}) } @@ -468,18 +481,14 @@ func (s) TestXdsBalanceHandleBalancerConfigFallbackUpdate(t *testing.T) { ChildPolicy: []lbPolicy{fakeBalancerA}, FallbackPolicy: []lbPolicy{fakeBalancerA}, } - workingBalancerConfig, _ := json.Marshal(cfg) - - if err := lb.HandleBalancerConfig(json.RawMessage(workingBalancerConfig)); err != nil { - t.Fatalf("failed to HandleBalancerConfig(%v), due to err: %v", string(workingBalancerConfig), err) - } + lb.UpdateResolverState(resolver.State{ + ServiceConfig: constructServiceConfigFromXdsConfig(cfg), + }) cfg.FallbackPolicy = []lbPolicy{fakeBalancerB} - workingBalancerConfig, _ = json.Marshal(cfg) - - if err := lb.HandleBalancerConfig(json.RawMessage(workingBalancerConfig)); err != nil { - t.Fatalf("failed to HandleBalancerConfig(%v), due to err: %v", string(workingBalancerConfig), err) - } + lb.UpdateResolverState(resolver.State{ + ServiceConfig: constructServiceConfigFromXdsConfig(cfg), + }) td.sendResp(&response{resp: testEDSRespWithoutEndpoints}) @@ -497,7 +506,10 @@ func (s) TestXdsBalanceHandleBalancerConfigFallbackUpdate(t *testing.T) { cleanup() addrs := []resolver.Address{{Addr: "1.1.1.1:10001"}, {Addr: "2.2.2.2:10002"}, {Addr: "3.3.3.3:10003"}} - lb.HandleResolvedAddrs(addrs, nil) + lb.UpdateResolverState(resolver.State{ + Addresses: addrs, + ServiceConfig: constructServiceConfigFromXdsConfig(cfg), + }) // verify fallback balancer B takes over select { @@ -510,10 +522,10 @@ func (s) TestXdsBalanceHandleBalancerConfigFallbackUpdate(t *testing.T) { } cfg.FallbackPolicy = []lbPolicy{fakeBalancerA} - workingBalancerConfig, _ = json.Marshal(cfg) - if err := lb.HandleBalancerConfig(json.RawMessage(workingBalancerConfig)); err != nil { - t.Fatalf("failed to HandleBalancerConfig(%v), due to err: %v", string(workingBalancerConfig), err) - } + lb.UpdateResolverState(resolver.State{ + Addresses: addrs, + ServiceConfig: constructServiceConfigFromXdsConfig(cfg), + }) // verify fallback balancer A takes over select { @@ -548,11 +560,9 @@ func (s) TestXdsBalancerHandlerSubConnStateChange(t *testing.T) { ChildPolicy: []lbPolicy{fakeBalancerA}, FallbackPolicy: []lbPolicy{fakeBalancerA}, } - workingBalancerConfig, _ := json.Marshal(cfg) - - if err := lb.HandleBalancerConfig(json.RawMessage(workingBalancerConfig)); err != nil { - t.Fatalf("failed to HandleBalancerConfig(%v), due to err: %v", string(workingBalancerConfig), err) - } + lb.UpdateResolverState(resolver.State{ + ServiceConfig: constructServiceConfigFromXdsConfig(cfg), + }) td.sendResp(&response{resp: testEDSRespWithoutEndpoints}) @@ -564,7 +574,7 @@ func (s) TestXdsBalancerHandlerSubConnStateChange(t *testing.T) { var i int for i = 0; i < 10; i++ { if edsLB := getLatestEdsBalancer(); edsLB != nil { - lb.HandleSubConnStateChange(expectedScStateChange.sc, expectedScStateChange.state) + lb.UpdateSubConnState(expectedScStateChange.sc, balancer.SubConnState{ConnectivityState: expectedScStateChange.state}) select { case scsc := <-edsLB.subconnStateChange: if !reflect.DeepEqual(scsc, expectedScStateChange) { @@ -590,7 +600,7 @@ func (s) TestXdsBalancerHandlerSubConnStateChange(t *testing.T) { // fallback balancer A takes over for i = 0; i < 10; i++ { if fblb := lbABuilder.getLastBalancer(); fblb != nil { - lb.HandleSubConnStateChange(expectedScStateChange.sc, expectedScStateChange.state) + lb.UpdateSubConnState(expectedScStateChange.sc, balancer.SubConnState{ConnectivityState: expectedScStateChange.state}) select { case scsc := <-fblb.subconnStateChange: if !reflect.DeepEqual(scsc, expectedScStateChange) { @@ -630,11 +640,9 @@ func (s) TestXdsBalancerFallbackSignalFromEdsBalancer(t *testing.T) { ChildPolicy: []lbPolicy{fakeBalancerA}, FallbackPolicy: []lbPolicy{fakeBalancerA}, } - workingBalancerConfig, _ := json.Marshal(cfg) - - if err := lb.HandleBalancerConfig(json.RawMessage(workingBalancerConfig)); err != nil { - t.Fatalf("failed to HandleBalancerConfig(%v), due to err: %v", string(workingBalancerConfig), err) - } + lb.UpdateResolverState(resolver.State{ + ServiceConfig: constructServiceConfigFromXdsConfig(cfg), + }) td.sendResp(&response{resp: testEDSRespWithoutEndpoints}) @@ -646,7 +654,7 @@ func (s) TestXdsBalancerFallbackSignalFromEdsBalancer(t *testing.T) { var i int for i = 0; i < 10; i++ { if edsLB := getLatestEdsBalancer(); edsLB != nil { - lb.HandleSubConnStateChange(expectedScStateChange.sc, expectedScStateChange.state) + lb.UpdateSubConnState(expectedScStateChange.sc, balancer.SubConnState{ConnectivityState: expectedScStateChange.state}) select { case scsc := <-edsLB.subconnStateChange: if !reflect.DeepEqual(scsc, expectedScStateChange) { @@ -672,7 +680,7 @@ func (s) TestXdsBalancerFallbackSignalFromEdsBalancer(t *testing.T) { // fallback balancer A takes over for i = 0; i < 10; i++ { if fblb := lbABuilder.getLastBalancer(); fblb != nil { - lb.HandleSubConnStateChange(expectedScStateChange.sc, expectedScStateChange.state) + lb.UpdateSubConnState(expectedScStateChange.sc, balancer.SubConnState{ConnectivityState: expectedScStateChange.state}) select { case scsc := <-fblb.subconnStateChange: if !reflect.DeepEqual(scsc, expectedScStateChange) { @@ -710,3 +718,84 @@ func (s) TestXdsBalancerConfigParsingSelectingLBPolicy(t *testing.T) { t.Fatalf("got fallback policy %v, want %v", xdsCfg.FallBackPolicy, wantFallbackPolicy) } } + +func (s) TestXdsFullServiceConfigParsing(t *testing.T) { + tests := []struct { + name string + s string + want *serviceConfig + }{ + { + name: "empty", + s: "", + want: nil, + }, + { + name: "success1", + s: `{"loadBalancingConfig":[{"xds":{"childPolicy":[{"pick_first":{}}]}}]}`, + want: &serviceConfig{ + LoadBalancingConfig: []*loadBalancingConfig{ + {"xds", json.RawMessage(`{"childPolicy":[{"pick_first":{}}]}`)}, + }, + }, + }, + { + name: "success2", + s: `{"loadBalancingConfig":[{"xds":{"childPolicy":[{"round_robin":{}},{"pick_first":{}}]}}]}`, + want: &serviceConfig{ + LoadBalancingConfig: []*loadBalancingConfig{ + {"xds", json.RawMessage(`{"childPolicy":[{"round_robin":{}},{"pick_first":{}}]}`)}, + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := parseFullServiceConfig(tt.s); !reflect.DeepEqual(got, tt.want) { + t.Errorf("test name: %s, parseFullServiceConfig() = %+v, want %+v", tt.name, got, tt.want) + } + }) + } +} + +func (s) TestXdsLoadbalancingConfigParsing(t *testing.T) { + tests := []struct { + name string + s string + want *xdsConfig + }{ + { + name: "empty", + s: "{}", + want: &xdsConfig{}, + }, + { + name: "success1", + s: `{"childPolicy":[{"pick_first":{}}]}`, + want: &xdsConfig{ + ChildPolicy: &loadBalancingConfig{ + Name: "pick_first", + Config: json.RawMessage(`{}`), + }, + }, + }, + { + name: "success2", + s: `{"childPolicy":[{"round_robin":{}},{"pick_first":{}}]}`, + want: &xdsConfig{ + ChildPolicy: &loadBalancingConfig{ + Name: "round_robin", + Config: json.RawMessage(`{}`), + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + 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) + } + }) + } +} From 5ed5cbab96d1cd17943e0b84ef748212d2cdc921 Mon Sep 17 00:00:00 2001 From: Easwar Swaminathan Date: Thu, 2 May 2019 10:23:31 -0700 Subject: [PATCH 24/34] dns: rate limit DNS resolution requests (#2760) --- resolver/dns/dns_resolver.go | 19 +++++ resolver/dns/dns_resolver_test.go | 124 +++++++++++++++++++++++++++++- 2 files changed, 139 insertions(+), 4 deletions(-) diff --git a/resolver/dns/dns_resolver.go b/resolver/dns/dns_resolver.go index 58355990779b..297492e87af4 100644 --- a/resolver/dns/dns_resolver.go +++ b/resolver/dns/dns_resolver.go @@ -66,6 +66,9 @@ var ( 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) { @@ -241,7 +244,13 @@ func (d *dnsResolver) watcher() { 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. @@ -254,6 +263,16 @@ func (d *dnsResolver) watcher() { } 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 + } } } diff --git a/resolver/dns/dns_resolver_test.go b/resolver/dns/dns_resolver_test.go index b97cf4f8843c..b03486b11d7c 100644 --- a/resolver/dns/dns_resolver_test.go +++ b/resolver/dns/dns_resolver_test.go @@ -34,7 +34,12 @@ import ( ) func TestMain(m *testing.M) { - cleanup := replaceNetFunc() + // 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) code := m.Run() cleanup() os.Exit(code) @@ -85,9 +90,16 @@ func (t *testClientConn) getSc() (string, int) { } type testResolver struct { + // A write to this channel is made when this resolver receives a resolution + // request. Tests can rely on reading from this channel to be notified about + // resolution requests instead of sleeping for a predefined period of time. + ch chan struct{} } -func (*testResolver) LookupHost(ctx context.Context, host string) ([]string, error) { +func (tr *testResolver) LookupHost(ctx context.Context, host string) ([]string, error) { + if tr.ch != nil { + tr.ch <- struct{}{} + } return hostLookup(host) } @@ -99,15 +111,24 @@ func (*testResolver) LookupTXT(ctx context.Context, host string) ([]string, erro return txtLookup(host) } -func replaceNetFunc() func() { +func replaceNetFunc(ch chan struct{}) func() { oldResolver := defaultResolver - defaultResolver = &testResolver{} + defaultResolver = &testResolver{ch: ch} return func() { defaultResolver = oldResolver } } +func replaceDNSResRate(d time.Duration) func() { + oldMinDNSResRate := minDNSResRate + minDNSResRate = d + + return func() { + minDNSResRate = oldMinDNSResRate + } +} + var hostLookupTbl = struct { sync.Mutex tbl map[string][]string @@ -1126,3 +1147,98 @@ func TestCustomAuthority(t *testing.T) { } } } + +// TestRateLimitedResolve exercises the rate limit enforced on re-resolution +// requests. It sets the re-resolution rate to a small value and repeatedly +// calls ResolveNow() and ensures only the expected number of resolution +// requests are made. +func TestRateLimitedResolve(t *testing.T) { + defer leakcheck.Check(t) + + const dnsResRate = 100 * time.Millisecond + dc := replaceDNSResRate(dnsResRate) + defer dc() + + // Create a new testResolver{} for this test because we want the exact count + // of the number of times the resolver was invoked. + nc := replaceNetFunc(make(chan struct{}, 1)) + defer nc() + + target := "foo.bar.com" + b := NewBuilder() + cc := &testClientConn{target: target} + r, err := b.Build(resolver.Target{Endpoint: target}, cc, resolver.BuildOption{}) + if err != nil { + t.Fatalf("resolver.Build() returned error: %v\n", err) + } + defer r.Close() + + dnsR, ok := r.(*dnsResolver) + if !ok { + t.Fatalf("resolver.Build() returned unexpected type: %T\n", dnsR) + } + tr, ok := dnsR.resolver.(*testResolver) + if !ok { + t.Fatalf("delegate resolver returned unexpected type: %T\n", tr) + } + + // Wait for the first resolution request to be done. This happens as part of + // the first iteration of the for loop in watcher() because we start with a + // timer of zero duration. + <-tr.ch + + // Here we start a couple of goroutines. One repeatedly calls ResolveNow() + // until asked to stop, and the other waits for two resolution requests to be + // made to our testResolver and stops the former. We measure the start and + // end times, and expect the duration elapsed to be in the interval + // {2*dnsResRate, 3*dnsResRate} + start := time.Now() + done := make(chan struct{}) + go func() { + for { + select { + case <-done: + return + default: + r.ResolveNow(resolver.ResolveNowOption{}) + time.Sleep(1 * time.Millisecond) + } + } + }() + + gotCalls := 0 + const wantCalls = 2 + min, max := wantCalls*dnsResRate, (wantCalls+1)*dnsResRate + tMax := time.NewTimer(max) + for gotCalls != wantCalls { + select { + case <-tr.ch: + gotCalls++ + case <-tMax.C: + t.Fatalf("Timed out waiting for %v calls after %v; got %v", wantCalls, max, gotCalls) + } + } + close(done) + elapsed := time.Since(start) + + if gotCalls != wantCalls { + t.Fatalf("resolve count mismatch for target: %q = %+v, want %+v\n", target, gotCalls, wantCalls) + } + if elapsed < min { + t.Fatalf("elapsed time: %v, wanted it to be between {%v and %v}", elapsed, min, max) + } + + wantAddrs := []resolver.Address{{Addr: "1.2.3.4" + colonDefaultPort}, {Addr: "5.6.7.8" + colonDefaultPort}} + var gotAddrs []resolver.Address + for { + var cnt int + gotAddrs, cnt = cc.getAddress() + 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) + } +} From a9408321c767bb7e91e670471420edeae2f3b2d7 Mon Sep 17 00:00:00 2001 From: Jean de Klerk Date: Thu, 2 May 2019 14:20:28 -0600 Subject: [PATCH 25/34] internal: remove err from ClientTransport.GracefulClose (#2771) --- internal/transport/http2_client.go | 8 ++++---- internal/transport/transport.go | 2 +- internal/transport/transport_test.go | 4 +--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/internal/transport/http2_client.go b/internal/transport/http2_client.go index 9dee6db61d9d..91e446fbe6c3 100644 --- a/internal/transport/http2_client.go +++ b/internal/transport/http2_client.go @@ -794,21 +794,21 @@ func (t *http2Client) Close() error { // stream is closed. If there are no active streams, the transport is closed // immediately. This does nothing if the transport is already draining or // closing. -func (t *http2Client) GracefulClose() error { +func (t *http2Client) GracefulClose() { t.mu.Lock() // Make sure we move to draining only from active. if t.state == draining || t.state == closing { t.mu.Unlock() - return nil + return } t.state = draining active := len(t.activeStreams) t.mu.Unlock() if active == 0 { - return t.Close() + t.Close() + return } t.controlBuf.put(&incomingGoAway{}) - return nil } // Write formats the data into HTTP2 data frame(s) and sends it out. The caller diff --git a/internal/transport/transport.go b/internal/transport/transport.go index 0600e5042da9..846147a64e50 100644 --- a/internal/transport/transport.go +++ b/internal/transport/transport.go @@ -583,7 +583,7 @@ type ClientTransport interface { // finished, the transport will close. // // It does not block. - GracefulClose() error + GracefulClose() // Write sends the data for the given stream. A nil stream indicates // the write is to be performed on the transport as a whole. diff --git a/internal/transport/transport_test.go b/internal/transport/transport_test.go index baea6befdcde..f2e0d48c0ffe 100644 --- a/internal/transport/transport_test.go +++ b/internal/transport/transport_test.go @@ -1130,9 +1130,7 @@ func TestGracefulClose(t *testing.T) { if _, err := s.Read(recvMsg); err != nil { t.Fatalf("Error while reading: %v", err) } - if err = ct.GracefulClose(); err != nil { - t.Fatalf("GracefulClose() = %v, want ", err) - } + ct.GracefulClose() var wg sync.WaitGroup // Expect the failure for all the follow-up streams because ct has been closed gracefully. for i := 0; i < 200; i++ { From 42baa8b1993027b9f7687008ddf3a600bf934303 Mon Sep 17 00:00:00 2001 From: lyuxuan Date: Thu, 2 May 2019 14:47:50 -0700 Subject: [PATCH 26/34] channelz: wait for clean up before next test (#2797) --- channelz/service/service_sktopt_test.go | 5 +- channelz/service/service_test.go | 58 ++++++++++++---- internal/channelz/funcs.go | 30 ++++++++- test/channelz_linux_go110_test.go | 3 +- test/channelz_test.go | 89 +++++++++++++++++-------- test/end2end_test.go | 3 +- 6 files changed, 143 insertions(+), 45 deletions(-) diff --git a/channelz/service/service_sktopt_test.go b/channelz/service/service_sktopt_test.go index d90ada0d4bf3..bfff13ec9420 100644 --- a/channelz/service/service_sktopt_test.go +++ b/channelz/service/service_sktopt_test.go @@ -125,7 +125,8 @@ func protoToSocketOption(skopts []*channelzpb.SocketOption) *channelz.SocketOpti } func TestGetSocketOptions(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer cleanupWrapper(czCleanup, t) ss := []*dummySocket{ { socketOptions: &channelz.SocketOptionData{ @@ -139,8 +140,10 @@ func TestGetSocketOptions(t *testing.T) { svr := newCZServer() ids := make([]int64, len(ss)) svrID := channelz.RegisterServer(&dummyServer{}, "") + defer channelz.RemoveEntry(svrID) for i, s := range ss { ids[i] = channelz.RegisterNormalSocket(s, svrID, strconv.Itoa(i)) + defer channelz.RemoveEntry(ids[i]) } for i, s := range ss { resp, _ := svr.GetSocket(context.Background(), &channelzpb.GetSocketRequest{SocketId: ids[i]}) diff --git a/channelz/service/service_test.go b/channelz/service/service_test.go index 26ef41314c2a..60c0b2685942 100644 --- a/channelz/service/service_test.go +++ b/channelz/service/service_test.go @@ -39,6 +39,12 @@ func init() { channelz.TurnOn() } +func cleanupWrapper(cleanup func() error, t *testing.T) { + if err := cleanup(); err != nil { + t.Error(err) + } +} + type protoToSocketOptFunc func([]*channelzpb.SocketOption) *channelz.SocketOptionData // protoToSocketOpt is used in function socketProtoToStruct to extract socket option @@ -305,9 +311,11 @@ func TestGetTopChannels(t *testing.T) { }, {}, } - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer cleanupWrapper(czCleanup, t) for _, c := range tcs { - channelz.RegisterChannel(c, 0, "") + id := channelz.RegisterChannel(c, 0, "") + defer channelz.RemoveEntry(id) } s := newCZServer() resp, _ := s.GetTopChannels(context.Background(), &channelzpb.GetTopChannelsRequest{StartChannelId: 0}) @@ -320,7 +328,8 @@ func TestGetTopChannels(t *testing.T) { } } for i := 0; i < 50; i++ { - channelz.RegisterChannel(tcs[0], 0, "") + id := channelz.RegisterChannel(tcs[0], 0, "") + defer channelz.RemoveEntry(id) } resp, _ = s.GetTopChannels(context.Background(), &channelzpb.GetTopChannelsRequest{StartChannelId: 0}) if resp.GetEnd() { @@ -349,9 +358,11 @@ func TestGetServers(t *testing.T) { lastCallStartedTimestamp: time.Now().UTC(), }, } - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer cleanupWrapper(czCleanup, t) for _, s := range ss { - channelz.RegisterServer(s, "") + id := channelz.RegisterServer(s, "") + defer channelz.RemoveEntry(id) } svr := newCZServer() resp, _ := svr.GetServers(context.Background(), &channelzpb.GetServersRequest{StartServerId: 0}) @@ -364,7 +375,8 @@ func TestGetServers(t *testing.T) { } } for i := 0; i < 50; i++ { - channelz.RegisterServer(ss[0], "") + id := channelz.RegisterServer(ss[0], "") + defer channelz.RemoveEntry(id) } resp, _ = svr.GetServers(context.Background(), &channelzpb.GetServersRequest{StartServerId: 0}) if resp.GetEnd() { @@ -373,13 +385,18 @@ func TestGetServers(t *testing.T) { } func TestGetServerSockets(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer cleanupWrapper(czCleanup, t) svrID := channelz.RegisterServer(&dummyServer{}, "") + defer channelz.RemoveEntry(svrID) refNames := []string{"listen socket 1", "normal socket 1", "normal socket 2"} ids := make([]int64, 3) ids[0] = channelz.RegisterListenSocket(&dummySocket{}, svrID, refNames[0]) ids[1] = channelz.RegisterNormalSocket(&dummySocket{}, svrID, refNames[1]) ids[2] = channelz.RegisterNormalSocket(&dummySocket{}, svrID, refNames[2]) + for _, id := range ids { + defer channelz.RemoveEntry(id) + } svr := newCZServer() resp, _ := svr.GetServerSockets(context.Background(), &channelzpb.GetServerSocketsRequest{ServerId: svrID, StartSocketId: 0}) if !resp.GetEnd() { @@ -395,7 +412,8 @@ func TestGetServerSockets(t *testing.T) { } for i := 0; i < 50; i++ { - channelz.RegisterNormalSocket(&dummySocket{}, svrID, "") + id := channelz.RegisterNormalSocket(&dummySocket{}, svrID, "") + defer channelz.RemoveEntry(id) } resp, _ = svr.GetServerSockets(context.Background(), &channelzpb.GetServerSocketsRequest{ServerId: svrID, StartSocketId: 0}) if resp.GetEnd() { @@ -406,13 +424,18 @@ func TestGetServerSockets(t *testing.T) { // This test makes a GetServerSockets with a non-zero start ID, and expect only // sockets with ID >= the given start ID. func TestGetServerSocketsNonZeroStartID(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer cleanupWrapper(czCleanup, t) svrID := channelz.RegisterServer(&dummyServer{}, "") + defer channelz.RemoveEntry(svrID) refNames := []string{"listen socket 1", "normal socket 1", "normal socket 2"} ids := make([]int64, 3) ids[0] = channelz.RegisterListenSocket(&dummySocket{}, svrID, refNames[0]) ids[1] = channelz.RegisterNormalSocket(&dummySocket{}, svrID, refNames[1]) ids[2] = channelz.RegisterNormalSocket(&dummySocket{}, svrID, refNames[2]) + for _, id := range ids { + defer channelz.RemoveEntry(id) + } svr := newCZServer() // Make GetServerSockets with startID = ids[1]+1, so socket-1 won't be // included in the response. @@ -431,7 +454,8 @@ func TestGetServerSocketsNonZeroStartID(t *testing.T) { } func TestGetChannel(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer cleanupWrapper(czCleanup, t) refNames := []string{"top channel 1", "nested channel 1", "sub channel 2", "nested channel 3"} ids := make([]int64, 4) ids[0] = channelz.RegisterChannel(&dummyChannel{}, 0, refNames[0]) @@ -475,6 +499,9 @@ func TestGetChannel(t *testing.T) { Desc: "Resolver returns an empty address list", Severity: channelz.CtWarning, }) + for _, id := range ids { + defer channelz.RemoveEntry(id) + } svr := newCZServer() resp, _ := svr.GetChannel(context.Background(), &channelzpb.GetChannelRequest{ChannelId: ids[0]}) metrics := resp.GetChannel() @@ -530,7 +557,8 @@ func TestGetSubChannel(t *testing.T) { subchanConnectivityChange = fmt.Sprintf("Subchannel Connectivity change to %v", connectivity.Ready) subChanPickNewAddress = fmt.Sprintf("Subchannel picks a new address %q to connect", "0.0.0.0") ) - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer cleanupWrapper(czCleanup, t) refNames := []string{"top channel 1", "sub channel 1", "socket 1", "socket 2"} ids := make([]int64, 4) ids[0] = channelz.RegisterChannel(&dummyChannel{}, 0, refNames[0]) @@ -557,6 +585,9 @@ func TestGetSubChannel(t *testing.T) { Desc: subChanPickNewAddress, Severity: channelz.CtINFO, }) + for _, id := range ids { + defer channelz.RemoveEntry(id) + } svr := newCZServer() resp, _ := svr.GetSubchannel(context.Background(), &channelzpb.GetSubchannelRequest{SubchannelId: ids[1]}) metrics := resp.GetSubchannel() @@ -598,7 +629,8 @@ func TestGetSubChannel(t *testing.T) { } func TestGetSocket(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer cleanupWrapper(czCleanup, t) ss := []*dummySocket{ { streamsStarted: 10, @@ -673,8 +705,10 @@ func TestGetSocket(t *testing.T) { svr := newCZServer() ids := make([]int64, len(ss)) svrID := channelz.RegisterServer(&dummyServer{}, "") + defer channelz.RemoveEntry(svrID) for i, s := range ss { ids[i] = channelz.RegisterNormalSocket(s, svrID, strconv.Itoa(i)) + defer channelz.RemoveEntry(ids[i]) } for i, s := range ss { resp, _ := svr.GetSocket(context.Background(), &channelzpb.GetSocketRequest{SocketId: ids[i]}) diff --git a/internal/channelz/funcs.go b/internal/channelz/funcs.go index 041520d35199..f0744f9937e9 100644 --- a/internal/channelz/funcs.go +++ b/internal/channelz/funcs.go @@ -24,6 +24,7 @@ package channelz import ( + "fmt" "sort" "sync" "sync/atomic" @@ -95,9 +96,14 @@ func (d *dbWrapper) get() *channelMap { // NewChannelzStorage initializes channelz data storage and id generator. // +// This function returns a cleanup function to wait for all channelz state to be reset by the +// grpc goroutines when those entities get closed. By using this cleanup function, we make sure tests +// don't mess up each other, i.e. lingering goroutine from previous test doing entity removal happen +// to remove some entity just register by the new test, since the id space is the same. +// // Note: This function is exported for testing purpose only. User should not call // it in most cases. -func NewChannelzStorage() { +func NewChannelzStorage() (cleanup func() error) { db.set(&channelMap{ topLevelChannels: make(map[int64]struct{}), channels: make(map[int64]*channel), @@ -107,6 +113,28 @@ func NewChannelzStorage() { subChannels: make(map[int64]*subChannel), }) idGen.reset() + return func() error { + var err error + cm := db.get() + if cm == nil { + return nil + } + for i := 0; i < 1000; i++ { + cm.mu.Lock() + if len(cm.topLevelChannels) == 0 && len(cm.servers) == 0 && len(cm.channels) == 0 && len(cm.subChannels) == 0 && len(cm.listenSockets) == 0 && len(cm.normalSockets) == 0 { + cm.mu.Unlock() + // all things stored in the channelz map have been cleared. + return nil + } + cm.mu.Unlock() + time.Sleep(10 * time.Millisecond) + } + + cm.mu.Lock() + err = fmt.Errorf("after 10s the channelz map has not been cleaned up yet, topchannels: %d, servers: %d, channels: %d, subchannels: %d, listen sockets: %d, normal sockets: %d", len(cm.topLevelChannels), len(cm.servers), len(cm.channels), len(cm.subChannels), len(cm.listenSockets), len(cm.normalSockets)) + cm.mu.Unlock() + return err + } } // GetTopChannels returns a slice of top channel's ChannelMetric, along with a diff --git a/test/channelz_linux_go110_test.go b/test/channelz_linux_go110_test.go index 13d3484fe188..ede329ad6297 100644 --- a/test/channelz_linux_go110_test.go +++ b/test/channelz_linux_go110_test.go @@ -40,7 +40,8 @@ func (s) TestCZSocketMetricsSocketOption(t *testing.T) { } func testCZSocketMetricsSocketOption(t *testing.T, e env) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) te := newTest(t, e) te.startServer(&testServer{security: e.security}) defer te.tearDown() diff --git a/test/channelz_test.go b/test/channelz_test.go index 4d8c0cc3e0b6..0adf0e886317 100644 --- a/test/channelz_test.go +++ b/test/channelz_test.go @@ -46,6 +46,12 @@ import ( "google.golang.org/grpc/testdata" ) +func czCleanupWrapper(cleanup func() error, t *testing.T) { + if err := cleanup(); err != nil { + t.Error(err) + } +} + func (te *test) startServers(ts testpb.TestServiceServer, num int) { for i := 0; i < num; i++ { te.startServer(ts) @@ -85,7 +91,8 @@ func (s) TestCZServerRegistrationAndDeletion(t *testing.T) { } for _, c := range testcases { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv te := newTest(t, e) te.startServers(&testServer{security: e.security}, c.total) @@ -103,7 +110,8 @@ func (s) TestCZServerRegistrationAndDeletion(t *testing.T) { } func (s) TestCZGetServer(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv te := newTest(t, e) te.startServer(&testServer{security: e.security}) @@ -154,7 +162,8 @@ func (s) TestCZTopChannelRegistrationAndDeletion(t *testing.T) { } for _, c := range testcases { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv te := newTest(t, e) var ccs []*grpc.ClientConn @@ -191,7 +200,8 @@ func (s) TestCZTopChannelRegistrationAndDeletion(t *testing.T) { } func (s) TestCZTopChannelRegistrationAndDeletionWhenDialFail(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) // Make dial fails (due to no transport security specified) _, err := grpc.Dial("fake.addr") if err == nil { @@ -203,7 +213,8 @@ func (s) TestCZTopChannelRegistrationAndDeletionWhenDialFail(t *testing.T) { } func (s) TestCZNestedChannelRegistrationAndDeletion(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv // avoid calling API to set balancer type, which will void service config's change of balancer. e.balancer = "" @@ -247,7 +258,8 @@ func (s) TestCZNestedChannelRegistrationAndDeletion(t *testing.T) { } func (s) TestCZClientSubChannelSocketRegistrationAndDeletion(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv num := 3 // number of backends te := newTest(t, e) @@ -335,11 +347,11 @@ func (s) TestCZServerSocketRegistrationAndDeletion(t *testing.T) { } for _, c := range testcases { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv te := newTest(t, e) te.startServer(&testServer{security: e.security}) - defer te.tearDown() var ccs []*grpc.ClientConn for i := 0; i < c.total; i++ { cc := te.clientConn() @@ -390,11 +402,13 @@ func (s) TestCZServerSocketRegistrationAndDeletion(t *testing.T) { }); err != nil { t.Fatal(err) } + te.tearDown() } } func (s) TestCZServerListenSocketDeletion(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) s := grpc.NewServer() lis, err := net.Listen("tcp", "localhost:0") if err != nil { @@ -450,7 +464,8 @@ func (s) TestCZRecusivelyDeletionOfEntry(t *testing.T) { // | | // v v // Socket1 Socket2 - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) topChanID := channelz.RegisterChannel(&dummyChannel{}, 0, "") subChanID1 := channelz.RegisterSubChannel(&dummyChannel{}, topChanID, "") subChanID2 := channelz.RegisterSubChannel(&dummyChannel{}, topChanID, "") @@ -494,7 +509,8 @@ func (s) TestCZRecusivelyDeletionOfEntry(t *testing.T) { } func (s) TestCZChannelMetrics(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv num := 3 // number of backends te := newTest(t, e) @@ -582,7 +598,8 @@ func (s) TestCZChannelMetrics(t *testing.T) { } func (s) TestCZServerMetrics(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv te := newTest(t, e) te.maxServerReceiveMsgSize = newInt(8) @@ -866,7 +883,8 @@ func doIdleCallToInvokeKeepAlive(tc testpb.TestServiceClient, t *testing.T) { } func (s) TestCZClientSocketMetricsStreamsAndMessagesCount(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv te := newTest(t, e) te.maxServerReceiveMsgSize = newInt(20) @@ -965,7 +983,8 @@ func (s) TestCZClientSocketMetricsStreamsAndMessagesCount(t *testing.T) { // It is separated from other cases due to setup incompatibly, i.e. max receive // size violation will mask flow control violation. func (s) TestCZClientAndServerSocketMetricsStreamsCountFlowControlRSTStream(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv te := newTest(t, e) te.serverInitialWindowSize = 65536 @@ -1025,7 +1044,8 @@ func (s) TestCZClientAndServerSocketMetricsStreamsCountFlowControlRSTStream(t *t } func (s) TestCZClientAndServerSocketMetricsFlowControl(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv te := newTest(t, e) // disable BDP @@ -1137,7 +1157,8 @@ func (s) TestCZClientAndServerSocketMetricsFlowControl(t *testing.T) { } func (s) TestCZClientSocketMetricsKeepAlive(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) defer func(t time.Duration) { internal.KeepaliveMinPingTime = t }(internal.KeepaliveMinPingTime) internal.KeepaliveMinPingTime = time.Second e := tcpClearRREnv @@ -1189,7 +1210,8 @@ func (s) TestCZClientSocketMetricsKeepAlive(t *testing.T) { } func (s) TestCZServerSocketMetricsStreamsAndMessagesCount(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv te := newTest(t, e) te.maxServerReceiveMsgSize = newInt(20) @@ -1249,7 +1271,8 @@ func (s) TestCZServerSocketMetricsStreamsAndMessagesCount(t *testing.T) { } func (s) TestCZServerSocketMetricsKeepAlive(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + 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})) @@ -1307,7 +1330,8 @@ var cipherSuites = []string{ } func (s) TestCZSocketGetSecurityValueTLS(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpTLSRREnv te := newTest(t, e) te.startServer(&testServer{security: e.security}) @@ -1356,7 +1380,8 @@ func (s) TestCZSocketGetSecurityValueTLS(t *testing.T) { } func (s) TestCZChannelTraceCreationDeletion(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv // avoid calling API to set balancer type, which will void service config's change of balancer. e.balancer = "" @@ -1431,7 +1456,8 @@ func (s) TestCZChannelTraceCreationDeletion(t *testing.T) { } func (s) TestCZSubChannelTraceCreationDeletion(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv te := newTest(t, e) te.startServer(&testServer{security: e.security}) @@ -1509,7 +1535,8 @@ func (s) TestCZSubChannelTraceCreationDeletion(t *testing.T) { } func (s) TestCZChannelAddressResolutionChange(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv e.balancer = "" te := newTest(t, e) @@ -1611,7 +1638,8 @@ func (s) TestCZChannelAddressResolutionChange(t *testing.T) { } func (s) TestCZSubChannelPickedNewAddress(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv e.balancer = "" te := newTest(t, e) @@ -1671,7 +1699,8 @@ func (s) TestCZSubChannelPickedNewAddress(t *testing.T) { } func (s) TestCZSubChannelConnectivityState(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv te := newTest(t, e) te.startServer(&testServer{security: e.security}) @@ -1765,7 +1794,8 @@ func (s) TestCZSubChannelConnectivityState(t *testing.T) { } func (s) TestCZChannelConnectivityState(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv te := newTest(t, e) te.startServer(&testServer{security: e.security}) @@ -1821,7 +1851,8 @@ func (s) TestCZChannelConnectivityState(t *testing.T) { } func (s) TestCZTraceOverwriteChannelDeletion(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv // avoid calling API to set balancer type, which will void service config's change of balancer. e.balancer = "" @@ -1881,7 +1912,8 @@ func (s) TestCZTraceOverwriteChannelDeletion(t *testing.T) { } func (s) TestCZTraceOverwriteSubChannelDeletion(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv te := newTest(t, e) channelz.SetMaxTraceEntry(1) @@ -1940,7 +1972,8 @@ func (s) TestCZTraceOverwriteSubChannelDeletion(t *testing.T) { } func (s) TestCZTraceTopChannelDeletionTraceClear(t *testing.T) { - channelz.NewChannelzStorage() + czCleanup := channelz.NewChannelzStorage() + defer czCleanupWrapper(czCleanup, t) e := tcpClearRREnv te := newTest(t, e) te.startServer(&testServer{security: e.security}) diff --git a/test/end2end_test.go b/test/end2end_test.go index f90509f5a6bf..d1de97cde033 100644 --- a/test/end2end_test.go +++ b/test/end2end_test.go @@ -6512,7 +6512,6 @@ func testCompressorRegister(t *testing.T, e env) { } func (s) TestServeExitsWhenListenerClosed(t *testing.T) { - ss := &stubServer{ emptyCall: func(context.Context, *testpb.Empty) (*testpb.Empty, error) { return &testpb.Empty{}, nil @@ -6520,6 +6519,7 @@ func (s) TestServeExitsWhenListenerClosed(t *testing.T) { } s := grpc.NewServer() + defer s.Stop() testpb.RegisterTestServiceServer(s, ss) lis, err := net.Listen("tcp", "localhost:0") @@ -7087,7 +7087,6 @@ func testLargeTimeout(t *testing.T, e env) { // test ensures that the connection is re-created after GO_AWAY and not affected by the // subsequent (old) connection closure. func (s) TestGoAwayThenClose(t *testing.T) { - ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second) defer cancel() From 028242f87445bf2cc2807399d403cbbada8c0e85 Mon Sep 17 00:00:00 2001 From: lyuxuan Date: Thu, 2 May 2019 16:14:08 -0700 Subject: [PATCH 27/34] xds: fix flaky test due to balancerV2 API update (#2799) --- balancer/xds/xds_test.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/balancer/xds/xds_test.go b/balancer/xds/xds_test.go index be9c4e2fb2aa..aacbdcf1d43e 100644 --- a/balancer/xds/xds_test.go +++ b/balancer/xds/xds_test.go @@ -485,8 +485,10 @@ func (s) TestXdsBalanceHandleBalancerConfigFallbackUpdate(t *testing.T) { ServiceConfig: constructServiceConfigFromXdsConfig(cfg), }) + addrs := []resolver.Address{{Addr: "1.1.1.1:10001"}, {Addr: "2.2.2.2:10002"}, {Addr: "3.3.3.3:10003"}} cfg.FallbackPolicy = []lbPolicy{fakeBalancerB} lb.UpdateResolverState(resolver.State{ + Addresses: addrs, ServiceConfig: constructServiceConfigFromXdsConfig(cfg), }) @@ -505,12 +507,6 @@ func (s) TestXdsBalanceHandleBalancerConfigFallbackUpdate(t *testing.T) { cleanup() - addrs := []resolver.Address{{Addr: "1.1.1.1:10001"}, {Addr: "2.2.2.2:10002"}, {Addr: "3.3.3.3:10003"}} - lb.UpdateResolverState(resolver.State{ - Addresses: addrs, - ServiceConfig: constructServiceConfigFromXdsConfig(cfg), - }) - // verify fallback balancer B takes over select { case nsc := <-cc.newSubConns: From 4b60e3b6a1900853971945c616869c0fc211ac75 Mon Sep 17 00:00:00 2001 From: Cesar Ghali Date: Fri, 3 May 2019 10:47:23 -0700 Subject: [PATCH 28/34] credentials/alts: Panic Bug Fix (#2800) --- credentials/alts/alts.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/credentials/alts/alts.go b/credentials/alts/alts.go index 4cb93f164737..72c7f0b23feb 100644 --- a/credentials/alts/alts.go +++ b/credentials/alts/alts.go @@ -197,14 +197,14 @@ func (g *altsTC) ClientHandshake(ctx context.Context, addr string, rawConn net.C MinRpcVersion: minRPCVersion, } chs, err := handshaker.NewClientHandshaker(ctx, hsConn, rawConn, opts) + if err != nil { + return nil, nil, err + } defer func() { if err != nil { chs.Close() } }() - if err != nil { - return nil, nil, err - } secConn, authInfo, err := chs.ClientHandshake(ctx) if err != nil { return nil, nil, err @@ -240,14 +240,14 @@ func (g *altsTC) ServerHandshake(rawConn net.Conn) (_ net.Conn, _ credentials.Au MinRpcVersion: minRPCVersion, } shs, err := handshaker.NewServerHandshaker(ctx, hsConn, rawConn, opts) + if err != nil { + return nil, nil, err + } defer func() { if err != nil { shs.Close() } }() - if err != nil { - return nil, nil, err - } secConn, authInfo, err := shs.ServerHandshake(ctx) if err != nil { return nil, nil, err From 9949ee0c459009ff1bba553c627e2f3b0b23daae Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Tue, 7 May 2019 10:06:40 -0700 Subject: [PATCH 29/34] xds: lrs load store (#2779) --- .../v2/endpoint/load_report/load_report.pb.go | 429 ++++++++++++++++++ .../envoy/service/load_stats/v2/lrs/lrs.pb.go | 272 +++++++++++ balancer/xds/lrs/lrs.go | 200 ++++++++ balancer/xds/lrs/lrs_test.go | 240 ++++++++++ benchmark/primitives/syncmap_test.go | 165 +++++++ 5 files changed, 1306 insertions(+) create mode 100755 balancer/xds/internal/proto/envoy/api/v2/endpoint/load_report/load_report.pb.go create mode 100755 balancer/xds/internal/proto/envoy/service/load_stats/v2/lrs/lrs.pb.go create mode 100644 balancer/xds/lrs/lrs.go create mode 100644 balancer/xds/lrs/lrs_test.go create mode 100644 benchmark/primitives/syncmap_test.go diff --git a/balancer/xds/internal/proto/envoy/api/v2/endpoint/load_report/load_report.pb.go b/balancer/xds/internal/proto/envoy/api/v2/endpoint/load_report/load_report.pb.go new file mode 100755 index 000000000000..d81d8aced7ab --- /dev/null +++ b/balancer/xds/internal/proto/envoy/api/v2/endpoint/load_report/load_report.pb.go @@ -0,0 +1,429 @@ +// 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/balancer/xds/internal/proto/envoy/api/v2/core/address" +import base "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/base" +import _ "google.golang.org/grpc/balancer/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"` + 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_5485b60725c658b8, []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) 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"` + 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_5485b60725c658b8, []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) 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_5485b60725c658b8, []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_5485b60725c658b8, []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_5485b60725c658b8, []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_5485b60725c658b8) +} + +var fileDescriptor_load_report_5485b60725c658b8 = []byte{ + // 737 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x55, 0x5b, 0x6e, 0xd3, 0x4c, + 0x18, 0x95, 0x93, 0xb4, 0x4d, 0x27, 0xad, 0xd2, 0x7f, 0xd4, 0xfe, 0x49, 0xfd, 0x5f, 0x1a, 0x52, + 0x21, 0xf2, 0x50, 0xd9, 0x55, 0x5a, 0x09, 0x04, 0x4f, 0xa4, 0x2d, 0xa2, 0xa2, 0xa0, 0xca, 0x11, + 0x20, 0x21, 0x81, 0x35, 0xb5, 0xa7, 0xe9, 0x48, 0xb6, 0xc7, 0xcc, 0x8c, 0x0d, 0x59, 0x02, 0xaf, + 0x2c, 0x81, 0x25, 0xf0, 0xc8, 0x13, 0xdb, 0x60, 0x09, 0xec, 0x02, 0x79, 0x2e, 0xce, 0xb5, 0x12, + 0x0b, 0xe0, 0xcd, 0xfe, 0xce, 0x39, 0xfe, 0x6e, 0x67, 0xc6, 0xe0, 0x1e, 0x4e, 0x72, 0x3a, 0x76, + 0x51, 0x4a, 0xdc, 0xbc, 0xef, 0xe2, 0x24, 0x4c, 0x29, 0x49, 0x84, 0x1b, 0x51, 0x14, 0xfa, 0x0c, + 0xa7, 0x94, 0x09, 0x27, 0x65, 0x54, 0x50, 0xb8, 0x23, 0x89, 0x0e, 0x4a, 0x89, 0x93, 0xf7, 0x1d, + 0x43, 0xb4, 0xf7, 0x66, 0xf4, 0x01, 0x65, 0xd8, 0x45, 0x61, 0xc8, 0x30, 0xe7, 0x4a, 0x67, 0xff, + 0xbb, 0x48, 0xb8, 0x42, 0x1c, 0x6b, 0xf4, 0xff, 0x11, 0xa5, 0xa3, 0x08, 0xbb, 0xf2, 0xed, 0x2a, + 0xbb, 0x76, 0xc3, 0x8c, 0x21, 0x41, 0x68, 0x62, 0xd4, 0xf3, 0x38, 0x17, 0x2c, 0x0b, 0x74, 0x4d, + 0x76, 0x2b, 0x47, 0x11, 0x09, 0x91, 0xc0, 0xae, 0x79, 0x50, 0x40, 0xf7, 0x47, 0x15, 0xec, 0xbc, + 0x4c, 0xb9, 0x60, 0x18, 0xc5, 0x17, 0x34, 0x40, 0x11, 0x11, 0xe3, 0xa1, 0x40, 0x82, 0xc3, 0xfb, + 0xa0, 0x1e, 0xe9, 0x40, 0xdb, 0xea, 0x58, 0xbd, 0x46, 0xff, 0x1f, 0x67, 0xa6, 0xb3, 0xa2, 0x42, + 0xc7, 0x68, 0xbc, 0x92, 0x0c, 0x1f, 0x82, 0x5d, 0x41, 0x05, 0x8a, 0x7c, 0x9e, 0x05, 0x01, 0xe6, + 0xfc, 0x3a, 0x8b, 0x7c, 0x86, 0xdf, 0x67, 0x98, 0x0b, 0xde, 0xae, 0x74, 0xac, 0x5e, 0xcd, 0x6b, + 0x49, 0xc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x68, 0xe8, 0x94, 0x09, 0x8a, 0xb1, 0xdc, 0xc8, + 0xba, 0x07, 0x54, 0xe8, 0x05, 0x8a, 0x31, 0x7c, 0x0a, 0xee, 0x24, 0x59, 0x3c, 0x99, 0xc2, 0x35, + 0x49, 0x08, 0xbf, 0xc1, 0xa1, 0xff, 0x81, 0x88, 0x1b, 0x5d, 0xae, 0x9e, 0xe5, 0x7f, 0x49, 0x16, + 0x9b, 0x86, 0x9e, 0x68, 0xda, 0x6b, 0x22, 0x6e, 0x54, 0x3e, 0x78, 0x00, 0x54, 0xe3, 0xa6, 0xc7, + 0x1c, 0x45, 0x19, 0x96, 0x93, 0xb4, 0xbc, 0x2d, 0x89, 0x28, 0xe2, 0xab, 0x22, 0xde, 0xfd, 0x52, + 0x03, 0x1b, 0x27, 0x51, 0xc6, 0x05, 0x66, 0xaa, 0xd2, 0x03, 0xb0, 0x11, 0xa8, 0xf7, 0xa9, 0x52, + 0x07, 0xeb, 0xdf, 0x7e, 0x7e, 0xaf, 0xd6, 0x58, 0xa5, 0x63, 0x79, 0x0d, 0x0d, 0xcb, 0xb2, 0x0f, + 0xc1, 0xb6, 0x61, 0x73, 0xcc, 0x72, 0x12, 0x60, 0xa5, 0x5a, 0x95, 0x0d, 0x42, 0x8d, 0x0d, 0x15, + 0x24, 0x15, 0xe9, 0xd4, 0x99, 0x31, 0xf7, 0x89, 0xde, 0x43, 0xe5, 0xb7, 0xce, 0xcc, 0xcc, 0x15, + 0x36, 0x00, 0x45, 0x61, 0x2b, 0x9f, 0xad, 0x4a, 0xdd, 0x9a, 0x9c, 0x9f, 0xd9, 0x5b, 0xee, 0x18, + 0xfc, 0xad, 0x06, 0x12, 0x32, 0x9a, 0xa6, 0x38, 0x9c, 0xf8, 0x44, 0xd9, 0x4b, 0x79, 0xe8, 0x54, + 0x81, 0xa5, 0x53, 0xde, 0x81, 0xad, 0x05, 0xbe, 0x32, 0xca, 0xd1, 0x2d, 0x05, 0x4e, 0x8f, 0xd1, + 0x99, 0xfb, 0x9c, 0xd7, 0x0c, 0xe7, 0xbe, 0xff, 0x0c, 0x6c, 0x4f, 0xfd, 0x57, 0x7c, 0x92, 0x08, + 0xcc, 0x72, 0x14, 0x49, 0xef, 0x36, 0xfa, 0xbb, 0x0b, 0xa7, 0xee, 0x54, 0xff, 0x0b, 0x3c, 0x58, + 0xc8, 0x3c, 0xa9, 0x3a, 0xd7, 0x22, 0xfb, 0x2d, 0x68, 0xce, 0xd7, 0x7f, 0x17, 0xd4, 0x03, 0x24, + 0xf0, 0x88, 0xb2, 0xf1, 0xe2, 0x0e, 0x4b, 0x08, 0xee, 0x83, 0x4d, 0xd3, 0x66, 0x40, 0xb3, 0x44, + 0x68, 0x8f, 0x6d, 0xe8, 0xe0, 0x49, 0x11, 0x1b, 0x3c, 0x00, 0xfb, 0x84, 0xaa, 0xae, 0x53, 0x46, + 0x3f, 0x8e, 0x97, 0x0f, 0x60, 0xd0, 0xbc, 0x28, 0x2b, 0xbb, 0x2c, 0xca, 0xbe, 0xb4, 0xae, 0x56, + 0x65, 0xfd, 0x47, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xad, 0x11, 0xfc, 0x18, 0x5a, 0x07, 0x00, + 0x00, +} diff --git a/balancer/xds/internal/proto/envoy/service/load_stats/v2/lrs/lrs.pb.go b/balancer/xds/internal/proto/envoy/service/load_stats/v2/lrs/lrs.pb.go new file mode 100755 index 000000000000..87a16d284534 --- /dev/null +++ b/balancer/xds/internal/proto/envoy/service/load_stats/v2/lrs/lrs.pb.go @@ -0,0 +1,272 @@ +// 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/balancer/xds/internal/proto/envoy/api/v2/core/base" +import load_report "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/endpoint/load_report" +import _ "google.golang.org/grpc/balancer/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, 0x78, 0x87, + 0xf1, 0x33, 0x8c, 0xfb, 0x64, 0x76, 0x2f, 0xec, 0x90, 0x95, 0x6a, 0x44, 0x19, 0x1a, 0x10, 0x5b, + 0x69, 0x21, 0x48, 0x67, 0x8f, 0xcf, 0x4d, 0x41, 0xe7, 0x15, 0x2a, 0xed, 0xc2, 0x4d, 0x06, 0x2a, + 0x34, 0xae, 0x03, 0xef, 0x17, 0x88, 0x45, 0x09, 0xa2, 0x3d, 0x6d, 0xeb, 0x4f, 0x22, 0xaf, 0x8d, + 0x74, 0x0a, 0x75, 0x37, 0x9f, 0x7a, 0x59, 0xaa, 0x5c, 0x3a, 0x10, 0xfd, 0x47, 0x18, 0x2c, 0xbe, + 0x13, 0x7a, 0x6b, 0x85, 0x32, 0x5f, 0x37, 0x86, 0x52, 0xf8, 0x52, 0x83, 0x75, 0xec, 0x29, 0xbd, + 0xac, 0x31, 0x87, 0x88, 0xcc, 0x49, 0x7c, 0x90, 0x4c, 0x79, 0x08, 0x20, 0x2b, 0xc5, 0x7d, 0xc2, + 0x1b, 0x8f, 0xfc, 0x3d, 0xe6, 0x90, 0xb6, 0x10, 0x7b, 0x4b, 0x6f, 0x64, 0x65, 0x6d, 0x1d, 0x98, + 0x90, 0x2a, 0x1a, 0xcd, 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, 0xb2, 0xbd, 0xda, 0x56, 0xf7, 0xe2, 0x5f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x44, 0xa2, 0xf5, 0xb3, 0xfa, 0x02, 0x00, 0x00, +} diff --git a/balancer/xds/lrs/lrs.go b/balancer/xds/lrs/lrs.go new file mode 100644 index 000000000000..e6689edd7341 --- /dev/null +++ b/balancer/xds/lrs/lrs.go @@ -0,0 +1,200 @@ +/* + * 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 lrs + +import ( + "context" + "sync" + "sync/atomic" + "time" + + "github.com/golang/protobuf/ptypes" + structpb "github.com/golang/protobuf/ptypes/struct" + "google.golang.org/grpc" + basepb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/base" + loadreportpb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/endpoint/load_report" + lrspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/load_stats/v2/lrs" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal/backoff" +) + +// lrsStore collects loads from xds balancer, and periodically sends load to the +// server. +type lrsStore struct { + serviceName string + node *basepb.Node + backoff backoff.Strategy + lastReported time.Time + + drops sync.Map // map[string]*uint64 +} + +const grpcHostname = "com.googleapis.trafficdirector.grpc_hostname" + +func newStore(serviceName string) *lrsStore { + return &lrsStore{ + serviceName: serviceName, + node: &basepb.Node{ + Metadata: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + grpcHostname: { + Kind: &structpb.Value_StringValue{StringValue: serviceName}, + }, + }, + }, + }, + backoff: backoff.Exponential{ + MaxDelay: 120 * time.Second, + }, + lastReported: time.Now(), + } +} + +// Update functions are called by picker for each RPC. To avoid contention, all +// updates are done atomically. + +func (ls *lrsStore) callDropped(category string) { + p, ok := ls.drops.Load(category) + if !ok { + tp := new(uint64) + p, _ = ls.drops.LoadOrStore(category, tp) + } + atomic.AddUint64(p.(*uint64), 1) +} + +// TODO: add query counts +// callStarted(l locality) +// callFinished(l locality, err error) + +func (ls *lrsStore) buildStats() []*loadreportpb.ClusterStats { + var ( + totalDropped uint64 + droppedReqs []*loadreportpb.ClusterStats_DroppedRequests + ) + ls.drops.Range(func(category, countP interface{}) bool { + tempCount := atomic.SwapUint64(countP.(*uint64), 0) + if tempCount <= 0 { + return true + } + totalDropped += tempCount + droppedReqs = append(droppedReqs, &loadreportpb.ClusterStats_DroppedRequests{ + Category: category.(string), + DroppedCount: tempCount, + }) + return true + }) + + dur := time.Since(ls.lastReported) + ls.lastReported = time.Now() + + var ret []*loadreportpb.ClusterStats + ret = append(ret, &loadreportpb.ClusterStats{ + ClusterName: ls.serviceName, + UpstreamLocalityStats: nil, // TODO: populate this to support per locality loads. + + TotalDroppedRequests: totalDropped, + DroppedRequests: droppedReqs, + LoadReportInterval: ptypes.DurationProto(dur), + }) + + return ret +} + +// reportTo makes a streaming lrs call to cc and blocks. +// +// It retries the call (with backoff) until ctx is canceled. +func (ls *lrsStore) reportTo(ctx context.Context, cc *grpc.ClientConn) { + c := lrspb.NewLoadReportingServiceClient(cc) + var ( + retryCount int + doBackoff bool + ) + for { + select { + case <-ctx.Done(): + return + default: + } + + if doBackoff { + backoffTimer := time.NewTimer(ls.backoff.Backoff(retryCount)) + select { + case <-backoffTimer.C: + case <-ctx.Done(): + backoffTimer.Stop() + return + } + retryCount++ + } + + doBackoff = true + stream, err := c.StreamLoadStats(ctx) + if err != nil { + grpclog.Infof("lrs: failed to create stream: %v", err) + continue + } + if err := stream.Send(&lrspb.LoadStatsRequest{ + Node: ls.node, + }); err != nil { + grpclog.Infof("lrs: failed to send first request: %v", err) + continue + } + first, err := stream.Recv() + if err != nil { + grpclog.Infof("lrs: failed to receive first response: %v", err) + continue + } + interval, err := ptypes.Duration(first.LoadReportingInterval) + if err != nil { + grpclog.Infof("lrs: failed to convert report interval: %v", err) + continue + } + if len(first.Clusters) != 1 || first.Clusters[0] != ls.serviceName { + grpclog.Infof("lrs: received clusters %v, expect one cluster %q", first.Clusters, ls.serviceName) + continue + } + if first.ReportEndpointGranularity { + // TODO: fixme to support per endpoint loads. + grpclog.Infof("lrs: endpoint loads requested, but not supported by current implementation") + continue + } + + // No backoff afterwards. + doBackoff = false + retryCount = 0 + ls.sendLoads(ctx, stream, first.Clusters[0], interval) + } +} + +func (ls *lrsStore) sendLoads(ctx context.Context, stream lrspb.LoadReportingService_StreamLoadStatsClient, clusterName string, interval time.Duration) { + tick := time.NewTicker(interval) + defer tick.Stop() + for { + select { + case <-tick.C: + case <-ctx.Done(): + return + } + if err := stream.Send(&lrspb.LoadStatsRequest{ + Node: ls.node, + ClusterStats: ls.buildStats(), + }); err != nil { + grpclog.Infof("lrs: failed to send report: %v", err) + return + } + } +} diff --git a/balancer/xds/lrs/lrs_test.go b/balancer/xds/lrs/lrs_test.go new file mode 100644 index 000000000000..ab3b3229d1b9 --- /dev/null +++ b/balancer/xds/lrs/lrs_test.go @@ -0,0 +1,240 @@ +/* + * + * 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 lrs + +import ( + "context" + "io" + "net" + "reflect" + "sort" + "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" + basepb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/base" + loadreportpb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/endpoint/load_report" + lrspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/load_stats/v2/lrs" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +const testService = "grpc.service.test" + +var dropCategories = []string{"drop_for_real", "drop_for_fun"} + +// equalClusterStats sorts requests and clear report internal before comparing. +func equalClusterStats(a, b []*loadreportpb.ClusterStats) bool { + for _, s := range a { + sort.Slice(s.DroppedRequests, func(i, j int) bool { + return s.DroppedRequests[i].Category < s.DroppedRequests[j].Category + }) + s.LoadReportInterval = nil + } + for _, s := range b { + sort.Slice(s.DroppedRequests, func(i, j int) bool { + return s.DroppedRequests[i].Category < s.DroppedRequests[j].Category + }) + s.LoadReportInterval = nil + } + return reflect.DeepEqual(a, b) +} + +func Test_lrsStore_buildStats(t *testing.T) { + tests := []struct { + name string + drops []map[string]uint64 + }{ + { + name: "one report", + drops: []map[string]uint64{{ + dropCategories[0]: 31, + dropCategories[1]: 41, + }}, + }, + { + name: "two reports", + drops: []map[string]uint64{{ + dropCategories[0]: 31, + dropCategories[1]: 41, + }, { + dropCategories[0]: 59, + dropCategories[1]: 26, + }}, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + ls := newStore(testService) + + for _, ds := range tt.drops { + var ( + totalDropped uint64 + droppedReqs []*loadreportpb.ClusterStats_DroppedRequests + ) + for cat, count := range ds { + totalDropped += count + droppedReqs = append(droppedReqs, &loadreportpb.ClusterStats_DroppedRequests{ + Category: cat, + DroppedCount: count, + }) + } + want := []*loadreportpb.ClusterStats{ + { + ClusterName: testService, + TotalDroppedRequests: totalDropped, + DroppedRequests: droppedReqs, + }, + } + + var wg sync.WaitGroup + for c, count := range ds { + for i := 0; i < int(count); i++ { + wg.Add(1) + go func(i int, c string) { + ls.callDropped(c) + wg.Done() + }(i, c) + } + } + wg.Wait() + + if got := ls.buildStats(); !equalClusterStats(got, want) { + t.Errorf("lrsStore.buildStats() = %v, want %v", got, want) + t.Errorf("%s", cmp.Diff(got, want)) + } + } + }) + } +} + +type lrsServer struct { + mu sync.Mutex + dropTotal uint64 + drops map[string]uint64 + reportingInterval *durationpb.Duration +} + +func (lrss *lrsServer) StreamLoadStats(stream lrspb.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{ + grpcHostname: { + Kind: &structpb.Value_StringValue{StringValue: testService}, + }, + }, + }, + }, + }) { + return status.Errorf(codes.FailedPrecondition, "unexpected req: %+v", req) + } + if err := stream.Send(&lrspb.LoadStatsResponse{ + Clusters: []string{testService}, + 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 setupServer(t *testing.T, reportingInterval *durationpb.Duration) (addr string, lrss *lrsServer, cleanup func()) { + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + t.Fatalf("listen failed due to: %v", err) + } + svr := grpc.NewServer() + lrss = &lrsServer{ + drops: make(map[string]uint64), + reportingInterval: reportingInterval, + } + lrspb.RegisterLoadReportingServiceServer(svr, lrss) + go svr.Serve(lis) + return lis.Addr().String(), lrss, func() { + svr.Stop() + lis.Close() + } +} + +func Test_lrsStore_reportTo(t *testing.T) { + const intervalNano = 1000 * 1000 * 50 + addr, lrss, cleanup := setupServer(t, &durationpb.Duration{ + Seconds: 0, + Nanos: intervalNano, + }) + defer cleanup() + + ls := newStore(testService) + cc, err := grpc.Dial(addr, grpc.WithInsecure()) + if err != nil { + t.Fatalf("failed to dial: %v", err) + } + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + done := make(chan struct{}) + go func() { + ls.reportTo(ctx, cc) + close(done) + }() + + drops := map[string]uint64{ + dropCategories[0]: 31, + dropCategories[1]: 41, + } + + for c, d := range drops { + for i := 0; i < int(d); i++ { + ls.callDropped(c) + time.Sleep(time.Nanosecond * intervalNano / 10) + } + } + time.Sleep(time.Nanosecond * intervalNano * 2) + cancel() + <-done + + lrss.mu.Lock() + defer lrss.mu.Unlock() + if !cmp.Equal(lrss.drops, drops) { + t.Errorf("different: %v", cmp.Diff(lrss.drops, drops)) + } +} diff --git a/benchmark/primitives/syncmap_test.go b/benchmark/primitives/syncmap_test.go new file mode 100644 index 000000000000..fc42f10ef6f3 --- /dev/null +++ b/benchmark/primitives/syncmap_test.go @@ -0,0 +1,165 @@ +/* + * + * 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 primitives + +import ( + "sync" + "sync/atomic" + "testing" +) + +type incrementUint64Map interface { + increment(string) + result(string) uint64 +} + +type mapWithLock struct { + mu sync.Mutex + m map[string]uint64 +} + +func newMapWithLock() incrementUint64Map { + return &mapWithLock{ + m: make(map[string]uint64), + } +} + +func (mwl *mapWithLock) increment(c string) { + mwl.mu.Lock() + mwl.m[c]++ + mwl.mu.Unlock() +} + +func (mwl *mapWithLock) result(c string) uint64 { + return mwl.m[c] +} + +type mapWithAtomicFastpath struct { + mu sync.RWMutex + m map[string]*uint64 +} + +func newMapWithAtomicFastpath() incrementUint64Map { + return &mapWithAtomicFastpath{ + m: make(map[string]*uint64), + } +} + +func (mwaf *mapWithAtomicFastpath) increment(c string) { + mwaf.mu.RLock() + if p, ok := mwaf.m[c]; ok { + atomic.AddUint64(p, 1) + mwaf.mu.RUnlock() + return + } + mwaf.mu.RUnlock() + + mwaf.mu.Lock() + if p, ok := mwaf.m[c]; ok { + atomic.AddUint64(p, 1) + mwaf.mu.Unlock() + return + } + var temp uint64 = 1 + mwaf.m[c] = &temp + mwaf.mu.Unlock() +} + +func (mwaf *mapWithAtomicFastpath) result(c string) uint64 { + return atomic.LoadUint64(mwaf.m[c]) +} + +type mapWithSyncMap struct { + m sync.Map +} + +func newMapWithSyncMap() incrementUint64Map { + return &mapWithSyncMap{} +} + +func (mwsm *mapWithSyncMap) increment(c string) { + p, ok := mwsm.m.Load(c) + if !ok { + tp := new(uint64) + p, _ = mwsm.m.LoadOrStore(c, tp) + } + atomic.AddUint64(p.(*uint64), 1) +} + +func (mwsm *mapWithSyncMap) result(c string) uint64 { + p, _ := mwsm.m.Load(c) + return atomic.LoadUint64(p.(*uint64)) +} + +func benchmarkIncrementUint64Map(b *testing.B, f func() incrementUint64Map) { + const cat = "cat" + benches := []struct { + name string + goroutineCount int + }{ + { + name: " 1", + goroutineCount: 1, + }, + { + name: " 10", + goroutineCount: 10, + }, + { + name: " 100", + goroutineCount: 100, + }, + { + name: "1000", + goroutineCount: 1000, + }, + } + for _, bb := range benches { + b.Run(bb.name, func(b *testing.B) { + m := f() + var wg sync.WaitGroup + wg.Add(bb.goroutineCount) + b.ResetTimer() + for i := 0; i < bb.goroutineCount; i++ { + go func() { + for j := 0; j < b.N; j++ { + m.increment(cat) + } + wg.Done() + }() + } + wg.Wait() + b.StopTimer() + if m.result(cat) != uint64(bb.goroutineCount*b.N) { + b.Fatalf("result is %d, want %d", m.result(cat), b.N) + } + }) + } +} + +func BenchmarkMapWithSyncMutexContetion(b *testing.B) { + benchmarkIncrementUint64Map(b, newMapWithLock) +} + +func BenchmarkMapWithAtomicFastpath(b *testing.B) { + benchmarkIncrementUint64Map(b, newMapWithAtomicFastpath) +} + +func BenchmarkMapWithSyncMap(b *testing.B) { + benchmarkIncrementUint64Map(b, newMapWithSyncMap) +} From 39ed87fce251c682fa52b9fb2ddfb75bb7d34a89 Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Tue, 7 May 2019 13:58:58 -0700 Subject: [PATCH 30/34] xds: report loads to traffic director (#2789) --- balancer/xds/edsbalancer/edsbalancer.go | 30 ++-- balancer/xds/edsbalancer/edsbalancer_test.go | 8 +- balancer/xds/lrs/lrs.go | 17 +- balancer/xds/lrs/lrs_test.go | 12 +- balancer/xds/xds.go | 11 +- balancer/xds/xds_client.go | 16 +- balancer/xds/xds_client_test.go | 30 ++-- balancer/xds/xds_lrs_test.go | 157 +++++++++++++++++++ balancer/xds/xds_test.go | 15 +- 9 files changed, 252 insertions(+), 44 deletions(-) create mode 100644 balancer/xds/xds_lrs_test.go diff --git a/balancer/xds/edsbalancer/edsbalancer.go b/balancer/xds/edsbalancer/edsbalancer.go index 97e329d66e58..483228fe0d3d 100644 --- a/balancer/xds/edsbalancer/edsbalancer.go +++ b/balancer/xds/edsbalancer/edsbalancer.go @@ -32,6 +32,7 @@ import ( "google.golang.org/grpc/balancer/roundrobin" edspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/eds" percentpb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/type/percent" + "google.golang.org/grpc/balancer/xds/lrs" "google.golang.org/grpc/codes" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/grpclog" @@ -56,6 +57,7 @@ type EDSBalancer struct { bg *balancerGroup subBalancerBuilder balancer.Builder lidToConfig map[string]*localityConfig + loadStore lrs.Store pickerMu sync.Mutex drops []*dropper @@ -64,12 +66,13 @@ type EDSBalancer struct { } // NewXDSBalancer create a new EDSBalancer. -func NewXDSBalancer(cc balancer.ClientConn) *EDSBalancer { +func NewXDSBalancer(cc balancer.ClientConn, loadStore lrs.Store) *EDSBalancer { xdsB := &EDSBalancer{ ClientConn: cc, subBalancerBuilder: balancer.Get(roundrobin.Name), lidToConfig: make(map[string]*localityConfig), + 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, @@ -158,7 +161,7 @@ func (xdsB *EDSBalancer) updateDrops(dropPolicies []*edspb.ClusterLoadAssignment xdsB.drops = newDrops if xdsB.innerPicker != nil { // Update picker with old inner picker, new drops. - xdsB.ClientConn.UpdateBalancerState(xdsB.innerState, newDropPicker(xdsB.innerPicker, newDrops)) + xdsB.ClientConn.UpdateBalancerState(xdsB.innerState, newDropPicker(xdsB.innerPicker, newDrops, xdsB.loadStore)) } xdsB.pickerMu.Unlock() } @@ -269,7 +272,7 @@ func (xdsB *EDSBalancer) UpdateBalancerState(s connectivity.State, p balancer.Pi 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.ClientConn.UpdateBalancerState(s, newDropPicker(p, xdsB.drops, xdsB.loadStore)) } // Close closes the balancer. @@ -278,26 +281,35 @@ func (xdsB *EDSBalancer) Close() { } type dropPicker struct { - drops []*dropper - p balancer.Picker + drops []*dropper + p balancer.Picker + loadStore lrs.Store } -func newDropPicker(p balancer.Picker, drops []*dropper) *dropPicker { +func newDropPicker(p balancer.Picker, drops []*dropper, loadStore lrs.Store) *dropPicker { return &dropPicker{ - drops: drops, - p: p, + drops: drops, + p: p, + loadStore: loadStore, } } func (d *dropPicker) Pick(ctx context.Context, opts balancer.PickOptions) (conn balancer.SubConn, done func(balancer.DoneInfo), err error) { - var drop bool + var ( + drop bool + category string + ) for _, dp := range d.drops { if dp.drop() { drop = true + category = dp.category break } } if drop { + if d.loadStore != nil { + d.loadStore.CallDropped(category) + } return nil, nil, status.Errorf(codes.Unavailable, "RPC is dropped") } // TODO: (eds) don't drop unless the inner picker is READY. Similar to diff --git a/balancer/xds/edsbalancer/edsbalancer_test.go b/balancer/xds/edsbalancer/edsbalancer_test.go index b9b037f3833c..b1d7c339682e 100644 --- a/balancer/xds/edsbalancer/edsbalancer_test.go +++ b/balancer/xds/edsbalancer/edsbalancer_test.go @@ -117,7 +117,7 @@ func (clab *clusterLoadAssignmentBuilder) build() *edspb.ClusterLoadAssignment { // - change drop rate func TestEDS_OneLocality(t *testing.T) { cc := newTestClientConn(t) - edsb := NewXDSBalancer(cc) + edsb := NewXDSBalancer(cc, nil) // One locality with one backend. clab1 := newClusterLoadAssignmentBuilder(testClusterNames[0], nil) @@ -226,7 +226,7 @@ func TestEDS_OneLocality(t *testing.T) { // - update locality weight func TestEDS_TwoLocalities(t *testing.T) { cc := newTestClientConn(t) - edsb := NewXDSBalancer(cc) + edsb := NewXDSBalancer(cc, nil) // Two localities, each with one backend. clab1 := newClusterLoadAssignmentBuilder(testClusterNames[0], nil) @@ -385,7 +385,7 @@ func (tcp *testConstPicker) Pick(ctx context.Context, opts balancer.PickOptions) // eds response. func TestEDS_UpdateSubBalancerName(t *testing.T) { cc := newTestClientConn(t) - edsb := NewXDSBalancer(cc) + edsb := NewXDSBalancer(cc, nil) t.Logf("update sub-balancer to test-const-balancer") edsb.HandleChildPolicy("test-const-balancer", nil) @@ -502,7 +502,7 @@ func TestDropPicker(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - p := newDropPicker(constPicker, tt.drops) + p := newDropPicker(constPicker, tt.drops, nil) // scCount is the number of sc's returned by pick. The opposite of // drop-count. diff --git a/balancer/xds/lrs/lrs.go b/balancer/xds/lrs/lrs.go index e6689edd7341..a332ada077e8 100644 --- a/balancer/xds/lrs/lrs.go +++ b/balancer/xds/lrs/lrs.go @@ -32,6 +32,13 @@ import ( "google.golang.org/grpc/internal/backoff" ) +// Store defines the interface for a load store. It keeps loads and can report +// them to a server when requested. +type Store interface { + CallDropped(category string) + ReportTo(ctx context.Context, cc *grpc.ClientConn) +} + // lrsStore collects loads from xds balancer, and periodically sends load to the // server. type lrsStore struct { @@ -45,7 +52,8 @@ type lrsStore struct { const grpcHostname = "com.googleapis.trafficdirector.grpc_hostname" -func newStore(serviceName string) *lrsStore { +// NewStore creates a store for load reports. +func NewStore(serviceName string) Store { return &lrsStore{ serviceName: serviceName, node: &basepb.Node{ @@ -67,7 +75,8 @@ func newStore(serviceName string) *lrsStore { // Update functions are called by picker for each RPC. To avoid contention, all // updates are done atomically. -func (ls *lrsStore) callDropped(category string) { +// CallDropped adds one drop record with the given category to store. +func (ls *lrsStore) CallDropped(category string) { p, ok := ls.drops.Load(category) if !ok { tp := new(uint64) @@ -114,10 +123,10 @@ func (ls *lrsStore) buildStats() []*loadreportpb.ClusterStats { return ret } -// reportTo makes a streaming lrs call to cc and blocks. +// ReportTo makes a streaming lrs call to cc and blocks. // // It retries the call (with backoff) until ctx is canceled. -func (ls *lrsStore) reportTo(ctx context.Context, cc *grpc.ClientConn) { +func (ls *lrsStore) ReportTo(ctx context.Context, cc *grpc.ClientConn) { c := lrspb.NewLoadReportingServiceClient(cc) var ( retryCount int diff --git a/balancer/xds/lrs/lrs_test.go b/balancer/xds/lrs/lrs_test.go index ab3b3229d1b9..91c4aaa009cb 100644 --- a/balancer/xds/lrs/lrs_test.go +++ b/balancer/xds/lrs/lrs_test.go @@ -85,7 +85,7 @@ func Test_lrsStore_buildStats(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - ls := newStore(testService) + ls := NewStore(testService).(*lrsStore) for _, ds := range tt.drops { var ( @@ -112,7 +112,7 @@ func Test_lrsStore_buildStats(t *testing.T) { for i := 0; i < int(count); i++ { wg.Add(1) go func(i int, c string) { - ls.callDropped(c) + ls.CallDropped(c) wg.Done() }(i, c) } @@ -196,7 +196,7 @@ func setupServer(t *testing.T, reportingInterval *durationpb.Duration) (addr str } } -func Test_lrsStore_reportTo(t *testing.T) { +func Test_lrsStore_ReportTo(t *testing.T) { const intervalNano = 1000 * 1000 * 50 addr, lrss, cleanup := setupServer(t, &durationpb.Duration{ Seconds: 0, @@ -204,7 +204,7 @@ func Test_lrsStore_reportTo(t *testing.T) { }) defer cleanup() - ls := newStore(testService) + ls := NewStore(testService) cc, err := grpc.Dial(addr, grpc.WithInsecure()) if err != nil { t.Fatalf("failed to dial: %v", err) @@ -213,7 +213,7 @@ func Test_lrsStore_reportTo(t *testing.T) { defer cancel() done := make(chan struct{}) go func() { - ls.reportTo(ctx, cc) + ls.ReportTo(ctx, cc) close(done) }() @@ -224,7 +224,7 @@ func Test_lrsStore_reportTo(t *testing.T) { for c, d := range drops { for i := 0; i < int(d); i++ { - ls.callDropped(c) + ls.CallDropped(c) time.Sleep(time.Nanosecond * intervalNano / 10) } } diff --git a/balancer/xds/xds.go b/balancer/xds/xds.go index ba8485a9ddbe..c305c82854b1 100644 --- a/balancer/xds/xds.go +++ b/balancer/xds/xds.go @@ -35,6 +35,7 @@ import ( "google.golang.org/grpc/balancer/xds/edsbalancer" cdspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/cds" edspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/eds" + "google.golang.org/grpc/balancer/xds/lrs" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/grpclog" @@ -51,8 +52,8 @@ var ( // TODO: if later we make startupTimeout configurable through BuildOptions(maybe?), then we can remove // this field and configure through BuildOptions instead. startupTimeout = defaultTimeout - newEDSBalancer = func(cc balancer.ClientConn) edsBalancerInterface { - return edsbalancer.NewXDSBalancer(cc) + newEDSBalancer = func(cc balancer.ClientConn, loadStore lrs.Store) edsBalancerInterface { + return edsbalancer.NewXDSBalancer(cc, loadStore) } ) @@ -78,6 +79,7 @@ func (b *xdsBalancerBuilder) Build(cc balancer.ClientConn, opts balancer.BuildOp grpcUpdate: make(chan interface{}), xdsClientUpdate: make(chan interface{}), timer: createDrainedTimer(), // initialized a timer that won't fire without reset + loadStore: lrs.NewStore(cc.Target()), } x.cc = &xdsClientConn{ updateState: x.connStateMgr.updateState, @@ -130,6 +132,7 @@ type xdsBalancer struct { xdsLB edsBalancerInterface fallbackLB balancer.Balancer fallbackInitData *resolver.State // may change when HandleResolved address is called + loadStore lrs.Store } func (x *xdsBalancer) startNewXDSClient(u *xdsConfig) { @@ -184,7 +187,7 @@ func (x *xdsBalancer) startNewXDSClient(u *xdsConfig) { prevClient.close() } } - x.client = newXDSClient(u.BalancerName, x.cc.Target(), u.ChildPolicy == nil, x.buildOpts, newADS, loseContact, exitCleanup) + x.client = newXDSClient(u.BalancerName, x.cc.Target(), u.ChildPolicy == nil, x.buildOpts, x.loadStore, newADS, loseContact, exitCleanup) go x.client.run() } @@ -519,7 +522,7 @@ func (x *xdsBalancer) cancelFallbackAndSwitchEDSBalancerIfNecessary() { x.fallbackLB.Close() x.fallbackLB = nil } - x.xdsLB = newEDSBalancer(x.cc) + x.xdsLB = newEDSBalancer(x.cc, x.loadStore) if x.config.ChildPolicy != nil { x.xdsLB.HandleChildPolicy(x.config.ChildPolicy.Name, x.config.ChildPolicy.Config) } diff --git a/balancer/xds/xds_client.go b/balancer/xds/xds_client.go index 0cc8d4c02b6a..60d86254af64 100644 --- a/balancer/xds/xds_client.go +++ b/balancer/xds/xds_client.go @@ -35,6 +35,7 @@ import ( discoverypb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/discovery" edspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/eds" adspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/discovery/v2/ads" + "google.golang.org/grpc/balancer/xds/lrs" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal/backoff" "google.golang.org/grpc/internal/channelz" @@ -69,6 +70,9 @@ type client struct { cleanup func() backoff backoff.Strategy + loadStore lrs.Store + loadReportOnce sync.Once + mu sync.Mutex cc *grpc.ClientConn } @@ -249,9 +253,18 @@ func (c *client) adsCallAttempt() (firstRespReceived bool) { grpclog.Warningf("xds: processing new ADS message failed due to %v.", err) return } + // Only start load reporting after ADS resp is received. + // + // Also, newADS() will close the previous load reporting stream, so we + // don't have double reporting. + c.loadReportOnce.Do(func() { + if c.loadStore != nil { + go c.loadStore.ReportTo(c.ctx, c.cc) + } + }) } } -func newXDSClient(balancerName string, serviceName string, enableCDS bool, opts balancer.BuildOptions, newADS func(context.Context, proto.Message) error, loseContact func(ctx context.Context), exitCleanup func()) *client { +func newXDSClient(balancerName string, serviceName string, enableCDS bool, opts balancer.BuildOptions, loadStore lrs.Store, newADS func(context.Context, proto.Message) error, loseContact func(ctx context.Context), exitCleanup func()) *client { c := &client{ balancerName: balancerName, serviceName: serviceName, @@ -261,6 +274,7 @@ func newXDSClient(balancerName string, serviceName string, enableCDS bool, opts loseContact: loseContact, cleanup: exitCleanup, backoff: defaultBackoffConfig, + loadStore: loadStore, } c.ctx, c.cancel = context.WithCancel(context.Background()) diff --git a/balancer/xds/xds_client_test.go b/balancer/xds/xds_client_test.go index 416a97fd176d..a2b34e2c8389 100644 --- a/balancer/xds/xds_client_test.go +++ b/balancer/xds/xds_client_test.go @@ -30,6 +30,7 @@ import ( "github.com/golang/protobuf/proto" anypb "github.com/golang/protobuf/ptypes/any" + durationpb "github.com/golang/protobuf/ptypes/duration" structpb "github.com/golang/protobuf/ptypes/struct" wrpb "github.com/golang/protobuf/ptypes/wrappers" "google.golang.org/grpc" @@ -41,6 +42,7 @@ import ( edspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/eds" endpointpb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/endpoint/endpoint" adspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/discovery/v2/ads" + lrspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/load_stats/v2/lrs" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) @@ -266,16 +268,24 @@ type testConfig struct { svrErr error } -func setupServer(t *testing.T) (addr string, td *testTrafficDirector, cleanup func()) { +func setupServer(t *testing.T) (addr string, td *testTrafficDirector, lrss *lrsServer, cleanup func()) { lis, err := net.Listen("tcp", "localhost:0") if err != nil { t.Fatalf("listen failed due to: %v", err) } svr := grpc.NewServer() td = newTestTrafficDirector() + lrss = &lrsServer{ + drops: make(map[string]uint64), + reportingInterval: &durationpb.Duration{ + Seconds: 60 * 60, // 1 hour, each test can override this to a shorter duration. + Nanos: 0, + }, + } adspb.RegisterAggregatedDiscoveryServiceServer(svr, td) + lrspb.RegisterLoadReportingServiceServer(svr, lrss) go svr.Serve(lis) - return lis.Addr().String(), td, func() { + return lis.Addr().String(), td, lrss, func() { svr.Stop() lis.Close() } @@ -301,14 +311,14 @@ func (s) TestXdsClientResponseHandling(t *testing.T) { } func testXdsClientResponseHandling(t *testing.T, test *testConfig) { - addr, td, cleanup := setupServer(t) + addr, td, _, cleanup := setupServer(t) defer cleanup() adsChan := make(chan proto.Message, 10) newADS := func(ctx context.Context, i proto.Message) error { adsChan <- i return nil } - client := newXDSClient(addr, testServiceName, test.doCDS, balancer.BuildOptions{}, newADS, func(context.Context) {}, func() {}) + client := newXDSClient(addr, testServiceName, test.doCDS, balancer.BuildOptions{}, nil, newADS, func(context.Context) {}, func() {}) defer client.close() go client.run() @@ -365,7 +375,7 @@ func (s) TestXdsClientLoseContact(t *testing.T) { } func testXdsClientLoseContactRemoteClose(t *testing.T, test *testConfig) { - addr, td, cleanup := setupServer(t) + addr, td, _, cleanup := setupServer(t) defer cleanup() adsChan := make(chan proto.Message, 10) newADS := func(ctx context.Context, i proto.Message) error { @@ -376,7 +386,7 @@ func testXdsClientLoseContactRemoteClose(t *testing.T, test *testConfig) { loseContactFunc := func(context.Context) { contactChan <- &loseContact{} } - client := newXDSClient(addr, testServiceName, test.doCDS, balancer.BuildOptions{}, newADS, loseContactFunc, func() {}) + client := newXDSClient(addr, testServiceName, test.doCDS, balancer.BuildOptions{}, nil, newADS, loseContactFunc, func() {}) defer client.close() go client.run() @@ -398,7 +408,7 @@ func testXdsClientLoseContactRemoteClose(t *testing.T, test *testConfig) { } func testXdsClientLoseContactADSRelatedErrorOccur(t *testing.T, test *testConfig) { - addr, td, cleanup := setupServer(t) + addr, td, _, cleanup := setupServer(t) defer cleanup() adsChan := make(chan proto.Message, 10) @@ -410,7 +420,7 @@ func testXdsClientLoseContactADSRelatedErrorOccur(t *testing.T, test *testConfig loseContactFunc := func(context.Context) { contactChan <- &loseContact{} } - client := newXDSClient(addr, testServiceName, test.doCDS, balancer.BuildOptions{}, newADS, loseContactFunc, func() {}) + client := newXDSClient(addr, testServiceName, test.doCDS, balancer.BuildOptions{}, nil, newADS, loseContactFunc, func() {}) defer client.close() go client.run() @@ -432,7 +442,7 @@ func (s) TestXdsClientExponentialRetry(t *testing.T) { cfg := &testConfig{ svrErr: status.Errorf(codes.Aborted, "abort the stream to trigger retry"), } - addr, td, cleanup := setupServer(t) + addr, td, _, cleanup := setupServer(t) defer cleanup() adsChan := make(chan proto.Message, 10) @@ -444,7 +454,7 @@ func (s) TestXdsClientExponentialRetry(t *testing.T) { loseContactFunc := func(context.Context) { contactChan <- &loseContact{} } - client := newXDSClient(addr, testServiceName, cfg.doCDS, balancer.BuildOptions{}, newADS, loseContactFunc, func() {}) + client := newXDSClient(addr, testServiceName, cfg.doCDS, balancer.BuildOptions{}, nil, newADS, loseContactFunc, func() {}) defer client.close() go client.run() diff --git a/balancer/xds/xds_lrs_test.go b/balancer/xds/xds_lrs_test.go new file mode 100644 index 000000000000..848d157a3feb --- /dev/null +++ b/balancer/xds/xds_lrs_test.go @@ -0,0 +1,157 @@ +// +build go1.12 + +/* + * + * 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 xds + +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/balancer" + basepb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/base" + lrspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/load_stats/v2/lrs" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/resolver" + "google.golang.org/grpc/status" +) + +type lrsServer struct { + mu sync.Mutex + dropTotal uint64 + drops map[string]uint64 + reportingInterval *durationpb.Duration +} + +func (lrss *lrsServer) StreamLoadStats(stream lrspb.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{ + 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("xds") + cc := newTestClientConn() + lb, ok := builder.Build(cc, balancer.BuildOptions{}).(*xdsBalancer) + if !ok { + t.Fatalf("unable to type assert to *xdsBalancer") + } + defer lb.Close() + + addr, td, lrss, cleanup := setupServer(t) + defer cleanup() + + const intervalNano = 1000 * 1000 * 50 + lrss.reportingInterval = &durationpb.Duration{ + Seconds: 0, + Nanos: intervalNano, + } + + cfg := &testBalancerConfig{ + BalancerName: addr, + ChildPolicy: []lbPolicy{fakeBalancerA}, // Set this to skip cds. + } + lb.UpdateResolverState(resolver.State{ + ServiceConfig: constructServiceConfigFromXdsConfig(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") + } + + var dropCategories = []string{"drop_for_real", "drop_for_fun"} + drops := map[string]uint64{ + dropCategories[0]: 31, + dropCategories[1]: 41, + } + + for c, d := range drops { + for i := 0; i < int(d); i++ { + edsLB.loadStore.CallDropped(c) + time.Sleep(time.Nanosecond * intervalNano / 10) + } + } + time.Sleep(time.Nanosecond * intervalNano * 2) + + lrss.mu.Lock() + defer lrss.mu.Unlock() + if !cmp.Equal(lrss.drops, drops) { + t.Errorf("different: %v", cmp.Diff(lrss.drops, drops)) + } +} diff --git a/balancer/xds/xds_test.go b/balancer/xds/xds_test.go index aacbdcf1d43e..8933436495b2 100644 --- a/balancer/xds/xds_test.go +++ b/balancer/xds/xds_test.go @@ -31,6 +31,7 @@ import ( "google.golang.org/grpc/balancer" discoverypb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/discovery" edspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/eds" + "google.golang.org/grpc/balancer/xds/lrs" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/internal/grpctest" "google.golang.org/grpc/internal/leakcheck" @@ -214,6 +215,7 @@ type fakeEDSBalancer struct { childPolicy chan *loadBalancingConfig fallbackPolicy chan *loadBalancingConfig subconnStateChange chan *scStateChange + loadStore lrs.Store } func (f *fakeEDSBalancer) HandleSubConnStateChange(sc balancer.SubConn, state connectivity.State) { @@ -237,13 +239,14 @@ func (f *fakeEDSBalancer) HandleChildPolicy(name string, config json.RawMessage) } } -func newFakeEDSBalancer(cc balancer.ClientConn) edsBalancerInterface { +func newFakeEDSBalancer(cc balancer.ClientConn, loadStore lrs.Store) edsBalancerInterface { lb := &fakeEDSBalancer{ cc: cc, edsChan: make(chan *edspb.ClusterLoadAssignment, 10), childPolicy: make(chan *loadBalancingConfig, 10), fallbackPolicy: make(chan *loadBalancingConfig, 10), subconnStateChange: make(chan *scStateChange, 10), + loadStore: loadStore, } mu.Lock() latestFakeEdsBalancer = lb @@ -337,7 +340,7 @@ func (s) TestXdsBalanceHandleBalancerConfigBalancerNameUpdate(t *testing.T) { // 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) + addr, td, _, cleanup := setupServer(t) cleanups = append(cleanups, cleanup) workingServiceConfig := constructServiceConfigFromXdsConfig(&testBalancerConfig{ BalancerName: addr, @@ -426,7 +429,7 @@ func (s) TestXdsBalanceHandleBalancerConfigChildPolicyUpdate(t *testing.T) { }, }, } { - addr, td, cleanup := setupServer(t) + addr, td, _, cleanup := setupServer(t) cleanups = append(cleanups, cleanup) test.cfg.BalancerName = addr @@ -474,7 +477,7 @@ func (s) TestXdsBalanceHandleBalancerConfigFallbackUpdate(t *testing.T) { } defer lb.Close() - addr, td, cleanup := setupServer(t) + addr, td, _, cleanup := setupServer(t) cfg := &testBalancerConfig{ BalancerName: addr, @@ -549,7 +552,7 @@ func (s) TestXdsBalancerHandlerSubConnStateChange(t *testing.T) { } defer lb.Close() - addr, td, cleanup := setupServer(t) + addr, td, _, cleanup := setupServer(t) defer cleanup() cfg := &testBalancerConfig{ BalancerName: addr, @@ -629,7 +632,7 @@ func (s) TestXdsBalancerFallbackSignalFromEdsBalancer(t *testing.T) { } defer lb.Close() - addr, td, cleanup := setupServer(t) + addr, td, _, cleanup := setupServer(t) defer cleanup() cfg := &testBalancerConfig{ BalancerName: addr, From 4748a040c895a974ae1820670e90205252fbafc3 Mon Sep 17 00:00:00 2001 From: lyuxuan Date: Thu, 9 May 2019 13:27:41 -0700 Subject: [PATCH 31/34] balancer: provide parsed target through BuildOptions (#2803) --- balancer/balancer.go | 6 ++++++ balancer/grpclb/grpclb.go | 11 +---------- balancer_v1_wrapper.go | 11 ++--------- clientconn.go | 1 + resolver/resolver.go | 15 +++++++++++++++ 5 files changed, 25 insertions(+), 19 deletions(-) diff --git a/balancer/balancer.go b/balancer/balancer.go index fafede238c13..4b72daa8bb09 100644 --- a/balancer/balancer.go +++ b/balancer/balancer.go @@ -138,6 +138,8 @@ type ClientConn interface { ResolveNow(resolver.ResolveNowOption) // Target returns the dial target for this ClientConn. + // + // Deprecated: Use the Target field in the BuildOptions instead. Target() string } @@ -155,6 +157,10 @@ type BuildOptions struct { Dialer func(context.Context, string) (net.Conn, error) // ChannelzParentID is the entity parent's channelz unique identification number. ChannelzParentID int64 + // Target contains the parsed address info of the dial target. It is the same resolver.Target as + // passed to the resolver. + // See the documentation for the resolver.Target type for details about what it contains. + Target resolver.Target } // Builder creates a balancer. diff --git a/balancer/grpclb/grpclb.go b/balancer/grpclb/grpclb.go index 9c5edc4b622b..cc1f0ec9ecd7 100644 --- a/balancer/grpclb/grpclb.go +++ b/balancer/grpclb/grpclb.go @@ -28,7 +28,6 @@ import ( "context" "errors" "strconv" - "strings" "sync" "time" @@ -144,17 +143,9 @@ func (b *lbBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) bal scheme := "grpclb_internal_" + strconv.FormatInt(time.Now().UnixNano(), 36) r := &lbManualResolver{scheme: scheme, ccb: cc} - var target string - targetSplitted := strings.Split(cc.Target(), ":///") - if len(targetSplitted) < 2 { - target = cc.Target() - } else { - target = targetSplitted[1] - } - lb := &lbBalancer{ cc: newLBCacheClientConn(cc), - target: target, + target: opt.Target.Endpoint, opt: opt, fallbackTimeout: b.fallbackTimeout, doneCh: make(chan struct{}), diff --git a/balancer_v1_wrapper.go b/balancer_v1_wrapper.go index c23ea16893cc..66e9a44ac4da 100644 --- a/balancer_v1_wrapper.go +++ b/balancer_v1_wrapper.go @@ -20,7 +20,6 @@ package grpc import ( "context" - "strings" "sync" "google.golang.org/grpc/balancer" @@ -34,13 +33,7 @@ type balancerWrapperBuilder struct { } func (bwb *balancerWrapperBuilder) Build(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.Balancer { - targetAddr := cc.Target() - targetSplitted := strings.Split(targetAddr, ":///") - if len(targetSplitted) >= 2 { - targetAddr = targetSplitted[1] - } - - bwb.b.Start(targetAddr, BalancerConfig{ + bwb.b.Start(opts.Target.Endpoint, BalancerConfig{ DialCreds: opts.DialCreds, Dialer: opts.Dialer, }) @@ -49,7 +42,7 @@ func (bwb *balancerWrapperBuilder) Build(cc balancer.ClientConn, opts balancer.B balancer: bwb.b, pickfirst: pickfirst, cc: cc, - targetAddr: targetAddr, + targetAddr: opts.Target.Endpoint, startCh: make(chan struct{}), conns: make(map[resolver.Address]balancer.SubConn), connSt: make(map[balancer.SubConn]*scState), diff --git a/clientconn.go b/clientconn.go index 8255caef929b..d76957034393 100644 --- a/clientconn.go +++ b/clientconn.go @@ -293,6 +293,7 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * CredsBundle: cc.dopts.copts.CredsBundle, Dialer: cc.dopts.copts.Dialer, ChannelzParentID: cc.channelzID, + Target: cc.parsedTarget, } // Build the resolver. diff --git a/resolver/resolver.go b/resolver/resolver.go index 52ec603daa77..f6f6934d9bc3 100644 --- a/resolver/resolver.go +++ b/resolver/resolver.go @@ -132,6 +132,21 @@ type ClientConn interface { // Target represents a target for gRPC, as specified in: // https://github.com/grpc/grpc/blob/master/doc/naming.md. +// It is parsed from the target string that gets passed into Dial or DialContext by the user. And +// grpc passes it to the resolver and the balancer. +// +// If the target follows the naming spec, and the parsed scheme is registered with grpc, we will +// parse the target string according to the spec. e.g. "dns://some_authority/foo.bar" will be parsed +// into &Target{Scheme: "dns", Authority: "some_authority", Endpoint: "foo.bar"} +// +// If the target does not contain a scheme, we will apply the default scheme, and set the Target to +// be the full target string. e.g. "foo.bar" will be parsed into +// &Target{Scheme: resolver.GetDefaultScheme(), Endpoint: "foo.bar"}. +// +// If the parsed scheme is not registered (i.e. no corresponding resolver available to resolve the +// endpoint), we set the Scheme to be the default scheme, and set the Endpoint to be the full target +// string. e.g. target string "unknown_scheme://authority/endpoint" will be parsed into +// &Target{Scheme: resolver.GetDefaultScheme(), Endpoint: "unknown_scheme://authority/endpoint"}. type Target struct { Scheme string Authority string From a0be99ad3251fe24387c5fde0b993b1e192bcd85 Mon Sep 17 00:00:00 2001 From: lyuxuan Date: Fri, 10 May 2019 10:45:05 -0700 Subject: [PATCH 32/34] xds: use BuildOptions.Target.endpoint string instead of deprecated cc.Target (#2807) --- balancer/xds/internal/const.go | 25 +++++++++++++++++++++++++ balancer/xds/lrs/lrs.go | 5 ++--- balancer/xds/lrs/lrs_test.go | 3 ++- balancer/xds/xds.go | 9 ++++----- balancer/xds/xds_client.go | 12 ++++++++---- balancer/xds/xds_client_test.go | 12 +++++++----- balancer/xds/xds_lrs_test.go | 7 ++++--- balancer/xds/xds_test.go | 12 ++++++------ 8 files changed, 58 insertions(+), 27 deletions(-) create mode 100644 balancer/xds/internal/const.go diff --git a/balancer/xds/internal/const.go b/balancer/xds/internal/const.go new file mode 100644 index 000000000000..d67297b93def --- /dev/null +++ b/balancer/xds/internal/const.go @@ -0,0 +1,25 @@ +/* + * + * 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 internal + +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" +) diff --git a/balancer/xds/lrs/lrs.go b/balancer/xds/lrs/lrs.go index a332ada077e8..5b4fcb93d72a 100644 --- a/balancer/xds/lrs/lrs.go +++ b/balancer/xds/lrs/lrs.go @@ -25,6 +25,7 @@ import ( "github.com/golang/protobuf/ptypes" structpb "github.com/golang/protobuf/ptypes/struct" "google.golang.org/grpc" + "google.golang.org/grpc/balancer/xds/internal" basepb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/base" loadreportpb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/endpoint/load_report" lrspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/load_stats/v2/lrs" @@ -50,8 +51,6 @@ type lrsStore struct { drops sync.Map // map[string]*uint64 } -const grpcHostname = "com.googleapis.trafficdirector.grpc_hostname" - // NewStore creates a store for load reports. func NewStore(serviceName string) Store { return &lrsStore{ @@ -59,7 +58,7 @@ func NewStore(serviceName string) Store { node: &basepb.Node{ Metadata: &structpb.Struct{ Fields: map[string]*structpb.Value{ - grpcHostname: { + internal.GrpcHostname: { Kind: &structpb.Value_StringValue{StringValue: serviceName}, }, }, diff --git a/balancer/xds/lrs/lrs_test.go b/balancer/xds/lrs/lrs_test.go index 91c4aaa009cb..ae8176a068ca 100644 --- a/balancer/xds/lrs/lrs_test.go +++ b/balancer/xds/lrs/lrs_test.go @@ -32,6 +32,7 @@ import ( structpb "github.com/golang/protobuf/ptypes/struct" "github.com/google/go-cmp/cmp" "google.golang.org/grpc" + "google.golang.org/grpc/balancer/xds/internal" basepb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/base" loadreportpb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/endpoint/load_report" lrspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/load_stats/v2/lrs" @@ -144,7 +145,7 @@ func (lrss *lrsServer) StreamLoadStats(stream lrspb.LoadReportingService_StreamL Node: &basepb.Node{ Metadata: &structpb.Struct{ Fields: map[string]*structpb.Value{ - grpcHostname: { + internal.GrpcHostname: { Kind: &structpb.Value_StringValue{StringValue: testService}, }, }, diff --git a/balancer/xds/xds.go b/balancer/xds/xds.go index c305c82854b1..aca38f798386 100644 --- a/balancer/xds/xds.go +++ b/balancer/xds/xds.go @@ -36,7 +36,6 @@ import ( cdspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/cds" edspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/eds" "google.golang.org/grpc/balancer/xds/lrs" - "google.golang.org/grpc/connectivity" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/resolver" @@ -79,7 +78,7 @@ func (b *xdsBalancerBuilder) Build(cc balancer.ClientConn, opts balancer.BuildOp grpcUpdate: make(chan interface{}), xdsClientUpdate: make(chan interface{}), timer: createDrainedTimer(), // initialized a timer that won't fire without reset - loadStore: lrs.NewStore(cc.Target()), + loadStore: lrs.NewStore(opts.Target.Endpoint), } x.cc = &xdsClientConn{ updateState: x.connStateMgr.updateState, @@ -187,7 +186,7 @@ func (x *xdsBalancer) startNewXDSClient(u *xdsConfig) { prevClient.close() } } - x.client = newXDSClient(u.BalancerName, x.cc.Target(), u.ChildPolicy == nil, x.buildOpts, x.loadStore, newADS, loseContact, exitCleanup) + x.client = newXDSClient(u.BalancerName, u.ChildPolicy == nil, x.buildOpts, x.loadStore, newADS, loseContact, exitCleanup) go x.client.run() } @@ -451,8 +450,8 @@ func (x *xdsBalancer) newADSResponse(ctx context.Context, resp proto.Message) er var update interface{} switch u := resp.(type) { case *cdspb.Cluster: - if u.GetName() != x.cc.Target() { - return fmt.Errorf("unmatched service name, got %s, want %s", u.GetName(), x.cc.Target()) + if u.GetName() != x.buildOpts.Target.Endpoint { + return fmt.Errorf("unmatched service name, got %s, want %s", u.GetName(), x.buildOpts.Target.Endpoint) } if u.GetType() != cdspb.Cluster_EDS { return fmt.Errorf("unexpected service discovery type, got %v, want %v", u.GetType(), cdspb.Cluster_EDS) diff --git a/balancer/xds/xds_client.go b/balancer/xds/xds_client.go index 60d86254af64..39bdb07ce2c2 100644 --- a/balancer/xds/xds_client.go +++ b/balancer/xds/xds_client.go @@ -30,6 +30,7 @@ import ( structpb "github.com/golang/protobuf/ptypes/struct" "google.golang.org/grpc" "google.golang.org/grpc/balancer" + "google.golang.org/grpc/balancer/xds/internal" cdspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/cds" basepb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/base" discoverypb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/discovery" @@ -42,7 +43,6 @@ import ( ) const ( - grpcHostname = "com.googleapis.trafficdirector.grpc_hostname" cdsType = "type.googleapis.com/envoy.api.v2.Cluster" edsType = "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment" endpointRequired = "endpoints_required" @@ -135,7 +135,7 @@ func (c *client) newCDSRequest() *discoverypb.DiscoveryRequest { Node: &basepb.Node{ Metadata: &structpb.Struct{ Fields: map[string]*structpb.Value{ - grpcHostname: { + internal.GrpcHostname: { Kind: &structpb.Value_StringValue{StringValue: c.serviceName}, }, }, @@ -209,11 +209,13 @@ func (c *client) adsCallAttempt() (firstRespReceived bool) { if c.enableCDS { if err := st.Send(c.newCDSRequest()); err != nil { // current stream is broken, start a new one. + grpclog.Infof("xds: ads RPC failed due to err: %v, when sending the CDS request ", err) return } } if err := st.Send(c.newEDSRequest()); err != nil { // current stream is broken, start a new one. + grpclog.Infof("xds: ads RPC failed due to err: %v, when sending the EDS request", err) return } expectCDS := c.enableCDS @@ -221,6 +223,7 @@ func (c *client) adsCallAttempt() (firstRespReceived bool) { resp, err := st.Recv() if err != nil { // current stream is broken, start a new one. + grpclog.Infof("xds: ads RPC failed due to err: %v, when receiving the response", err) return } firstRespReceived = true @@ -264,10 +267,11 @@ func (c *client) adsCallAttempt() (firstRespReceived bool) { }) } } -func newXDSClient(balancerName string, serviceName string, enableCDS bool, opts balancer.BuildOptions, loadStore lrs.Store, newADS func(context.Context, proto.Message) error, loseContact func(ctx context.Context), exitCleanup func()) *client { + +func newXDSClient(balancerName string, enableCDS bool, opts balancer.BuildOptions, loadStore lrs.Store, newADS func(context.Context, proto.Message) error, loseContact func(ctx context.Context), exitCleanup func()) *client { c := &client{ balancerName: balancerName, - serviceName: serviceName, + serviceName: opts.Target.Endpoint, enableCDS: enableCDS, opts: opts, newADS: newADS, diff --git a/balancer/xds/xds_client_test.go b/balancer/xds/xds_client_test.go index a2b34e2c8389..e05dcac9396a 100644 --- a/balancer/xds/xds_client_test.go +++ b/balancer/xds/xds_client_test.go @@ -35,6 +35,7 @@ import ( wrpb "github.com/golang/protobuf/ptypes/wrappers" "google.golang.org/grpc" "google.golang.org/grpc/balancer" + "google.golang.org/grpc/balancer/xds/internal" cdspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/cds" addresspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/address" basepb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/base" @@ -44,6 +45,7 @@ import ( adspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/discovery/v2/ads" lrspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/load_stats/v2/lrs" "google.golang.org/grpc/codes" + "google.golang.org/grpc/resolver" "google.golang.org/grpc/status" ) @@ -53,7 +55,7 @@ var ( Node: &basepb.Node{ Metadata: &structpb.Struct{ Fields: map[string]*structpb.Value{ - grpcHostname: { + internal.GrpcHostname: { Kind: &structpb.Value_StringValue{StringValue: testServiceName}, }, }, @@ -318,7 +320,7 @@ func testXdsClientResponseHandling(t *testing.T, test *testConfig) { adsChan <- i return nil } - client := newXDSClient(addr, testServiceName, test.doCDS, balancer.BuildOptions{}, nil, newADS, func(context.Context) {}, func() {}) + client := newXDSClient(addr, test.doCDS, balancer.BuildOptions{Target: resolver.Target{Endpoint: testServiceName}}, nil, newADS, func(context.Context) {}, func() {}) defer client.close() go client.run() @@ -386,7 +388,7 @@ func testXdsClientLoseContactRemoteClose(t *testing.T, test *testConfig) { loseContactFunc := func(context.Context) { contactChan <- &loseContact{} } - client := newXDSClient(addr, testServiceName, test.doCDS, balancer.BuildOptions{}, nil, newADS, loseContactFunc, func() {}) + client := newXDSClient(addr, test.doCDS, balancer.BuildOptions{Target: resolver.Target{Endpoint: testServiceName}}, nil, newADS, loseContactFunc, func() {}) defer client.close() go client.run() @@ -420,7 +422,7 @@ func testXdsClientLoseContactADSRelatedErrorOccur(t *testing.T, test *testConfig loseContactFunc := func(context.Context) { contactChan <- &loseContact{} } - client := newXDSClient(addr, testServiceName, test.doCDS, balancer.BuildOptions{}, nil, newADS, loseContactFunc, func() {}) + client := newXDSClient(addr, test.doCDS, balancer.BuildOptions{Target: resolver.Target{Endpoint: testServiceName}}, nil, newADS, loseContactFunc, func() {}) defer client.close() go client.run() @@ -454,7 +456,7 @@ func (s) TestXdsClientExponentialRetry(t *testing.T) { loseContactFunc := func(context.Context) { contactChan <- &loseContact{} } - client := newXDSClient(addr, testServiceName, cfg.doCDS, balancer.BuildOptions{}, nil, newADS, loseContactFunc, func() {}) + client := newXDSClient(addr, cfg.doCDS, balancer.BuildOptions{Target: resolver.Target{Endpoint: testServiceName}}, nil, newADS, loseContactFunc, func() {}) defer client.close() go client.run() diff --git a/balancer/xds/xds_lrs_test.go b/balancer/xds/xds_lrs_test.go index 848d157a3feb..2c051a0876cc 100644 --- a/balancer/xds/xds_lrs_test.go +++ b/balancer/xds/xds_lrs_test.go @@ -31,6 +31,7 @@ import ( structpb "github.com/golang/protobuf/ptypes/struct" "github.com/google/go-cmp/cmp" "google.golang.org/grpc/balancer" + "google.golang.org/grpc/balancer/xds/internal" basepb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/base" lrspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/load_stats/v2/lrs" "google.golang.org/grpc/codes" @@ -54,7 +55,7 @@ func (lrss *lrsServer) StreamLoadStats(stream lrspb.LoadReportingService_StreamL Node: &basepb.Node{ Metadata: &structpb.Struct{ Fields: map[string]*structpb.Value{ - grpcHostname: { + internal.GrpcHostname: { Kind: &structpb.Value_StringValue{StringValue: testServiceName}, }, }, @@ -97,7 +98,7 @@ func (s) TestXdsLoadReporting(t *testing.T) { builder := balancer.Get("xds") cc := newTestClientConn() - lb, ok := builder.Build(cc, balancer.BuildOptions{}).(*xdsBalancer) + lb, ok := builder.Build(cc, balancer.BuildOptions{Target: resolver.Target{Endpoint: testServiceName}}).(*xdsBalancer) if !ok { t.Fatalf("unable to type assert to *xdsBalancer") } @@ -152,6 +153,6 @@ func (s) TestXdsLoadReporting(t *testing.T) { lrss.mu.Lock() defer lrss.mu.Unlock() if !cmp.Equal(lrss.drops, drops) { - t.Errorf("different: %v", cmp.Diff(lrss.drops, drops)) + t.Errorf("different: %v %v %v", lrss.drops, drops, cmp.Diff(lrss.drops, drops)) } } diff --git a/balancer/xds/xds_test.go b/balancer/xds/xds_test.go index 8933436495b2..8e0968078ac8 100644 --- a/balancer/xds/xds_test.go +++ b/balancer/xds/xds_test.go @@ -276,7 +276,7 @@ func (s) TestXdsBalanceHandleResolvedAddrs(t *testing.T) { builder := balancer.Get("xds") cc := newTestClientConn() - lb, ok := builder.Build(cc, balancer.BuildOptions{}).(*xdsBalancer) + lb, ok := builder.Build(cc, balancer.BuildOptions{Target: resolver.Target{Endpoint: testServiceName}}).(*xdsBalancer) if !ok { t.Fatalf("unable to type assert to *xdsBalancer") } @@ -310,7 +310,7 @@ func (s) TestXdsBalanceHandleBalancerConfigBalancerNameUpdate(t *testing.T) { builder := balancer.Get("xds") cc := newTestClientConn() - lb, ok := builder.Build(cc, balancer.BuildOptions{}).(*xdsBalancer) + lb, ok := builder.Build(cc, balancer.BuildOptions{Target: resolver.Target{Endpoint: testServiceName}}).(*xdsBalancer) if !ok { t.Fatalf("unable to type assert to *xdsBalancer") } @@ -385,7 +385,7 @@ func (s) TestXdsBalanceHandleBalancerConfigChildPolicyUpdate(t *testing.T) { builder := balancer.Get("xds") cc := newTestClientConn() - lb, ok := builder.Build(cc, balancer.BuildOptions{}).(*xdsBalancer) + lb, ok := builder.Build(cc, balancer.BuildOptions{Target: resolver.Target{Endpoint: testServiceName}}).(*xdsBalancer) if !ok { t.Fatalf("unable to type assert to *xdsBalancer") } @@ -471,7 +471,7 @@ func (s) TestXdsBalanceHandleBalancerConfigFallbackUpdate(t *testing.T) { builder := balancer.Get("xds") cc := newTestClientConn() - lb, ok := builder.Build(cc, balancer.BuildOptions{}).(*xdsBalancer) + lb, ok := builder.Build(cc, balancer.BuildOptions{Target: resolver.Target{Endpoint: testServiceName}}).(*xdsBalancer) if !ok { t.Fatalf("unable to type assert to *xdsBalancer") } @@ -546,7 +546,7 @@ func (s) TestXdsBalancerHandlerSubConnStateChange(t *testing.T) { builder := balancer.Get("xds") cc := newTestClientConn() - lb, ok := builder.Build(cc, balancer.BuildOptions{}).(*xdsBalancer) + lb, ok := builder.Build(cc, balancer.BuildOptions{Target: resolver.Target{Endpoint: testServiceName}}).(*xdsBalancer) if !ok { t.Fatalf("unable to type assert to *xdsBalancer") } @@ -626,7 +626,7 @@ func (s) TestXdsBalancerFallbackSignalFromEdsBalancer(t *testing.T) { builder := balancer.Get("xds") cc := newTestClientConn() - lb, ok := builder.Build(cc, balancer.BuildOptions{}).(*xdsBalancer) + lb, ok := builder.Build(cc, balancer.BuildOptions{Target: resolver.Target{Endpoint: testServiceName}}).(*xdsBalancer) if !ok { t.Fatalf("unable to type assert to *xdsBalancer") } From ab909771a093a95d8634391debbafe3aea44f688 Mon Sep 17 00:00:00 2001 From: wjywbs Date: Fri, 10 May 2019 18:42:49 -0400 Subject: [PATCH 33/34] Fix using grpc.WithBalancerName("grpclb") explicitly (#2778) (#2802) --- clientconn.go | 1 + 1 file changed, 1 insertion(+) diff --git a/clientconn.go b/clientconn.go index d76957034393..78e6d178a1b4 100644 --- a/clientconn.go +++ b/clientconn.go @@ -603,6 +603,7 @@ func (cc *ClientConn) updateResolverState(s resolver.State) error { } 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) } From 4a199db1948d4e05a2b8f284271d65343253ee78 Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Tue, 14 May 2019 15:15:08 -0700 Subject: [PATCH 34/34] xds: split proto imports for message and service (#2812) --- balancer/xds/lrs/lrs.go | 6 ++++-- balancer/xds/lrs/lrs_test.go | 5 +++-- balancer/xds/xds_client.go | 6 +++--- balancer/xds/xds_client_test.go | 12 ++++++------ balancer/xds/xds_lrs_test.go | 3 ++- benchmark/primitives/syncmap_test.go | 2 +- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/balancer/xds/lrs/lrs.go b/balancer/xds/lrs/lrs.go index 5b4fcb93d72a..acac1adf7e86 100644 --- a/balancer/xds/lrs/lrs.go +++ b/balancer/xds/lrs/lrs.go @@ -14,6 +14,7 @@ * limitations under the License. */ +// Package lrs implements load reporting service for xds balancer. package lrs import ( @@ -28,6 +29,7 @@ import ( "google.golang.org/grpc/balancer/xds/internal" basepb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/base" loadreportpb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/endpoint/load_report" + lrsgrpc "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/load_stats/v2/lrs" lrspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/load_stats/v2/lrs" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal/backoff" @@ -126,7 +128,7 @@ func (ls *lrsStore) buildStats() []*loadreportpb.ClusterStats { // // It retries the call (with backoff) until ctx is canceled. func (ls *lrsStore) ReportTo(ctx context.Context, cc *grpc.ClientConn) { - c := lrspb.NewLoadReportingServiceClient(cc) + c := lrsgrpc.NewLoadReportingServiceClient(cc) var ( retryCount int doBackoff bool @@ -188,7 +190,7 @@ func (ls *lrsStore) ReportTo(ctx context.Context, cc *grpc.ClientConn) { } } -func (ls *lrsStore) sendLoads(ctx context.Context, stream lrspb.LoadReportingService_StreamLoadStatsClient, clusterName string, interval time.Duration) { +func (ls *lrsStore) sendLoads(ctx context.Context, stream lrsgrpc.LoadReportingService_StreamLoadStatsClient, clusterName string, interval time.Duration) { tick := time.NewTicker(interval) defer tick.Stop() for { diff --git a/balancer/xds/lrs/lrs_test.go b/balancer/xds/lrs/lrs_test.go index ae8176a068ca..5bb8c00cd06e 100644 --- a/balancer/xds/lrs/lrs_test.go +++ b/balancer/xds/lrs/lrs_test.go @@ -35,6 +35,7 @@ import ( "google.golang.org/grpc/balancer/xds/internal" basepb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/base" loadreportpb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/endpoint/load_report" + lrsgrpc "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/load_stats/v2/lrs" lrspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/load_stats/v2/lrs" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -136,7 +137,7 @@ type lrsServer struct { reportingInterval *durationpb.Duration } -func (lrss *lrsServer) StreamLoadStats(stream lrspb.LoadReportingService_StreamLoadStatsServer) error { +func (lrss *lrsServer) StreamLoadStats(stream lrsgrpc.LoadReportingService_StreamLoadStatsServer) error { req, err := stream.Recv() if err != nil { return err @@ -189,7 +190,7 @@ func setupServer(t *testing.T, reportingInterval *durationpb.Duration) (addr str drops: make(map[string]uint64), reportingInterval: reportingInterval, } - lrspb.RegisterLoadReportingServiceServer(svr, lrss) + lrsgrpc.RegisterLoadReportingServiceServer(svr, lrss) go svr.Serve(lis) return lis.Addr().String(), lrss, func() { svr.Stop() diff --git a/balancer/xds/xds_client.go b/balancer/xds/xds_client.go index 39bdb07ce2c2..ef779ff8c034 100644 --- a/balancer/xds/xds_client.go +++ b/balancer/xds/xds_client.go @@ -35,7 +35,7 @@ import ( basepb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/base" discoverypb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/discovery" edspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/eds" - adspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/discovery/v2/ads" + adsgrpc "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/discovery/v2/ads" "google.golang.org/grpc/balancer/xds/lrs" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal/backoff" @@ -60,7 +60,7 @@ var ( type client struct { ctx context.Context cancel context.CancelFunc - cli adspb.AggregatedDiscoveryServiceClient + cli adsgrpc.AggregatedDiscoveryServiceClient opts balancer.BuildOptions balancerName string // the traffic director name serviceName string // the user dial target name @@ -164,7 +164,7 @@ func (c *client) newEDSRequest() *discoverypb.DiscoveryRequest { } func (c *client) makeADSCall() { - c.cli = adspb.NewAggregatedDiscoveryServiceClient(c.cc) + c.cli = adsgrpc.NewAggregatedDiscoveryServiceClient(c.cc) retryCount := 0 var doRetry bool diff --git a/balancer/xds/xds_client_test.go b/balancer/xds/xds_client_test.go index e05dcac9396a..2e3ce9df8623 100644 --- a/balancer/xds/xds_client_test.go +++ b/balancer/xds/xds_client_test.go @@ -42,8 +42,8 @@ import ( discoverypb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/discovery" edspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/eds" endpointpb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/endpoint/endpoint" - adspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/discovery/v2/ads" - lrspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/load_stats/v2/lrs" + adsgrpc "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/discovery/v2/ads" + lrsgrpc "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/load_stats/v2/lrs" "google.golang.org/grpc/codes" "google.golang.org/grpc/resolver" "google.golang.org/grpc/status" @@ -205,7 +205,7 @@ type response struct { err error } -func (ttd *testTrafficDirector) StreamAggregatedResources(s adspb.AggregatedDiscoveryService_StreamAggregatedResourcesServer) error { +func (ttd *testTrafficDirector) StreamAggregatedResources(s adsgrpc.AggregatedDiscoveryService_StreamAggregatedResourcesServer) error { for { req, err := s.Recv() if err != nil { @@ -242,7 +242,7 @@ func (ttd *testTrafficDirector) StreamAggregatedResources(s adspb.AggregatedDisc } } -func (ttd *testTrafficDirector) DeltaAggregatedResources(adspb.AggregatedDiscoveryService_DeltaAggregatedResourcesServer) error { +func (ttd *testTrafficDirector) DeltaAggregatedResources(adsgrpc.AggregatedDiscoveryService_DeltaAggregatedResourcesServer) error { return status.Error(codes.Unimplemented, "") } @@ -284,8 +284,8 @@ func setupServer(t *testing.T) (addr string, td *testTrafficDirector, lrss *lrsS Nanos: 0, }, } - adspb.RegisterAggregatedDiscoveryServiceServer(svr, td) - lrspb.RegisterLoadReportingServiceServer(svr, lrss) + adsgrpc.RegisterAggregatedDiscoveryServiceServer(svr, td) + lrsgrpc.RegisterLoadReportingServiceServer(svr, lrss) go svr.Serve(lis) return lis.Addr().String(), td, lrss, func() { svr.Stop() diff --git a/balancer/xds/xds_lrs_test.go b/balancer/xds/xds_lrs_test.go index 2c051a0876cc..26ec49241ee9 100644 --- a/balancer/xds/xds_lrs_test.go +++ b/balancer/xds/xds_lrs_test.go @@ -33,6 +33,7 @@ import ( "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/xds/internal" basepb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/api/v2/core/base" + lrsgrpc "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/load_stats/v2/lrs" lrspb "google.golang.org/grpc/balancer/xds/internal/proto/envoy/service/load_stats/v2/lrs" "google.golang.org/grpc/codes" "google.golang.org/grpc/resolver" @@ -46,7 +47,7 @@ type lrsServer struct { reportingInterval *durationpb.Duration } -func (lrss *lrsServer) StreamLoadStats(stream lrspb.LoadReportingService_StreamLoadStatsServer) error { +func (lrss *lrsServer) StreamLoadStats(stream lrsgrpc.LoadReportingService_StreamLoadStatsServer) error { req, err := stream.Recv() if err != nil { return err diff --git a/benchmark/primitives/syncmap_test.go b/benchmark/primitives/syncmap_test.go index fc42f10ef6f3..3ece8d92034b 100644 --- a/benchmark/primitives/syncmap_test.go +++ b/benchmark/primitives/syncmap_test.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package primitives +package primitives_test import ( "sync"