mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 04:42:25 -05:00
[chore] bump dependencies (#4406)
- codeberg.org/gruf/go-ffmpreg: v0.6.9 -> v0.6.10
- github.com/ncruces/go-sqlite3: v0.27.1 -> v0.28.0
- github.com/stretchr/testify: v1.10.0 -> v1.11.1
- github.com/tdewolff/minify/v2 v2.23.11 -> v2.24.2
- go.opentelemetry.io/otel{,/*}: v1.37.0 -> v1.38.0
- go.opentelemetry.io/contrib/*: v0.62.0 -> v0.63.0
Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4406
Co-authored-by: kim <grufwub@gmail.com>
Co-committed-by: kim <grufwub@gmail.com>
This commit is contained in:
parent
5a54e7156b
commit
78defcd916
274 changed files with 9213 additions and 2368 deletions
8
vendor/google.golang.org/grpc/MAINTAINERS.md
generated
vendored
8
vendor/google.golang.org/grpc/MAINTAINERS.md
generated
vendored
|
|
@ -9,21 +9,19 @@ for general contribution guidelines.
|
|||
|
||||
## Maintainers (in alphabetical order)
|
||||
|
||||
- [aranjans](https://github.com/aranjans), Google LLC
|
||||
- [arjan-bal](https://github.com/arjan-bal), Google LLC
|
||||
- [arvindbr8](https://github.com/arvindbr8), Google LLC
|
||||
- [atollena](https://github.com/atollena), Datadog, Inc.
|
||||
- [dfawley](https://github.com/dfawley), Google LLC
|
||||
- [easwars](https://github.com/easwars), Google LLC
|
||||
- [erm-g](https://github.com/erm-g), Google LLC
|
||||
- [gtcooke94](https://github.com/gtcooke94), Google LLC
|
||||
- [purnesh42h](https://github.com/purnesh42h), Google LLC
|
||||
- [zasweq](https://github.com/zasweq), Google LLC
|
||||
|
||||
## Emeritus Maintainers (in alphabetical order)
|
||||
- [adelez](https://github.com/adelez)
|
||||
- [aranjans](https://github.com/aranjans)
|
||||
- [canguler](https://github.com/canguler)
|
||||
- [cesarghali](https://github.com/cesarghali)
|
||||
- [erm-g](https://github.com/erm-g)
|
||||
- [iamqizhao](https://github.com/iamqizhao)
|
||||
- [jeanbza](https://github.com/jeanbza)
|
||||
- [jtattermusch](https://github.com/jtattermusch)
|
||||
|
|
@ -32,5 +30,7 @@ for general contribution guidelines.
|
|||
- [matt-kwong](https://github.com/matt-kwong)
|
||||
- [menghanl](https://github.com/menghanl)
|
||||
- [nicolasnoble](https://github.com/nicolasnoble)
|
||||
- [purnesh42h](https://github.com/purnesh42h)
|
||||
- [srini100](https://github.com/srini100)
|
||||
- [yongni](https://github.com/yongni)
|
||||
- [zasweq](https://github.com/zasweq)
|
||||
|
|
|
|||
8
vendor/google.golang.org/grpc/balancer/balancer.go
generated
vendored
8
vendor/google.golang.org/grpc/balancer/balancer.go
generated
vendored
|
|
@ -360,6 +360,10 @@ type Balancer interface {
|
|||
// call SubConn.Shutdown for its existing SubConns; however, this will be
|
||||
// required in a future release, so it is recommended.
|
||||
Close()
|
||||
// ExitIdle instructs the LB policy to reconnect to backends / exit the
|
||||
// IDLE state, if appropriate and possible. Note that SubConns that enter
|
||||
// the IDLE state will not reconnect until SubConn.Connect is called.
|
||||
ExitIdle()
|
||||
}
|
||||
|
||||
// ExitIdler is an optional interface for balancers to implement. If
|
||||
|
|
@ -367,8 +371,8 @@ type Balancer interface {
|
|||
// the ClientConn is idle. If unimplemented, ClientConn.Connect will cause
|
||||
// all SubConns to connect.
|
||||
//
|
||||
// Notice: it will be required for all balancers to implement this in a future
|
||||
// release.
|
||||
// Deprecated: All balancers must implement this interface. This interface will
|
||||
// be removed in a future release.
|
||||
type ExitIdler interface {
|
||||
// ExitIdle instructs the LB policy to reconnect to backends / exit the
|
||||
// IDLE state, if appropriate and possible. Note that SubConns that enter
|
||||
|
|
|
|||
57
vendor/google.golang.org/grpc/balancer/endpointsharding/endpointsharding.go
generated
vendored
57
vendor/google.golang.org/grpc/balancer/endpointsharding/endpointsharding.go
generated
vendored
|
|
@ -37,6 +37,8 @@ import (
|
|||
"google.golang.org/grpc/resolver"
|
||||
)
|
||||
|
||||
var randIntN = rand.IntN
|
||||
|
||||
// ChildState is the balancer state of a child along with the endpoint which
|
||||
// identifies the child balancer.
|
||||
type ChildState struct {
|
||||
|
|
@ -45,7 +47,15 @@ type ChildState struct {
|
|||
|
||||
// Balancer exposes only the ExitIdler interface of the child LB policy.
|
||||
// Other methods of the child policy are called only by endpointsharding.
|
||||
Balancer balancer.ExitIdler
|
||||
Balancer ExitIdler
|
||||
}
|
||||
|
||||
// ExitIdler provides access to only the ExitIdle method of the child balancer.
|
||||
type ExitIdler interface {
|
||||
// ExitIdle instructs the LB policy to reconnect to backends / exit the
|
||||
// IDLE state, if appropriate and possible. Note that SubConns that enter
|
||||
// the IDLE state will not reconnect until SubConn.Connect is called.
|
||||
ExitIdle()
|
||||
}
|
||||
|
||||
// Options are the options to configure the behaviour of the
|
||||
|
|
@ -104,6 +114,21 @@ type endpointSharding struct {
|
|||
mu sync.Mutex
|
||||
}
|
||||
|
||||
// rotateEndpoints returns a slice of all the input endpoints rotated a random
|
||||
// amount.
|
||||
func rotateEndpoints(es []resolver.Endpoint) []resolver.Endpoint {
|
||||
les := len(es)
|
||||
if les == 0 {
|
||||
return es
|
||||
}
|
||||
r := randIntN(les)
|
||||
// Make a copy to avoid mutating data beyond the end of es.
|
||||
ret := make([]resolver.Endpoint, les)
|
||||
copy(ret, es[r:])
|
||||
copy(ret[les-r:], es[:r])
|
||||
return ret
|
||||
}
|
||||
|
||||
// UpdateClientConnState creates a child for new endpoints and deletes children
|
||||
// for endpoints that are no longer present. It also updates all the children,
|
||||
// and sends a single synchronous update of the childrens' aggregated state at
|
||||
|
|
@ -125,7 +150,7 @@ func (es *endpointSharding) UpdateClientConnState(state balancer.ClientConnState
|
|||
newChildren := resolver.NewEndpointMap[*balancerWrapper]()
|
||||
|
||||
// Update/Create new children.
|
||||
for _, endpoint := range state.ResolverState.Endpoints {
|
||||
for _, endpoint := range rotateEndpoints(state.ResolverState.Endpoints) {
|
||||
if _, ok := newChildren.Get(endpoint); ok {
|
||||
// Endpoint child was already created, continue to avoid duplicate
|
||||
// update.
|
||||
|
|
@ -205,6 +230,16 @@ func (es *endpointSharding) Close() {
|
|||
}
|
||||
}
|
||||
|
||||
func (es *endpointSharding) ExitIdle() {
|
||||
es.childMu.Lock()
|
||||
defer es.childMu.Unlock()
|
||||
for _, bw := range es.children.Load().Values() {
|
||||
if !bw.isClosed {
|
||||
bw.child.ExitIdle()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// updateState updates this component's state. It sends the aggregated state,
|
||||
// and a picker with round robin behavior with all the child states present if
|
||||
// needed.
|
||||
|
|
@ -261,7 +296,7 @@ func (es *endpointSharding) updateState() {
|
|||
p := &pickerWithChildStates{
|
||||
pickers: pickers,
|
||||
childStates: childStates,
|
||||
next: uint32(rand.IntN(len(pickers))),
|
||||
next: uint32(randIntN(len(pickers))),
|
||||
}
|
||||
es.cc.UpdateState(balancer.State{
|
||||
ConnectivityState: aggState,
|
||||
|
|
@ -326,15 +361,13 @@ func (bw *balancerWrapper) UpdateState(state balancer.State) {
|
|||
// ExitIdle pings an IDLE child balancer to exit idle in a new goroutine to
|
||||
// avoid deadlocks due to synchronous balancer state updates.
|
||||
func (bw *balancerWrapper) ExitIdle() {
|
||||
if ei, ok := bw.child.(balancer.ExitIdler); ok {
|
||||
go func() {
|
||||
bw.es.childMu.Lock()
|
||||
if !bw.isClosed {
|
||||
ei.ExitIdle()
|
||||
}
|
||||
bw.es.childMu.Unlock()
|
||||
}()
|
||||
}
|
||||
go func() {
|
||||
bw.es.childMu.Lock()
|
||||
if !bw.isClosed {
|
||||
bw.child.ExitIdle()
|
||||
}
|
||||
bw.es.childMu.Unlock()
|
||||
}()
|
||||
}
|
||||
|
||||
// updateClientConnStateLocked delivers the ClientConnState to the child
|
||||
|
|
|
|||
33
vendor/google.golang.org/grpc/balancer/pickfirst/pickfirstleaf/pickfirstleaf.go
generated
vendored
33
vendor/google.golang.org/grpc/balancer/pickfirst/pickfirstleaf/pickfirstleaf.go
generated
vendored
|
|
@ -54,18 +54,9 @@ func init() {
|
|||
balancer.Register(pickfirstBuilder{})
|
||||
}
|
||||
|
||||
type (
|
||||
// enableHealthListenerKeyType is a unique key type used in resolver
|
||||
// attributes to indicate whether the health listener usage is enabled.
|
||||
enableHealthListenerKeyType struct{}
|
||||
// managedByPickfirstKeyType is an attribute key type to inform Outlier
|
||||
// Detection that the generic health listener is being used.
|
||||
// TODO: https://github.com/grpc/grpc-go/issues/7915 - Remove this when
|
||||
// implementing the dualstack design. This is a hack. Once Dualstack is
|
||||
// completed, outlier detection will stop sending ejection updates through
|
||||
// the connectivity listener.
|
||||
managedByPickfirstKeyType struct{}
|
||||
)
|
||||
// enableHealthListenerKeyType is a unique key type used in resolver
|
||||
// attributes to indicate whether the health listener usage is enabled.
|
||||
type enableHealthListenerKeyType struct{}
|
||||
|
||||
var (
|
||||
logger = grpclog.Component("pick-first-leaf-lb")
|
||||
|
|
@ -76,21 +67,21 @@ var (
|
|||
disconnectionsMetric = expstats.RegisterInt64Count(expstats.MetricDescriptor{
|
||||
Name: "grpc.lb.pick_first.disconnections",
|
||||
Description: "EXPERIMENTAL. Number of times the selected subchannel becomes disconnected.",
|
||||
Unit: "disconnection",
|
||||
Unit: "{disconnection}",
|
||||
Labels: []string{"grpc.target"},
|
||||
Default: false,
|
||||
})
|
||||
connectionAttemptsSucceededMetric = expstats.RegisterInt64Count(expstats.MetricDescriptor{
|
||||
Name: "grpc.lb.pick_first.connection_attempts_succeeded",
|
||||
Description: "EXPERIMENTAL. Number of successful connection attempts.",
|
||||
Unit: "attempt",
|
||||
Unit: "{attempt}",
|
||||
Labels: []string{"grpc.target"},
|
||||
Default: false,
|
||||
})
|
||||
connectionAttemptsFailedMetric = expstats.RegisterInt64Count(expstats.MetricDescriptor{
|
||||
Name: "grpc.lb.pick_first.connection_attempts_failed",
|
||||
Description: "EXPERIMENTAL. Number of failed connection attempts.",
|
||||
Unit: "attempt",
|
||||
Unit: "{attempt}",
|
||||
Labels: []string{"grpc.target"},
|
||||
Default: false,
|
||||
})
|
||||
|
|
@ -149,17 +140,6 @@ func EnableHealthListener(state resolver.State) resolver.State {
|
|||
return state
|
||||
}
|
||||
|
||||
// IsManagedByPickfirst returns whether an address belongs to a SubConn
|
||||
// managed by the pickfirst LB policy.
|
||||
// TODO: https://github.com/grpc/grpc-go/issues/7915 - This is a hack to disable
|
||||
// outlier_detection via the with connectivity listener when using pick_first.
|
||||
// Once Dualstack changes are complete, all SubConns will be created by
|
||||
// pick_first and outlier detection will only use the health listener for
|
||||
// ejection. This hack can then be removed.
|
||||
func IsManagedByPickfirst(addr resolver.Address) bool {
|
||||
return addr.BalancerAttributes.Value(managedByPickfirstKeyType{}) != nil
|
||||
}
|
||||
|
||||
type pfConfig struct {
|
||||
serviceconfig.LoadBalancingConfig `json:"-"`
|
||||
|
||||
|
|
@ -186,7 +166,6 @@ type scData struct {
|
|||
}
|
||||
|
||||
func (b *pickfirstBalancer) newSCData(addr resolver.Address) (*scData, error) {
|
||||
addr.BalancerAttributes = addr.BalancerAttributes.WithValue(managedByPickfirstKeyType{}, true)
|
||||
sd := &scData{
|
||||
rawConnectivityState: connectivity.Idle,
|
||||
effectiveState: connectivity.Idle,
|
||||
|
|
|
|||
7
vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go
generated
vendored
7
vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go
generated
vendored
|
|
@ -70,10 +70,3 @@ func (b *rrBalancer) UpdateClientConnState(ccs balancer.ClientConnState) error {
|
|||
ResolverState: pickfirstleaf.EnableHealthListener(ccs.ResolverState),
|
||||
})
|
||||
}
|
||||
|
||||
func (b *rrBalancer) ExitIdle() {
|
||||
// Should always be ok, as child is endpoint sharding.
|
||||
if ei, ok := b.Balancer.(balancer.ExitIdler); ok {
|
||||
ei.ExitIdle()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
11
vendor/google.golang.org/grpc/clientconn.go
generated
vendored
11
vendor/google.golang.org/grpc/clientconn.go
generated
vendored
|
|
@ -208,7 +208,7 @@ func NewClient(target string, opts ...DialOption) (conn *ClientConn, err error)
|
|||
channelz.Infof(logger, cc.channelz, "Channel authority set to %q", cc.authority)
|
||||
|
||||
cc.csMgr = newConnectivityStateManager(cc.ctx, cc.channelz)
|
||||
cc.pickerWrapper = newPickerWrapper(cc.dopts.copts.StatsHandlers)
|
||||
cc.pickerWrapper = newPickerWrapper()
|
||||
|
||||
cc.metricsRecorderList = stats.NewMetricsRecorderList(cc.dopts.copts.StatsHandlers)
|
||||
|
||||
|
|
@ -1076,13 +1076,6 @@ func (cc *ClientConn) healthCheckConfig() *healthCheckConfig {
|
|||
return cc.sc.healthCheckConfig
|
||||
}
|
||||
|
||||
func (cc *ClientConn) getTransport(ctx context.Context, failfast bool, method string) (transport.ClientTransport, balancer.PickResult, error) {
|
||||
return cc.pickerWrapper.pick(ctx, failfast, balancer.PickInfo{
|
||||
Ctx: ctx,
|
||||
FullMethodName: method,
|
||||
})
|
||||
}
|
||||
|
||||
func (cc *ClientConn) applyServiceConfigAndBalancer(sc *ServiceConfig, configSelector iresolver.ConfigSelector) {
|
||||
if sc == nil {
|
||||
// should never reach here.
|
||||
|
|
@ -1831,7 +1824,7 @@ func (cc *ClientConn) initAuthority() error {
|
|||
} else if auth, ok := cc.resolverBuilder.(resolver.AuthorityOverrider); ok {
|
||||
cc.authority = auth.OverrideAuthority(cc.parsedTarget)
|
||||
} else if strings.HasPrefix(endpoint, ":") {
|
||||
cc.authority = "localhost" + endpoint
|
||||
cc.authority = "localhost" + encodeAuthority(endpoint)
|
||||
} else {
|
||||
cc.authority = encodeAuthority(endpoint)
|
||||
}
|
||||
|
|
|
|||
25
vendor/google.golang.org/grpc/credentials/credentials.go
generated
vendored
25
vendor/google.golang.org/grpc/credentials/credentials.go
generated
vendored
|
|
@ -96,10 +96,11 @@ func (c CommonAuthInfo) GetCommonAuthInfo() CommonAuthInfo {
|
|||
return c
|
||||
}
|
||||
|
||||
// ProtocolInfo provides information regarding the gRPC wire protocol version,
|
||||
// security protocol, security protocol version in use, server name, etc.
|
||||
// ProtocolInfo provides static information regarding transport credentials.
|
||||
type ProtocolInfo struct {
|
||||
// ProtocolVersion is the gRPC wire protocol version.
|
||||
//
|
||||
// Deprecated: this is unused by gRPC.
|
||||
ProtocolVersion string
|
||||
// SecurityProtocol is the security protocol in use.
|
||||
SecurityProtocol string
|
||||
|
|
@ -109,7 +110,16 @@ type ProtocolInfo struct {
|
|||
//
|
||||
// Deprecated: please use Peer.AuthInfo.
|
||||
SecurityVersion string
|
||||
// ServerName is the user-configured server name.
|
||||
// ServerName is the user-configured server name. If set, this overrides
|
||||
// the default :authority header used for all RPCs on the channel using the
|
||||
// containing credentials, unless grpc.WithAuthority is set on the channel,
|
||||
// in which case that setting will take precedence.
|
||||
//
|
||||
// This must be a valid `:authority` header according to
|
||||
// [RFC3986](https://datatracker.ietf.org/doc/html/rfc3986#section-3.2).
|
||||
//
|
||||
// Deprecated: Users should use grpc.WithAuthority to override the authority
|
||||
// on a channel instead of configuring the credentials.
|
||||
ServerName string
|
||||
}
|
||||
|
||||
|
|
@ -173,12 +183,17 @@ type TransportCredentials interface {
|
|||
// Clone makes a copy of this TransportCredentials.
|
||||
Clone() TransportCredentials
|
||||
// OverrideServerName specifies the value used for the following:
|
||||
//
|
||||
// - verifying the hostname on the returned certificates
|
||||
// - as SNI in the client's handshake to support virtual hosting
|
||||
// - as the value for `:authority` header at stream creation time
|
||||
//
|
||||
// Deprecated: use grpc.WithAuthority instead. Will be supported
|
||||
// throughout 1.x.
|
||||
// The provided string should be a valid `:authority` header according to
|
||||
// [RFC3986](https://datatracker.ietf.org/doc/html/rfc3986#section-3.2).
|
||||
//
|
||||
// Deprecated: this method is unused by gRPC. Users should use
|
||||
// grpc.WithAuthority to override the authority on a channel instead of
|
||||
// configuring the credentials.
|
||||
OverrideServerName(string) error
|
||||
}
|
||||
|
||||
|
|
|
|||
30
vendor/google.golang.org/grpc/credentials/tls.go
generated
vendored
30
vendor/google.golang.org/grpc/credentials/tls.go
generated
vendored
|
|
@ -110,14 +110,14 @@ func (c tlsCreds) Info() ProtocolInfo {
|
|||
func (c *tlsCreds) ClientHandshake(ctx context.Context, authority string, rawConn net.Conn) (_ net.Conn, _ AuthInfo, err error) {
|
||||
// use local cfg to avoid clobbering ServerName if using multiple endpoints
|
||||
cfg := credinternal.CloneTLSConfig(c.config)
|
||||
if cfg.ServerName == "" {
|
||||
serverName, _, err := net.SplitHostPort(authority)
|
||||
if err != nil {
|
||||
// If the authority had no host port or if the authority cannot be parsed, use it as-is.
|
||||
serverName = authority
|
||||
}
|
||||
cfg.ServerName = serverName
|
||||
|
||||
serverName, _, err := net.SplitHostPort(authority)
|
||||
if err != nil {
|
||||
// If the authority had no host port or if the authority cannot be parsed, use it as-is.
|
||||
serverName = authority
|
||||
}
|
||||
cfg.ServerName = serverName
|
||||
|
||||
conn := tls.Client(rawConn, cfg)
|
||||
errChannel := make(chan error, 1)
|
||||
go func() {
|
||||
|
|
@ -259,9 +259,11 @@ func applyDefaults(c *tls.Config) *tls.Config {
|
|||
// certificates to establish the identity of the client need to be included in
|
||||
// the credentials (eg: for mTLS), use NewTLS instead, where a complete
|
||||
// tls.Config can be specified.
|
||||
// serverNameOverride is for testing only. If set to a non empty string,
|
||||
// it will override the virtual host name of authority (e.g. :authority header
|
||||
// field) in requests.
|
||||
//
|
||||
// serverNameOverride is for testing only. If set to a non empty string, it will
|
||||
// override the virtual host name of authority (e.g. :authority header field) in
|
||||
// requests. Users should use grpc.WithAuthority passed to grpc.NewClient to
|
||||
// override the authority of the client instead.
|
||||
func NewClientTLSFromCert(cp *x509.CertPool, serverNameOverride string) TransportCredentials {
|
||||
return NewTLS(&tls.Config{ServerName: serverNameOverride, RootCAs: cp})
|
||||
}
|
||||
|
|
@ -271,9 +273,11 @@ func NewClientTLSFromCert(cp *x509.CertPool, serverNameOverride string) Transpor
|
|||
// certificates to establish the identity of the client need to be included in
|
||||
// the credentials (eg: for mTLS), use NewTLS instead, where a complete
|
||||
// tls.Config can be specified.
|
||||
// serverNameOverride is for testing only. If set to a non empty string,
|
||||
// it will override the virtual host name of authority (e.g. :authority header
|
||||
// field) in requests.
|
||||
//
|
||||
// serverNameOverride is for testing only. If set to a non empty string, it will
|
||||
// override the virtual host name of authority (e.g. :authority header field) in
|
||||
// requests. Users should use grpc.WithAuthority passed to grpc.NewClient to
|
||||
// override the authority of the client instead.
|
||||
func NewClientTLSFromFile(certFile, serverNameOverride string) (TransportCredentials, error) {
|
||||
b, err := os.ReadFile(certFile)
|
||||
if err != nil {
|
||||
|
|
|
|||
23
vendor/google.golang.org/grpc/dialoptions.go
generated
vendored
23
vendor/google.golang.org/grpc/dialoptions.go
generated
vendored
|
|
@ -213,6 +213,7 @@ func WithReadBufferSize(s int) DialOption {
|
|||
func WithInitialWindowSize(s int32) DialOption {
|
||||
return newFuncDialOption(func(o *dialOptions) {
|
||||
o.copts.InitialWindowSize = s
|
||||
o.copts.StaticWindowSize = true
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -222,6 +223,26 @@ func WithInitialWindowSize(s int32) DialOption {
|
|||
func WithInitialConnWindowSize(s int32) DialOption {
|
||||
return newFuncDialOption(func(o *dialOptions) {
|
||||
o.copts.InitialConnWindowSize = s
|
||||
o.copts.StaticWindowSize = true
|
||||
})
|
||||
}
|
||||
|
||||
// WithStaticStreamWindowSize returns a DialOption which sets the initial
|
||||
// stream window size to the value provided and disables dynamic flow control.
|
||||
func WithStaticStreamWindowSize(s int32) DialOption {
|
||||
return newFuncDialOption(func(o *dialOptions) {
|
||||
o.copts.InitialWindowSize = s
|
||||
o.copts.StaticWindowSize = true
|
||||
})
|
||||
}
|
||||
|
||||
// WithStaticConnWindowSize returns a DialOption which sets the initial
|
||||
// connection window size to the value provided and disables dynamic flow
|
||||
// control.
|
||||
func WithStaticConnWindowSize(s int32) DialOption {
|
||||
return newFuncDialOption(func(o *dialOptions) {
|
||||
o.copts.InitialConnWindowSize = s
|
||||
o.copts.StaticWindowSize = true
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -587,6 +608,8 @@ func WithChainStreamInterceptor(interceptors ...StreamClientInterceptor) DialOpt
|
|||
|
||||
// WithAuthority returns a DialOption that specifies the value to be used as the
|
||||
// :authority pseudo-header and as the server name in authentication handshake.
|
||||
// This overrides all other ways of setting authority on the channel, but can be
|
||||
// overridden per-call by using grpc.CallAuthority.
|
||||
func WithAuthority(a string) DialOption {
|
||||
return newFuncDialOption(func(o *dialOptions) {
|
||||
o.authority = a
|
||||
|
|
|
|||
6
vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go
generated
vendored
6
vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go
generated
vendored
|
|
@ -188,13 +188,13 @@ type HealthServer interface {
|
|||
type UnimplementedHealthServer struct{}
|
||||
|
||||
func (UnimplementedHealthServer) Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Check not implemented")
|
||||
return nil, status.Error(codes.Unimplemented, "method Check not implemented")
|
||||
}
|
||||
func (UnimplementedHealthServer) List(context.Context, *HealthListRequest) (*HealthListResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
|
||||
return nil, status.Error(codes.Unimplemented, "method List not implemented")
|
||||
}
|
||||
func (UnimplementedHealthServer) Watch(*HealthCheckRequest, grpc.ServerStreamingServer[HealthCheckResponse]) error {
|
||||
return status.Errorf(codes.Unimplemented, "method Watch not implemented")
|
||||
return status.Error(codes.Unimplemented, "method Watch not implemented")
|
||||
}
|
||||
func (UnimplementedHealthServer) testEmbeddedByValue() {}
|
||||
|
||||
|
|
|
|||
10
vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/gracefulswitch.go
generated
vendored
10
vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/gracefulswitch.go
generated
vendored
|
|
@ -223,15 +223,7 @@ func (gsb *Balancer) ExitIdle() {
|
|||
// There is no need to protect this read with a mutex, as the write to the
|
||||
// Balancer field happens in SwitchTo, which completes before this can be
|
||||
// called.
|
||||
if ei, ok := balToUpdate.Balancer.(balancer.ExitIdler); ok {
|
||||
ei.ExitIdle()
|
||||
return
|
||||
}
|
||||
gsb.mu.Lock()
|
||||
defer gsb.mu.Unlock()
|
||||
for sc := range balToUpdate.subconns {
|
||||
sc.Connect()
|
||||
}
|
||||
balToUpdate.ExitIdle()
|
||||
}
|
||||
|
||||
// updateSubConnState forwards the update to the appropriate child.
|
||||
|
|
|
|||
20
vendor/google.golang.org/grpc/internal/envconfig/envconfig.go
generated
vendored
20
vendor/google.golang.org/grpc/internal/envconfig/envconfig.go
generated
vendored
|
|
@ -26,30 +26,32 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
// TXTErrIgnore is set if TXT errors should be ignored ("GRPC_GO_IGNORE_TXT_ERRORS" is not "false").
|
||||
// EnableTXTServiceConfig is set if the DNS resolver should perform TXT
|
||||
// lookups for service config ("GRPC_ENABLE_TXT_SERVICE_CONFIG" is not
|
||||
// "false").
|
||||
EnableTXTServiceConfig = boolFromEnv("GRPC_ENABLE_TXT_SERVICE_CONFIG", true)
|
||||
|
||||
// TXTErrIgnore is set if TXT errors should be ignored
|
||||
// ("GRPC_GO_IGNORE_TXT_ERRORS" is not "false").
|
||||
TXTErrIgnore = boolFromEnv("GRPC_GO_IGNORE_TXT_ERRORS", true)
|
||||
|
||||
// RingHashCap indicates the maximum ring size which defaults to 4096
|
||||
// entries but may be overridden by setting the environment variable
|
||||
// "GRPC_RING_HASH_CAP". This does not override the default bounds
|
||||
// checking which NACKs configs specifying ring sizes > 8*1024*1024 (~8M).
|
||||
RingHashCap = uint64FromEnv("GRPC_RING_HASH_CAP", 4096, 1, 8*1024*1024)
|
||||
// LeastRequestLB is set if we should support the least_request_experimental
|
||||
// LB policy, which can be enabled by setting the environment variable
|
||||
// "GRPC_EXPERIMENTAL_ENABLE_LEAST_REQUEST" to "true".
|
||||
LeastRequestLB = boolFromEnv("GRPC_EXPERIMENTAL_ENABLE_LEAST_REQUEST", true)
|
||||
|
||||
// ALTSMaxConcurrentHandshakes is the maximum number of concurrent ALTS
|
||||
// handshakes that can be performed.
|
||||
ALTSMaxConcurrentHandshakes = uint64FromEnv("GRPC_ALTS_MAX_CONCURRENT_HANDSHAKES", 100, 1, 100)
|
||||
|
||||
// EnforceALPNEnabled is set if TLS connections to servers with ALPN disabled
|
||||
// should be rejected. The HTTP/2 protocol requires ALPN to be enabled, this
|
||||
// option is present for backward compatibility. This option may be overridden
|
||||
// by setting the environment variable "GRPC_ENFORCE_ALPN_ENABLED" to "true"
|
||||
// or "false".
|
||||
EnforceALPNEnabled = boolFromEnv("GRPC_ENFORCE_ALPN_ENABLED", true)
|
||||
// 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 server in the list of server configs will be used.
|
||||
XDSFallbackSupport = boolFromEnv("GRPC_EXPERIMENTAL_XDS_FALLBACK", true)
|
||||
|
||||
// NewPickFirstEnabled is set if the new pickfirst leaf policy is to be used
|
||||
// instead of the exiting pickfirst implementation. This can be disabled by
|
||||
// setting the environment variable "GRPC_EXPERIMENTAL_ENABLE_NEW_PICK_FIRST"
|
||||
|
|
|
|||
29
vendor/google.golang.org/grpc/internal/internal.go
generated
vendored
29
vendor/google.golang.org/grpc/internal/internal.go
generated
vendored
|
|
@ -182,35 +182,6 @@ var (
|
|||
// other features, including the CSDS service.
|
||||
NewXDSResolverWithClientForTesting any // func(xdsclient.XDSClient) (resolver.Builder, error)
|
||||
|
||||
// RegisterRLSClusterSpecifierPluginForTesting registers the RLS Cluster
|
||||
// Specifier Plugin for testing purposes, regardless of the XDSRLS environment
|
||||
// variable.
|
||||
//
|
||||
// TODO: Remove this function once the RLS env var is removed.
|
||||
RegisterRLSClusterSpecifierPluginForTesting func()
|
||||
|
||||
// UnregisterRLSClusterSpecifierPluginForTesting unregisters the RLS Cluster
|
||||
// Specifier Plugin for testing purposes. This is needed because there is no way
|
||||
// to unregister the RLS Cluster Specifier Plugin after registering it solely
|
||||
// for testing purposes using RegisterRLSClusterSpecifierPluginForTesting().
|
||||
//
|
||||
// TODO: Remove this function once the RLS env var is removed.
|
||||
UnregisterRLSClusterSpecifierPluginForTesting func()
|
||||
|
||||
// RegisterRBACHTTPFilterForTesting registers the RBAC HTTP Filter for testing
|
||||
// purposes, regardless of the RBAC environment variable.
|
||||
//
|
||||
// TODO: Remove this function once the RBAC env var is removed.
|
||||
RegisterRBACHTTPFilterForTesting func()
|
||||
|
||||
// UnregisterRBACHTTPFilterForTesting unregisters the RBAC HTTP Filter for
|
||||
// testing purposes. This is needed because there is no way to unregister the
|
||||
// HTTP Filter after registering it solely for testing purposes using
|
||||
// RegisterRBACHTTPFilterForTesting().
|
||||
//
|
||||
// TODO: Remove this function once the RBAC env var is removed.
|
||||
UnregisterRBACHTTPFilterForTesting func()
|
||||
|
||||
// ORCAAllowAnyMinReportingInterval is for examples/orca use ONLY.
|
||||
ORCAAllowAnyMinReportingInterval any // func(so *orca.ServiceOptions)
|
||||
|
||||
|
|
|
|||
20
vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go
generated
vendored
20
vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go
generated
vendored
|
|
@ -132,13 +132,13 @@ func (b *dnsBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts
|
|||
// DNS address (non-IP).
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
d := &dnsResolver{
|
||||
host: host,
|
||||
port: port,
|
||||
ctx: ctx,
|
||||
cancel: cancel,
|
||||
cc: cc,
|
||||
rn: make(chan struct{}, 1),
|
||||
disableServiceConfig: opts.DisableServiceConfig,
|
||||
host: host,
|
||||
port: port,
|
||||
ctx: ctx,
|
||||
cancel: cancel,
|
||||
cc: cc,
|
||||
rn: make(chan struct{}, 1),
|
||||
enableServiceConfig: envconfig.EnableTXTServiceConfig && !opts.DisableServiceConfig,
|
||||
}
|
||||
|
||||
d.resolver, err = internal.NewNetResolver(target.URL.Host)
|
||||
|
|
@ -181,8 +181,8 @@ type dnsResolver struct {
|
|||
// finishes, race detector sometimes will warn lookup (READ the lookup
|
||||
// function pointers) inside watcher() goroutine has data race with
|
||||
// replaceNetFunc (WRITE the lookup function pointers).
|
||||
wg sync.WaitGroup
|
||||
disableServiceConfig bool
|
||||
wg sync.WaitGroup
|
||||
enableServiceConfig bool
|
||||
}
|
||||
|
||||
// ResolveNow invoke an immediate resolution of the target that this
|
||||
|
|
@ -346,7 +346,7 @@ func (d *dnsResolver) lookup() (*resolver.State, error) {
|
|||
if len(srv) > 0 {
|
||||
state = grpclbstate.Set(state, &grpclbstate.State{BalancerAddresses: srv})
|
||||
}
|
||||
if !d.disableServiceConfig {
|
||||
if d.enableServiceConfig {
|
||||
state.ServiceConfig = d.lookupTXT(ctx)
|
||||
}
|
||||
return &state, nil
|
||||
|
|
|
|||
68
vendor/google.golang.org/grpc/internal/transport/controlbuf.go
generated
vendored
68
vendor/google.golang.org/grpc/internal/transport/controlbuf.go
generated
vendored
|
|
@ -40,6 +40,13 @@ var updateHeaderTblSize = func(e *hpack.Encoder, v uint32) {
|
|||
e.SetMaxDynamicTableSizeLimit(v)
|
||||
}
|
||||
|
||||
// itemNodePool is used to reduce heap allocations.
|
||||
var itemNodePool = sync.Pool{
|
||||
New: func() any {
|
||||
return &itemNode{}
|
||||
},
|
||||
}
|
||||
|
||||
type itemNode struct {
|
||||
it any
|
||||
next *itemNode
|
||||
|
|
@ -51,7 +58,9 @@ type itemList struct {
|
|||
}
|
||||
|
||||
func (il *itemList) enqueue(i any) {
|
||||
n := &itemNode{it: i}
|
||||
n := itemNodePool.Get().(*itemNode)
|
||||
n.next = nil
|
||||
n.it = i
|
||||
if il.tail == nil {
|
||||
il.head, il.tail = n, n
|
||||
return
|
||||
|
|
@ -71,7 +80,9 @@ func (il *itemList) dequeue() any {
|
|||
return nil
|
||||
}
|
||||
i := il.head.it
|
||||
temp := il.head
|
||||
il.head = il.head.next
|
||||
itemNodePool.Put(temp)
|
||||
if il.head == nil {
|
||||
il.tail = nil
|
||||
}
|
||||
|
|
@ -146,10 +157,11 @@ type earlyAbortStream struct {
|
|||
func (*earlyAbortStream) isTransportResponseFrame() bool { return false }
|
||||
|
||||
type dataFrame struct {
|
||||
streamID uint32
|
||||
endStream bool
|
||||
h []byte
|
||||
reader mem.Reader
|
||||
streamID uint32
|
||||
endStream bool
|
||||
h []byte
|
||||
data mem.BufferSlice
|
||||
processing bool
|
||||
// onEachWrite is called every time
|
||||
// a part of data is written out.
|
||||
onEachWrite func()
|
||||
|
|
@ -234,6 +246,7 @@ type outStream struct {
|
|||
itl *itemList
|
||||
bytesOutStanding int
|
||||
wq *writeQuota
|
||||
reader mem.Reader
|
||||
|
||||
next *outStream
|
||||
prev *outStream
|
||||
|
|
@ -461,7 +474,9 @@ func (c *controlBuffer) finish() {
|
|||
v.onOrphaned(ErrConnClosing)
|
||||
}
|
||||
case *dataFrame:
|
||||
_ = v.reader.Close()
|
||||
if !v.processing {
|
||||
v.data.Free()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -650,10 +665,11 @@ func (l *loopyWriter) incomingSettingsHandler(s *incomingSettings) error {
|
|||
|
||||
func (l *loopyWriter) registerStreamHandler(h *registerStream) {
|
||||
str := &outStream{
|
||||
id: h.streamID,
|
||||
state: empty,
|
||||
itl: &itemList{},
|
||||
wq: h.wq,
|
||||
id: h.streamID,
|
||||
state: empty,
|
||||
itl: &itemList{},
|
||||
wq: h.wq,
|
||||
reader: mem.BufferSlice{}.Reader(),
|
||||
}
|
||||
l.estdStreams[h.streamID] = str
|
||||
}
|
||||
|
|
@ -685,10 +701,11 @@ func (l *loopyWriter) headerHandler(h *headerFrame) error {
|
|||
}
|
||||
// Case 2: Client wants to originate stream.
|
||||
str := &outStream{
|
||||
id: h.streamID,
|
||||
state: empty,
|
||||
itl: &itemList{},
|
||||
wq: h.wq,
|
||||
id: h.streamID,
|
||||
state: empty,
|
||||
itl: &itemList{},
|
||||
wq: h.wq,
|
||||
reader: mem.BufferSlice{}.Reader(),
|
||||
}
|
||||
return l.originateStream(str, h)
|
||||
}
|
||||
|
|
@ -790,10 +807,13 @@ func (l *loopyWriter) cleanupStreamHandler(c *cleanupStream) error {
|
|||
// a RST_STREAM before stream initialization thus the stream might
|
||||
// not be established yet.
|
||||
delete(l.estdStreams, c.streamID)
|
||||
str.reader.Close()
|
||||
str.deleteSelf()
|
||||
for head := str.itl.dequeueAll(); head != nil; head = head.next {
|
||||
if df, ok := head.it.(*dataFrame); ok {
|
||||
_ = df.reader.Close()
|
||||
if !df.processing {
|
||||
df.data.Free()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -928,7 +948,13 @@ func (l *loopyWriter) processData() (bool, error) {
|
|||
if str == nil {
|
||||
return true, nil
|
||||
}
|
||||
reader := str.reader
|
||||
dataItem := str.itl.peek().(*dataFrame) // Peek at the first data item this stream.
|
||||
if !dataItem.processing {
|
||||
dataItem.processing = true
|
||||
str.reader.Reset(dataItem.data)
|
||||
dataItem.data.Free()
|
||||
}
|
||||
// A data item is represented by a dataFrame, since it later translates into
|
||||
// multiple HTTP2 data frames.
|
||||
// Every dataFrame has two buffers; h that keeps grpc-message header and data
|
||||
|
|
@ -936,13 +962,13 @@ func (l *loopyWriter) processData() (bool, error) {
|
|||
// from data is copied to h to make as big as the maximum possible HTTP2 frame
|
||||
// size.
|
||||
|
||||
if len(dataItem.h) == 0 && dataItem.reader.Remaining() == 0 { // Empty data frame
|
||||
if len(dataItem.h) == 0 && reader.Remaining() == 0 { // Empty data frame
|
||||
// Client sends out empty data frame with endStream = true
|
||||
if err := l.framer.fr.WriteData(dataItem.streamID, dataItem.endStream, nil); err != nil {
|
||||
return false, err
|
||||
}
|
||||
str.itl.dequeue() // remove the empty data item from stream
|
||||
_ = dataItem.reader.Close()
|
||||
_ = reader.Close()
|
||||
if str.itl.isEmpty() {
|
||||
str.state = empty
|
||||
} else if trailer, ok := str.itl.peek().(*headerFrame); ok { // the next item is trailers.
|
||||
|
|
@ -971,8 +997,8 @@ func (l *loopyWriter) processData() (bool, error) {
|
|||
}
|
||||
// Compute how much of the header and data we can send within quota and max frame length
|
||||
hSize := min(maxSize, len(dataItem.h))
|
||||
dSize := min(maxSize-hSize, dataItem.reader.Remaining())
|
||||
remainingBytes := len(dataItem.h) + dataItem.reader.Remaining() - hSize - dSize
|
||||
dSize := min(maxSize-hSize, reader.Remaining())
|
||||
remainingBytes := len(dataItem.h) + reader.Remaining() - hSize - dSize
|
||||
size := hSize + dSize
|
||||
|
||||
var buf *[]byte
|
||||
|
|
@ -993,7 +1019,7 @@ func (l *loopyWriter) processData() (bool, error) {
|
|||
defer pool.Put(buf)
|
||||
|
||||
copy((*buf)[:hSize], dataItem.h)
|
||||
_, _ = dataItem.reader.Read((*buf)[hSize:])
|
||||
_, _ = reader.Read((*buf)[hSize:])
|
||||
}
|
||||
|
||||
// Now that outgoing flow controls are checked we can replenish str's write quota
|
||||
|
|
@ -1014,7 +1040,7 @@ func (l *loopyWriter) processData() (bool, error) {
|
|||
dataItem.h = dataItem.h[hSize:]
|
||||
|
||||
if remainingBytes == 0 { // All the data from that message was written out.
|
||||
_ = dataItem.reader.Close()
|
||||
_ = reader.Close()
|
||||
str.itl.dequeue()
|
||||
}
|
||||
if str.itl.isEmpty() {
|
||||
|
|
|
|||
20
vendor/google.golang.org/grpc/internal/transport/http2_client.go
generated
vendored
20
vendor/google.golang.org/grpc/internal/transport/http2_client.go
generated
vendored
|
|
@ -309,11 +309,9 @@ func NewHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts
|
|||
scheme = "https"
|
||||
}
|
||||
}
|
||||
dynamicWindow := true
|
||||
icwz := int32(initialWindowSize)
|
||||
if opts.InitialConnWindowSize >= defaultWindowSize {
|
||||
icwz = opts.InitialConnWindowSize
|
||||
dynamicWindow = false
|
||||
}
|
||||
writeBufSize := opts.WriteBufferSize
|
||||
readBufSize := opts.ReadBufferSize
|
||||
|
|
@ -381,9 +379,8 @@ func NewHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts
|
|||
t.controlBuf = newControlBuffer(t.ctxDone)
|
||||
if opts.InitialWindowSize >= defaultWindowSize {
|
||||
t.initialWindowSize = opts.InitialWindowSize
|
||||
dynamicWindow = false
|
||||
}
|
||||
if dynamicWindow {
|
||||
if !opts.StaticWindowSize {
|
||||
t.bdpEst = &bdpEstimator{
|
||||
bdp: initialWindowSize,
|
||||
updateFlowControl: t.updateFlowControl,
|
||||
|
|
@ -1091,32 +1088,29 @@ func (t *http2Client) GracefulClose() {
|
|||
// Write formats the data into HTTP2 data frame(s) and sends it out. The caller
|
||||
// should proceed only if Write returns nil.
|
||||
func (t *http2Client) write(s *ClientStream, hdr []byte, data mem.BufferSlice, opts *WriteOptions) error {
|
||||
reader := data.Reader()
|
||||
|
||||
if opts.Last {
|
||||
// If it's the last message, update stream state.
|
||||
if !s.compareAndSwapState(streamActive, streamWriteDone) {
|
||||
_ = reader.Close()
|
||||
return errStreamDone
|
||||
}
|
||||
} else if s.getState() != streamActive {
|
||||
_ = reader.Close()
|
||||
return errStreamDone
|
||||
}
|
||||
df := &dataFrame{
|
||||
streamID: s.id,
|
||||
endStream: opts.Last,
|
||||
h: hdr,
|
||||
reader: reader,
|
||||
data: data,
|
||||
}
|
||||
if hdr != nil || df.reader.Remaining() != 0 { // If it's not an empty data frame, check quota.
|
||||
if err := s.wq.get(int32(len(hdr) + df.reader.Remaining())); err != nil {
|
||||
_ = reader.Close()
|
||||
dataLen := data.Len()
|
||||
if hdr != nil || dataLen != 0 { // If it's not an empty data frame, check quota.
|
||||
if err := s.wq.get(int32(len(hdr) + dataLen)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
data.Ref()
|
||||
if err := t.controlBuf.put(df); err != nil {
|
||||
_ = reader.Close()
|
||||
data.Free()
|
||||
return err
|
||||
}
|
||||
t.incrMsgSent()
|
||||
|
|
|
|||
44
vendor/google.golang.org/grpc/internal/transport/http2_server.go
generated
vendored
44
vendor/google.golang.org/grpc/internal/transport/http2_server.go
generated
vendored
|
|
@ -132,6 +132,10 @@ type http2Server struct {
|
|||
maxStreamID uint32 // max stream ID ever seen
|
||||
|
||||
logger *grpclog.PrefixLogger
|
||||
// setResetPingStrikes is stored as a closure instead of making this a
|
||||
// method on http2Server to avoid a heap allocation when converting a method
|
||||
// to a closure for passing to frames objects.
|
||||
setResetPingStrikes func()
|
||||
}
|
||||
|
||||
// NewServerTransport creates a http2 transport with conn and configuration
|
||||
|
|
@ -176,16 +180,13 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport,
|
|||
Val: config.MaxStreams,
|
||||
})
|
||||
}
|
||||
dynamicWindow := true
|
||||
iwz := int32(initialWindowSize)
|
||||
if config.InitialWindowSize >= defaultWindowSize {
|
||||
iwz = config.InitialWindowSize
|
||||
dynamicWindow = false
|
||||
}
|
||||
icwz := int32(initialWindowSize)
|
||||
if config.InitialConnWindowSize >= defaultWindowSize {
|
||||
icwz = config.InitialConnWindowSize
|
||||
dynamicWindow = false
|
||||
}
|
||||
if iwz != defaultWindowSize {
|
||||
isettings = append(isettings, http2.Setting{
|
||||
|
|
@ -266,6 +267,9 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport,
|
|||
initialWindowSize: iwz,
|
||||
bufferPool: config.BufferPool,
|
||||
}
|
||||
t.setResetPingStrikes = func() {
|
||||
atomic.StoreUint32(&t.resetPingStrikes, 1)
|
||||
}
|
||||
var czSecurity credentials.ChannelzSecurityValue
|
||||
if au, ok := authInfo.(credentials.ChannelzSecurityInfo); ok {
|
||||
czSecurity = au.GetSecurityValue()
|
||||
|
|
@ -285,7 +289,7 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport,
|
|||
t.logger = prefixLoggerForServerTransport(t)
|
||||
|
||||
t.controlBuf = newControlBuffer(t.done)
|
||||
if dynamicWindow {
|
||||
if !config.StaticWindowSize {
|
||||
t.bdpEst = &bdpEstimator{
|
||||
bdp: initialWindowSize,
|
||||
updateFlowControl: t.updateFlowControl,
|
||||
|
|
@ -596,10 +600,25 @@ func (t *http2Server) operateHeaders(ctx context.Context, frame *http2.MetaHeade
|
|||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
if s.ctx.Err() != nil {
|
||||
t.mu.Unlock()
|
||||
// Early abort in case the timeout was zero or so low it already fired.
|
||||
t.controlBuf.put(&earlyAbortStream{
|
||||
httpStatus: http.StatusOK,
|
||||
streamID: s.id,
|
||||
contentSubtype: s.contentSubtype,
|
||||
status: status.New(codes.DeadlineExceeded, context.DeadlineExceeded.Error()),
|
||||
rst: !frame.StreamEnded(),
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
t.activeStreams[streamID] = s
|
||||
if len(t.activeStreams) == 1 {
|
||||
t.idle = time.Time{}
|
||||
}
|
||||
|
||||
// Start a timer to close the stream on reaching the deadline.
|
||||
if timeoutSet {
|
||||
// We need to wait for s.cancel to be updated before calling
|
||||
|
|
@ -1016,10 +1035,6 @@ func (t *http2Server) writeHeader(s *ServerStream, md metadata.MD) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (t *http2Server) setResetPingStrikes() {
|
||||
atomic.StoreUint32(&t.resetPingStrikes, 1)
|
||||
}
|
||||
|
||||
func (t *http2Server) writeHeaderLocked(s *ServerStream) error {
|
||||
// TODO(mmukhi): Benchmark if the performance gets better if count the metadata and other header fields
|
||||
// first and create a slice of that exact size.
|
||||
|
|
@ -1132,17 +1147,13 @@ func (t *http2Server) writeStatus(s *ServerStream, st *status.Status) 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).
|
||||
func (t *http2Server) write(s *ServerStream, hdr []byte, data mem.BufferSlice, _ *WriteOptions) error {
|
||||
reader := data.Reader()
|
||||
|
||||
if !s.isHeaderSent() { // Headers haven't been written yet.
|
||||
if err := t.writeHeader(s, nil); err != nil {
|
||||
_ = reader.Close()
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
// Writing headers checks for this condition.
|
||||
if s.getState() == streamDone {
|
||||
_ = reader.Close()
|
||||
return t.streamContextErr(s)
|
||||
}
|
||||
}
|
||||
|
|
@ -1150,15 +1161,16 @@ func (t *http2Server) write(s *ServerStream, hdr []byte, data mem.BufferSlice, _
|
|||
df := &dataFrame{
|
||||
streamID: s.id,
|
||||
h: hdr,
|
||||
reader: reader,
|
||||
data: data,
|
||||
onEachWrite: t.setResetPingStrikes,
|
||||
}
|
||||
if err := s.wq.get(int32(len(hdr) + df.reader.Remaining())); err != nil {
|
||||
_ = reader.Close()
|
||||
dataLen := data.Len()
|
||||
if err := s.wq.get(int32(len(hdr) + dataLen)); err != nil {
|
||||
return t.streamContextErr(s)
|
||||
}
|
||||
data.Ref()
|
||||
if err := t.controlBuf.put(df); err != nil {
|
||||
_ = reader.Close()
|
||||
data.Free()
|
||||
return err
|
||||
}
|
||||
t.incrMsgSent()
|
||||
|
|
|
|||
3
vendor/google.golang.org/grpc/internal/transport/http_util.go
generated
vendored
3
vendor/google.golang.org/grpc/internal/transport/http_util.go
generated
vendored
|
|
@ -200,9 +200,6 @@ func decodeTimeout(s string) (time.Duration, error) {
|
|||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if t == 0 {
|
||||
return 0, fmt.Errorf("transport: timeout must be positive: %q", s)
|
||||
}
|
||||
const maxHours = math.MaxInt64 / uint64(time.Hour)
|
||||
if d == time.Hour && t > maxHours {
|
||||
// This timeout would overflow math.MaxInt64; clamp it.
|
||||
|
|
|
|||
3
vendor/google.golang.org/grpc/internal/transport/transport.go
generated
vendored
3
vendor/google.golang.org/grpc/internal/transport/transport.go
generated
vendored
|
|
@ -466,6 +466,7 @@ type ServerConfig struct {
|
|||
MaxHeaderListSize *uint32
|
||||
HeaderTableSize *uint32
|
||||
BufferPool mem.BufferPool
|
||||
StaticWindowSize bool
|
||||
}
|
||||
|
||||
// ConnectOptions covers all relevant options for communicating with the server.
|
||||
|
|
@ -504,6 +505,8 @@ type ConnectOptions struct {
|
|||
MaxHeaderListSize *uint32
|
||||
// The mem.BufferPool to use when reading/writing to the wire.
|
||||
BufferPool mem.BufferPool
|
||||
// StaticWindowSize controls whether dynamic window sizing is enabled.
|
||||
StaticWindowSize bool
|
||||
}
|
||||
|
||||
// WriteOptions provides additional hints and information for message
|
||||
|
|
|
|||
11
vendor/google.golang.org/grpc/mem/buffer_slice.go
generated
vendored
11
vendor/google.golang.org/grpc/mem/buffer_slice.go
generated
vendored
|
|
@ -137,6 +137,9 @@ type Reader interface {
|
|||
Close() error
|
||||
// Remaining returns the number of unread bytes remaining in the slice.
|
||||
Remaining() int
|
||||
// Reset frees the currently held buffer slice and starts reading from the
|
||||
// provided slice. This allows reusing the reader object.
|
||||
Reset(s BufferSlice)
|
||||
}
|
||||
|
||||
type sliceReader struct {
|
||||
|
|
@ -150,6 +153,14 @@ func (r *sliceReader) Remaining() int {
|
|||
return r.len
|
||||
}
|
||||
|
||||
func (r *sliceReader) Reset(s BufferSlice) {
|
||||
r.data.Free()
|
||||
s.Ref()
|
||||
r.data = s
|
||||
r.len = s.Len()
|
||||
r.bufferIdx = 0
|
||||
}
|
||||
|
||||
func (r *sliceReader) Close() error {
|
||||
r.data.Free()
|
||||
r.data = nil
|
||||
|
|
|
|||
36
vendor/google.golang.org/grpc/picker_wrapper.go
generated
vendored
36
vendor/google.golang.org/grpc/picker_wrapper.go
generated
vendored
|
|
@ -29,7 +29,6 @@ import (
|
|||
"google.golang.org/grpc/internal/channelz"
|
||||
istatus "google.golang.org/grpc/internal/status"
|
||||
"google.golang.org/grpc/internal/transport"
|
||||
"google.golang.org/grpc/stats"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
|
|
@ -48,14 +47,11 @@ type pickerGeneration struct {
|
|||
// actions and unblock when there's a picker update.
|
||||
type pickerWrapper struct {
|
||||
// If pickerGen holds a nil pointer, the pickerWrapper is closed.
|
||||
pickerGen atomic.Pointer[pickerGeneration]
|
||||
statsHandlers []stats.Handler // to record blocking picker calls
|
||||
pickerGen atomic.Pointer[pickerGeneration]
|
||||
}
|
||||
|
||||
func newPickerWrapper(statsHandlers []stats.Handler) *pickerWrapper {
|
||||
pw := &pickerWrapper{
|
||||
statsHandlers: statsHandlers,
|
||||
}
|
||||
func newPickerWrapper() *pickerWrapper {
|
||||
pw := &pickerWrapper{}
|
||||
pw.pickerGen.Store(&pickerGeneration{
|
||||
blockingCh: make(chan struct{}),
|
||||
})
|
||||
|
|
@ -93,6 +89,12 @@ func doneChannelzWrapper(acbw *acBalancerWrapper, result *balancer.PickResult) {
|
|||
}
|
||||
}
|
||||
|
||||
type pick struct {
|
||||
transport transport.ClientTransport // the selected transport
|
||||
result balancer.PickResult // the contents of the pick from the LB policy
|
||||
blocked bool // set if a picker call queued for a new picker
|
||||
}
|
||||
|
||||
// pick returns the transport that will be used for the RPC.
|
||||
// It may block in the following cases:
|
||||
// - there's no picker
|
||||
|
|
@ -100,15 +102,16 @@ func doneChannelzWrapper(acbw *acBalancerWrapper, result *balancer.PickResult) {
|
|||
// - the current picker returns other errors and failfast is false.
|
||||
// - the subConn returned by the current picker is not READY
|
||||
// When one of these situations happens, pick blocks until the picker gets updated.
|
||||
func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer.PickInfo) (transport.ClientTransport, balancer.PickResult, error) {
|
||||
func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer.PickInfo) (pick, error) {
|
||||
var ch chan struct{}
|
||||
|
||||
var lastPickErr error
|
||||
pickBlocked := false
|
||||
|
||||
for {
|
||||
pg := pw.pickerGen.Load()
|
||||
if pg == nil {
|
||||
return nil, balancer.PickResult{}, ErrClientConnClosing
|
||||
return pick{}, ErrClientConnClosing
|
||||
}
|
||||
if pg.picker == nil {
|
||||
ch = pg.blockingCh
|
||||
|
|
@ -127,9 +130,9 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer.
|
|||
}
|
||||
switch ctx.Err() {
|
||||
case context.DeadlineExceeded:
|
||||
return nil, balancer.PickResult{}, status.Error(codes.DeadlineExceeded, errStr)
|
||||
return pick{}, status.Error(codes.DeadlineExceeded, errStr)
|
||||
case context.Canceled:
|
||||
return nil, balancer.PickResult{}, status.Error(codes.Canceled, errStr)
|
||||
return pick{}, status.Error(codes.Canceled, errStr)
|
||||
}
|
||||
case <-ch:
|
||||
}
|
||||
|
|
@ -145,9 +148,7 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer.
|
|||
// In the second case, the only way it will get to this conditional is
|
||||
// if there is a new picker.
|
||||
if ch != nil {
|
||||
for _, sh := range pw.statsHandlers {
|
||||
sh.HandleRPC(ctx, &stats.PickerUpdated{})
|
||||
}
|
||||
pickBlocked = true
|
||||
}
|
||||
|
||||
ch = pg.blockingCh
|
||||
|
|
@ -164,7 +165,7 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer.
|
|||
if istatus.IsRestrictedControlPlaneCode(st) {
|
||||
err = status.Errorf(codes.Internal, "received picker error with illegal status: %v", err)
|
||||
}
|
||||
return nil, balancer.PickResult{}, dropError{error: err}
|
||||
return pick{}, dropError{error: err}
|
||||
}
|
||||
// For all other errors, wait for ready RPCs should block and other
|
||||
// RPCs should fail with unavailable.
|
||||
|
|
@ -172,7 +173,7 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer.
|
|||
lastPickErr = err
|
||||
continue
|
||||
}
|
||||
return nil, balancer.PickResult{}, status.Error(codes.Unavailable, err.Error())
|
||||
return pick{}, status.Error(codes.Unavailable, err.Error())
|
||||
}
|
||||
|
||||
acbw, ok := pickResult.SubConn.(*acBalancerWrapper)
|
||||
|
|
@ -183,9 +184,8 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer.
|
|||
if t := acbw.ac.getReadyTransport(); t != nil {
|
||||
if channelz.IsOn() {
|
||||
doneChannelzWrapper(acbw, &pickResult)
|
||||
return t, pickResult, nil
|
||||
}
|
||||
return t, pickResult, nil
|
||||
return pick{transport: t, result: pickResult, blocked: pickBlocked}, nil
|
||||
}
|
||||
if pickResult.Done != nil {
|
||||
// Calling done with nil error, no bytes sent and no bytes received.
|
||||
|
|
|
|||
5
vendor/google.golang.org/grpc/resolver/resolver.go
generated
vendored
5
vendor/google.golang.org/grpc/resolver/resolver.go
generated
vendored
|
|
@ -332,6 +332,11 @@ type AuthorityOverrider interface {
|
|||
// OverrideAuthority returns the authority to use for a ClientConn with the
|
||||
// given target. The implementation must generate it without blocking,
|
||||
// typically in line, and must keep it unchanged.
|
||||
//
|
||||
// The returned string must be a valid ":authority" header value, i.e. be
|
||||
// encoded according to
|
||||
// [RFC3986](https://datatracker.ietf.org/doc/html/rfc3986#section-3.2) as
|
||||
// necessary.
|
||||
OverrideAuthority(Target) string
|
||||
}
|
||||
|
||||
|
|
|
|||
27
vendor/google.golang.org/grpc/server.go
generated
vendored
27
vendor/google.golang.org/grpc/server.go
generated
vendored
|
|
@ -179,6 +179,7 @@ type serverOptions struct {
|
|||
numServerWorkers uint32
|
||||
bufferPool mem.BufferPool
|
||||
waitForHandlers bool
|
||||
staticWindowSize bool
|
||||
}
|
||||
|
||||
var defaultServerOptions = serverOptions{
|
||||
|
|
@ -279,6 +280,7 @@ func ReadBufferSize(s int) ServerOption {
|
|||
func InitialWindowSize(s int32) ServerOption {
|
||||
return newFuncServerOption(func(o *serverOptions) {
|
||||
o.initialWindowSize = s
|
||||
o.staticWindowSize = true
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -287,6 +289,29 @@ func InitialWindowSize(s int32) ServerOption {
|
|||
func InitialConnWindowSize(s int32) ServerOption {
|
||||
return newFuncServerOption(func(o *serverOptions) {
|
||||
o.initialConnWindowSize = s
|
||||
o.staticWindowSize = true
|
||||
})
|
||||
}
|
||||
|
||||
// StaticStreamWindowSize returns a ServerOption to set the initial stream
|
||||
// window size to the value provided and disables dynamic flow control.
|
||||
// The lower bound for window size is 64K and any value smaller than that
|
||||
// will be ignored.
|
||||
func StaticStreamWindowSize(s int32) ServerOption {
|
||||
return newFuncServerOption(func(o *serverOptions) {
|
||||
o.initialWindowSize = s
|
||||
o.staticWindowSize = true
|
||||
})
|
||||
}
|
||||
|
||||
// StaticConnWindowSize returns a ServerOption to set the initial connection
|
||||
// window size to the value provided and disables dynamic flow control.
|
||||
// The lower bound for window size is 64K and any value smaller than that
|
||||
// will be ignored.
|
||||
func StaticConnWindowSize(s int32) ServerOption {
|
||||
return newFuncServerOption(func(o *serverOptions) {
|
||||
o.initialConnWindowSize = s
|
||||
o.staticWindowSize = true
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -986,6 +1011,7 @@ func (s *Server) newHTTP2Transport(c net.Conn) transport.ServerTransport {
|
|||
MaxHeaderListSize: s.opts.maxHeaderListSize,
|
||||
HeaderTableSize: s.opts.headerTableSize,
|
||||
BufferPool: s.opts.bufferPool,
|
||||
StaticWindowSize: s.opts.staticWindowSize,
|
||||
}
|
||||
st, err := transport.NewServerTransport(c, config)
|
||||
if err != nil {
|
||||
|
|
@ -1572,6 +1598,7 @@ func (s *Server) processStreamingRPC(ctx context.Context, stream *transport.Serv
|
|||
s: stream,
|
||||
p: &parser{r: stream, bufferPool: s.opts.bufferPool},
|
||||
codec: s.getCodec(stream.ContentSubtype()),
|
||||
desc: sd,
|
||||
maxReceiveMessageSize: s.opts.maxReceiveMessageSize,
|
||||
maxSendMessageSize: s.opts.maxSendMessageSize,
|
||||
trInfo: trInfo,
|
||||
|
|
|
|||
20
vendor/google.golang.org/grpc/stats/stats.go
generated
vendored
20
vendor/google.golang.org/grpc/stats/stats.go
generated
vendored
|
|
@ -64,15 +64,21 @@ func (s *Begin) IsClient() bool { return s.Client }
|
|||
|
||||
func (s *Begin) isRPCStats() {}
|
||||
|
||||
// PickerUpdated indicates that the LB policy provided a new picker while the
|
||||
// RPC was waiting for one.
|
||||
type PickerUpdated struct{}
|
||||
// DelayedPickComplete indicates that the RPC is unblocked following a delay in
|
||||
// selecting a connection for the call.
|
||||
type DelayedPickComplete struct{}
|
||||
|
||||
// IsClient indicates if the stats information is from client side. Only Client
|
||||
// Side interfaces with a Picker, thus always returns true.
|
||||
func (*PickerUpdated) IsClient() bool { return true }
|
||||
// IsClient indicates DelayedPickComplete is available on the client.
|
||||
func (*DelayedPickComplete) IsClient() bool { return true }
|
||||
|
||||
func (*PickerUpdated) isRPCStats() {}
|
||||
func (*DelayedPickComplete) isRPCStats() {}
|
||||
|
||||
// PickerUpdated indicates that the RPC is unblocked following a delay in
|
||||
// selecting a connection for the call.
|
||||
//
|
||||
// Deprecated: will be removed in a future release; use DelayedPickComplete
|
||||
// instead.
|
||||
type PickerUpdated = DelayedPickComplete
|
||||
|
||||
// InPayload contains stats about an incoming payload.
|
||||
type InPayload struct {
|
||||
|
|
|
|||
36
vendor/google.golang.org/grpc/stream.go
generated
vendored
36
vendor/google.golang.org/grpc/stream.go
generated
vendored
|
|
@ -469,8 +469,9 @@ func (cs *clientStream) newAttemptLocked(isTransparent bool) (*csAttempt, error)
|
|||
func (a *csAttempt) getTransport() error {
|
||||
cs := a.cs
|
||||
|
||||
var err error
|
||||
a.transport, a.pickResult, err = cs.cc.getTransport(a.ctx, cs.callInfo.failFast, cs.callHdr.Method)
|
||||
pickInfo := balancer.PickInfo{Ctx: a.ctx, FullMethodName: cs.callHdr.Method}
|
||||
pick, err := cs.cc.pickerWrapper.pick(a.ctx, cs.callInfo.failFast, pickInfo)
|
||||
a.transport, a.pickResult = pick.transport, pick.result
|
||||
if err != nil {
|
||||
if de, ok := err.(dropError); ok {
|
||||
err = de.error
|
||||
|
|
@ -481,6 +482,11 @@ func (a *csAttempt) getTransport() error {
|
|||
if a.trInfo != nil {
|
||||
a.trInfo.firstLine.SetRemoteAddr(a.transport.RemoteAddr())
|
||||
}
|
||||
if pick.blocked {
|
||||
for _, sh := range a.statsHandlers {
|
||||
sh.HandleRPC(a.ctx, &stats.DelayedPickComplete{})
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -1171,7 +1177,7 @@ func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) {
|
|||
} else if err != nil {
|
||||
return toRPCErr(err)
|
||||
}
|
||||
return toRPCErr(errors.New("grpc: client streaming protocol violation: get <nil>, want <EOF>"))
|
||||
return status.Errorf(codes.Internal, "cardinality violation: expected <EOF> for non server-streaming RPCs, but received another message")
|
||||
}
|
||||
|
||||
func (a *csAttempt) finish(err error) {
|
||||
|
|
@ -1495,7 +1501,7 @@ func (as *addrConnStream) RecvMsg(m any) (err error) {
|
|||
} else if err != nil {
|
||||
return toRPCErr(err)
|
||||
}
|
||||
return toRPCErr(errors.New("grpc: client streaming protocol violation: get <nil>, want <EOF>"))
|
||||
return status.Errorf(codes.Internal, "cardinality violation: expected <EOF> for non server-streaming RPCs, but received another message")
|
||||
}
|
||||
|
||||
func (as *addrConnStream) finish(err error) {
|
||||
|
|
@ -1580,6 +1586,7 @@ type serverStream struct {
|
|||
s *transport.ServerStream
|
||||
p *parser
|
||||
codec baseCodec
|
||||
desc *StreamDesc
|
||||
|
||||
compressorV0 Compressor
|
||||
compressorV1 encoding.Compressor
|
||||
|
|
@ -1588,6 +1595,8 @@ type serverStream struct {
|
|||
|
||||
sendCompressorName string
|
||||
|
||||
recvFirstMsg bool // set after the first message is received
|
||||
|
||||
maxReceiveMessageSize int
|
||||
maxSendMessageSize int
|
||||
trInfo *traceInfo
|
||||
|
|
@ -1774,6 +1783,10 @@ func (ss *serverStream) RecvMsg(m any) (err error) {
|
|||
binlog.Log(ss.ctx, chc)
|
||||
}
|
||||
}
|
||||
// Received no request msg for non-client streaming rpcs.
|
||||
if !ss.desc.ClientStreams && !ss.recvFirstMsg {
|
||||
return status.Error(codes.Internal, "cardinality violation: received no request message from non-client-streaming RPC")
|
||||
}
|
||||
return err
|
||||
}
|
||||
if err == io.ErrUnexpectedEOF {
|
||||
|
|
@ -1781,6 +1794,7 @@ func (ss *serverStream) RecvMsg(m any) (err error) {
|
|||
}
|
||||
return toRPCErr(err)
|
||||
}
|
||||
ss.recvFirstMsg = true
|
||||
if len(ss.statsHandler) != 0 {
|
||||
for _, sh := range ss.statsHandler {
|
||||
sh.HandleRPC(ss.s.Context(), &stats.InPayload{
|
||||
|
|
@ -1800,7 +1814,19 @@ func (ss *serverStream) RecvMsg(m any) (err error) {
|
|||
binlog.Log(ss.ctx, cm)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
if ss.desc.ClientStreams {
|
||||
// Subsequent messages should be received by subsequent RecvMsg calls.
|
||||
return nil
|
||||
}
|
||||
// Special handling for non-client-stream rpcs.
|
||||
// This recv expects EOF or errors, so we don't collect inPayload.
|
||||
if err := recv(ss.p, ss.codec, ss.s, ss.decompressorV0, m, ss.maxReceiveMessageSize, nil, ss.decompressorV1, true); err == io.EOF {
|
||||
return nil
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
return status.Error(codes.Internal, "cardinality violation: received multiple request messages for non-client-streaming RPC")
|
||||
}
|
||||
|
||||
// MethodFromServerStream returns the method string for the input stream.
|
||||
|
|
|
|||
2
vendor/google.golang.org/grpc/version.go
generated
vendored
2
vendor/google.golang.org/grpc/version.go
generated
vendored
|
|
@ -19,4 +19,4 @@
|
|||
package grpc
|
||||
|
||||
// Version is the current grpc version.
|
||||
const Version = "1.73.0"
|
||||
const Version = "1.75.0"
|
||||
|
|
|
|||
26
vendor/google.golang.org/protobuf/encoding/protowire/wire.go
generated
vendored
26
vendor/google.golang.org/protobuf/encoding/protowire/wire.go
generated
vendored
|
|
@ -371,7 +371,31 @@ func ConsumeVarint(b []byte) (v uint64, n int) {
|
|||
func SizeVarint(v uint64) int {
|
||||
// This computes 1 + (bits.Len64(v)-1)/7.
|
||||
// 9/64 is a good enough approximation of 1/7
|
||||
return int(9*uint32(bits.Len64(v))+64) / 64
|
||||
//
|
||||
// The Go compiler can translate the bits.LeadingZeros64 call into the LZCNT
|
||||
// instruction, which is very fast on CPUs from the last few years. The
|
||||
// specific way of expressing the calculation matches C++ Protobuf, see
|
||||
// https://godbolt.org/z/4P3h53oM4 for the C++ code and how gcc/clang
|
||||
// optimize that function for GOAMD64=v1 and GOAMD64=v3 (-march=haswell).
|
||||
|
||||
// By OR'ing v with 1, we guarantee that v is never 0, without changing the
|
||||
// result of SizeVarint. LZCNT is not defined for 0, meaning the compiler
|
||||
// needs to add extra instructions to handle that case.
|
||||
//
|
||||
// The Go compiler currently (go1.24.4) does not make use of this knowledge.
|
||||
// This opportunity (removing the XOR instruction, which handles the 0 case)
|
||||
// results in a small (1%) performance win across CPU architectures.
|
||||
//
|
||||
// Independently of avoiding the 0 case, we need the v |= 1 line because
|
||||
// it allows the Go compiler to eliminate an extra XCHGL barrier.
|
||||
v |= 1
|
||||
|
||||
// It would be clearer to write log2value := 63 - uint32(...), but
|
||||
// writing uint32(...) ^ 63 is much more efficient (-14% ARM, -20% Intel).
|
||||
// Proof of identity for our value range [0..63]:
|
||||
// https://go.dev/play/p/Pdn9hEWYakX
|
||||
log2value := uint32(bits.LeadingZeros64(v)) ^ 63
|
||||
return int((log2value*9 + (64 + 9)) / 64)
|
||||
}
|
||||
|
||||
// AppendFixed32 appends v to b as a little-endian uint32.
|
||||
|
|
|
|||
BIN
vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb
generated
vendored
BIN
vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb
generated
vendored
Binary file not shown.
3
vendor/google.golang.org/protobuf/internal/filedesc/editions.go
generated
vendored
3
vendor/google.golang.org/protobuf/internal/filedesc/editions.go
generated
vendored
|
|
@ -72,6 +72,9 @@ func unmarshalFeatureSet(b []byte, parent EditionFeatures) EditionFeatures {
|
|||
case genid.FeatureSet_EnforceNamingStyle_field_number:
|
||||
// EnforceNamingStyle is enforced in protoc, languages other than C++
|
||||
// are not supposed to do anything with this feature.
|
||||
case genid.FeatureSet_DefaultSymbolVisibility_field_number:
|
||||
// DefaultSymbolVisibility is enforced in protoc, runtimes should not
|
||||
// inspect this value.
|
||||
default:
|
||||
panic(fmt.Sprintf("unkown field number %d while unmarshalling FeatureSet", num))
|
||||
}
|
||||
|
|
|
|||
33
vendor/google.golang.org/protobuf/internal/filedesc/presence.go
generated
vendored
Normal file
33
vendor/google.golang.org/protobuf/internal/filedesc/presence.go
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright 2025 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package filedesc
|
||||
|
||||
import "google.golang.org/protobuf/reflect/protoreflect"
|
||||
|
||||
// UsePresenceForField reports whether the presence bitmap should be used for
|
||||
// the specified field.
|
||||
func UsePresenceForField(fd protoreflect.FieldDescriptor) (usePresence, canBeLazy bool) {
|
||||
switch {
|
||||
case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic():
|
||||
// Oneof fields never use the presence bitmap.
|
||||
//
|
||||
// Synthetic oneofs are an exception: Those are used to implement proto3
|
||||
// optional fields and hence should follow non-oneof field semantics.
|
||||
return false, false
|
||||
|
||||
case fd.IsMap():
|
||||
// Map-typed fields never use the presence bitmap.
|
||||
return false, false
|
||||
|
||||
case fd.Kind() == protoreflect.MessageKind || fd.Kind() == protoreflect.GroupKind:
|
||||
// Lazy fields always use the presence bitmap (only messages can be lazy).
|
||||
isLazy := fd.(interface{ IsLazy() bool }).IsLazy()
|
||||
return isLazy, isLazy
|
||||
|
||||
default:
|
||||
// If the field has presence, use the presence bitmap.
|
||||
return fd.HasPresence(), false
|
||||
}
|
||||
}
|
||||
6
vendor/google.golang.org/protobuf/internal/genid/api_gen.go
generated
vendored
6
vendor/google.golang.org/protobuf/internal/genid/api_gen.go
generated
vendored
|
|
@ -27,6 +27,7 @@ const (
|
|||
Api_SourceContext_field_name protoreflect.Name = "source_context"
|
||||
Api_Mixins_field_name protoreflect.Name = "mixins"
|
||||
Api_Syntax_field_name protoreflect.Name = "syntax"
|
||||
Api_Edition_field_name protoreflect.Name = "edition"
|
||||
|
||||
Api_Name_field_fullname protoreflect.FullName = "google.protobuf.Api.name"
|
||||
Api_Methods_field_fullname protoreflect.FullName = "google.protobuf.Api.methods"
|
||||
|
|
@ -35,6 +36,7 @@ const (
|
|||
Api_SourceContext_field_fullname protoreflect.FullName = "google.protobuf.Api.source_context"
|
||||
Api_Mixins_field_fullname protoreflect.FullName = "google.protobuf.Api.mixins"
|
||||
Api_Syntax_field_fullname protoreflect.FullName = "google.protobuf.Api.syntax"
|
||||
Api_Edition_field_fullname protoreflect.FullName = "google.protobuf.Api.edition"
|
||||
)
|
||||
|
||||
// Field numbers for google.protobuf.Api.
|
||||
|
|
@ -46,6 +48,7 @@ const (
|
|||
Api_SourceContext_field_number protoreflect.FieldNumber = 5
|
||||
Api_Mixins_field_number protoreflect.FieldNumber = 6
|
||||
Api_Syntax_field_number protoreflect.FieldNumber = 7
|
||||
Api_Edition_field_number protoreflect.FieldNumber = 8
|
||||
)
|
||||
|
||||
// Names for google.protobuf.Method.
|
||||
|
|
@ -63,6 +66,7 @@ const (
|
|||
Method_ResponseStreaming_field_name protoreflect.Name = "response_streaming"
|
||||
Method_Options_field_name protoreflect.Name = "options"
|
||||
Method_Syntax_field_name protoreflect.Name = "syntax"
|
||||
Method_Edition_field_name protoreflect.Name = "edition"
|
||||
|
||||
Method_Name_field_fullname protoreflect.FullName = "google.protobuf.Method.name"
|
||||
Method_RequestTypeUrl_field_fullname protoreflect.FullName = "google.protobuf.Method.request_type_url"
|
||||
|
|
@ -71,6 +75,7 @@ const (
|
|||
Method_ResponseStreaming_field_fullname protoreflect.FullName = "google.protobuf.Method.response_streaming"
|
||||
Method_Options_field_fullname protoreflect.FullName = "google.protobuf.Method.options"
|
||||
Method_Syntax_field_fullname protoreflect.FullName = "google.protobuf.Method.syntax"
|
||||
Method_Edition_field_fullname protoreflect.FullName = "google.protobuf.Method.edition"
|
||||
)
|
||||
|
||||
// Field numbers for google.protobuf.Method.
|
||||
|
|
@ -82,6 +87,7 @@ const (
|
|||
Method_ResponseStreaming_field_number protoreflect.FieldNumber = 5
|
||||
Method_Options_field_number protoreflect.FieldNumber = 6
|
||||
Method_Syntax_field_number protoreflect.FieldNumber = 7
|
||||
Method_Edition_field_number protoreflect.FieldNumber = 8
|
||||
)
|
||||
|
||||
// Names for google.protobuf.Mixin.
|
||||
|
|
|
|||
88
vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go
generated
vendored
88
vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go
generated
vendored
|
|
@ -34,6 +34,19 @@ const (
|
|||
Edition_EDITION_MAX_enum_value = 2147483647
|
||||
)
|
||||
|
||||
// Full and short names for google.protobuf.SymbolVisibility.
|
||||
const (
|
||||
SymbolVisibility_enum_fullname = "google.protobuf.SymbolVisibility"
|
||||
SymbolVisibility_enum_name = "SymbolVisibility"
|
||||
)
|
||||
|
||||
// Enum values for google.protobuf.SymbolVisibility.
|
||||
const (
|
||||
SymbolVisibility_VISIBILITY_UNSET_enum_value = 0
|
||||
SymbolVisibility_VISIBILITY_LOCAL_enum_value = 1
|
||||
SymbolVisibility_VISIBILITY_EXPORT_enum_value = 2
|
||||
)
|
||||
|
||||
// Names for google.protobuf.FileDescriptorSet.
|
||||
const (
|
||||
FileDescriptorSet_message_name protoreflect.Name = "FileDescriptorSet"
|
||||
|
|
@ -65,6 +78,7 @@ const (
|
|||
FileDescriptorProto_Dependency_field_name protoreflect.Name = "dependency"
|
||||
FileDescriptorProto_PublicDependency_field_name protoreflect.Name = "public_dependency"
|
||||
FileDescriptorProto_WeakDependency_field_name protoreflect.Name = "weak_dependency"
|
||||
FileDescriptorProto_OptionDependency_field_name protoreflect.Name = "option_dependency"
|
||||
FileDescriptorProto_MessageType_field_name protoreflect.Name = "message_type"
|
||||
FileDescriptorProto_EnumType_field_name protoreflect.Name = "enum_type"
|
||||
FileDescriptorProto_Service_field_name protoreflect.Name = "service"
|
||||
|
|
@ -79,6 +93,7 @@ const (
|
|||
FileDescriptorProto_Dependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.dependency"
|
||||
FileDescriptorProto_PublicDependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.public_dependency"
|
||||
FileDescriptorProto_WeakDependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.weak_dependency"
|
||||
FileDescriptorProto_OptionDependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.option_dependency"
|
||||
FileDescriptorProto_MessageType_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.message_type"
|
||||
FileDescriptorProto_EnumType_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.enum_type"
|
||||
FileDescriptorProto_Service_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.service"
|
||||
|
|
@ -96,6 +111,7 @@ const (
|
|||
FileDescriptorProto_Dependency_field_number protoreflect.FieldNumber = 3
|
||||
FileDescriptorProto_PublicDependency_field_number protoreflect.FieldNumber = 10
|
||||
FileDescriptorProto_WeakDependency_field_number protoreflect.FieldNumber = 11
|
||||
FileDescriptorProto_OptionDependency_field_number protoreflect.FieldNumber = 15
|
||||
FileDescriptorProto_MessageType_field_number protoreflect.FieldNumber = 4
|
||||
FileDescriptorProto_EnumType_field_number protoreflect.FieldNumber = 5
|
||||
FileDescriptorProto_Service_field_number protoreflect.FieldNumber = 6
|
||||
|
|
@ -124,6 +140,7 @@ const (
|
|||
DescriptorProto_Options_field_name protoreflect.Name = "options"
|
||||
DescriptorProto_ReservedRange_field_name protoreflect.Name = "reserved_range"
|
||||
DescriptorProto_ReservedName_field_name protoreflect.Name = "reserved_name"
|
||||
DescriptorProto_Visibility_field_name protoreflect.Name = "visibility"
|
||||
|
||||
DescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.name"
|
||||
DescriptorProto_Field_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.field"
|
||||
|
|
@ -135,6 +152,7 @@ const (
|
|||
DescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.options"
|
||||
DescriptorProto_ReservedRange_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.reserved_range"
|
||||
DescriptorProto_ReservedName_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.reserved_name"
|
||||
DescriptorProto_Visibility_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.visibility"
|
||||
)
|
||||
|
||||
// Field numbers for google.protobuf.DescriptorProto.
|
||||
|
|
@ -149,6 +167,7 @@ const (
|
|||
DescriptorProto_Options_field_number protoreflect.FieldNumber = 7
|
||||
DescriptorProto_ReservedRange_field_number protoreflect.FieldNumber = 9
|
||||
DescriptorProto_ReservedName_field_number protoreflect.FieldNumber = 10
|
||||
DescriptorProto_Visibility_field_number protoreflect.FieldNumber = 11
|
||||
)
|
||||
|
||||
// Names for google.protobuf.DescriptorProto.ExtensionRange.
|
||||
|
|
@ -388,12 +407,14 @@ const (
|
|||
EnumDescriptorProto_Options_field_name protoreflect.Name = "options"
|
||||
EnumDescriptorProto_ReservedRange_field_name protoreflect.Name = "reserved_range"
|
||||
EnumDescriptorProto_ReservedName_field_name protoreflect.Name = "reserved_name"
|
||||
EnumDescriptorProto_Visibility_field_name protoreflect.Name = "visibility"
|
||||
|
||||
EnumDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.name"
|
||||
EnumDescriptorProto_Value_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.value"
|
||||
EnumDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.options"
|
||||
EnumDescriptorProto_ReservedRange_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.reserved_range"
|
||||
EnumDescriptorProto_ReservedName_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.reserved_name"
|
||||
EnumDescriptorProto_Visibility_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.visibility"
|
||||
)
|
||||
|
||||
// Field numbers for google.protobuf.EnumDescriptorProto.
|
||||
|
|
@ -403,6 +424,7 @@ const (
|
|||
EnumDescriptorProto_Options_field_number protoreflect.FieldNumber = 3
|
||||
EnumDescriptorProto_ReservedRange_field_number protoreflect.FieldNumber = 4
|
||||
EnumDescriptorProto_ReservedName_field_number protoreflect.FieldNumber = 5
|
||||
EnumDescriptorProto_Visibility_field_number protoreflect.FieldNumber = 6
|
||||
)
|
||||
|
||||
// Names for google.protobuf.EnumDescriptorProto.EnumReservedRange.
|
||||
|
|
@ -1008,32 +1030,35 @@ const (
|
|||
|
||||
// Field names for google.protobuf.FeatureSet.
|
||||
const (
|
||||
FeatureSet_FieldPresence_field_name protoreflect.Name = "field_presence"
|
||||
FeatureSet_EnumType_field_name protoreflect.Name = "enum_type"
|
||||
FeatureSet_RepeatedFieldEncoding_field_name protoreflect.Name = "repeated_field_encoding"
|
||||
FeatureSet_Utf8Validation_field_name protoreflect.Name = "utf8_validation"
|
||||
FeatureSet_MessageEncoding_field_name protoreflect.Name = "message_encoding"
|
||||
FeatureSet_JsonFormat_field_name protoreflect.Name = "json_format"
|
||||
FeatureSet_EnforceNamingStyle_field_name protoreflect.Name = "enforce_naming_style"
|
||||
FeatureSet_FieldPresence_field_name protoreflect.Name = "field_presence"
|
||||
FeatureSet_EnumType_field_name protoreflect.Name = "enum_type"
|
||||
FeatureSet_RepeatedFieldEncoding_field_name protoreflect.Name = "repeated_field_encoding"
|
||||
FeatureSet_Utf8Validation_field_name protoreflect.Name = "utf8_validation"
|
||||
FeatureSet_MessageEncoding_field_name protoreflect.Name = "message_encoding"
|
||||
FeatureSet_JsonFormat_field_name protoreflect.Name = "json_format"
|
||||
FeatureSet_EnforceNamingStyle_field_name protoreflect.Name = "enforce_naming_style"
|
||||
FeatureSet_DefaultSymbolVisibility_field_name protoreflect.Name = "default_symbol_visibility"
|
||||
|
||||
FeatureSet_FieldPresence_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.field_presence"
|
||||
FeatureSet_EnumType_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.enum_type"
|
||||
FeatureSet_RepeatedFieldEncoding_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.repeated_field_encoding"
|
||||
FeatureSet_Utf8Validation_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.utf8_validation"
|
||||
FeatureSet_MessageEncoding_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.message_encoding"
|
||||
FeatureSet_JsonFormat_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.json_format"
|
||||
FeatureSet_EnforceNamingStyle_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.enforce_naming_style"
|
||||
FeatureSet_FieldPresence_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.field_presence"
|
||||
FeatureSet_EnumType_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.enum_type"
|
||||
FeatureSet_RepeatedFieldEncoding_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.repeated_field_encoding"
|
||||
FeatureSet_Utf8Validation_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.utf8_validation"
|
||||
FeatureSet_MessageEncoding_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.message_encoding"
|
||||
FeatureSet_JsonFormat_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.json_format"
|
||||
FeatureSet_EnforceNamingStyle_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.enforce_naming_style"
|
||||
FeatureSet_DefaultSymbolVisibility_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.default_symbol_visibility"
|
||||
)
|
||||
|
||||
// Field numbers for google.protobuf.FeatureSet.
|
||||
const (
|
||||
FeatureSet_FieldPresence_field_number protoreflect.FieldNumber = 1
|
||||
FeatureSet_EnumType_field_number protoreflect.FieldNumber = 2
|
||||
FeatureSet_RepeatedFieldEncoding_field_number protoreflect.FieldNumber = 3
|
||||
FeatureSet_Utf8Validation_field_number protoreflect.FieldNumber = 4
|
||||
FeatureSet_MessageEncoding_field_number protoreflect.FieldNumber = 5
|
||||
FeatureSet_JsonFormat_field_number protoreflect.FieldNumber = 6
|
||||
FeatureSet_EnforceNamingStyle_field_number protoreflect.FieldNumber = 7
|
||||
FeatureSet_FieldPresence_field_number protoreflect.FieldNumber = 1
|
||||
FeatureSet_EnumType_field_number protoreflect.FieldNumber = 2
|
||||
FeatureSet_RepeatedFieldEncoding_field_number protoreflect.FieldNumber = 3
|
||||
FeatureSet_Utf8Validation_field_number protoreflect.FieldNumber = 4
|
||||
FeatureSet_MessageEncoding_field_number protoreflect.FieldNumber = 5
|
||||
FeatureSet_JsonFormat_field_number protoreflect.FieldNumber = 6
|
||||
FeatureSet_EnforceNamingStyle_field_number protoreflect.FieldNumber = 7
|
||||
FeatureSet_DefaultSymbolVisibility_field_number protoreflect.FieldNumber = 8
|
||||
)
|
||||
|
||||
// Full and short names for google.protobuf.FeatureSet.FieldPresence.
|
||||
|
|
@ -1128,6 +1153,27 @@ const (
|
|||
FeatureSet_STYLE_LEGACY_enum_value = 2
|
||||
)
|
||||
|
||||
// Names for google.protobuf.FeatureSet.VisibilityFeature.
|
||||
const (
|
||||
FeatureSet_VisibilityFeature_message_name protoreflect.Name = "VisibilityFeature"
|
||||
FeatureSet_VisibilityFeature_message_fullname protoreflect.FullName = "google.protobuf.FeatureSet.VisibilityFeature"
|
||||
)
|
||||
|
||||
// Full and short names for google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility.
|
||||
const (
|
||||
FeatureSet_VisibilityFeature_DefaultSymbolVisibility_enum_fullname = "google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility"
|
||||
FeatureSet_VisibilityFeature_DefaultSymbolVisibility_enum_name = "DefaultSymbolVisibility"
|
||||
)
|
||||
|
||||
// Enum values for google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility.
|
||||
const (
|
||||
FeatureSet_VisibilityFeature_DEFAULT_SYMBOL_VISIBILITY_UNKNOWN_enum_value = 0
|
||||
FeatureSet_VisibilityFeature_EXPORT_ALL_enum_value = 1
|
||||
FeatureSet_VisibilityFeature_EXPORT_TOP_LEVEL_enum_value = 2
|
||||
FeatureSet_VisibilityFeature_LOCAL_ALL_enum_value = 3
|
||||
FeatureSet_VisibilityFeature_STRICT_enum_value = 4
|
||||
)
|
||||
|
||||
// Names for google.protobuf.FeatureSetDefaults.
|
||||
const (
|
||||
FeatureSetDefaults_message_name protoreflect.Name = "FeatureSetDefaults"
|
||||
|
|
|
|||
3
vendor/google.golang.org/protobuf/internal/impl/codec_message_opaque.go
generated
vendored
3
vendor/google.golang.org/protobuf/internal/impl/codec_message_opaque.go
generated
vendored
|
|
@ -11,6 +11,7 @@ import (
|
|||
|
||||
"google.golang.org/protobuf/encoding/protowire"
|
||||
"google.golang.org/protobuf/internal/encoding/messageset"
|
||||
"google.golang.org/protobuf/internal/filedesc"
|
||||
"google.golang.org/protobuf/internal/order"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
||||
|
|
@ -80,7 +81,7 @@ func (mi *MessageInfo) makeOpaqueCoderMethods(t reflect.Type, si opaqueStructInf
|
|||
// permit us to skip over definitely-unset fields at marshal time.
|
||||
|
||||
var hasPresence bool
|
||||
hasPresence, cf.isLazy = usePresenceForField(si, fd)
|
||||
hasPresence, cf.isLazy = filedesc.UsePresenceForField(fd)
|
||||
|
||||
if hasPresence {
|
||||
cf.presenceIndex, mi.presenceSize = presenceIndex(mi.Desc, fd)
|
||||
|
|
|
|||
45
vendor/google.golang.org/protobuf/internal/impl/message_opaque.go
generated
vendored
45
vendor/google.golang.org/protobuf/internal/impl/message_opaque.go
generated
vendored
|
|
@ -11,6 +11,7 @@ import (
|
|||
"strings"
|
||||
"sync/atomic"
|
||||
|
||||
"google.golang.org/protobuf/internal/filedesc"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
|
|
@ -53,7 +54,7 @@ func opaqueInitHook(mi *MessageInfo) bool {
|
|||
fd := fds.Get(i)
|
||||
fs := si.fieldsByNumber[fd.Number()]
|
||||
var fi fieldInfo
|
||||
usePresence, _ := usePresenceForField(si, fd)
|
||||
usePresence, _ := filedesc.UsePresenceForField(fd)
|
||||
|
||||
switch {
|
||||
case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic():
|
||||
|
|
@ -343,17 +344,15 @@ func (mi *MessageInfo) fieldInfoForMessageListOpaqueNoPresence(si opaqueStructIn
|
|||
if p.IsNil() {
|
||||
return false
|
||||
}
|
||||
sp := p.Apply(fieldOffset).AtomicGetPointer()
|
||||
if sp.IsNil() {
|
||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||
if rv.IsNil() {
|
||||
return false
|
||||
}
|
||||
rv := sp.AsValueOf(fs.Type.Elem())
|
||||
return rv.Elem().Len() > 0
|
||||
},
|
||||
clear: func(p pointer) {
|
||||
sp := p.Apply(fieldOffset).AtomicGetPointer()
|
||||
if !sp.IsNil() {
|
||||
rv := sp.AsValueOf(fs.Type.Elem())
|
||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||
if !rv.IsNil() {
|
||||
rv.Elem().Set(reflect.Zero(rv.Type().Elem()))
|
||||
}
|
||||
},
|
||||
|
|
@ -361,11 +360,10 @@ func (mi *MessageInfo) fieldInfoForMessageListOpaqueNoPresence(si opaqueStructIn
|
|||
if p.IsNil() {
|
||||
return conv.Zero()
|
||||
}
|
||||
sp := p.Apply(fieldOffset).AtomicGetPointer()
|
||||
if sp.IsNil() {
|
||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||
if rv.IsNil() {
|
||||
return conv.Zero()
|
||||
}
|
||||
rv := sp.AsValueOf(fs.Type.Elem())
|
||||
if rv.Elem().Len() == 0 {
|
||||
return conv.Zero()
|
||||
}
|
||||
|
|
@ -598,30 +596,3 @@ func (mi *MessageInfo) clearPresent(p pointer, index uint32) {
|
|||
func (mi *MessageInfo) present(p pointer, index uint32) bool {
|
||||
return p.Apply(mi.presenceOffset).PresenceInfo().Present(index)
|
||||
}
|
||||
|
||||
// usePresenceForField implements the somewhat intricate logic of when
|
||||
// the presence bitmap is used for a field. The main logic is that a
|
||||
// field that is optional or that can be lazy will use the presence
|
||||
// bit, but for proto2, also maps have a presence bit. It also records
|
||||
// if the field can ever be lazy, which is true if we have a
|
||||
// lazyOffset and the field is a message or a slice of messages. A
|
||||
// field that is lazy will always need a presence bit. Oneofs are not
|
||||
// lazy and do not use presence, unless they are a synthetic oneof,
|
||||
// which is a proto3 optional field. For proto3 optionals, we use the
|
||||
// presence and they can also be lazy when applicable (a message).
|
||||
func usePresenceForField(si opaqueStructInfo, fd protoreflect.FieldDescriptor) (usePresence, canBeLazy bool) {
|
||||
hasLazyField := fd.(interface{ IsLazy() bool }).IsLazy()
|
||||
|
||||
// Non-oneof scalar fields with explicit field presence use the presence array.
|
||||
usesPresenceArray := fd.HasPresence() && fd.Message() == nil && (fd.ContainingOneof() == nil || fd.ContainingOneof().IsSynthetic())
|
||||
switch {
|
||||
case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic():
|
||||
return false, false
|
||||
case fd.IsMap():
|
||||
return false, false
|
||||
case fd.Kind() == protoreflect.MessageKind || fd.Kind() == protoreflect.GroupKind:
|
||||
return hasLazyField, hasLazyField
|
||||
default:
|
||||
return usesPresenceArray || (hasLazyField && fd.HasPresence()), false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
3
vendor/google.golang.org/protobuf/internal/impl/presence.go
generated
vendored
3
vendor/google.golang.org/protobuf/internal/impl/presence.go
generated
vendored
|
|
@ -32,9 +32,6 @@ func (p presence) toElem(num uint32) (ret *uint32) {
|
|||
|
||||
// Present checks for the presence of a specific field number in a presence set.
|
||||
func (p presence) Present(num uint32) bool {
|
||||
if p.P == nil {
|
||||
return false
|
||||
}
|
||||
return Export{}.Present(p.toElem(num), num)
|
||||
}
|
||||
|
||||
|
|
|
|||
2
vendor/google.golang.org/protobuf/internal/version/version.go
generated
vendored
2
vendor/google.golang.org/protobuf/internal/version/version.go
generated
vendored
|
|
@ -52,7 +52,7 @@ import (
|
|||
const (
|
||||
Major = 1
|
||||
Minor = 36
|
||||
Patch = 6
|
||||
Patch = 8
|
||||
PreRelease = ""
|
||||
)
|
||||
|
||||
|
|
|
|||
8
vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go
generated
vendored
8
vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go
generated
vendored
|
|
@ -21,6 +21,8 @@ func (p *SourcePath) appendFileDescriptorProto(b []byte) []byte {
|
|||
b = p.appendRepeatedField(b, "public_dependency", nil)
|
||||
case 11:
|
||||
b = p.appendRepeatedField(b, "weak_dependency", nil)
|
||||
case 15:
|
||||
b = p.appendRepeatedField(b, "option_dependency", nil)
|
||||
case 4:
|
||||
b = p.appendRepeatedField(b, "message_type", (*SourcePath).appendDescriptorProto)
|
||||
case 5:
|
||||
|
|
@ -66,6 +68,8 @@ func (p *SourcePath) appendDescriptorProto(b []byte) []byte {
|
|||
b = p.appendRepeatedField(b, "reserved_range", (*SourcePath).appendDescriptorProto_ReservedRange)
|
||||
case 10:
|
||||
b = p.appendRepeatedField(b, "reserved_name", nil)
|
||||
case 11:
|
||||
b = p.appendSingularField(b, "visibility", nil)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
|
@ -85,6 +89,8 @@ func (p *SourcePath) appendEnumDescriptorProto(b []byte) []byte {
|
|||
b = p.appendRepeatedField(b, "reserved_range", (*SourcePath).appendEnumDescriptorProto_EnumReservedRange)
|
||||
case 5:
|
||||
b = p.appendRepeatedField(b, "reserved_name", nil)
|
||||
case 6:
|
||||
b = p.appendSingularField(b, "visibility", nil)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
|
@ -400,6 +406,8 @@ func (p *SourcePath) appendFeatureSet(b []byte) []byte {
|
|||
b = p.appendSingularField(b, "json_format", nil)
|
||||
case 7:
|
||||
b = p.appendSingularField(b, "enforce_naming_style", nil)
|
||||
case 8:
|
||||
b = p.appendSingularField(b, "default_symbol_visibility", nil)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue