mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rebase: use latest google.golang.org/grpc version
google.golang.org/grpc was listed in go.mod:replace and updating the
dependency was not possible. There should not be a reason to prevent
updating, commit 5aca04d540
added it but without explanation.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
bf77ab57dc
commit
c12b155940
53
vendor/google.golang.org/grpc/rpc_util.go
generated
vendored
53
vendor/google.golang.org/grpc/rpc_util.go
generated
vendored
@ -258,7 +258,8 @@ func (o PeerCallOption) after(c *callInfo, attempt *csAttempt) {
|
||||
}
|
||||
|
||||
// WaitForReady configures the action to take when an RPC is attempted on broken
|
||||
// connections or unreachable servers. If waitForReady is false, the RPC will fail
|
||||
// connections or unreachable servers. If waitForReady is false and the
|
||||
// connection is in the TRANSIENT_FAILURE state, the RPC will fail
|
||||
// immediately. Otherwise, the RPC client will block the call until a
|
||||
// connection is available (or the call is canceled or times out) and will
|
||||
// retry the call if it fails due to a transient error. gRPC will not retry if
|
||||
@ -429,9 +430,10 @@ func (o ContentSubtypeCallOption) before(c *callInfo) error {
|
||||
}
|
||||
func (o ContentSubtypeCallOption) after(c *callInfo, attempt *csAttempt) {}
|
||||
|
||||
// ForceCodec returns a CallOption that will set the given Codec to be
|
||||
// used for all request and response messages for a call. The result of calling
|
||||
// String() will be used as the content-subtype in a case-insensitive manner.
|
||||
// ForceCodec returns a CallOption that will set codec to be used for all
|
||||
// request and response messages for a call. The result of calling Name() will
|
||||
// be used as the content-subtype after converting to lowercase, unless
|
||||
// CallContentSubtype is also used.
|
||||
//
|
||||
// See Content-Type on
|
||||
// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for
|
||||
@ -827,33 +829,45 @@ func Errorf(c codes.Code, format string, a ...interface{}) error {
|
||||
|
||||
// toRPCErr converts an error into an error from the status package.
|
||||
func toRPCErr(err error) error {
|
||||
if err == nil || err == io.EOF {
|
||||
switch err {
|
||||
case nil, io.EOF:
|
||||
return err
|
||||
}
|
||||
if err == io.ErrUnexpectedEOF {
|
||||
case context.DeadlineExceeded:
|
||||
return status.Error(codes.DeadlineExceeded, err.Error())
|
||||
case context.Canceled:
|
||||
return status.Error(codes.Canceled, err.Error())
|
||||
case io.ErrUnexpectedEOF:
|
||||
return status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
if _, ok := status.FromError(err); ok {
|
||||
return err
|
||||
}
|
||||
|
||||
switch e := err.(type) {
|
||||
case transport.ConnectionError:
|
||||
return status.Error(codes.Unavailable, e.Desc)
|
||||
default:
|
||||
switch err {
|
||||
case context.DeadlineExceeded:
|
||||
return status.Error(codes.DeadlineExceeded, err.Error())
|
||||
case context.Canceled:
|
||||
return status.Error(codes.Canceled, err.Error())
|
||||
}
|
||||
case *transport.NewStreamError:
|
||||
return toRPCErr(e.Err)
|
||||
}
|
||||
|
||||
if _, ok := status.FromError(err); ok {
|
||||
return err
|
||||
}
|
||||
|
||||
return status.Error(codes.Unknown, err.Error())
|
||||
}
|
||||
|
||||
// setCallInfoCodec should only be called after CallOptions have been applied.
|
||||
func setCallInfoCodec(c *callInfo) error {
|
||||
if c.codec != nil {
|
||||
// codec was already set by a CallOption; use it.
|
||||
// codec was already set by a CallOption; use it, but set the content
|
||||
// subtype if it is not set.
|
||||
if c.contentSubtype == "" {
|
||||
// c.codec is a baseCodec to hide the difference between grpc.Codec and
|
||||
// encoding.Codec (Name vs. String method name). We only support
|
||||
// setting content subtype from encoding.Codec to avoid a behavior
|
||||
// change with the deprecated version.
|
||||
if ec, ok := c.codec.(encoding.Codec); ok {
|
||||
c.contentSubtype = strings.ToLower(ec.Name())
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -888,8 +902,7 @@ type channelzData struct {
|
||||
// buffer files to ensure compatibility with the gRPC version used. The latest
|
||||
// support package version is 7.
|
||||
//
|
||||
// Older versions are kept for compatibility. They may be removed if
|
||||
// compatibility cannot be maintained.
|
||||
// Older versions are kept for compatibility.
|
||||
//
|
||||
// These constants should not be referenced from any other code.
|
||||
const (
|
||||
|
Reference in New Issue
Block a user