-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xds/outlierdetection: fix config handling #6361
Changes from 1 commit
e9c6d27
a2552fe
183d67f
65f380f
e5aaa8e
f37646d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* | ||
* Copyright 2023 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 nop implements a balancer with all of it's balancer operations as | ||
// no-ops, other than returning a Transient Failure Picker on a Client Conn | ||
// update. | ||
package nop | ||
|
||
import ( | ||
"errors" | ||
|
||
"google.golang.org/grpc/balancer" | ||
"google.golang.org/grpc/balancer/base" | ||
"google.golang.org/grpc/connectivity" | ||
) | ||
|
||
// Balancer is a balancer with all of it's balancer operations as no-ops, other | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. its There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :/. Haha switched. |
||
// than returning a Transient Failure Picker on a Client Conn update. | ||
type Balancer struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unexport, then you don't need all these comments. Only There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had it unexported, but it was throwing errors wrt lint. I had to change it to pass lint :/ |
||
cc balancer.ClientConn | ||
} | ||
|
||
// NewNOPBalancer returns a no-op balancer. | ||
func NewNOPBalancer(cc balancer.ClientConn) *Balancer { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah ok. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
return &Balancer{cc: cc} | ||
} | ||
|
||
// UpdateClientConnState updates the Balancer's Client Conn with an Error Picker | ||
// and a Connectivity State of TRANSIENT_FAILURE. | ||
func (b *Balancer) UpdateClientConnState(_ balancer.ClientConnState) error { | ||
b.cc.UpdateState(balancer.State{ | ||
Picker: base.NewErrPicker(errors.New("no-op balancer invoked")), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error returned here should be an error passed to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
ConnectivityState: connectivity.TransientFailure, | ||
}) | ||
return nil | ||
} | ||
|
||
// ResolverError is a no-op. | ||
func (b *Balancer) ResolverError(_ error) {} | ||
|
||
// UpdateSubConnState is a no-op. | ||
func (b *Balancer) UpdateSubConnState(_ balancer.SubConn, _ balancer.SubConnState) {} | ||
|
||
// Close is a no-op. | ||
func (b *Balancer) Close() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:/. Haha switched.