vendor: google.golang.org/grpc v1.67.1

full diff:

- https://github.com/grpc/grpc-go/compare/v1.66.2...v1.67.1
- ef581f9131...5fefd90f89

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2024-11-01 13:39:15 +01:00
parent 1bba009944
commit 1dbcce2057
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
31 changed files with 188 additions and 108 deletions

View File

@ -98,8 +98,8 @@ require (
golang.org/x/crypto v0.28.0 // indirect golang.org/x/crypto v0.28.0 // indirect
golang.org/x/net v0.30.0 // indirect golang.org/x/net v0.30.0 // indirect
golang.org/x/time v0.6.0 // indirect golang.org/x/time v0.6.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect
google.golang.org/grpc v1.66.2 // indirect google.golang.org/grpc v1.67.1 // indirect
google.golang.org/protobuf v1.35.1 // indirect google.golang.org/protobuf v1.35.1 // indirect
) )

View File

@ -105,8 +105,8 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
github.com/golang/glog v1.2.1 h1:OptwRhECazUx5ix5TTWC3EZhsZEHWcYWY4FQHTIubm4= github.com/golang/glog v1.2.2 h1:1+mZ9upx1Dh6FmUTFR1naJ77miKiXgALjWOZ3NVFPmY=
github.com/golang/glog v1.2.1/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/glog v1.2.2/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@ -416,13 +416,13 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 h1:T6rh4haD3GVYsgEfWExoCZA2o2FmbNyKpTuAxbEFPTg=
google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:wp2WsuBYj6j8wUdo3ToZsdxxixbvQNAHqVJrTgi5E5M=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1:QCqS/PdaHTSWGvupk2F/ehwHtGc0/GYkT+3GAcR1CCc=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
google.golang.org/grpc v1.0.5/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.0.5/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=

View File

@ -36,7 +36,7 @@ type baseBuilder struct {
config Config config Config
} }
func (bb *baseBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) balancer.Balancer { func (bb *baseBuilder) Build(cc balancer.ClientConn, _ balancer.BuildOptions) balancer.Balancer {
bal := &baseBalancer{ bal := &baseBalancer{
cc: cc, cc: cc,
pickerBuilder: bb.pickerBuilder, pickerBuilder: bb.pickerBuilder,
@ -259,6 +259,6 @@ type errPicker struct {
err error // Pick() always returns this err. err error // Pick() always returns this err.
} }
func (p *errPicker) Pick(info balancer.PickInfo) (balancer.PickResult, error) { func (p *errPicker) Pick(balancer.PickInfo) (balancer.PickResult, error) {
return balancer.PickResult{}, p.err return balancer.PickResult{}, p.err
} }

View File

@ -50,7 +50,7 @@ const (
type pickfirstBuilder struct{} type pickfirstBuilder struct{}
func (pickfirstBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) balancer.Balancer { func (pickfirstBuilder) Build(cc balancer.ClientConn, _ balancer.BuildOptions) balancer.Balancer {
b := &pickfirstBalancer{cc: cc} b := &pickfirstBalancer{cc: cc}
b.logger = internalgrpclog.NewPrefixLogger(logger, fmt.Sprintf(logPrefix, b)) b.logger = internalgrpclog.NewPrefixLogger(logger, fmt.Sprintf(logPrefix, b))
return b return b

View File

@ -192,7 +192,7 @@ func (ccb *ccBalancerWrapper) NewSubConn(addrs []resolver.Address, opts balancer
return acbw, nil return acbw, nil
} }
func (ccb *ccBalancerWrapper) RemoveSubConn(sc balancer.SubConn) { func (ccb *ccBalancerWrapper) RemoveSubConn(balancer.SubConn) {
// The graceful switch balancer will never call this. // The graceful switch balancer will never call this.
logger.Errorf("ccb RemoveSubConn(%v) called unexpectedly, sc") logger.Errorf("ccb RemoveSubConn(%v) called unexpectedly, sc")
} }
@ -342,8 +342,8 @@ func (acbw *acBalancerWrapper) GetOrBuildProducer(pb balancer.ProducerBuilder) (
pData := acbw.producers[pb] pData := acbw.producers[pb]
if pData == nil { if pData == nil {
// Not found; create a new one and add it to the producers map. // Not found; create a new one and add it to the producers map.
p, close := pb.Build(acbw) p, closeFn := pb.Build(acbw)
pData = &refCountedProducer{producer: p, close: close} pData = &refCountedProducer{producer: p, close: closeFn}
acbw.producers[pb] = pData acbw.producers[pb] = pData
} }
// Account for this new reference. // Account for this new reference.

View File

@ -18,7 +18,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.1 // protoc-gen-go v1.34.2
// protoc v5.27.1 // protoc v5.27.1
// source: grpc/binlog/v1/binarylog.proto // source: grpc/binlog/v1/binarylog.proto
@ -1015,7 +1015,7 @@ func file_grpc_binlog_v1_binarylog_proto_rawDescGZIP() []byte {
var file_grpc_binlog_v1_binarylog_proto_enumTypes = make([]protoimpl.EnumInfo, 3) var file_grpc_binlog_v1_binarylog_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
var file_grpc_binlog_v1_binarylog_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_grpc_binlog_v1_binarylog_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_grpc_binlog_v1_binarylog_proto_goTypes = []interface{}{ var file_grpc_binlog_v1_binarylog_proto_goTypes = []any{
(GrpcLogEntry_EventType)(0), // 0: grpc.binarylog.v1.GrpcLogEntry.EventType (GrpcLogEntry_EventType)(0), // 0: grpc.binarylog.v1.GrpcLogEntry.EventType
(GrpcLogEntry_Logger)(0), // 1: grpc.binarylog.v1.GrpcLogEntry.Logger (GrpcLogEntry_Logger)(0), // 1: grpc.binarylog.v1.GrpcLogEntry.Logger
(Address_Type)(0), // 2: grpc.binarylog.v1.Address.Type (Address_Type)(0), // 2: grpc.binarylog.v1.Address.Type
@ -1058,7 +1058,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_grpc_binlog_v1_binarylog_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_grpc_binlog_v1_binarylog_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*GrpcLogEntry); i { switch v := v.(*GrpcLogEntry); i {
case 0: case 0:
return &v.state return &v.state
@ -1070,7 +1070,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() {
return nil return nil
} }
} }
file_grpc_binlog_v1_binarylog_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { file_grpc_binlog_v1_binarylog_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*ClientHeader); i { switch v := v.(*ClientHeader); i {
case 0: case 0:
return &v.state return &v.state
@ -1082,7 +1082,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() {
return nil return nil
} }
} }
file_grpc_binlog_v1_binarylog_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { file_grpc_binlog_v1_binarylog_proto_msgTypes[2].Exporter = func(v any, i int) any {
switch v := v.(*ServerHeader); i { switch v := v.(*ServerHeader); i {
case 0: case 0:
return &v.state return &v.state
@ -1094,7 +1094,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() {
return nil return nil
} }
} }
file_grpc_binlog_v1_binarylog_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { file_grpc_binlog_v1_binarylog_proto_msgTypes[3].Exporter = func(v any, i int) any {
switch v := v.(*Trailer); i { switch v := v.(*Trailer); i {
case 0: case 0:
return &v.state return &v.state
@ -1106,7 +1106,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() {
return nil return nil
} }
} }
file_grpc_binlog_v1_binarylog_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { file_grpc_binlog_v1_binarylog_proto_msgTypes[4].Exporter = func(v any, i int) any {
switch v := v.(*Message); i { switch v := v.(*Message); i {
case 0: case 0:
return &v.state return &v.state
@ -1118,7 +1118,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() {
return nil return nil
} }
} }
file_grpc_binlog_v1_binarylog_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { file_grpc_binlog_v1_binarylog_proto_msgTypes[5].Exporter = func(v any, i int) any {
switch v := v.(*Metadata); i { switch v := v.(*Metadata); i {
case 0: case 0:
return &v.state return &v.state
@ -1130,7 +1130,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() {
return nil return nil
} }
} }
file_grpc_binlog_v1_binarylog_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { file_grpc_binlog_v1_binarylog_proto_msgTypes[6].Exporter = func(v any, i int) any {
switch v := v.(*MetadataEntry); i { switch v := v.(*MetadataEntry); i {
case 0: case 0:
return &v.state return &v.state
@ -1142,7 +1142,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() {
return nil return nil
} }
} }
file_grpc_binlog_v1_binarylog_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { file_grpc_binlog_v1_binarylog_proto_msgTypes[7].Exporter = func(v any, i int) any {
switch v := v.(*Address); i { switch v := v.(*Address); i {
case 0: case 0:
return &v.state return &v.state
@ -1155,7 +1155,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() {
} }
} }
} }
file_grpc_binlog_v1_binarylog_proto_msgTypes[0].OneofWrappers = []interface{}{ file_grpc_binlog_v1_binarylog_proto_msgTypes[0].OneofWrappers = []any{
(*GrpcLogEntry_ClientHeader)(nil), (*GrpcLogEntry_ClientHeader)(nil),
(*GrpcLogEntry_ServerHeader)(nil), (*GrpcLogEntry_ServerHeader)(nil),
(*GrpcLogEntry_Message)(nil), (*GrpcLogEntry_Message)(nil),

View File

@ -40,7 +40,7 @@ func NewCredentials() credentials.TransportCredentials {
// NoSecurity. // NoSecurity.
type insecureTC struct{} type insecureTC struct{}
func (insecureTC) ClientHandshake(ctx context.Context, _ string, conn net.Conn) (net.Conn, credentials.AuthInfo, error) { func (insecureTC) ClientHandshake(_ context.Context, _ string, conn net.Conn) (net.Conn, credentials.AuthInfo, error) {
return conn, info{credentials.CommonAuthInfo{SecurityLevel: credentials.NoSecurity}}, nil return conn, info{credentials.CommonAuthInfo{SecurityLevel: credentials.NoSecurity}}, nil
} }

View File

@ -518,6 +518,8 @@ func WithUserAgent(s string) DialOption {
// WithKeepaliveParams returns a DialOption that specifies keepalive parameters // WithKeepaliveParams returns a DialOption that specifies keepalive parameters
// for the client transport. // for the client transport.
//
// Keepalive is disabled by default.
func WithKeepaliveParams(kp keepalive.ClientParameters) DialOption { func WithKeepaliveParams(kp keepalive.ClientParameters) DialOption {
if kp.Time < internal.KeepaliveMinPingTime { if kp.Time < internal.KeepaliveMinPingTime {
logger.Warningf("Adjusting keepalive ping interval to minimum period of %v", internal.KeepaliveMinPingTime) logger.Warningf("Adjusting keepalive ping interval to minimum period of %v", internal.KeepaliveMinPingTime)

View File

@ -81,7 +81,7 @@ func (l *LoggerWrapper) Errorf(format string, args ...any) {
} }
// V reports whether verbosity level l is at least the requested verbose level. // V reports whether verbosity level l is at least the requested verbose level.
func (*LoggerWrapper) V(l int) bool { func (*LoggerWrapper) V(int) bool {
// Returns true for all verbose level. // Returns true for all verbose level.
return true return true
} }

View File

@ -17,7 +17,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.1 // protoc-gen-go v1.34.2
// protoc v5.27.1 // protoc v5.27.1
// source: grpc/health/v1/health.proto // source: grpc/health/v1/health.proto
@ -237,7 +237,7 @@ func file_grpc_health_v1_health_proto_rawDescGZIP() []byte {
var file_grpc_health_v1_health_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_grpc_health_v1_health_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_grpc_health_v1_health_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_grpc_health_v1_health_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_grpc_health_v1_health_proto_goTypes = []interface{}{ var file_grpc_health_v1_health_proto_goTypes = []any{
(HealthCheckResponse_ServingStatus)(0), // 0: grpc.health.v1.HealthCheckResponse.ServingStatus (HealthCheckResponse_ServingStatus)(0), // 0: grpc.health.v1.HealthCheckResponse.ServingStatus
(*HealthCheckRequest)(nil), // 1: grpc.health.v1.HealthCheckRequest (*HealthCheckRequest)(nil), // 1: grpc.health.v1.HealthCheckRequest
(*HealthCheckResponse)(nil), // 2: grpc.health.v1.HealthCheckResponse (*HealthCheckResponse)(nil), // 2: grpc.health.v1.HealthCheckResponse
@ -261,7 +261,7 @@ func file_grpc_health_v1_health_proto_init() {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_grpc_health_v1_health_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_grpc_health_v1_health_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*HealthCheckRequest); i { switch v := v.(*HealthCheckRequest); i {
case 0: case 0:
return &v.state return &v.state
@ -273,7 +273,7 @@ func file_grpc_health_v1_health_proto_init() {
return nil return nil
} }
} }
file_grpc_health_v1_health_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { file_grpc_health_v1_health_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*HealthCheckResponse); i { switch v := v.(*HealthCheckResponse); i {
case 0: case 0:
return &v.state return &v.state

View File

@ -106,7 +106,7 @@ func (ml *TruncatingMethodLogger) Build(c LogEntryConfig) *binlogpb.GrpcLogEntry
} }
// Log creates a proto binary log entry, and logs it to the sink. // Log creates a proto binary log entry, and logs it to the sink.
func (ml *TruncatingMethodLogger) Log(ctx context.Context, c LogEntryConfig) { func (ml *TruncatingMethodLogger) Log(_ context.Context, c LogEntryConfig) {
ml.sink.Write(ml.Build(c)) ml.sink.Write(ml.Build(c))
} }

View File

@ -234,13 +234,6 @@ func copyMap(m map[int64]string) map[int64]string {
return n return n
} }
func min(a, b int) int {
if a < b {
return a
}
return b
}
func (c *channelMap) getTopChannels(id int64, maxResults int) ([]*Channel, bool) { func (c *channelMap) getTopChannels(id int64, maxResults int) ([]*Channel, bool) {
if maxResults <= 0 { if maxResults <= 0 {
maxResults = EntriesPerPage maxResults = EntriesPerPage

View File

@ -33,7 +33,7 @@ var (
// outside this package except by tests. // outside this package except by tests.
IDGen IDGenerator IDGen IDGenerator
db *channelMap = newChannelMap() db = newChannelMap()
// EntriesPerPage defines the number of channelz entries to be shown on a web page. // EntriesPerPage defines the number of channelz entries to be shown on a web page.
EntriesPerPage = 50 EntriesPerPage = 50
curState int32 curState int32

View File

@ -35,13 +35,13 @@ type SocketOptionData struct {
// Getsockopt defines the function to get socket options requested by channelz. // Getsockopt defines the function to get socket options requested by channelz.
// It is to be passed to syscall.RawConn.Control(). // It is to be passed to syscall.RawConn.Control().
// Windows OS doesn't support Socket Option // Windows OS doesn't support Socket Option
func (s *SocketOptionData) Getsockopt(fd uintptr) { func (s *SocketOptionData) Getsockopt(uintptr) {
once.Do(func() { once.Do(func() {
logger.Warning("Channelz: socket options are not supported on non-linux environments") logger.Warning("Channelz: socket options are not supported on non-linux environments")
}) })
} }
// GetSocketOption gets the socket option info of the conn. // GetSocketOption gets the socket option info of the conn.
func GetSocketOption(c any) *SocketOptionData { func GetSocketOption(any) *SocketOptionData {
return nil return nil
} }

View File

@ -45,7 +45,7 @@ var (
// option is present for backward compatibility. This option may be overridden // option is present for backward compatibility. This option may be overridden
// by setting the environment variable "GRPC_ENFORCE_ALPN_ENABLED" to "true" // by setting the environment variable "GRPC_ENFORCE_ALPN_ENABLED" to "true"
// or "false". // or "false".
EnforceALPNEnabled = boolFromEnv("GRPC_ENFORCE_ALPN_ENABLED", false) EnforceALPNEnabled = boolFromEnv("GRPC_ENFORCE_ALPN_ENABLED", true)
// XDSFallbackSupport is the env variable that controls whether support for // XDSFallbackSupport is the env variable that controls whether support for
// xDS fallback is turned on. If this is unset or is false, only the first // xDS fallback is turned on. If this is unset or is false, only the first
// xDS server in the list of server configs will be used. // xDS server in the list of server configs will be used.

View File

@ -183,7 +183,7 @@ var (
// GRPCResolverSchemeExtraMetadata determines when gRPC will add extra // GRPCResolverSchemeExtraMetadata determines when gRPC will add extra
// metadata to RPCs. // metadata to RPCs.
GRPCResolverSchemeExtraMetadata string = "xds" GRPCResolverSchemeExtraMetadata = "xds"
// EnterIdleModeForTesting gets the ClientConn to enter IDLE mode. // EnterIdleModeForTesting gets the ClientConn to enter IDLE mode.
EnterIdleModeForTesting any // func(*grpc.ClientConn) EnterIdleModeForTesting any // func(*grpc.ClientConn)
@ -203,7 +203,7 @@ var (
// UserSetDefaultScheme is set to true if the user has overridden the // UserSetDefaultScheme is set to true if the user has overridden the
// default resolver scheme. // default resolver scheme.
UserSetDefaultScheme bool = false UserSetDefaultScheme = false
// ShuffleAddressListForTesting pseudo-randomizes the order of addresses. n // ShuffleAddressListForTesting pseudo-randomizes the order of addresses. n
// is the number of elements. swap swaps the elements with indexes i and j. // is the number of elements. swap swaps the elements with indexes i and j.

View File

@ -55,7 +55,7 @@ func (r *passthroughResolver) start() {
r.cc.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: r.target.Endpoint()}}}) r.cc.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: r.target.Endpoint()}}})
} }
func (*passthroughResolver) ResolveNow(o resolver.ResolveNowOptions) {} func (*passthroughResolver) ResolveNow(resolver.ResolveNowOptions) {}
func (*passthroughResolver) Close() {} func (*passthroughResolver) Close() {}

View File

@ -138,11 +138,11 @@ func (s *Status) WithDetails(details ...protoadapt.MessageV1) (*Status, error) {
// s.Code() != OK implies that s.Proto() != nil. // s.Code() != OK implies that s.Proto() != nil.
p := s.Proto() p := s.Proto()
for _, detail := range details { for _, detail := range details {
any, err := anypb.New(protoadapt.MessageV2Of(detail)) m, err := anypb.New(protoadapt.MessageV2Of(detail))
if err != nil { if err != nil {
return nil, err return nil, err
} }
p.Details = append(p.Details, any) p.Details = append(p.Details, m)
} }
return &Status{s: p}, nil return &Status{s: p}, nil
} }

View File

@ -58,20 +58,20 @@ func GetRusage() *Rusage {
// CPUTimeDiff returns the differences of user CPU time and system CPU time used // CPUTimeDiff returns the differences of user CPU time and system CPU time used
// between two Rusage structs. It a no-op function for non-linux environments. // between two Rusage structs. It a no-op function for non-linux environments.
func CPUTimeDiff(first *Rusage, latest *Rusage) (float64, float64) { func CPUTimeDiff(*Rusage, *Rusage) (float64, float64) {
log() log()
return 0, 0 return 0, 0
} }
// SetTCPUserTimeout is a no-op function under non-linux environments. // SetTCPUserTimeout is a no-op function under non-linux environments.
func SetTCPUserTimeout(conn net.Conn, timeout time.Duration) error { func SetTCPUserTimeout(net.Conn, time.Duration) error {
log() log()
return nil return nil
} }
// GetTCPUserTimeout is a no-op function under non-linux environments. // GetTCPUserTimeout is a no-op function under non-linux environments.
// A negative return value indicates the operation is not supported // A negative return value indicates the operation is not supported
func GetTCPUserTimeout(conn net.Conn) (int, error) { func GetTCPUserTimeout(net.Conn) (int, error) {
log() log()
return -1, nil return -1, nil
} }

View File

@ -1033,10 +1033,3 @@ func (l *loopyWriter) processData() (bool, error) {
} }
return false, nil return false, nil
} }
func min(a, b int) int {
if a < b {
return a
}
return b
}

View File

@ -333,7 +333,7 @@ func (ht *serverHandlerTransport) writeCustomHeaders(s *Stream) {
s.hdrMu.Unlock() s.hdrMu.Unlock()
} }
func (ht *serverHandlerTransport) Write(s *Stream, hdr []byte, data mem.BufferSlice, opts *Options) error { func (ht *serverHandlerTransport) Write(s *Stream, hdr []byte, data mem.BufferSlice, _ *Options) error {
// Always take a reference because otherwise there is no guarantee the data will // Always take a reference because otherwise there is no guarantee the data will
// be available after this function returns. This is what callers to Write // be available after this function returns. This is what callers to Write
// expect. // expect.
@ -475,7 +475,7 @@ func (ht *serverHandlerTransport) IncrMsgSent() {}
func (ht *serverHandlerTransport) IncrMsgRecv() {} func (ht *serverHandlerTransport) IncrMsgRecv() {}
func (ht *serverHandlerTransport) Drain(debugData string) { func (ht *serverHandlerTransport) Drain(string) {
panic("Drain() is not implemented") panic("Drain() is not implemented")
} }

View File

@ -772,7 +772,7 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*Stream,
hdr := &headerFrame{ hdr := &headerFrame{
hf: headerFields, hf: headerFields,
endStream: false, endStream: false,
initStream: func(id uint32) error { initStream: func(uint32) error {
t.mu.Lock() t.mu.Lock()
// TODO: handle transport closure in loopy instead and remove this // TODO: handle transport closure in loopy instead and remove this
// initStream is never called when transport is draining. // initStream is never called when transport is draining.
@ -1667,11 +1667,10 @@ func (t *http2Client) reader(errCh chan<- error) {
t.closeStream(s, status.Error(code, msg), true, http2.ErrCodeProtocol, status.New(code, msg), nil, false) t.closeStream(s, status.Error(code, msg), true, http2.ErrCodeProtocol, status.New(code, msg), nil, false)
} }
continue continue
} else {
// Transport error.
t.Close(connectionErrorf(true, err, "error reading from server: %v", err))
return
} }
// Transport error.
t.Close(connectionErrorf(true, err, "error reading from server: %v", err))
return
} }
switch frame := frame.(type) { switch frame := frame.(type) {
case *http2.MetaHeadersFrame: case *http2.MetaHeadersFrame:
@ -1696,13 +1695,6 @@ func (t *http2Client) reader(errCh chan<- error) {
} }
} }
func minTime(a, b time.Duration) time.Duration {
if a < b {
return a
}
return b
}
// keepalive running in a separate goroutine makes sure the connection is alive by sending pings. // keepalive running in a separate goroutine makes sure the connection is alive by sending pings.
func (t *http2Client) keepalive() { func (t *http2Client) keepalive() {
p := &ping{data: [8]byte{}} p := &ping{data: [8]byte{}}
@ -1770,7 +1762,7 @@ func (t *http2Client) keepalive() {
// timeoutLeft. This will ensure that we wait only for kp.Time // timeoutLeft. This will ensure that we wait only for kp.Time
// before sending out the next ping (for cases where the ping is // before sending out the next ping (for cases where the ping is
// acked). // acked).
sleepDuration := minTime(t.kp.Time, timeoutLeft) sleepDuration := min(t.kp.Time, timeoutLeft)
timeoutLeft -= sleepDuration timeoutLeft -= sleepDuration
timer.Reset(sleepDuration) timer.Reset(sleepDuration)
case <-t.ctx.Done(): case <-t.ctx.Done():

View File

@ -1117,7 +1117,7 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error {
// Write converts the data into HTTP2 data frame and sends it out. Non-nil error // Write converts the data into HTTP2 data frame and sends it out. Non-nil error
// is returns if it fails (e.g., framing error, transport error). // is returns if it fails (e.g., framing error, transport error).
func (t *http2Server) Write(s *Stream, hdr []byte, data mem.BufferSlice, opts *Options) error { func (t *http2Server) Write(s *Stream, hdr []byte, data mem.BufferSlice, _ *Options) error {
reader := data.Reader() reader := data.Reader()
if !s.isHeaderSent() { // Headers haven't been written yet. if !s.isHeaderSent() { // Headers haven't been written yet.
@ -1238,7 +1238,7 @@ func (t *http2Server) keepalive() {
// timeoutLeft. This will ensure that we wait only for kp.Time // timeoutLeft. This will ensure that we wait only for kp.Time
// before sending out the next ping (for cases where the ping is // before sending out the next ping (for cases where the ping is
// acked). // acked).
sleepDuration := minTime(t.kp.Time, kpTimeoutLeft) sleepDuration := min(t.kp.Time, kpTimeoutLeft)
kpTimeoutLeft -= sleepDuration kpTimeoutLeft -= sleepDuration
kpTimer.Reset(sleepDuration) kpTimer.Reset(sleepDuration)
case <-t.done: case <-t.done:

View File

@ -393,7 +393,7 @@ type framer struct {
fr *http2.Framer fr *http2.Framer
} }
var writeBufferPoolMap map[int]*sync.Pool = make(map[int]*sync.Pool) var writeBufferPoolMap = make(map[int]*sync.Pool)
var writeBufferMutex sync.Mutex var writeBufferMutex sync.Mutex
func newFramer(conn net.Conn, writeBufferSize, readBufferSize int, sharedWriteBuffer bool, maxHeaderListSize uint32) *framer { func newFramer(conn net.Conn, writeBufferSize, readBufferSize int, sharedWriteBuffer bool, maxHeaderListSize uint32) *framer {

View File

@ -616,7 +616,7 @@ func (t *transportReader) ReadHeader(header []byte) (int, error) {
t.er = err t.er = err
return 0, err return 0, err
} }
t.windowHandler(len(header)) t.windowHandler(n)
return n, nil return n, nil
} }

View File

@ -34,15 +34,29 @@ type ClientParameters struct {
// After a duration of this time if the client doesn't see any activity it // After a duration of this time if the client doesn't see any activity it
// pings the server to see if the transport is still alive. // pings the server to see if the transport is still alive.
// If set below 10s, a minimum value of 10s will be used instead. // If set below 10s, a minimum value of 10s will be used instead.
Time time.Duration // The current default value is infinity. //
// Note that gRPC servers have a default EnforcementPolicy.MinTime of 5
// minutes (which means the client shouldn't ping more frequently than every
// 5 minutes).
//
// Though not ideal, it's not a strong requirement for Time to be less than
// EnforcementPolicy.MinTime. Time will automatically double if the server
// disconnects due to its enforcement policy.
//
// For more details, see
// https://github.com/grpc/proposal/blob/master/A8-client-side-keepalive.md
Time time.Duration
// After having pinged for keepalive check, the client waits for a duration // After having pinged for keepalive check, the client waits for a duration
// of Timeout and if no activity is seen even after that the connection is // of Timeout and if no activity is seen even after that the connection is
// closed. // closed.
Timeout time.Duration // The current default value is 20 seconds. //
// If keepalive is enabled, and this value is not explicitly set, the default
// is 20 seconds.
Timeout time.Duration
// If true, client sends keepalive pings even with no active RPCs. If false, // If true, client sends keepalive pings even with no active RPCs. If false,
// when there are no active RPCs, Time and Timeout will be ignored and no // when there are no active RPCs, Time and Timeout will be ignored and no
// keepalive pings will be sent. // keepalive pings will be sent.
PermitWithoutStream bool // false by default. PermitWithoutStream bool
} }
// ServerParameters is used to set keepalive and max-age parameters on the // ServerParameters is used to set keepalive and max-age parameters on the

View File

@ -224,11 +224,11 @@ func (e emptyBuffer) Len() int {
return 0 return 0
} }
func (e emptyBuffer) split(n int) (left, right Buffer) { func (e emptyBuffer) split(int) (left, right Buffer) {
return e, e return e, e
} }
func (e emptyBuffer) read(buf []byte) (int, Buffer) { func (e emptyBuffer) read([]byte) (int, Buffer) {
return 0, e return 0, e
} }

View File

@ -220,8 +220,8 @@ type HeaderCallOption struct {
HeaderAddr *metadata.MD HeaderAddr *metadata.MD
} }
func (o HeaderCallOption) before(c *callInfo) error { return nil } func (o HeaderCallOption) before(*callInfo) error { return nil }
func (o HeaderCallOption) after(c *callInfo, attempt *csAttempt) { func (o HeaderCallOption) after(_ *callInfo, attempt *csAttempt) {
*o.HeaderAddr, _ = attempt.s.Header() *o.HeaderAddr, _ = attempt.s.Header()
} }
@ -242,8 +242,8 @@ type TrailerCallOption struct {
TrailerAddr *metadata.MD TrailerAddr *metadata.MD
} }
func (o TrailerCallOption) before(c *callInfo) error { return nil } func (o TrailerCallOption) before(*callInfo) error { return nil }
func (o TrailerCallOption) after(c *callInfo, attempt *csAttempt) { func (o TrailerCallOption) after(_ *callInfo, attempt *csAttempt) {
*o.TrailerAddr = attempt.s.Trailer() *o.TrailerAddr = attempt.s.Trailer()
} }
@ -264,8 +264,8 @@ type PeerCallOption struct {
PeerAddr *peer.Peer PeerAddr *peer.Peer
} }
func (o PeerCallOption) before(c *callInfo) error { return nil } func (o PeerCallOption) before(*callInfo) error { return nil }
func (o PeerCallOption) after(c *callInfo, attempt *csAttempt) { func (o PeerCallOption) after(_ *callInfo, attempt *csAttempt) {
if x, ok := peer.FromContext(attempt.s.Context()); ok { if x, ok := peer.FromContext(attempt.s.Context()); ok {
*o.PeerAddr = *x *o.PeerAddr = *x
} }
@ -304,7 +304,7 @@ func (o FailFastCallOption) before(c *callInfo) error {
c.failFast = o.FailFast c.failFast = o.FailFast
return nil return nil
} }
func (o FailFastCallOption) after(c *callInfo, attempt *csAttempt) {} func (o FailFastCallOption) after(*callInfo, *csAttempt) {}
// OnFinish returns a CallOption that configures a callback to be called when // OnFinish returns a CallOption that configures a callback to be called when
// the call completes. The error passed to the callback is the status of the // the call completes. The error passed to the callback is the status of the
@ -339,7 +339,7 @@ func (o OnFinishCallOption) before(c *callInfo) error {
return nil return nil
} }
func (o OnFinishCallOption) after(c *callInfo, attempt *csAttempt) {} func (o OnFinishCallOption) after(*callInfo, *csAttempt) {}
// MaxCallRecvMsgSize returns a CallOption which sets the maximum message size // MaxCallRecvMsgSize returns a CallOption which sets the maximum message size
// in bytes the client can receive. If this is not set, gRPC uses the default // in bytes the client can receive. If this is not set, gRPC uses the default
@ -363,7 +363,7 @@ func (o MaxRecvMsgSizeCallOption) before(c *callInfo) error {
c.maxReceiveMessageSize = &o.MaxRecvMsgSize c.maxReceiveMessageSize = &o.MaxRecvMsgSize
return nil return nil
} }
func (o MaxRecvMsgSizeCallOption) after(c *callInfo, attempt *csAttempt) {} func (o MaxRecvMsgSizeCallOption) after(*callInfo, *csAttempt) {}
// MaxCallSendMsgSize returns a CallOption which sets the maximum message size // MaxCallSendMsgSize returns a CallOption which sets the maximum message size
// in bytes the client can send. If this is not set, gRPC uses the default // in bytes the client can send. If this is not set, gRPC uses the default
@ -387,7 +387,7 @@ func (o MaxSendMsgSizeCallOption) before(c *callInfo) error {
c.maxSendMessageSize = &o.MaxSendMsgSize c.maxSendMessageSize = &o.MaxSendMsgSize
return nil return nil
} }
func (o MaxSendMsgSizeCallOption) after(c *callInfo, attempt *csAttempt) {} func (o MaxSendMsgSizeCallOption) after(*callInfo, *csAttempt) {}
// PerRPCCredentials returns a CallOption that sets credentials.PerRPCCredentials // PerRPCCredentials returns a CallOption that sets credentials.PerRPCCredentials
// for a call. // for a call.
@ -410,7 +410,7 @@ func (o PerRPCCredsCallOption) before(c *callInfo) error {
c.creds = o.Creds c.creds = o.Creds
return nil return nil
} }
func (o PerRPCCredsCallOption) after(c *callInfo, attempt *csAttempt) {} func (o PerRPCCredsCallOption) after(*callInfo, *csAttempt) {}
// UseCompressor returns a CallOption which sets the compressor used when // UseCompressor returns a CallOption which sets the compressor used when
// sending the request. If WithCompressor is also set, UseCompressor has // sending the request. If WithCompressor is also set, UseCompressor has
@ -438,7 +438,7 @@ func (o CompressorCallOption) before(c *callInfo) error {
c.compressorType = o.CompressorType c.compressorType = o.CompressorType
return nil return nil
} }
func (o CompressorCallOption) after(c *callInfo, attempt *csAttempt) {} func (o CompressorCallOption) after(*callInfo, *csAttempt) {}
// CallContentSubtype returns a CallOption that will set the content-subtype // CallContentSubtype returns a CallOption that will set the content-subtype
// for a call. For example, if content-subtype is "json", the Content-Type over // for a call. For example, if content-subtype is "json", the Content-Type over
@ -475,7 +475,7 @@ func (o ContentSubtypeCallOption) before(c *callInfo) error {
c.contentSubtype = o.ContentSubtype c.contentSubtype = o.ContentSubtype
return nil return nil
} }
func (o ContentSubtypeCallOption) after(c *callInfo, attempt *csAttempt) {} func (o ContentSubtypeCallOption) after(*callInfo, *csAttempt) {}
// ForceCodec returns a CallOption that will set codec to be used for all // 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 // request and response messages for a call. The result of calling Name() will
@ -514,7 +514,7 @@ func (o ForceCodecCallOption) before(c *callInfo) error {
c.codec = newCodecV1Bridge(o.Codec) c.codec = newCodecV1Bridge(o.Codec)
return nil return nil
} }
func (o ForceCodecCallOption) after(c *callInfo, attempt *csAttempt) {} func (o ForceCodecCallOption) after(*callInfo, *csAttempt) {}
// ForceCodecV2 returns a CallOption that will set codec to be used for all // ForceCodecV2 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 // request and response messages for a call. The result of calling Name() will
@ -554,7 +554,7 @@ func (o ForceCodecV2CallOption) before(c *callInfo) error {
return nil return nil
} }
func (o ForceCodecV2CallOption) after(c *callInfo, attempt *csAttempt) {} func (o ForceCodecV2CallOption) after(*callInfo, *csAttempt) {}
// CallCustomCodec behaves like ForceCodec, but accepts a grpc.Codec instead of // CallCustomCodec behaves like ForceCodec, but accepts a grpc.Codec instead of
// an encoding.Codec. // an encoding.Codec.
@ -579,7 +579,7 @@ func (o CustomCodecCallOption) before(c *callInfo) error {
c.codec = newCodecV0Bridge(o.Codec) c.codec = newCodecV0Bridge(o.Codec)
return nil return nil
} }
func (o CustomCodecCallOption) after(c *callInfo, attempt *csAttempt) {} func (o CustomCodecCallOption) after(*callInfo, *csAttempt) {}
// MaxRetryRPCBufferSize returns a CallOption that limits the amount of memory // MaxRetryRPCBufferSize returns a CallOption that limits the amount of memory
// used for buffering this RPC's requests for retry purposes. // used for buffering this RPC's requests for retry purposes.
@ -607,7 +607,7 @@ func (o MaxRetryRPCBufferSizeCallOption) before(c *callInfo) error {
c.maxRetryRPCBufferSize = o.MaxRetryRPCBufferSize c.maxRetryRPCBufferSize = o.MaxRetryRPCBufferSize
return nil return nil
} }
func (o MaxRetryRPCBufferSizeCallOption) after(c *callInfo, attempt *csAttempt) {} func (o MaxRetryRPCBufferSizeCallOption) after(*callInfo, *csAttempt) {}
// The format of the payload: compressed or not? // The format of the payload: compressed or not?
type payloadFormat uint8 type payloadFormat uint8

View File

@ -22,15 +22,35 @@ package grpc
// request, many responses) RPC. It is generic over the type of the response // request, many responses) RPC. It is generic over the type of the response
// message. It is used in generated code. // message. It is used in generated code.
type ServerStreamingClient[Res any] interface { type ServerStreamingClient[Res any] interface {
// Recv receives the next response message from the server. The client may
// repeatedly call Recv to read messages from the response stream. If
// io.EOF is returned, the stream has terminated with an OK status. Any
// other error is compatible with the status package and indicates the
// RPC's status code and message.
Recv() (*Res, error) Recv() (*Res, error)
// ClientStream is embedded to provide Context, Header, and Trailer
// functionality. No other methods in the ClientStream should be called
// directly.
ClientStream ClientStream
} }
// ServerStreamingServer represents the server side of a server-streaming (one // ServerStreamingServer represents the server side of a server-streaming (one
// request, many responses) RPC. It is generic over the type of the response // request, many responses) RPC. It is generic over the type of the response
// message. It is used in generated code. // message. It is used in generated code.
//
// To terminate the response stream, return from the handler method and return
// an error from the status package, or use nil to indicate an OK status code.
type ServerStreamingServer[Res any] interface { type ServerStreamingServer[Res any] interface {
// Send sends a response message to the client. The server handler may
// call Send multiple times to send multiple messages to the client. An
// error is returned if the stream was terminated unexpectedly, and the
// handler method should return, as the stream is no longer usable.
Send(*Res) error Send(*Res) error
// ServerStream is embedded to provide Context, SetHeader, SendHeader, and
// SetTrailer functionality. No other methods in the ServerStream should
// be called directly.
ServerStream ServerStream
} }
@ -39,8 +59,22 @@ type ServerStreamingServer[Res any] interface {
// message stream and the type of the unary response message. It is used in // message stream and the type of the unary response message. It is used in
// generated code. // generated code.
type ClientStreamingClient[Req any, Res any] interface { type ClientStreamingClient[Req any, Res any] interface {
// Send sends a request message to the server. The client may call Send
// multiple times to send multiple messages to the server. On error, Send
// aborts the stream. If the error was generated by the client, the status
// is returned directly. Otherwise, io.EOF is returned, and the status of
// the stream may be discovered using CloseAndRecv().
Send(*Req) error Send(*Req) error
// CloseAndRecv closes the request stream and waits for the server's
// response. This method must be called once and only once after sending
// all request messages. Any error returned is implemented by the status
// package.
CloseAndRecv() (*Res, error) CloseAndRecv() (*Res, error)
// ClientStream is embedded to provide Context, Header, and Trailer
// functionality. No other methods in the ClientStream should be called
// directly.
ClientStream ClientStream
} }
@ -48,9 +82,28 @@ type ClientStreamingClient[Req any, Res any] interface {
// requests, one response) RPC. It is generic over both the type of the request // requests, one response) RPC. It is generic over both the type of the request
// message stream and the type of the unary response message. It is used in // message stream and the type of the unary response message. It is used in
// generated code. // generated code.
//
// To terminate the RPC, call SendAndClose and return nil from the method
// handler or do not call SendAndClose and return an error from the status
// package.
type ClientStreamingServer[Req any, Res any] interface { type ClientStreamingServer[Req any, Res any] interface {
// Recv receives the next request message from the client. The server may
// repeatedly call Recv to read messages from the request stream. If
// io.EOF is returned, it indicates the client called CloseAndRecv on its
// ClientStreamingClient. Any other error indicates the stream was
// terminated unexpectedly, and the handler method should return, as the
// stream is no longer usable.
Recv() (*Req, error) Recv() (*Req, error)
// SendAndClose sends a single response message to the client and closes
// the stream. This method must be called once and only once after all
// request messages have been processed. Recv should not be called after
// calling SendAndClose.
SendAndClose(*Res) error SendAndClose(*Res) error
// ServerStream is embedded to provide Context, SetHeader, SendHeader, and
// SetTrailer functionality. No other methods in the ServerStream should
// be called directly.
ServerStream ServerStream
} }
@ -59,8 +112,23 @@ type ClientStreamingServer[Req any, Res any] interface {
// request message stream and the type of the response message stream. It is // request message stream and the type of the response message stream. It is
// used in generated code. // used in generated code.
type BidiStreamingClient[Req any, Res any] interface { type BidiStreamingClient[Req any, Res any] interface {
// Send sends a request message to the server. The client may call Send
// multiple times to send multiple messages to the server. On error, Send
// aborts the stream. If the error was generated by the client, the status
// is returned directly. Otherwise, io.EOF is returned, and the status of
// the stream may be discovered using Recv().
Send(*Req) error Send(*Req) error
// Recv receives the next response message from the server. The client may
// repeatedly call Recv to read messages from the response stream. If
// io.EOF is returned, the stream has terminated with an OK status. Any
// other error is compatible with the status package and indicates the
// RPC's status code and message.
Recv() (*Res, error) Recv() (*Res, error)
// ClientStream is embedded to provide Context, Header, Trailer, and
// CloseSend functionality. No other methods in the ClientStream should be
// called directly.
ClientStream ClientStream
} }
@ -68,9 +136,27 @@ type BidiStreamingClient[Req any, Res any] interface {
// (many requests, many responses) RPC. It is generic over both the type of the // (many requests, many responses) RPC. It is generic over both the type of the
// request message stream and the type of the response message stream. It is // request message stream and the type of the response message stream. It is
// used in generated code. // used in generated code.
//
// To terminate the stream, return from the handler method and return
// an error from the status package, or use nil to indicate an OK status code.
type BidiStreamingServer[Req any, Res any] interface { type BidiStreamingServer[Req any, Res any] interface {
// Recv receives the next request message from the client. The server may
// repeatedly call Recv to read messages from the request stream. If
// io.EOF is returned, it indicates the client called CloseSend on its
// BidiStreamingClient. Any other error indicates the stream was
// terminated unexpectedly, and the handler method should return, as the
// stream is no longer usable.
Recv() (*Req, error) Recv() (*Req, error)
// Send sends a response message to the client. The server handler may
// call Send multiple times to send multiple messages to the client. An
// error is returned if the stream was terminated unexpectedly, and the
// handler method should return, as the stream is no longer usable.
Send(*Res) error Send(*Res) error
// ServerStream is embedded to provide Context, SetHeader, SendHeader, and
// SetTrailer functionality. No other methods in the ServerStream should
// be called directly.
ServerStream ServerStream
} }

View File

@ -19,4 +19,4 @@
package grpc package grpc
// Version is the current grpc version. // Version is the current grpc version.
const Version = "1.66.2" const Version = "1.67.1"

10
vendor/modules.txt vendored
View File

@ -410,14 +410,14 @@ golang.org/x/text/width
# golang.org/x/time v0.6.0 # golang.org/x/time v0.6.0
## explicit; go 1.18 ## explicit; go 1.18
golang.org/x/time/rate golang.org/x/time/rate
# google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 # google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9
## explicit; go 1.20 ## explicit; go 1.21
google.golang.org/genproto/googleapis/api/httpbody google.golang.org/genproto/googleapis/api/httpbody
# google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 # google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9
## explicit; go 1.20 ## explicit; go 1.21
google.golang.org/genproto/googleapis/rpc/errdetails google.golang.org/genproto/googleapis/rpc/errdetails
google.golang.org/genproto/googleapis/rpc/status google.golang.org/genproto/googleapis/rpc/status
# google.golang.org/grpc v1.66.2 # google.golang.org/grpc v1.67.1
## explicit; go 1.21 ## explicit; go 1.21
google.golang.org/grpc google.golang.org/grpc
google.golang.org/grpc/attributes google.golang.org/grpc/attributes