testing: update Go to 1.19 (#5717)

This commit is contained in:
Doug Fawley 2022-10-17 15:04:34 -07:00 committed by GitHub
parent eb8aa3192b
commit 778860e606
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
94 changed files with 570 additions and 503 deletions

View File

@ -24,7 +24,7 @@ jobs:
- name: Setup Go - name: Setup Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: 1.18 go-version: 1.19
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -44,31 +44,31 @@ jobs:
matrix: matrix:
include: include:
- type: vet+tests - type: vet+tests
goversion: 1.18 goversion: 1.19
- type: tests - type: tests
goversion: 1.18 goversion: 1.19
testflags: -race testflags: -race
- type: tests - type: tests
goversion: 1.18 goversion: 1.19
goarch: 386 goarch: 386
- type: tests - type: tests
goversion: 1.18 goversion: 1.19
goarch: arm64 goarch: arm64
- type: tests
goversion: 1.18
- type: tests - type: tests
goversion: 1.17 goversion: 1.17
- type: tests - type: tests
goversion: 1.16 goversion: 1.16
- type: tests
goversion: 1.15
- type: extras - type: extras
goversion: 1.18 goversion: 1.19
steps: steps:
# Setup the environment. # Setup the environment.

View File

@ -23,7 +23,7 @@
// //
// - CSDS: https://github.com/grpc/proposal/blob/master/A40-csds-support.md // - CSDS: https://github.com/grpc/proposal/blob/master/A40-csds-support.md
// //
// Experimental // # Experimental
// //
// Notice: All APIs in this package are experimental and may be removed in a // Notice: All APIs in this package are experimental and may be removed in a
// later release. // later release.

View File

@ -19,7 +19,7 @@
// Package attributes defines a generic key/value store used in various gRPC // Package attributes defines a generic key/value store used in various gRPC
// components. // components.
// //
// Experimental // # Experimental
// //
// Notice: This package is EXPERIMENTAL and may be changed or removed in a // Notice: This package is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.

View File

@ -16,7 +16,7 @@
// Package authz exposes methods to manage authorization within gRPC. // Package authz exposes methods to manage authorization within gRPC.
// //
// Experimental // # Experimental
// //
// Notice: This package is EXPERIMENTAL and may be changed or removed // Notice: This package is EXPERIMENTAL and may be changed or removed
// in a later release. // in a later release.

View File

@ -48,7 +48,7 @@ type BackoffConfig struct {
// here for more details: // here for more details:
// https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. // https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.

View File

@ -157,8 +157,8 @@ func (b *baseBalancer) mergeErrors() error {
// regeneratePicker takes a snapshot of the balancer, and generates a picker // regeneratePicker takes a snapshot of the balancer, and generates a picker
// from it. The picker is // from it. The picker is
// - errPicker if the balancer is in TransientFailure, // - errPicker if the balancer is in TransientFailure,
// - built by the pickerBuilder with all READY SubConns otherwise. // - built by the pickerBuilder with all READY SubConns otherwise.
func (b *baseBalancer) regeneratePicker() { func (b *baseBalancer) regeneratePicker() {
if b.state == connectivity.TransientFailure { if b.state == connectivity.TransientFailure {
b.picker = NewErrPicker(b.mergeErrors()) b.picker = NewErrPicker(b.mergeErrors())

View File

@ -34,10 +34,10 @@ type ConnectivityStateEvaluator struct {
// RecordTransition records state change happening in subConn and based on that // RecordTransition records state change happening in subConn and based on that
// it evaluates what aggregated state should be. // it evaluates what aggregated state should be.
// //
// - If at least one SubConn in Ready, the aggregated state is Ready; // - If at least one SubConn in Ready, the aggregated state is Ready;
// - Else if at least one SubConn in Connecting, the aggregated state is Connecting; // - Else if at least one SubConn in Connecting, the aggregated state is Connecting;
// - Else if at least one SubConn is Idle, the aggregated state is Idle; // - Else if at least one SubConn is Idle, the aggregated state is Idle;
// - Else if at least one SubConn is TransientFailure (or there are no SubConns), the aggregated state is Transient Failure. // - Else if at least one SubConn is TransientFailure (or there are no SubConns), the aggregated state is Transient Failure.
// //
// Shutdown is not considered. // Shutdown is not considered.
func (cse *ConnectivityStateEvaluator) RecordTransition(oldState, newState connectivity.State) connectivity.State { func (cse *ConnectivityStateEvaluator) RecordTransition(oldState, newState connectivity.State) connectivity.State {

View File

@ -52,6 +52,7 @@ type LoadBalanceRequest struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// Types that are assignable to LoadBalanceRequestType: // Types that are assignable to LoadBalanceRequestType:
//
// *LoadBalanceRequest_InitialRequest // *LoadBalanceRequest_InitialRequest
// *LoadBalanceRequest_ClientStats // *LoadBalanceRequest_ClientStats
LoadBalanceRequestType isLoadBalanceRequest_LoadBalanceRequestType `protobuf_oneof:"load_balance_request_type"` LoadBalanceRequestType isLoadBalanceRequest_LoadBalanceRequestType `protobuf_oneof:"load_balance_request_type"`
@ -340,6 +341,7 @@ type LoadBalanceResponse struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// Types that are assignable to LoadBalanceResponseType: // Types that are assignable to LoadBalanceResponseType:
//
// *LoadBalanceResponse_InitialResponse // *LoadBalanceResponse_InitialResponse
// *LoadBalanceResponse_ServerList // *LoadBalanceResponse_ServerList
// *LoadBalanceResponse_FallbackResponse // *LoadBalanceResponse_FallbackResponse

View File

@ -19,7 +19,8 @@
// Package grpclb defines a grpclb balancer. // Package grpclb defines a grpclb balancer.
// //
// To install grpclb balancer, import this package as: // To install grpclb balancer, import this package as:
// import _ "google.golang.org/grpc/balancer/grpclb" //
// import _ "google.golang.org/grpc/balancer/grpclb"
package grpclb package grpclb
import ( import (
@ -229,8 +230,9 @@ type lbBalancer struct {
// regeneratePicker takes a snapshot of the balancer, and generates a picker from // regeneratePicker takes a snapshot of the balancer, and generates a picker from
// it. The picker // it. The picker
// - always returns ErrTransientFailure if the balancer is in TransientFailure, // - always returns ErrTransientFailure if the balancer is in TransientFailure,
// - does two layer roundrobin pick otherwise. // - does two layer roundrobin pick otherwise.
//
// Caller must hold lb.mu. // Caller must hold lb.mu.
func (lb *lbBalancer) regeneratePicker(resetDrop bool) { func (lb *lbBalancer) regeneratePicker(resetDrop bool) {
if lb.state == connectivity.TransientFailure { if lb.state == connectivity.TransientFailure {
@ -290,14 +292,14 @@ func (lb *lbBalancer) regeneratePicker(resetDrop bool) {
// fallback and grpclb). lb.scState contains states for all SubConns, including // fallback and grpclb). lb.scState contains states for all SubConns, including
// those in cache (SubConns are cached for 10 seconds after remove). // those in cache (SubConns are cached for 10 seconds after remove).
// //
// The aggregated state is: // The aggregated state is:
// - If at least one SubConn in Ready, the aggregated state is Ready; // - If at least one SubConn in Ready, the aggregated state is Ready;
// - Else if at least one SubConn in Connecting or IDLE, the aggregated state is Connecting; // - Else if at least one SubConn in Connecting or IDLE, the aggregated state is Connecting;
// - It's OK to consider IDLE as Connecting. SubConns never stay in IDLE, // - It's OK to consider IDLE as Connecting. SubConns never stay in IDLE,
// they start to connect immediately. But there's a race between the overall // they start to connect immediately. But there's a race between the overall
// state is reported, and when the new SubConn state arrives. And SubConns // state is reported, and when the new SubConn state arrives. And SubConns
// never go back to IDLE. // never go back to IDLE.
// - Else the aggregated state is TransientFailure. // - Else the aggregated state is TransientFailure.
func (lb *lbBalancer) aggregateSubConnStates() connectivity.State { func (lb *lbBalancer) aggregateSubConnStates() connectivity.State {
var numConnecting uint64 var numConnecting uint64

View File

@ -426,7 +426,6 @@ func (b *rlsBalancer) ExitIdle() {
// sendNewPickerLocked pushes a new picker on to the channel. // sendNewPickerLocked pushes a new picker on to the channel.
// //
//
// Note that regardless of what connectivity state is reported, the policy will // Note that regardless of what connectivity state is reported, the policy will
// return its own picker, and not a picker that unconditionally queues // return its own picker, and not a picker that unconditionally queues
// (typically used for IDLE or CONNECTING) or a picker that unconditionally // (typically used for IDLE or CONNECTING) or a picker that unconditionally
@ -485,14 +484,14 @@ func (b *rlsBalancer) sendNewPicker() {
} }
// The aggregated connectivity state reported is determined as follows: // The aggregated connectivity state reported is determined as follows:
// - If there is at least one child policy in state READY, the connectivity // - If there is at least one child policy in state READY, the connectivity
// state is READY. // state is READY.
// - Otherwise, if there is at least one child policy in state CONNECTING, the // - Otherwise, if there is at least one child policy in state CONNECTING, the
// connectivity state is CONNECTING. // connectivity state is CONNECTING.
// - Otherwise, if there is at least one child policy in state IDLE, the // - Otherwise, if there is at least one child policy in state IDLE, the
// connectivity state is IDLE. // connectivity state is IDLE.
// - Otherwise, all child policies are in TRANSIENT_FAILURE, and the // - Otherwise, all child policies are in TRANSIENT_FAILURE, and the
// connectivity state is TRANSIENT_FAILURE. // connectivity state is TRANSIENT_FAILURE.
// //
// If the RLS policy has no child policies and no configured default target, // If the RLS policy has no child policies and no configured default target,
// then we will report connectivity state IDLE. // then we will report connectivity state IDLE.
@ -542,9 +541,9 @@ func (b *rlsBalancer) UpdateState(id string, state balancer.State) {
// This method is invoked by the BalancerGroup whenever a child policy sends a // This method is invoked by the BalancerGroup whenever a child policy sends a
// state update. We cache the child policy's connectivity state and picker for // state update. We cache the child policy's connectivity state and picker for
// two reasons: // two reasons:
// - to suppress connectivity state transitions from TRANSIENT_FAILURE to states // - to suppress connectivity state transitions from TRANSIENT_FAILURE to states
// other than READY // other than READY
// - to delegate picks to child policies // - to delegate picks to child policies
func (b *rlsBalancer) handleChildPolicyStateUpdate(id string, newState balancer.State) { func (b *rlsBalancer) handleChildPolicyStateUpdate(id string, newState balancer.State) {
b.stateMu.Lock() b.stateMu.Lock()
defer b.stateMu.Unlock() defer b.stateMu.Unlock()

View File

@ -113,33 +113,36 @@ type lbConfigJSON struct {
// ParseConfig parses the JSON load balancer config provided into an // ParseConfig parses the JSON load balancer config provided into an
// internal form or returns an error if the config is invalid. // internal form or returns an error if the config is invalid.
// //
// When parsing a config update, the following validations are performed: // When parsing a config update, the following validations are performed:
// - routeLookupConfig: // - routeLookupConfig:
// - grpc_keybuilders field: // - grpc_keybuilders field:
// - must have at least one entry // - must have at least one entry
// - must not have two entries with the same `Name` // - must not have two entries with the same `Name`
// - within each entry: // - within each entry:
// - must have at least one `Name` // - must have at least one `Name`
// - must not have a `Name` with the `service` field unset or empty // - must not have a `Name` with the `service` field unset or empty
// - within each `headers` entry: // - within each `headers` entry:
// - must not have `required_match` set // - must not have `required_match` set
// - must not have `key` unset or empty // - must not have `key` unset or empty
// - across all `headers`, `constant_keys` and `extra_keys` fields: // - across all `headers`, `constant_keys` and `extra_keys` fields:
// - must not have the same `key` specified twice // - must not have the same `key` specified twice
// - no `key` must be the empty string // - no `key` must be the empty string
// - `lookup_service` field must be set and must parse as a target URI // - `lookup_service` field must be set and must parse as a target URI
// - if `max_age` > 5m, it should be set to 5 minutes // - if `max_age` > 5m, it should be set to 5 minutes
// - if `stale_age` > `max_age`, ignore it // - if `stale_age` > `max_age`, ignore it
// - if `stale_age` is set, then `max_age` must also be set // - if `stale_age` is set, then `max_age` must also be set
// - ignore `valid_targets` field // - ignore `valid_targets` field
// - `cache_size_bytes` field must have a value greater than 0, and if its // - `cache_size_bytes` field must have a value greater than 0, and if its
// value is greater than 5M, we cap it at 5M // value is greater than 5M, we cap it at 5M
// - routeLookupChannelServiceConfig: //
// - if specified, must parse as valid service config // - routeLookupChannelServiceConfig:
// - childPolicy: // - if specified, must parse as valid service config
// - must find a valid child policy with a valid config //
// - childPolicyConfigTargetFieldName: // - childPolicy:
// - must be set and non-empty // - must find a valid child policy with a valid config
//
// - childPolicyConfigTargetFieldName:
// - must be set and non-empty
func (rlsBB) ParseConfig(c json.RawMessage) (serviceconfig.LoadBalancingConfig, error) { func (rlsBB) ParseConfig(c json.RawMessage) (serviceconfig.LoadBalancingConfig, error) {
logger.Infof("Received JSON service config: %v", pretty.ToJSON(c)) logger.Infof("Received JSON service config: %v", pretty.ToJSON(c))
cfgJSON := &lbConfigJSON{} cfgJSON := &lbConfigJSON{}

View File

@ -220,12 +220,12 @@ func startManualResolverWithConfig(t *testing.T, rlsConfig *e2e.RLSConfig) *manu
// //
// There are many instances where it can take a while before the attempted RPC // There are many instances where it can take a while before the attempted RPC
// reaches the expected backend. Examples include, but are not limited to: // reaches the expected backend. Examples include, but are not limited to:
// - control channel is changed in a config update. The RLS LB policy creates a // - control channel is changed in a config update. The RLS LB policy creates a
// new control channel, and sends a new picker to gRPC. But it takes a while // new control channel, and sends a new picker to gRPC. But it takes a while
// before gRPC actually starts using the new picker. // before gRPC actually starts using the new picker.
// - test is waiting for a cache entry to expire after which we expect a // - test is waiting for a cache entry to expire after which we expect a
// different behavior because we have configured the fake RLS server to return // different behavior because we have configured the fake RLS server to return
// different backends. // different backends.
// //
// Therefore, we do not return an error when the RPC fails. Instead, we wait for // Therefore, we do not return an error when the RPC fails. Instead, we wait for
// the context to expire before failing. // the context to expire before failing.

View File

@ -45,21 +45,21 @@ const (
// The throttler has the following knobs for which we will use defaults for // The throttler has the following knobs for which we will use defaults for
// now. If there is a need to make them configurable at a later point in time, // now. If there is a need to make them configurable at a later point in time,
// support for the same will be added. // support for the same will be added.
// * Duration: amount of recent history that will be taken into account for // - Duration: amount of recent history that will be taken into account for
// making client-side throttling decisions. A default of 30 seconds is used. // making client-side throttling decisions. A default of 30 seconds is used.
// * Bins: number of bins to be used for bucketing historical data. A default // - Bins: number of bins to be used for bucketing historical data. A default
// of 100 is used. // of 100 is used.
// * RatioForAccepts: ratio by which accepts are multiplied, typically a value // - RatioForAccepts: ratio by which accepts are multiplied, typically a value
// slightly larger than 1.0. This is used to make the throttler behave as if // slightly larger than 1.0. This is used to make the throttler behave as if
// the backend had accepted more requests than it actually has, which lets us // the backend had accepted more requests than it actually has, which lets us
// err on the side of sending to the backend more requests than we think it // err on the side of sending to the backend more requests than we think it
// will accept for the sake of speeding up the propagation of state. A // will accept for the sake of speeding up the propagation of state. A
// default of 2.0 is used. // default of 2.0 is used.
// * RequestsPadding: is used to decrease the (client-side) throttling // - RequestsPadding: is used to decrease the (client-side) throttling
// probability in the low QPS regime (to speed up propagation of state), as // probability in the low QPS regime (to speed up propagation of state), as
// well as to safeguard against hitting a client-side throttling probability // well as to safeguard against hitting a client-side throttling probability
// of 100%. The weight of this value decreases as the number of requests in // of 100%. The weight of this value decreases as the number of requests in
// recent history grows. A default of 8 is used. // recent history grows. A default of 8 is used.
// //
// The adaptive throttler attempts to estimate the probability that a request // The adaptive throttler attempts to estimate the probability that a request
// will be throttled using recent history. Server requests (both throttled and // will be throttled using recent history. Server requests (both throttled and

View File

@ -45,7 +45,7 @@ func (a AddrInfo) Equal(o interface{}) bool {
// SetAddrInfo returns a copy of addr in which the BalancerAttributes field is // SetAddrInfo returns a copy of addr in which the BalancerAttributes field is
// updated with addrInfo. // updated with addrInfo.
// //
// Experimental // # Experimental
// //
// Notice: This API is EXPERIMENTAL and may be changed or removed in a // Notice: This API is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -57,7 +57,7 @@ func SetAddrInfo(addr resolver.Address, addrInfo AddrInfo) resolver.Address {
// GetAddrInfo returns the AddrInfo stored in the BalancerAttributes field of // GetAddrInfo returns the AddrInfo stored in the BalancerAttributes field of
// addr. // addr.
// //
// Experimental // # Experimental
// //
// Notice: This API is EXPERIMENTAL and may be changed or removed in a // Notice: This API is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.

View File

@ -21,10 +21,10 @@ Package main provides benchmark with setting flags.
An example to run some benchmarks with profiling enabled: An example to run some benchmarks with profiling enabled:
go run benchmark/benchmain/main.go -benchtime=10s -workloads=all \ go run benchmark/benchmain/main.go -benchtime=10s -workloads=all \
-compression=gzip -maxConcurrentCalls=1 -trace=off \ -compression=gzip -maxConcurrentCalls=1 -trace=off \
-reqSizeBytes=1,1048576 -respSizeBytes=1,1048576 -networkMode=Local \ -reqSizeBytes=1,1048576 -respSizeBytes=1,1048576 -networkMode=Local \
-cpuProfile=cpuProf -memProfile=memProf -memProfileRate=10000 -resultFile=result -cpuProfile=cpuProf -memProfile=memProf -memProfileRate=10000 -resultFile=result
As a suggestion, when creating a branch, you can run this benchmark and save the result As a suggestion, when creating a branch, you can run this benchmark and save the result
file "-resultFile=basePerf", and later when you at the middle of the work or finish the file "-resultFile=basePerf", and later when you at the middle of the work or finish the
@ -32,10 +32,11 @@ work, you can get the benchmark result and compare it with the base anytime.
Assume there are two result files names as "basePerf" and "curPerf" created by adding Assume there are two result files names as "basePerf" and "curPerf" created by adding
-resultFile=basePerf and -resultFile=curPerf. -resultFile=basePerf and -resultFile=curPerf.
To format the curPerf, run:
go run benchmark/benchresult/main.go curPerf To format the curPerf, run:
To observe how the performance changes based on a base result, run: go run benchmark/benchresult/main.go curPerf
go run benchmark/benchresult/main.go basePerf curPerf To observe how the performance changes based on a base result, run:
go run benchmark/benchresult/main.go basePerf curPerf
*/ */
package main package main

View File

@ -18,12 +18,14 @@
/* /*
To format the benchmark result: To format the benchmark result:
go run benchmark/benchresult/main.go resultfile
go run benchmark/benchresult/main.go resultfile
To see the performance change based on a old result: To see the performance change based on a old result:
go run benchmark/benchresult/main.go resultfile_old resultfile
It will print the comparison result of intersection benchmarks between two files.
go run benchmark/benchresult/main.go resultfile_old resultfile
It will print the comparison result of intersection benchmarks between two files.
*/ */
package main package main

View File

@ -20,6 +20,7 @@
Package main provides a server used for benchmarking. It launches a server Package main provides a server used for benchmarking. It launches a server
which is listening on port 50051. An example to start the server can be found which is listening on port 50051. An example to start the server can be found
at: at:
go run benchmark/server/main.go -test_name=grpc_test go run benchmark/server/main.go -test_name=grpc_test
After starting the server, the client can be run separately and used to test After starting the server, the client can be run separately and used to test

View File

@ -261,6 +261,7 @@ type GrpcLogEntry struct {
// according to the type of the log entry. // according to the type of the log entry.
// //
// Types that are assignable to Payload: // Types that are assignable to Payload:
//
// *GrpcLogEntry_ClientHeader // *GrpcLogEntry_ClientHeader
// *GrpcLogEntry_ServerHeader // *GrpcLogEntry_ServerHeader
// *GrpcLogEntry_Message // *GrpcLogEntry_Message
@ -694,12 +695,12 @@ func (x *Message) GetData() []byte {
// Header keys added by gRPC are omitted. To be more specific, // Header keys added by gRPC are omitted. To be more specific,
// implementations will not log the following entries, and this is // implementations will not log the following entries, and this is
// not to be treated as a truncation: // not to be treated as a truncation:
// - entries handled by grpc that are not user visible, such as those // - entries handled by grpc that are not user visible, such as those
// that begin with 'grpc-' (with exception of grpc-trace-bin) // that begin with 'grpc-' (with exception of grpc-trace-bin)
// or keys like 'lb-token' // or keys like 'lb-token'
// - transport specific entries, including but not limited to: // - transport specific entries, including but not limited to:
// ':path', ':authority', 'content-encoding', 'user-agent', 'te', etc // ':path', ':authority', 'content-encoding', 'user-agent', 'te', etc
// - entries added for call credentials // - entries added for call credentials
// //
// Implementations must always log grpc-trace-bin if it is present. // Implementations must always log grpc-trace-bin if it is present.
// Practically speaking it will only be visible on server side because // Practically speaking it will only be visible on server side because

View File

@ -23,7 +23,7 @@
// https://github.com/grpc/proposal/blob/master/A14-channelz.md, is provided by // https://github.com/grpc/proposal/blob/master/A14-channelz.md, is provided by
// the `internal/channelz` package. // the `internal/channelz` package.
// //
// Experimental // # Experimental
// //
// Notice: All APIs in this package are experimental and may be removed in a // Notice: All APIs in this package are experimental and may be removed in a
// later release. // later release.

View File

@ -514,6 +514,7 @@ type ChannelTraceEvent struct {
// created. // created.
// //
// Types that are assignable to ChildRef: // Types that are assignable to ChildRef:
//
// *ChannelTraceEvent_ChannelRef // *ChannelTraceEvent_ChannelRef
// *ChannelTraceEvent_SubchannelRef // *ChannelTraceEvent_SubchannelRef
ChildRef isChannelTraceEvent_ChildRef `protobuf_oneof:"child_ref"` ChildRef isChannelTraceEvent_ChildRef `protobuf_oneof:"child_ref"`
@ -1338,6 +1339,7 @@ type Address struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// Types that are assignable to Address: // Types that are assignable to Address:
//
// *Address_TcpipAddress // *Address_TcpipAddress
// *Address_UdsAddress_ // *Address_UdsAddress_
// *Address_OtherAddress_ // *Address_OtherAddress_
@ -1433,6 +1435,7 @@ type Security struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// Types that are assignable to Model: // Types that are assignable to Model:
//
// *Security_Tls_ // *Security_Tls_
// *Security_Other // *Security_Other
Model isSecurity_Model `protobuf_oneof:"model"` Model isSecurity_Model `protobuf_oneof:"model"`
@ -2908,6 +2911,7 @@ type Security_Tls struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// Types that are assignable to CipherSuite: // Types that are assignable to CipherSuite:
//
// *Security_Tls_StandardName // *Security_Tls_StandardName
// *Security_Tls_OtherName // *Security_Tls_OtherName
CipherSuite isSecurity_Tls_CipherSuite `protobuf_oneof:"cipher_suite"` CipherSuite isSecurity_Tls_CipherSuite `protobuf_oneof:"cipher_suite"`

View File

@ -503,7 +503,7 @@ type ClientConn struct {
// WaitForStateChange waits until the connectivity.State of ClientConn changes from sourceState or // WaitForStateChange waits until the connectivity.State of ClientConn changes from sourceState or
// ctx expires. A true value is returned in former case and false in latter. // ctx expires. A true value is returned in former case and false in latter.
// //
// Experimental // # Experimental
// //
// Notice: This API is EXPERIMENTAL and may be changed or removed in a // Notice: This API is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -522,7 +522,7 @@ func (cc *ClientConn) WaitForStateChange(ctx context.Context, sourceState connec
// GetState returns the connectivity.State of ClientConn. // GetState returns the connectivity.State of ClientConn.
// //
// Experimental // # Experimental
// //
// Notice: This API is EXPERIMENTAL and may be changed or removed in a later // Notice: This API is EXPERIMENTAL and may be changed or removed in a later
// release. // release.
@ -534,7 +534,7 @@ func (cc *ClientConn) GetState() connectivity.State {
// the channel is idle. Does not wait for the connection attempts to begin // the channel is idle. Does not wait for the connection attempts to begin
// before returning. // before returning.
// //
// Experimental // # Experimental
// //
// Notice: This API is EXPERIMENTAL and may be changed or removed in a later // Notice: This API is EXPERIMENTAL and may be changed or removed in a later
// release. // release.
@ -761,7 +761,7 @@ func (cc *ClientConn) channelzMetric() *channelz.ChannelInternalMetric {
// Target returns the target string of the ClientConn. // Target returns the target string of the ClientConn.
// //
// Experimental // # Experimental
// //
// Notice: This API is EXPERIMENTAL and may be changed or removed in a // Notice: This API is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -831,9 +831,9 @@ func equalAddresses(a, b []resolver.Address) bool {
// //
// If ac is Ready, it checks whether current connected address of ac is in the // If ac is Ready, it checks whether current connected address of ac is in the
// new addrs list. // new addrs list.
// - If true, it updates ac.addrs and returns true. The ac will keep using // - If true, it updates ac.addrs and returns true. The ac will keep using
// the existing connection. // the existing connection.
// - If false, it does nothing and returns false. // - If false, it does nothing and returns false.
func (ac *addrConn) tryUpdateAddrs(addrs []resolver.Address) bool { func (ac *addrConn) tryUpdateAddrs(addrs []resolver.Address) bool {
ac.mu.Lock() ac.mu.Lock()
defer ac.mu.Unlock() defer ac.mu.Unlock()
@ -998,7 +998,7 @@ func (cc *ClientConn) resolveNow(o resolver.ResolveNowOptions) {
// However, if a previously unavailable network becomes available, this may be // However, if a previously unavailable network becomes available, this may be
// used to trigger an immediate reconnect. // used to trigger an immediate reconnect.
// //
// Experimental // # Experimental
// //
// Notice: This API is EXPERIMENTAL and may be changed or removed in a // Notice: This API is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.

View File

@ -19,14 +19,17 @@
// protoc-gen-go-grpc is a plugin for the Google protocol buffer compiler to // protoc-gen-go-grpc is a plugin for the Google protocol buffer compiler to
// generate Go code. Install it by building this program and making it // generate Go code. Install it by building this program and making it
// accessible within your PATH with the name: // accessible within your PATH with the name:
//
// protoc-gen-go-grpc // protoc-gen-go-grpc
// //
// The 'go-grpc' suffix becomes part of the argument for the protocol compiler, // The 'go-grpc' suffix becomes part of the argument for the protocol compiler,
// such that it can be invoked as: // such that it can be invoked as:
//
// protoc --go-grpc_out=. path/to/file.proto // protoc --go-grpc_out=. path/to/file.proto
// //
// This generates Go service definitions for the protocol buffer defined by // This generates Go service definitions for the protocol buffer defined by
// file.proto. With that input, the output will be written to: // file.proto. With that input, the output will be written to:
//
// path/to/file_grpc.pb.go // path/to/file_grpc.pb.go
package main package main

View File

@ -216,6 +216,7 @@ type Identity struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// Types that are assignable to IdentityOneof: // Types that are assignable to IdentityOneof:
//
// *Identity_ServiceAccount // *Identity_ServiceAccount
// *Identity_Hostname // *Identity_Hostname
IdentityOneof isIdentity_IdentityOneof `protobuf_oneof:"identity_oneof"` IdentityOneof isIdentity_IdentityOneof `protobuf_oneof:"identity_oneof"`
@ -664,6 +665,7 @@ type HandshakerReq struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// Types that are assignable to ReqOneof: // Types that are assignable to ReqOneof:
//
// *HandshakerReq_ClientStart // *HandshakerReq_ClientStart
// *HandshakerReq_ServerStart // *HandshakerReq_ServerStart
// *HandshakerReq_Next // *HandshakerReq_Next

View File

@ -40,6 +40,7 @@ const cfeClusterAuthorityName = "traffic-director-c2p.xds.googleapis.com"
// "xdstp://traffic-director-c2p.xds.googleapis.com/envoy.config.cluster.v3.Cluster/google_cfe_", // "xdstp://traffic-director-c2p.xds.googleapis.com/envoy.config.cluster.v3.Cluster/google_cfe_",
// use TLS // use TLS
// - otherwise, use ALTS // - otherwise, use ALTS
//
// - else, do TLS // - else, do TLS
// //
// On the server, ServerHandshake always does TLS. // On the server, ServerHandshake always does TLS.

View File

@ -23,7 +23,7 @@
// reported. If local credentials is not used in local connections // reported. If local credentials is not used in local connections
// (local TCP or UDS), it will fail. // (local TCP or UDS), it will fail.
// //
// Experimental // # Experimental
// //
// Notice: This package is EXPERIMENTAL and may be changed or removed in a // Notice: This package is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.

View File

@ -19,7 +19,7 @@
// Package sts implements call credentials using STS (Security Token Service) as // Package sts implements call credentials using STS (Security Token Service) as
// defined in https://tools.ietf.org/html/rfc8693. // defined in https://tools.ietf.org/html/rfc8693.
// //
// Experimental // # Experimental
// //
// Notice: All APIs in this package are experimental and may be changed or // Notice: All APIs in this package are experimental and may be changed or
// removed in a later release. // removed in a later release.
@ -245,12 +245,12 @@ func (c *callCreds) cachedMetadata() map[string]string {
// constructRequest creates the STS request body in JSON based on the provided // constructRequest creates the STS request body in JSON based on the provided
// options. // options.
// - Contents of the subjectToken are read from the file specified in // - Contents of the subjectToken are read from the file specified in
// options. If we encounter an error here, we bail out. // options. If we encounter an error here, we bail out.
// - Contents of the actorToken are read from the file specified in options. // - Contents of the actorToken are read from the file specified in options.
// If we encounter an error here, we ignore this field because this is // If we encounter an error here, we ignore this field because this is
// optional. // optional.
// - Most of the other fields in the request come directly from options. // - Most of the other fields in the request come directly from options.
// //
// A new HTTP request is created by calling http.NewRequestWithContext() and // A new HTTP request is created by calling http.NewRequestWithContext() and
// passing the provided context, thereby enforcing any timeouts specified in // passing the provided context, thereby enforcing any timeouts specified in

View File

@ -195,7 +195,7 @@ func NewServerTLSFromFile(certFile, keyFile string) (TransportCredentials, error
// TLSChannelzSecurityValue defines the struct that TLS protocol should return // TLSChannelzSecurityValue defines the struct that TLS protocol should return
// from GetSecurityValue(), containing security info like cipher and certificate used. // from GetSecurityValue(), containing security info like cipher and certificate used.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.

View File

@ -31,11 +31,11 @@ import (
// //
// Provider implementations which choose to use a Distributor should do the // Provider implementations which choose to use a Distributor should do the
// following: // following:
// - create a new Distributor using the NewDistributor() function. // - create a new Distributor using the NewDistributor() function.
// - invoke the Set() method whenever they have new key material or errors to // - invoke the Set() method whenever they have new key material or errors to
// report. // report.
// - delegate to the distributor when handing calls to KeyMaterial(). // - delegate to the distributor when handing calls to KeyMaterial().
// - invoke the Stop() method when they are done using the distributor. // - invoke the Stop() method when they are done using the distributor.
type Distributor struct { type Distributor struct {
// mu protects the underlying key material. // mu protects the underlying key material.
mu sync.Mutex mu sync.Mutex

View File

@ -19,7 +19,7 @@
// Package pemfile provides a file watching certificate provider plugin // Package pemfile provides a file watching certificate provider plugin
// implementation which works for files with PEM contents. // implementation which works for files with PEM contents.
// //
// Experimental // # Experimental
// //
// Notice: All APIs in this package are experimental and may be removed in a // Notice: All APIs in this package are experimental and may be removed in a
// later release. // later release.

View File

@ -18,7 +18,7 @@
// Package certprovider defines APIs for Certificate Providers in gRPC. // Package certprovider defines APIs for Certificate Providers in gRPC.
// //
// Experimental // # Experimental
// //
// Notice: All APIs in this package are experimental and may be removed in a // Notice: All APIs in this package are experimental and may be removed in a
// later release. // later release.

View File

@ -19,7 +19,7 @@
// Package encoding defines the interface for the compressor and codec, and // Package encoding defines the interface for the compressor and codec, and
// functions to register and retrieve compressors and codecs. // functions to register and retrieve compressors and codecs.
// //
// Experimental // # Experimental
// //
// Notice: This package is EXPERIMENTAL and may be changed or removed in a // Notice: This package is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.

View File

@ -19,7 +19,7 @@
// Package gzip implements and registers the gzip compressor // Package gzip implements and registers the gzip compressor
// during the initialization. // during the initialization.
// //
// Experimental // # Experimental
// //
// Notice: This package is EXPERIMENTAL and may be changed or removed in a // Notice: This package is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.

View File

@ -19,7 +19,7 @@
// Package observability implements the tracing, metrics, and logging data // Package observability implements the tracing, metrics, and logging data
// collection, and provides controlling knobs via a config file. // collection, and provides controlling knobs via a config file.
// //
// Experimental // # Experimental
// //
// Notice: This package is EXPERIMENTAL and may be changed or removed in a // Notice: This package is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.

View File

@ -242,7 +242,7 @@ func (g *loggerT) V(l int) bool {
// DepthLoggerV2, the below functions will be called with the appropriate stack // DepthLoggerV2, the below functions will be called with the appropriate stack
// depth set for trivial functions the logger may ignore. // depth set for trivial functions the logger may ignore.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.

View File

@ -52,7 +52,8 @@ func TestLoggerV2Severity(t *testing.T) {
} }
// check if b is in the format of: // check if b is in the format of:
// 2017/04/07 14:55:42 WARNING: WARNING //
// 2017/04/07 14:55:42 WARNING: WARNING
func checkLogForSeverity(s int, b []byte) error { func checkLogForSeverity(s int, b []byte) error {
expected := regexp.MustCompile(fmt.Sprintf(`^[0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} %s: %s\n$`, severityName[s], severityName[s])) expected := regexp.MustCompile(fmt.Sprintf(`^[0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} %s: %s\n$`, severityName[s], severityName[s]))
if m := expected.Match(b); !m { if m := expected.Match(b); !m {

View File

@ -185,19 +185,19 @@ func (sbc *subBalancerWrapper) stopBalancer() {
// intended to be used directly as a balancer. It's expected to be used as a // intended to be used directly as a balancer. It's expected to be used as a
// sub-balancer manager by a high level balancer. // sub-balancer manager by a high level balancer.
// //
// Updates from ClientConn are forwarded to sub-balancers // Updates from ClientConn are forwarded to sub-balancers
// - service config update // - service config update
// - address update // - address update
// - subConn state change // - subConn state change
// - find the corresponding balancer and forward // - find the corresponding balancer and forward
// //
// Actions from sub-balances are forwarded to parent ClientConn // Actions from sub-balances are forwarded to parent ClientConn
// - new/remove SubConn // - new/remove SubConn
// - picker update and health states change // - picker update and health states change
// - sub-pickers are sent to an aggregator provided by the parent, which // - sub-pickers are sent to an aggregator provided by the parent, which
// will group them into a group-picker. The aggregated connectivity state is // will group them into a group-picker. The aggregated connectivity state is
// also handled by the aggregator. // also handled by the aggregator.
// - resolveNow // - resolveNow
// //
// Sub-balancers are only built when the balancer group is started. If the // Sub-balancers are only built when the balancer group is started. If the
// balancer group is closed, the sub-balancers are also closed. And it's // balancer group is closed, the sub-balancers are also closed. And it's

View File

@ -167,8 +167,9 @@ func (s) TestBalancerGroup_start_close(t *testing.T) {
// into balancer group inline when it gets an update. // into balancer group inline when it gets an update.
// //
// The potential deadlock can happen if we // The potential deadlock can happen if we
// - hold a lock and send updates to balancer (e.g. update resolved addresses) // - hold a lock and send updates to balancer (e.g. update resolved addresses)
// - the balancer calls back (NewSubConn or update picker) in line // - the balancer calls back (NewSubConn or update picker) in line
//
// The callback will try to hold hte same lock again, which will cause a // The callback will try to hold hte same lock again, which will cause a
// deadlock. // deadlock.
// //

View File

@ -30,15 +30,15 @@ import (
// to build a new logger and assign it to binarylog.Logger. // to build a new logger and assign it to binarylog.Logger.
// //
// Example filter config strings: // Example filter config strings:
// - "" Nothing will be logged // - "" Nothing will be logged
// - "*" All headers and messages will be fully logged. // - "*" All headers and messages will be fully logged.
// - "*{h}" Only headers will be logged. // - "*{h}" Only headers will be logged.
// - "*{m:256}" Only the first 256 bytes of each message will be logged. // - "*{m:256}" Only the first 256 bytes of each message will be logged.
// - "Foo/*" Logs every method in service Foo // - "Foo/*" Logs every method in service Foo
// - "Foo/*,-Foo/Bar" Logs every method in service Foo except method /Foo/Bar // - "Foo/*,-Foo/Bar" Logs every method in service Foo except method /Foo/Bar
// - "Foo/*,Foo/Bar{m:256}" Logs the first 256 bytes of each message in method // - "Foo/*,Foo/Bar{m:256}" Logs the first 256 bytes of each message in method
// /Foo/Bar, logs all headers and messages in every other method in service // /Foo/Bar, logs all headers and messages in every other method in service
// Foo. // Foo.
// //
// If two configs exist for one certain method or service, the one specified // If two configs exist for one certain method or service, the one specified
// later overrides the previous config. // later overrides the previous config.

View File

@ -273,10 +273,10 @@ func (c *channel) deleteSelfFromMap() (delete bool) {
// deleteSelfIfReady tries to delete the channel itself from the channelz database. // deleteSelfIfReady tries to delete the channel itself from the channelz database.
// The delete process includes two steps: // The delete process includes two steps:
// 1. delete the channel from the entry relation tree, i.e. delete the channel reference from its // 1. delete the channel from the entry relation tree, i.e. delete the channel reference from its
// parent's child list. // parent's child list.
// 2. delete the channel from the map, i.e. delete the channel entirely from channelz. Lookup by id // 2. delete the channel from the map, i.e. delete the channel entirely from channelz. Lookup by id
// will return entry not found error. // will return entry not found error.
func (c *channel) deleteSelfIfReady() { func (c *channel) deleteSelfIfReady() {
if !c.deleteSelfFromTree() { if !c.deleteSelfFromTree() {
return return
@ -381,10 +381,10 @@ func (sc *subChannel) deleteSelfFromMap() (delete bool) {
// deleteSelfIfReady tries to delete the subchannel itself from the channelz database. // deleteSelfIfReady tries to delete the subchannel itself from the channelz database.
// The delete process includes two steps: // The delete process includes two steps:
// 1. delete the subchannel from the entry relation tree, i.e. delete the subchannel reference from // 1. delete the subchannel from the entry relation tree, i.e. delete the subchannel reference from
// its parent's child list. // its parent's child list.
// 2. delete the subchannel from the map, i.e. delete the subchannel entirely from channelz. Lookup // 2. delete the subchannel from the map, i.e. delete the subchannel entirely from channelz. Lookup
// by id will return entry not found error. // by id will return entry not found error.
func (sc *subChannel) deleteSelfIfReady() { func (sc *subChannel) deleteSelfIfReady() {
if !sc.deleteSelfFromTree() { if !sc.deleteSelfFromTree() {
return return

View File

@ -110,7 +110,7 @@ type LoggerV2 interface {
// This is a copy of the DepthLoggerV2 defined in the external grpclog package. // This is a copy of the DepthLoggerV2 defined in the external grpclog package.
// It is defined here to avoid a circular dependency. // It is defined here to avoid a circular dependency.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.

View File

@ -79,10 +79,12 @@ func getTestFunc(t *testing.T, xv reflect.Value, name string) func(*testing.T) {
// functions, respectively. // functions, respectively.
// //
// For example usage, see example_test.go. Run it using: // For example usage, see example_test.go. Run it using:
// $ go test -v -run TestExample . //
// $ go test -v -run TestExample .
// //
// To run a specific test/subtest: // To run a specific test/subtest:
// $ go test -v -run 'TestExample/^Something$' . //
// $ go test -v -run 'TestExample/^Something$' .
func RunSubTests(t *testing.T, x interface{}) { func RunSubTests(t *testing.T, x interface{}) {
xt := reflect.TypeOf(x) xt := reflect.TypeOf(x)
xv := reflect.ValueOf(x) xv := reflect.ValueOf(x)

View File

@ -25,7 +25,6 @@ import (
// ParseMethod splits service and method from the input. It expects format // ParseMethod splits service and method from the input. It expects format
// "/service/method". // "/service/method".
//
func ParseMethod(methodName string) (service, method string, _ error) { func ParseMethod(methodName string) (service, method string, _ error) {
if !strings.HasPrefix(methodName, "/") { if !strings.HasPrefix(methodName, "/") {
return "", "", errors.New("invalid method name: should start with /") return "", "", errors.New("invalid method name: should start with /")

View File

@ -70,26 +70,29 @@ func Set(addr resolver.Address, path []string) resolver.Address {
// //
// Input: // Input:
// [ // [
// {addr0, path: [p0, wt0]} //
// {addr1, path: [p0, wt1]} // {addr0, path: [p0, wt0]}
// {addr2, path: [p1, wt2]} // {addr1, path: [p0, wt1]}
// {addr3, path: [p1, wt3]} // {addr2, path: [p1, wt2]}
// {addr3, path: [p1, wt3]}
//
// ] // ]
// //
// Addresses will be split into p0/p1, and the p0/p1 will be removed from the // Addresses will be split into p0/p1, and the p0/p1 will be removed from the
// path. // path.
// //
// Output: // Output:
// { //
// p0: [ // {
// {addr0, path: [wt0]}, // p0: [
// {addr1, path: [wt1]}, // {addr0, path: [wt0]},
// ], // {addr1, path: [wt1]},
// p1: [ // ],
// {addr2, path: [wt2]}, // p1: [
// {addr3, path: [wt3]}, // {addr2, path: [wt2]},
// ], // {addr3, path: [wt3]},
// } // ],
// }
// //
// If hierarchical path is not set, or has no path in it, the address is // If hierarchical path is not set, or has no path in it, the address is
// dropped. // dropped.

View File

@ -33,48 +33,48 @@ import (
// //
// Several other approaches were considered before arriving at this: // Several other approaches were considered before arriving at this:
// //
// 1. Using a CGO module: CGO usually has access to some things that regular // 1. Using a CGO module: CGO usually has access to some things that regular
// Go does not. Till go1.4, CGO used to have access to the goroutine struct // Go does not. Till go1.4, CGO used to have access to the goroutine struct
// because the Go runtime was written in C. However, 1.5+ uses a native Go // because the Go runtime was written in C. However, 1.5+ uses a native Go
// runtime; as a result, CGO does not have access to the goroutine structure // runtime; as a result, CGO does not have access to the goroutine structure
// anymore in modern Go. Besides, CGO interop wasn't fast enough (estimated // anymore in modern Go. Besides, CGO interop wasn't fast enough (estimated
// to be ~170ns/op). This would also make building grpc require a C // to be ~170ns/op). This would also make building grpc require a C
// compiler, which isn't a requirement currently, breaking a lot of stuff. // compiler, which isn't a requirement currently, breaking a lot of stuff.
// //
// 2. Using runtime.Stack stacktrace: While this would remove the need for a // 2. Using runtime.Stack stacktrace: While this would remove the need for a
// modified Go runtime, this is ridiculously slow, thanks to the all the // modified Go runtime, this is ridiculously slow, thanks to the all the
// string processing shenanigans required to extract the goroutine ID (about // string processing shenanigans required to extract the goroutine ID (about
// ~2000ns/op). // ~2000ns/op).
// //
// 3. Using Go version-specific build tags: For any given Go version, the // 3. Using Go version-specific build tags: For any given Go version, the
// goroutine struct has a fixed structure. As a result, the goroutine ID // goroutine struct has a fixed structure. As a result, the goroutine ID
// could be extracted if we know the offset using some assembly. This would // could be extracted if we know the offset using some assembly. This would
// be faster then #1 and #2, but is harder to maintain. This would require // be faster then #1 and #2, but is harder to maintain. This would require
// special Go code that's both architecture-specific and go version-specific // special Go code that's both architecture-specific and go version-specific
// (a quadratic number of variants to maintain). // (a quadratic number of variants to maintain).
// //
// 4. This approach, which requires a simple modification [1] to the Go runtime // 4. This approach, which requires a simple modification [1] to the Go runtime
// to expose the current goroutine's ID. This is the chosen approach and it // to expose the current goroutine's ID. This is the chosen approach and it
// takes about ~2 ns/op, which is negligible in the face of the tens of // takes about ~2 ns/op, which is negligible in the face of the tens of
// microseconds that grpc takes to complete a RPC request. // microseconds that grpc takes to complete a RPC request.
// //
// [1] To make the goroutine ID visible to Go programs apply the following // [1] To make the goroutine ID visible to Go programs apply the following
// change to the runtime2.go file in your Go runtime installation: // change to the runtime2.go file in your Go runtime installation:
// //
// diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go // diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
// --- a/src/runtime/runtime2.go // --- a/src/runtime/runtime2.go
// +++ b/src/runtime/runtime2.go // +++ b/src/runtime/runtime2.go
// @@ -392,6 +392,10 @@ type stack struct { // @@ -392,6 +392,10 @@ type stack struct {
// hi uintptr // hi uintptr
// } // }
// //
// +func Goid() int64 { // +func Goid() int64 {
// + return getg().goid // + return getg().goid
// +} // +}
// + // +
// type g struct { // type g struct {
// // Stack parameters. // // Stack parameters.
// // stack describes the actual stack memory: [stack.lo, stack.hi). // // stack describes the actual stack memory: [stack.lo, stack.hi).
// //
// The exposed runtime.Goid() function will return a int64 goroutine ID. // The exposed runtime.Goid() function will return a int64 goroutine ID.
func goid() int64 { func goid() int64 {

View File

@ -204,8 +204,10 @@ func (x *GrpcKeyBuilder) GetConstantKeys() map[string]string {
// //
// For a service where the project id can be expressed either as a subdomain or // For a service where the project id can be expressed either as a subdomain or
// in the path, separate HttpKeyBuilders must be used: // in the path, separate HttpKeyBuilders must be used:
// host_pattern: 'example.com' path_pattern: '/{id}/{object}/**' //
// host_pattern: '{id}.example.com' path_pattern: '/{object}/**' // host_pattern: 'example.com' path_pattern: '/{id}/{object}/**'
// host_pattern: '{id}.example.com' path_pattern: '/{object}/**'
//
// If the host is exactly 'example.com', the first path segment will be used as // If the host is exactly 'example.com', the first path segment will be used as
// the id and the second segment as the object. If the host has a subdomain, the // the id and the second segment as the object. If the host has a subdomain, the
// subdomain will be used as the id and the first segment as the object. If // subdomain will be used as the id and the first segment as the object. If
@ -223,7 +225,7 @@ type HttpKeyBuilder struct {
// - "*": Matches any single label. // - "*": Matches any single label.
// - "**": Matches zero or more labels (first or last part of host only). // - "**": Matches zero or more labels (first or last part of host only).
// - "{<name>=...}": One or more label capture, where "..." can be any // - "{<name>=...}": One or more label capture, where "..." can be any
// template that does not include a capture. // template that does not include a capture.
// - "{<name>}": A single label capture. Identical to {<name>=*}. // - "{<name>}": A single label capture. Identical to {<name>=*}.
// //
// Examples: // Examples:
@ -242,8 +244,9 @@ type HttpKeyBuilder struct {
// - "*": Matches any single segment. // - "*": Matches any single segment.
// - "**": Matches zero or more segments (first or last part of path only). // - "**": Matches zero or more segments (first or last part of path only).
// - "{<name>=...}": One or more segment capture, where "..." can be any // - "{<name>=...}": One or more segment capture, where "..." can be any
// template that does not include a capture. // template that does not include a capture.
// - "{<name>}": A single segment capture. Identical to {<name>=*}. // - "{<name>}": A single segment capture. Identical to {<name>=*}.
//
// A custom method may also be specified by appending ":" and the custom // A custom method may also be specified by appending ":" and the custom
// method name or "*" to indicate any custom method (including no custom // method name or "*" to indicate any custom method (including no custom
// method). For example, "/*/projects/{project_id}/**:*" extracts // method). For example, "/*/projects/{project_id}/**:*" extracts

View File

@ -67,10 +67,10 @@ func (bc *BalancerConfig) MarshalJSON() ([]byte, error) {
// ServiceConfig contains a list of loadBalancingConfigs, each with a name and // ServiceConfig contains a list of loadBalancingConfigs, each with a name and
// config. This method iterates through that list in order, and stops at the // config. This method iterates through that list in order, and stops at the
// first policy that is supported. // first policy that is supported.
// - If the config for the first supported policy is invalid, the whole service // - If the config for the first supported policy is invalid, the whole service
// config is invalid. // config is invalid.
// - If the list doesn't contain any supported policy, the whole service config // - If the list doesn't contain any supported policy, the whole service config
// is invalid. // is invalid.
func (bc *BalancerConfig) UnmarshalJSON(b []byte) error { func (bc *BalancerConfig) UnmarshalJSON(b []byte) error {
var ir intermediateBalancerConfig var ir intermediateBalancerConfig
err := json.Unmarshal(b, &ir) err := json.Unmarshal(b, &ir)

View File

@ -290,16 +290,16 @@ func (tcc *TestClientConn) WaitForPicker(ctx context.Context, f func(balancer.Pi
// Step 1. the return values of f should form a permutation of all elements in // Step 1. the return values of f should form a permutation of all elements in
// want, but not necessary in the same order. E.g. if want is {a,a,b}, the check // want, but not necessary in the same order. E.g. if want is {a,a,b}, the check
// fails if f returns: // fails if f returns:
// - {a,a,a}: third a is returned before b // - {a,a,a}: third a is returned before b
// - {a,b,b}: second b is returned before the second a // - {a,b,b}: second b is returned before the second a
// //
// If error is found in this step, the returned error contains only the first // If error is found in this step, the returned error contains only the first
// iteration until where it goes wrong. // iteration until where it goes wrong.
// //
// Step 2. the return values of f should be repetitions of the same permutation. // Step 2. the return values of f should be repetitions of the same permutation.
// E.g. if want is {a,a,b}, the check failes if f returns: // E.g. if want is {a,a,b}, the check failes if f returns:
// - {a,b,a,b,a,a}: though it satisfies step 1, the second iteration is not // - {a,b,a,b,a,a}: though it satisfies step 1, the second iteration is not
// repeating the first iteration. // repeating the first iteration.
// //
// If error is found in this step, the returned error contains the first // If error is found in this step, the returned error contains the first
// iteration + the second iteration until where it goes wrong. // iteration + the second iteration until where it goes wrong.

View File

@ -442,10 +442,10 @@ func (ht *serverHandlerTransport) Drain() {
// mapRecvMsgError returns the non-nil err into the appropriate // mapRecvMsgError returns the non-nil err into the appropriate
// error value as expected by callers of *grpc.parser.recvMsg. // error value as expected by callers of *grpc.parser.recvMsg.
// In particular, in can only be: // In particular, in can only be:
// * io.EOF // - io.EOF
// * io.ErrUnexpectedEOF // - io.ErrUnexpectedEOF
// * of type transport.ConnectionError // - of type transport.ConnectionError
// * an error from the status package // - an error from the status package
func mapRecvMsgError(err error) error { func mapRecvMsgError(err error) error {
if err == io.EOF || err == io.ErrUnexpectedEOF { if err == io.EOF || err == io.ErrUnexpectedEOF {
return err return err

View File

@ -661,13 +661,13 @@ func (t *http2Client) getCallAuthData(ctx context.Context, audience string, call
// NewStream errors result in transparent retry, as they mean nothing went onto // NewStream errors result in transparent retry, as they mean nothing went onto
// the wire. However, there are two notable exceptions: // the wire. However, there are two notable exceptions:
// //
// 1. If the stream headers violate the max header list size allowed by the // 1. If the stream headers violate the max header list size allowed by the
// server. It's possible this could succeed on another transport, even if // server. It's possible this could succeed on another transport, even if
// it's unlikely, but do not transparently retry. // it's unlikely, but do not transparently retry.
// 2. If the credentials errored when requesting their headers. In this case, // 2. If the credentials errored when requesting their headers. In this case,
// it's possible a retry can fix the problem, but indefinitely transparently // it's possible a retry can fix the problem, but indefinitely transparently
// retrying is not appropriate as it is likely the credentials, if they can // retrying is not appropriate as it is likely the credentials, if they can
// eventually succeed, would need I/O to do so. // eventually succeed, would need I/O to do so.
type NewStreamError struct { type NewStreamError struct {
Err error Err error

View File

@ -2005,7 +2005,7 @@ func (s) TestPingPong1MB(t *testing.T) {
runPingPongTest(t, 1048576) runPingPongTest(t, 1048576)
} }
//This is a stress-test of flow control logic. // This is a stress-test of flow control logic.
func runPingPongTest(t *testing.T, msgSize int) { func runPingPongTest(t *testing.T, msgSize int) {
server, client, cancel := setUp(t, 0, 0, pingpong) server, client, cancel := setUp(t, 0, 0, pingpong)
defer cancel() defer cancel()

View File

@ -300,6 +300,7 @@ type LoadParams struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// Types that are assignable to Load: // Types that are assignable to Load:
//
// *LoadParams_ClosedLoop // *LoadParams_ClosedLoop
// *LoadParams_Poisson // *LoadParams_Poisson
Load isLoadParams_Load `protobuf_oneof:"load"` Load isLoadParams_Load `protobuf_oneof:"load"`
@ -445,6 +446,7 @@ type ChannelArg struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// Types that are assignable to Value: // Types that are assignable to Value:
//
// *ChannelArg_StrValue // *ChannelArg_StrValue
// *ChannelArg_IntValue // *ChannelArg_IntValue
Value isChannelArg_Value `protobuf_oneof:"value"` Value isChannelArg_Value `protobuf_oneof:"value"`
@ -834,6 +836,7 @@ type ClientArgs struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// Types that are assignable to Argtype: // Types that are assignable to Argtype:
//
// *ClientArgs_Setup // *ClientArgs_Setup
// *ClientArgs_Mark // *ClientArgs_Mark
Argtype isClientArgs_Argtype `protobuf_oneof:"argtype"` Argtype isClientArgs_Argtype `protobuf_oneof:"argtype"`
@ -1061,6 +1064,7 @@ type ServerArgs struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// Types that are assignable to Argtype: // Types that are assignable to Argtype:
//
// *ServerArgs_Setup // *ServerArgs_Setup
// *ServerArgs_Mark // *ServerArgs_Mark
Argtype isServerArgs_Argtype `protobuf_oneof:"argtype"` Argtype isServerArgs_Argtype `protobuf_oneof:"argtype"`

View File

@ -148,6 +148,7 @@ type Metric struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// Types that are assignable to Value: // Types that are assignable to Value:
//
// *Metric_Count // *Metric_Count
// *Metric_Histogram // *Metric_Histogram
Value isMetric_Value `protobuf_oneof:"value"` Value isMetric_Value `protobuf_oneof:"value"`

View File

@ -43,10 +43,9 @@ const _ = proto.ProtoPackageIsVersion4
// messages in your project. A typical example is to use it as argument or the // messages in your project. A typical example is to use it as argument or the
// return value of a service API. For instance: // return value of a service API. For instance:
// //
// service Foo { // service Foo {
// rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { }; // rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { };
// }; // };
//
type Empty struct { type Empty struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache

View File

@ -193,6 +193,7 @@ type PayloadConfig struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// Types that are assignable to Payload: // Types that are assignable to Payload:
//
// *PayloadConfig_BytebufParams // *PayloadConfig_BytebufParams
// *PayloadConfig_SimpleParams // *PayloadConfig_SimpleParams
// *PayloadConfig_ComplexParams // *PayloadConfig_ComplexParams

View File

@ -340,7 +340,8 @@ type rpcConfig struct {
} }
// parseRPCMetadata turns EmptyCall:key1:value1 into // parseRPCMetadata turns EmptyCall:key1:value1 into
// {typ: emptyCall, md: {key1:value1}}. //
// {typ: emptyCall, md: {key1:value1}}.
func parseRPCMetadata(rpcMetadataStr string, rpcs []string) []*rpcConfig { func parseRPCMetadata(rpcMetadataStr string, rpcs []string) []*rpcConfig {
rpcMetadataSplit := strings.Split(rpcMetadataStr, ",") rpcMetadataSplit := strings.Split(rpcMetadataStr, ",")
rpcsToMD := make(map[string][]string) rpcsToMD := make(map[string][]string)

View File

@ -41,10 +41,11 @@ type MD map[string][]string
// New creates an MD from a given key-value map. // New creates an MD from a given key-value map.
// //
// Only the following ASCII characters are allowed in keys: // Only the following ASCII characters are allowed in keys:
// - digits: 0-9 // - digits: 0-9
// - uppercase letters: A-Z (normalized to lower) // - uppercase letters: A-Z (normalized to lower)
// - lowercase letters: a-z // - lowercase letters: a-z
// - special characters: -_. // - special characters: -_.
//
// Uppercase letters are automatically converted to lowercase. // Uppercase letters are automatically converted to lowercase.
// //
// Keys beginning with "grpc-" are reserved for grpc-internal use only and may // Keys beginning with "grpc-" are reserved for grpc-internal use only and may
@ -62,10 +63,11 @@ func New(m map[string]string) MD {
// Pairs panics if len(kv) is odd. // Pairs panics if len(kv) is odd.
// //
// Only the following ASCII characters are allowed in keys: // Only the following ASCII characters are allowed in keys:
// - digits: 0-9 // - digits: 0-9
// - uppercase letters: A-Z (normalized to lower) // - uppercase letters: A-Z (normalized to lower)
// - lowercase letters: a-z // - lowercase letters: a-z
// - special characters: -_. // - special characters: -_.
//
// Uppercase letters are automatically converted to lowercase. // Uppercase letters are automatically converted to lowercase.
// //
// Keys beginning with "grpc-" are reserved for grpc-internal use only and may // Keys beginning with "grpc-" are reserved for grpc-internal use only and may
@ -196,7 +198,7 @@ func FromIncomingContext(ctx context.Context) (MD, bool) {
// ValueFromIncomingContext returns the metadata value corresponding to the metadata // ValueFromIncomingContext returns the metadata value corresponding to the metadata
// key from the incoming metadata if it exists. Key must be lower-case. // key from the incoming metadata if it exists. Key must be lower-case.
// //
// Experimental // # Experimental
// //
// Notice: This API is EXPERIMENTAL and may be changed or removed in a // Notice: This API is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.

View File

@ -20,7 +20,7 @@
// Envoy) on the data plane. In a proxyless world with gRPC enabled // Envoy) on the data plane. In a proxyless world with gRPC enabled
// applications, aggregation of such reports will be done by the gRPC client. // applications, aggregation of such reports will be done by the gRPC client.
// //
// Experimental // # Experimental
// //
// Notice: All APIs is this package are EXPERIMENTAL and may be changed or // Notice: All APIs is this package are EXPERIMENTAL and may be changed or
// removed in a later release. // removed in a later release.

View File

@ -25,7 +25,7 @@ import (
// PreparedMsg is responsible for creating a Marshalled and Compressed object. // PreparedMsg is responsible for creating a Marshalled and Compressed object.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.

View File

@ -18,7 +18,7 @@
// Package profiling exposes methods to manage profiling within gRPC. // Package profiling exposes methods to manage profiling within gRPC.
// //
// Experimental // # Experimental
// //
// Notice: This package is EXPERIMENTAL and may be changed or removed in a // Notice: This package is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.

View File

@ -21,7 +21,7 @@
// queried by a client to remotely manage the gRPC profiling behaviour of an // queried by a client to remotely manage the gRPC profiling behaviour of an
// application. // application.
// //
// Experimental // # Experimental
// //
// Notice: This package is EXPERIMENTAL and may be changed or removed in a // Notice: This package is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.

View File

@ -53,6 +53,7 @@ type ServerReflectionRequest struct {
// defined field and then handles them using corresponding methods. // defined field and then handles them using corresponding methods.
// //
// Types that are assignable to MessageRequest: // Types that are assignable to MessageRequest:
//
// *ServerReflectionRequest_FileByFilename // *ServerReflectionRequest_FileByFilename
// *ServerReflectionRequest_FileContainingSymbol // *ServerReflectionRequest_FileContainingSymbol
// *ServerReflectionRequest_FileContainingExtension // *ServerReflectionRequest_FileContainingExtension
@ -263,6 +264,7 @@ type ServerReflectionResponse struct {
// message_request in the request. // message_request in the request.
// //
// Types that are assignable to MessageResponse: // Types that are assignable to MessageResponse:
//
// *ServerReflectionResponse_FileDescriptorResponse // *ServerReflectionResponse_FileDescriptorResponse
// *ServerReflectionResponse_AllExtensionNumbersResponse // *ServerReflectionResponse_AllExtensionNumbersResponse
// *ServerReflectionResponse_ListServicesResponse // *ServerReflectionResponse_ListServicesResponse

View File

@ -23,9 +23,11 @@
Package grpc_testing_not_regenerate is a generated protocol buffer package. Package grpc_testing_not_regenerate is a generated protocol buffer package.
It is generated from these files: It is generated from these files:
testv3.proto testv3.proto
It has these top-level messages: It has these top-level messages:
SearchResponseV3 SearchResponseV3
SearchRequestV3 SearchRequestV3
*/ */

View File

@ -23,6 +23,7 @@ The service implemented is defined in:
https://github.com/grpc/grpc/blob/master/src/proto/grpc/reflection/v1alpha/reflection.proto. https://github.com/grpc/grpc/blob/master/src/proto/grpc/reflection/v1alpha/reflection.proto.
To register server reflection on a gRPC server: To register server reflection on a gRPC server:
import "google.golang.org/grpc/reflection" import "google.golang.org/grpc/reflection"
s := grpc.NewServer() s := grpc.NewServer()
@ -32,7 +33,6 @@ To register server reflection on a gRPC server:
reflection.Register(s) reflection.Register(s)
s.Serve(lis) s.Serve(lis)
*/ */
package reflection // import "google.golang.org/grpc/reflection" package reflection // import "google.golang.org/grpc/reflection"
@ -74,7 +74,7 @@ func Register(s GRPCServer) {
// for a custom implementation to return zero values for the // for a custom implementation to return zero values for the
// grpc.ServiceInfo values in the map. // grpc.ServiceInfo values in the map.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -85,7 +85,7 @@ type ServiceInfoProvider interface {
// ExtensionResolver is the interface used to query details about extensions. // ExtensionResolver is the interface used to query details about extensions.
// This interface is satisfied by protoregistry.GlobalTypes. // This interface is satisfied by protoregistry.GlobalTypes.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -96,7 +96,7 @@ type ExtensionResolver interface {
// ServerOptions represents the options used to construct a reflection server. // ServerOptions represents the options used to construct a reflection server.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -120,7 +120,7 @@ type ServerOptions struct {
// This can be used to customize behavior of the reflection service. Most usages // This can be used to customize behavior of the reflection service. Most usages
// should prefer to use Register instead. // should prefer to use Register instead.
// //
// Experimental // # Experimental
// //
// Notice: This function is EXPERIMENTAL and may be changed or removed in a // Notice: This function is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.

View File

@ -96,7 +96,7 @@ const (
// Address represents a server the client connects to. // Address represents a server the client connects to.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -236,12 +236,12 @@ type ClientConn interface {
// //
// Examples: // Examples:
// //
// - "dns://some_authority/foo.bar" // - "dns://some_authority/foo.bar"
// Target{Scheme: "dns", Authority: "some_authority", Endpoint: "foo.bar"} // Target{Scheme: "dns", Authority: "some_authority", Endpoint: "foo.bar"}
// - "foo.bar" // - "foo.bar"
// Target{Scheme: resolver.GetDefaultScheme(), Endpoint: "foo.bar"} // Target{Scheme: resolver.GetDefaultScheme(), Endpoint: "foo.bar"}
// - "unknown_scheme://authority/endpoint" // - "unknown_scheme://authority/endpoint"
// Target{Scheme: resolver.GetDefaultScheme(), Endpoint: "unknown_scheme://authority/endpoint"} // Target{Scheme: resolver.GetDefaultScheme(), Endpoint: "unknown_scheme://authority/endpoint"}
type Target struct { type Target struct {
// Deprecated: use URL.Scheme instead. // Deprecated: use URL.Scheme instead.
Scheme string Scheme string

View File

@ -198,7 +198,7 @@ func Header(md *metadata.MD) CallOption {
// HeaderCallOption is a CallOption for collecting response header metadata. // HeaderCallOption is a CallOption for collecting response header metadata.
// The metadata field will be populated *after* the RPC completes. // The metadata field will be populated *after* the RPC completes.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -220,7 +220,7 @@ func Trailer(md *metadata.MD) CallOption {
// TrailerCallOption is a CallOption for collecting response trailer metadata. // TrailerCallOption is a CallOption for collecting response trailer metadata.
// The metadata field will be populated *after* the RPC completes. // The metadata field will be populated *after* the RPC completes.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -242,7 +242,7 @@ func Peer(p *peer.Peer) CallOption {
// PeerCallOption is a CallOption for collecting the identity of the remote // PeerCallOption is a CallOption for collecting the identity of the remote
// peer. The peer field will be populated *after* the RPC completes. // peer. The peer field will be populated *after* the RPC completes.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -282,7 +282,7 @@ func FailFast(failFast bool) CallOption {
// FailFastCallOption is a CallOption for indicating whether an RPC should fail // FailFastCallOption is a CallOption for indicating whether an RPC should fail
// fast or not. // fast or not.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -305,7 +305,7 @@ func MaxCallRecvMsgSize(bytes int) CallOption {
// MaxRecvMsgSizeCallOption is a CallOption that indicates the maximum message // MaxRecvMsgSizeCallOption is a CallOption that indicates the maximum message
// size in bytes the client can receive. // size in bytes the client can receive.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -328,7 +328,7 @@ func MaxCallSendMsgSize(bytes int) CallOption {
// MaxSendMsgSizeCallOption is a CallOption that indicates the maximum message // MaxSendMsgSizeCallOption is a CallOption that indicates the maximum message
// size in bytes the client can send. // size in bytes the client can send.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -351,7 +351,7 @@ func PerRPCCredentials(creds credentials.PerRPCCredentials) CallOption {
// PerRPCCredsCallOption is a CallOption that indicates the per-RPC // PerRPCCredsCallOption is a CallOption that indicates the per-RPC
// credentials to use for the call. // credentials to use for the call.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -369,7 +369,7 @@ func (o PerRPCCredsCallOption) after(c *callInfo, attempt *csAttempt) {}
// sending the request. If WithCompressor is also set, UseCompressor has // sending the request. If WithCompressor is also set, UseCompressor has
// higher priority. // higher priority.
// //
// Experimental // # Experimental
// //
// Notice: This API is EXPERIMENTAL and may be changed or removed in a // Notice: This API is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -379,7 +379,7 @@ func UseCompressor(name string) CallOption {
// CompressorCallOption is a CallOption that indicates the compressor to use. // CompressorCallOption is a CallOption that indicates the compressor to use.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -416,7 +416,7 @@ func CallContentSubtype(contentSubtype string) CallOption {
// ContentSubtypeCallOption is a CallOption that indicates the content-subtype // ContentSubtypeCallOption is a CallOption that indicates the content-subtype
// used for marshaling messages. // used for marshaling messages.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -444,7 +444,7 @@ func (o ContentSubtypeCallOption) after(c *callInfo, attempt *csAttempt) {}
// This function is provided for advanced users; prefer to use only // This function is provided for advanced users; prefer to use only
// CallContentSubtype to select a registered codec instead. // CallContentSubtype to select a registered codec instead.
// //
// Experimental // # Experimental
// //
// Notice: This API is EXPERIMENTAL and may be changed or removed in a // Notice: This API is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -455,7 +455,7 @@ func ForceCodec(codec encoding.Codec) CallOption {
// ForceCodecCallOption is a CallOption that indicates the codec used for // ForceCodecCallOption is a CallOption that indicates the codec used for
// marshaling messages. // marshaling messages.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -480,7 +480,7 @@ func CallCustomCodec(codec Codec) CallOption {
// CustomCodecCallOption is a CallOption that indicates the codec used for // CustomCodecCallOption is a CallOption that indicates the codec used for
// marshaling messages. // marshaling messages.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -497,7 +497,7 @@ func (o CustomCodecCallOption) after(c *callInfo, attempt *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.
// //
// Experimental // # Experimental
// //
// Notice: This API is EXPERIMENTAL and may be changed or removed in a // Notice: This API is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -508,7 +508,7 @@ func MaxRetryRPCBufferSize(bytes int) CallOption {
// MaxRetryRPCBufferSizeCallOption is a CallOption indicating the amount of // MaxRetryRPCBufferSizeCallOption is a CallOption indicating the amount of
// memory to be used for caching this RPC for retry purposes. // memory to be used for caching this RPC for retry purposes.
// //
// Experimental // # Experimental
// //
// Notice: This type is EXPERIMENTAL and may be changed or removed in a // Notice: This type is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.
@ -548,10 +548,11 @@ type parser struct {
// format. The caller owns the returned msg memory. // format. The caller owns the returned msg memory.
// //
// If there is an error, possible values are: // If there is an error, possible values are:
// * io.EOF, when no messages remain // - io.EOF, when no messages remain
// * io.ErrUnexpectedEOF // - io.ErrUnexpectedEOF
// * of type transport.ConnectionError // - of type transport.ConnectionError
// * an error from the status package // - an error from the status package
//
// No other error values or types must be returned, which also means // No other error values or types must be returned, which also means
// that the underlying io.Reader must not return an incompatible // that the underlying io.Reader must not return an incompatible
// error. // error.

View File

@ -449,9 +449,9 @@ func (c *advancedTLSCreds) OverrideServerName(serverNameOverride string) error {
// and possibly custom verification check. // and possibly custom verification check.
// We have to build our own verification function here because current // We have to build our own verification function here because current
// tls module: // tls module:
// 1. does not have a good support on root cert reloading. // 1. does not have a good support on root cert reloading.
// 2. will ignore basic certificate check when setting InsecureSkipVerify // 2. will ignore basic certificate check when setting InsecureSkipVerify
// to true. // to true.
func buildVerifyFunc(c *advancedTLSCreds, func buildVerifyFunc(c *advancedTLSCreds,
serverName string, serverName string,
rawConn net.Conn) func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error { rawConn net.Conn) func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error {

View File

@ -150,12 +150,12 @@ func x509NameHash(r pkix.RDNSequence) string {
// CheckRevocation checks the connection for revoked certificates based on RFC5280. // CheckRevocation checks the connection for revoked certificates based on RFC5280.
// This implementation has the following major limitations: // This implementation has the following major limitations:
// * Indirect CRL files are not supported. // - Indirect CRL files are not supported.
// * CRL loading is only supported from directories in the X509_LOOKUP_hash_dir format. // - CRL loading is only supported from directories in the X509_LOOKUP_hash_dir format.
// * OnlySomeReasons is not supported. // - OnlySomeReasons is not supported.
// * Delta CRL files are not supported. // - Delta CRL files are not supported.
// * Certificate CRLDistributionPoint must be URLs, but are then ignored and converted into a file path. // - Certificate CRLDistributionPoint must be URLs, but are then ignored and converted into a file path.
// * CRL checks are done after path building, which goes against RFC4158. // - CRL checks are done after path building, which goes against RFC4158.
func CheckRevocation(conn tls.ConnectionState, cfg RevocationConfig) error { func CheckRevocation(conn tls.ConnectionState, cfg RevocationConfig) error {
return CheckChainRevocation(conn.VerifiedChains, cfg) return CheckChainRevocation(conn.VerifiedChains, cfg)
} }
@ -359,8 +359,8 @@ type authKeyID struct {
// indirectCRL [4] BOOLEAN DEFAULT FALSE, // indirectCRL [4] BOOLEAN DEFAULT FALSE,
// onlyContainsAttributeCerts [5] BOOLEAN DEFAULT FALSE } // onlyContainsAttributeCerts [5] BOOLEAN DEFAULT FALSE }
// -- at most one of onlyContainsUserCerts, onlyContainsCACerts, // -- at most one of onlyContainsUserCerts, onlyContainsCACerts,
// -- and onlyContainsAttributeCerts may be set to TRUE. // -- and onlyContainsAttributeCerts may be set to TRUE.
type issuingDistributionPoint struct { type issuingDistributionPoint struct {
DistributionPoint asn1.RawValue `asn1:"optional,tag:0"` DistributionPoint asn1.RawValue `asn1:"optional,tag:0"`
OnlyContainsUserCerts bool `asn1:"optional,tag:1"` OnlyContainsUserCerts bool `asn1:"optional,tag:1"`

View File

@ -253,13 +253,16 @@ func getDecision(engine *policyEngine, match bool) Decision {
return DecisionDeny return DecisionDeny
} }
// Returns the authorization decision of a single policy engine based on activation. // Returns the authorization decision of a single policy engine based on
// If any policy matches, the decision matches the engine's action, and the first // activation. If any policy matches, the decision matches the engine's
// matching policy name will be returned. // action, and the first matching policy name will be returned.
// Else if any policy is missing attributes, the decision is unknown, and the list of //
// policy names that can't be evaluated due to missing attributes will be returned. // Else if any policy is missing attributes, the decision is unknown, and the
// Else, the decision is the opposite of the engine's action, i.e. an ALLOW engine // list of policy names that can't be evaluated due to missing attributes will
// will return DecisionDeny, and vice versa. // be returned.
//
// Else, the decision is the opposite of the engine's action, i.e. an ALLOW
// engine will return DecisionDeny, and vice versa.
func (engine *policyEngine) evaluate(activation interpreter.Activation) (Decision, []string) { func (engine *policyEngine) evaluate(activation interpreter.Activation) (Decision, []string) {
unknownPolicyNames := []string{} unknownPolicyNames := []string{}
for policyName, program := range engine.programs { for policyName, program := range engine.programs {

View File

@ -19,7 +19,7 @@
// Package serviceconfig defines types and methods for operating on gRPC // Package serviceconfig defines types and methods for operating on gRPC
// service configs. // service configs.
// //
// Experimental // # Experimental
// //
// Notice: This package is EXPERIMENTAL and may be changed or removed in a // Notice: This package is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.

View File

@ -76,14 +76,14 @@ func FromProto(s *spb.Status) *Status {
// FromError returns a Status representation of err. // FromError returns a Status representation of err.
// //
// - If err was produced by this package or implements the method `GRPCStatus() // - If err was produced by this package or implements the method `GRPCStatus()
// *Status`, the appropriate Status is returned. // *Status`, the appropriate Status is returned.
// //
// - If err is nil, a Status is returned with codes.OK and no message. // - If err is nil, a Status is returned with codes.OK and no message.
// //
// - Otherwise, err is an error not compatible with this package. In this // - Otherwise, err is an error not compatible with this package. In this
// case, a Status is returned with codes.Unknown and err's Error() message, // case, a Status is returned with codes.Unknown and err's Error() message,
// and ok is false. // and ok is false.
func FromError(err error) (s *Status, ok bool) { func FromError(err error) (s *Status, ok bool) {
if err == nil { if err == nil {
return nil, true return nil, true

View File

@ -54,6 +54,7 @@ type GaugeResponse struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// Types that are assignable to Value: // Types that are assignable to Value:
//
// *GaugeResponse_LongValue // *GaugeResponse_LongValue
// *GaugeResponse_DoubleValue // *GaugeResponse_DoubleValue
// *GaugeResponse_StringValue // *GaugeResponse_StringValue

View File

@ -19,7 +19,7 @@
// Package tap defines the function handles which are executed on the transport // Package tap defines the function handles which are executed on the transport
// layer of gRPC-Go and related information. // layer of gRPC-Go and related information.
// //
// Experimental // # Experimental
// //
// Notice: This API is EXPERIMENTAL and may be changed or removed in a // Notice: This API is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.

View File

@ -51,9 +51,9 @@ func (*testService) UnaryCall(context.Context, *testpb.SimpleRequest) (*testpb.S
} }
// setupGRPCServer performs the following: // setupGRPCServer performs the following:
// - spin up an xDS-enabled gRPC server, configure it with xdsCredentials and // - spin up an xDS-enabled gRPC server, configure it with xdsCredentials and
// register the test service on it // register the test service on it
// - create a local TCP listener and start serving on it // - create a local TCP listener and start serving on it
// //
// Returns the following: // Returns the following:
// - local listener on which the xDS-enabled gRPC server is serving on // - local listener on which the xDS-enabled gRPC server is serving on
@ -118,12 +118,12 @@ func hostPortFromListener(lis net.Listener) (string, uint32, error) {
// fallback functionality. // fallback functionality.
// //
// The following sequence of events happen as part of this test: // The following sequence of events happen as part of this test:
// - An xDS-enabled gRPC server is created and xDS credentials are configured. // - An xDS-enabled gRPC server is created and xDS credentials are configured.
// - xDS is enabled on the client by the use of the xds:/// scheme, and xDS // - xDS is enabled on the client by the use of the xds:/// scheme, and xDS
// credentials are configured. // credentials are configured.
// - Control plane is configured to not send any security configuration to both // - Control plane is configured to not send any security configuration to both
// the client and the server. This results in both of them using the // the client and the server. This results in both of them using the
// configured fallback credentials (which is insecure creds in this case). // configured fallback credentials (which is insecure creds in this case).
func (s) TestServerSideXDS_Fallback(t *testing.T) { func (s) TestServerSideXDS_Fallback(t *testing.T) {
managementServer, nodeID, bootstrapContents, resolver, cleanup1 := e2e.SetupManagementServer(t, nil) managementServer, nodeID, bootstrapContents, resolver, cleanup1 := e2e.SetupManagementServer(t, nil)
defer cleanup1() defer cleanup1()
@ -185,12 +185,12 @@ func (s) TestServerSideXDS_Fallback(t *testing.T) {
// credentials with file watcher certificate provider. // credentials with file watcher certificate provider.
// //
// The following sequence of events happen as part of this test: // The following sequence of events happen as part of this test:
// - An xDS-enabled gRPC server is created and xDS credentials are configured. // - An xDS-enabled gRPC server is created and xDS credentials are configured.
// - xDS is enabled on the client by the use of the xds:/// scheme, and xDS // - xDS is enabled on the client by the use of the xds:/// scheme, and xDS
// credentials are configured. // credentials are configured.
// - Control plane is configured to send security configuration to both the // - Control plane is configured to send security configuration to both the
// client and the server, pointing to the file watcher certificate provider. // client and the server, pointing to the file watcher certificate provider.
// We verify both TLS and mTLS scenarios. // We verify both TLS and mTLS scenarios.
func (s) TestServerSideXDS_FileWatcherCerts(t *testing.T) { func (s) TestServerSideXDS_FileWatcherCerts(t *testing.T) {
tests := []struct { tests := []struct {
name string name string

View File

@ -19,7 +19,7 @@
// Package bootstrap provides the functionality to register possible options // Package bootstrap provides the functionality to register possible options
// for aspects of the xDS client through the bootstrap file. // for aspects of the xDS client through the bootstrap file.
// //
// Experimental // # Experimental
// //
// Notice: This package is EXPERIMENTAL and may be changed or removed // Notice: This package is EXPERIMENTAL and may be changed or removed
// in a later release. // in a later release.

View File

@ -66,41 +66,41 @@ type priorityConfig struct {
// If xds lb policy is ROUND_ROBIN, the children will be weighted_target for // If xds lb policy is ROUND_ROBIN, the children will be weighted_target for
// locality picking, and round_robin for endpoint picking. // locality picking, and round_robin for endpoint picking.
// //
// ┌────────┐ // ┌────────┐
// │priority│ // │priority│
// └┬──────┬┘ // └┬──────┬┘
// │ │ // │ │
// ┌───────────▼┐ ┌▼───────────┐ // ┌───────────▼┐ ┌▼───────────┐
// │cluster_impl│ │cluster_impl│ // │cluster_impl│ │cluster_impl│
// └─┬──────────┘ └──────────┬─┘ // └─┬──────────┘ └──────────┬─┘
// │ │ // │ │
// ┌──────────────▼─┐ ┌─▼──────────────┐ // ┌──────────────▼─┐ ┌─▼──────────────┐
// │locality_picking│ │locality_picking│ // │locality_picking│ │locality_picking│
// └┬──────────────┬┘ └┬──────────────┬┘ // └┬──────────────┬┘ └┬──────────────┬┘
// │ │ │ │ // │ │ │ │
// ┌─▼─┐ ┌─▼─┐ ┌─▼─┐ ┌─▼─┐ // ┌─▼─┐ ┌─▼─┐ ┌─▼─┐ ┌─▼─┐
// │LRS│ │LRS│ │LRS│ │LRS│ // │LRS│ │LRS│ │LRS│ │LRS│
// └─┬─┘ └─┬─┘ └─┬─┘ └─┬─┘ // └─┬─┘ └─┬─┘ └─┬─┘ └─┬─┘
// │ │ │ │ // │ │ │ │
// ┌──────────▼─────┐ ┌─────▼──────────┐ ┌──────────▼─────┐ ┌─────▼──────────┐ // ┌──────────▼─────┐ ┌─────▼──────────┐ ┌──────────▼─────┐ ┌─────▼──────────┐
// │endpoint_picking│ │endpoint_picking│ │endpoint_picking│ │endpoint_picking│ // │endpoint_picking│ │endpoint_picking│ │endpoint_picking│ │endpoint_picking│
// └────────────────┘ └────────────────┘ └────────────────┘ └────────────────┘ // └────────────────┘ └────────────────┘ └────────────────┘ └────────────────┘
// //
// If xds lb policy is RING_HASH, the children will be just a ring_hash policy. // If xds lb policy is RING_HASH, the children will be just a ring_hash policy.
// The endpoints from all localities will be flattened to one addresses list, // The endpoints from all localities will be flattened to one addresses list,
// and the ring_hash policy will pick endpoints from it. // and the ring_hash policy will pick endpoints from it.
// //
// ┌────────┐ // ┌────────┐
// │priority│ // │priority│
// └┬──────┬┘ // └┬──────┬┘
// │ │ // │ │
// ┌──────────▼─┐ ┌─▼──────────┐ // ┌──────────▼─┐ ┌─▼──────────┐
// │cluster_impl│ │cluster_impl│ // │cluster_impl│ │cluster_impl│
// └──────┬─────┘ └─────┬──────┘ // └──────┬─────┘ └─────┬──────┘
// │ │ // │ │
// ┌──────▼─────┐ ┌─────▼──────┐ // ┌──────▼─────┐ ┌─────▼──────┐
// │ ring_hash │ │ ring_hash │ // │ ring_hash │ │ ring_hash │
// └────────────┘ └────────────┘ // └────────────┘ └────────────┘
// //
// If endpointPickingPolicy is nil, roundrobin will be used. // If endpointPickingPolicy is nil, roundrobin will be used.
// //

View File

@ -168,11 +168,11 @@ func clientEndpointsResource(nodeID, edsServiceName string, localities []localit
// TestEDS_OneLocality tests the cluster_resolver LB policy using an EDS // TestEDS_OneLocality tests the cluster_resolver LB policy using an EDS
// resource with one locality. The following scenarios are tested: // resource with one locality. The following scenarios are tested:
// 1. Single backend. Test verifies that RPCs reach this backend. // 1. Single backend. Test verifies that RPCs reach this backend.
// 2. Add a backend. Test verifies that RPCs are roundrobined across the two // 2. Add a backend. Test verifies that RPCs are roundrobined across the two
// backends. // backends.
// 3. Remove one backend. Test verifies that all RPCs reach the other backend. // 3. Remove one backend. Test verifies that all RPCs reach the other backend.
// 4. Replace the backend. Test verifies that all RPCs reach the new backend. // 4. Replace the backend. Test verifies that all RPCs reach the new backend.
func (s) TestEDS_OneLocality(t *testing.T) { func (s) TestEDS_OneLocality(t *testing.T) {
// Spin up a management server to receive xDS resources from. // Spin up a management server to receive xDS resources from.
managementServer, nodeID, bootstrapContents, _, cleanup1 := e2e.SetupManagementServer(t, nil) managementServer, nodeID, bootstrapContents, _, cleanup1 := e2e.SetupManagementServer(t, nil)
@ -262,16 +262,16 @@ func (s) TestEDS_OneLocality(t *testing.T) {
// TestEDS_MultipleLocalities tests the cluster_resolver LB policy using an EDS // TestEDS_MultipleLocalities tests the cluster_resolver LB policy using an EDS
// resource with multiple localities. The following scenarios are tested: // resource with multiple localities. The following scenarios are tested:
// 1. Two localities, each with a single backend. Test verifies that RPCs are // 1. Two localities, each with a single backend. Test verifies that RPCs are
// weighted roundrobined across these two backends. // weighted roundrobined across these two backends.
// 2. Add another locality, with a single backend. Test verifies that RPCs are // 2. Add another locality, with a single backend. Test verifies that RPCs are
// weighted roundrobined across all the backends. // weighted roundrobined across all the backends.
// 3. Remove one locality. Test verifies that RPCs are weighted roundrobined // 3. Remove one locality. Test verifies that RPCs are weighted roundrobined
// across backends from the remaining localities. // across backends from the remaining localities.
// 4. Add a backend to one locality. Test verifies that RPCs are weighted // 4. Add a backend to one locality. Test verifies that RPCs are weighted
// roundrobined across localities. // roundrobined across localities.
// 5. Change the weight of one of the localities. Test verifies that RPCs are // 5. Change the weight of one of the localities. Test verifies that RPCs are
// weighted roundrobined across the localities. // weighted roundrobined across the localities.
// //
// In our LB policy tree, one of the descendents of the "cluster_resolver" LB // In our LB policy tree, one of the descendents of the "cluster_resolver" LB
// policy is the "weighted_target" LB policy which performs weighted roundrobin // policy is the "weighted_target" LB policy which performs weighted roundrobin

View File

@ -41,30 +41,44 @@ var (
// from a priority to another). // from a priority to another).
// //
// It's guaranteed that after this function returns: // It's guaranteed that after this function returns:
// - If some child is READY, it is childInUse, and all lower priorities are //
// closed. // If some child is READY, it is childInUse, and all lower priorities are
// - If some child is newly started(in Connecting for the first time), it is // closed.
// childInUse, and all lower priorities are closed. //
// - Otherwise, the lowest priority is childInUse (none of the children is // If some child is newly started(in Connecting for the first time), it is
// ready, and the overall state is not ready). // childInUse, and all lower priorities are closed.
//
// Otherwise, the lowest priority is childInUse (none of the children is
// ready, and the overall state is not ready).
// //
// Steps: // Steps:
// - If all priorities were deleted, unset childInUse (to an empty string), and //
// set parent ClientConn to TransientFailure // If all priorities were deleted, unset childInUse (to an empty string), and
// - Otherwise, Scan all children from p0, and check balancer stats: // set parent ClientConn to TransientFailure
// - For any of the following cases: //
// - If balancer is not started (not built), this is either a new child with // Otherwise, Scan all children from p0, and check balancer stats:
// high priority, or a new builder for an existing child. //
// - If balancer is Connecting and has non-nil initTimer (meaning it // For any of the following cases:
// transitioned from Ready or Idle to connecting, not from TF, so we //
// should give it init-time to connect). // If balancer is not started (not built), this is either a new child with
// - If balancer is READY or IDLE // high priority, or a new builder for an existing child.
// - If this is the lowest priority //
// - do the following: // If balancer is Connecting and has non-nil initTimer (meaning it
// - if this is not the old childInUse, override picker so old picker is no // transitioned from Ready or Idle to connecting, not from TF, so we
// longer used. // should give it init-time to connect).
// - switch to it (because all higher priorities are neither new or Ready) //
// - forward the new addresses and config // If balancer is READY or IDLE
//
// If this is the lowest priority
//
// do the following:
//
// if this is not the old childInUse, override picker so old picker is no
// longer used.
//
// switch to it (because all higher priorities are neither new or Ready)
//
// forward the new addresses and config
// //
// Caller must hold b.mu. // Caller must hold b.mu.
func (b *priorityBalancer) syncPriority(childUpdating string) { func (b *priorityBalancer) syncPriority(childUpdating string) {

View File

@ -324,13 +324,14 @@ func (b *ringhashBalancer) ResolverError(err error) {
// UpdateSubConnState updates the per-SubConn state stored in the ring, and also // UpdateSubConnState updates the per-SubConn state stored in the ring, and also
// the aggregated state. // the aggregated state.
// //
// It triggers an update to cc when: // It triggers an update to cc when:
// - the new state is TransientFailure, to update the error message // - the new state is TransientFailure, to update the error message
// - it's possible that this is a noop, but sending an extra update is easier // - it's possible that this is a noop, but sending an extra update is easier
// than comparing errors // than comparing errors
// - the aggregated state is changed //
// - the same picker will be sent again, but this update may trigger a re-pick // - the aggregated state is changed
// for some RPCs. // - the same picker will be sent again, but this update may trigger a re-pick
// for some RPCs.
func (b *ringhashBalancer) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState) { func (b *ringhashBalancer) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState) {
s := state.ConnectivityState s := state.ConnectivityState
if logger.V(2) { if logger.V(2) {

View File

@ -92,11 +92,11 @@ func (*testService) FullDuplexCall(stream testpb.TestService_FullDuplexCallServe
// - create a local TCP listener and start serving on it // - create a local TCP listener and start serving on it
// //
// Returns the following: // Returns the following:
// - the management server: tests use this to configure resources // - the management server: tests use this to configure resources
// - nodeID expected by the management server: this is set in the Node proto // - nodeID expected by the management server: this is set in the Node proto
// sent by the xdsClient for queries. // sent by the xdsClient for queries.
// - the port the server is listening on // - the port the server is listening on
// - cleanup function to be invoked by the tests when done // - cleanup function to be invoked by the tests when done
func clientSetup(t *testing.T) (*e2e.ManagementServer, string, uint32, func()) { func clientSetup(t *testing.T) (*e2e.ManagementServer, string, uint32, func()) {
// Spin up a xDS management server on a local port. // Spin up a xDS management server on a local port.
nodeID := uuid.New().String() nodeID := uuid.New().String()

View File

@ -32,13 +32,13 @@ import (
// connWrapper is a thin wrapper around a net.Conn returned by Accept(). It // connWrapper is a thin wrapper around a net.Conn returned by Accept(). It
// provides the following additional functionality: // provides the following additional functionality:
// 1. A way to retrieve the configured deadline. This is required by the // 1. A way to retrieve the configured deadline. This is required by the
// ServerHandshake() method of the xdsCredentials when it attempts to read // ServerHandshake() method of the xdsCredentials when it attempts to read
// key material from the certificate providers. // key material from the certificate providers.
// 2. Implements the XDSHandshakeInfo() method used by the xdsCredentials to // 2. Implements the XDSHandshakeInfo() method used by the xdsCredentials to
// retrieve the configured certificate providers. // retrieve the configured certificate providers.
// 3. xDS filter_chain matching logic to select appropriate security // 3. xDS filter_chain matching logic to select appropriate security
// configuration for the incoming connection. // configuration for the incoming connection.
type connWrapper struct { type connWrapper struct {
net.Conn net.Conn

View File

@ -123,6 +123,7 @@ func TestPingPong(t *testing.T) {
// - verify that // - verify that
// - all RPCs with the same metadata value are sent to the same backend // - all RPCs with the same metadata value are sent to the same backend
// - only one backend is Ready // - only one backend is Ready
//
// - send more RPCs with different metadata values until a new backend is picked, and verify that // - send more RPCs with different metadata values until a new backend is picked, and verify that
// - only two backends are in Ready // - only two backends are in Ready
func TestAffinity(t *testing.T) { func TestAffinity(t *testing.T) {

View File

@ -163,9 +163,9 @@ func (s) TestAuthorityNoneDefaultAuthority(t *testing.T) {
} }
// TestAuthorityShare covers that // TestAuthorityShare covers that
// - watch with the same authority name doesn't create new authority // - watch with the same authority name doesn't create new authority
// - watch with different authority name but same authority config doesn't // - watch with different authority name but same authority config doesn't
// create new authority // create new authority
func (s) TestAuthorityShare(t *testing.T) { func (s) TestAuthorityShare(t *testing.T) {
overrideFedEnvVar(t) overrideFedEnvVar(t)
ctrlCh := overrideNewController(t) ctrlCh := overrideNewController(t)
@ -210,9 +210,9 @@ func (s) TestAuthorityShare(t *testing.T) {
} }
// TestAuthorityIdle covers that // TestAuthorityIdle covers that
// - authorities are put in a timeout cache when the last watch is canceled // - authorities are put in a timeout cache when the last watch is canceled
// - idle authorities are not immediately closed. They will be closed after a // - idle authorities are not immediately closed. They will be closed after a
// timeout. // timeout.
func (s) TestAuthorityIdleTimeout(t *testing.T) { func (s) TestAuthorityIdleTimeout(t *testing.T) {
overrideFedEnvVar(t) overrideFedEnvVar(t)
ctrlCh := overrideNewController(t) ctrlCh := overrideNewController(t)

View File

@ -72,7 +72,7 @@ func newWithConfig(config *bootstrap.Config, watchExpiryTimeout time.Duration, i
// NewWithConfigForTesting returns an xDS client for the specified bootstrap // NewWithConfigForTesting returns an xDS client for the specified bootstrap
// config, separate from the global singleton. // config, separate from the global singleton.
// //
// Testing Only // # Testing Only
// //
// This function should ONLY be used for testing purposes. // This function should ONLY be used for testing purposes.
func NewWithConfigForTesting(config *bootstrap.Config, watchExpiryTimeout, authorityIdleTimeout time.Duration) (XDSClient, error) { func NewWithConfigForTesting(config *bootstrap.Config, watchExpiryTimeout, authorityIdleTimeout time.Duration) (XDSClient, error) {
@ -86,8 +86,7 @@ func NewWithConfigForTesting(config *bootstrap.Config, watchExpiryTimeout, autho
// NewWithBootstrapContentsForTesting returns an xDS client for this config, // NewWithBootstrapContentsForTesting returns an xDS client for this config,
// separate from the global singleton. // separate from the global singleton.
// //
// // # Testing Only
// Testing Only
// //
// This function should ONLY be used for testing purposes. // This function should ONLY be used for testing purposes.
func NewWithBootstrapContentsForTesting(contents []byte) (XDSClient, error) { func NewWithBootstrapContentsForTesting(contents []byte) (XDSClient, error) {

View File

@ -79,10 +79,10 @@ func (v2c *client) NewStream(ctx context.Context, cc *grpc.ClientConn) (grpc.Cli
// rType, on the provided stream. // rType, on the provided stream.
// //
// version is the ack version to be sent with the request // version is the ack version to be sent with the request
// - If this is the new request (not an ack/nack), version will be empty. // - If this is the new request (not an ack/nack), version will be empty.
// - If this is an ack, version will be the version from the response. // - If this is an ack, version will be the version from the response.
// - If this is a nack, version will be the previous acked version (from // - If this is a nack, version will be the previous acked version (from
// versionMap). If there was no ack before, it will be empty. // versionMap). If there was no ack before, it will be empty.
func (v2c *client) SendRequest(s grpc.ClientStream, resourceNames []string, rType xdsresource.ResourceType, version, nonce, errMsg string) error { func (v2c *client) SendRequest(s grpc.ClientStream, resourceNames []string, rType xdsresource.ResourceType, version, nonce, errMsg string) error {
stream, ok := s.(adsStream) stream, ok := s.(adsStream)
if !ok { if !ok {

View File

@ -81,10 +81,10 @@ func (v3c *client) NewStream(ctx context.Context, cc *grpc.ClientConn) (grpc.Cli
// rType, on the provided stream. // rType, on the provided stream.
// //
// version is the ack version to be sent with the request // version is the ack version to be sent with the request
// - If this is the new request (not an ack/nack), version will be empty. // - If this is the new request (not an ack/nack), version will be empty.
// - If this is an ack, version will be the version from the response. // - If this is an ack, version will be the version from the response.
// - If this is a nack, version will be the previous acked version (from // - If this is a nack, version will be the previous acked version (from
// versionMap). If there was no ack before, it will be empty. // versionMap). If there was no ack before, it will be empty.
func (v3c *client) SendRequest(s grpc.ClientStream, resourceNames []string, rType xdsresource.ResourceType, version, nonce, errMsg string) error { func (v3c *client) SendRequest(s grpc.ClientStream, resourceNames []string, rType xdsresource.ResourceType, version, nonce, errMsg string) error {
stream, ok := s.(adsStream) stream, ok := s.(adsStream)
if !ok { if !ok {

View File

@ -144,13 +144,13 @@ func verifyListenerUpdate(ctx context.Context, updateCh *testutils.Channel, want
// TestLDSWatch covers the case where a single watcher exists for a single // TestLDSWatch covers the case where a single watcher exists for a single
// listener resource. The test verifies the following scenarios: // listener resource. The test verifies the following scenarios:
// 1. An update from the management server containing the resource being // 1. An update from the management server containing the resource being
// watched should result in the invocation of the watch callback. // watched should result in the invocation of the watch callback.
// 2. An update from the management server containing a resource *not* being // 2. An update from the management server containing a resource *not* being
// watched should not result in the invocation of the watch callback. // watched should not result in the invocation of the watch callback.
// 3. After the watch is cancelled, an update from the management server // 3. After the watch is cancelled, an update from the management server
// containing the resource that was being watched should not result in the // containing the resource that was being watched should not result in the
// invocation of the watch callback. // invocation of the watch callback.
// //
// The test is run for old and new style names. // The test is run for old and new style names.
func (s) TestLDSWatch(t *testing.T) { func (s) TestLDSWatch(t *testing.T) {
@ -263,14 +263,14 @@ func (s) TestLDSWatch(t *testing.T) {
// TestLDSWatch_TwoWatchesForSameResourceName covers the case where two watchers // TestLDSWatch_TwoWatchesForSameResourceName covers the case where two watchers
// exist for a single listener resource. The test verifies the following // exist for a single listener resource. The test verifies the following
// scenarios: // scenarios:
// 1. An update from the management server containing the resource being // 1. An update from the management server containing the resource being
// watched should result in the invocation of both watch callbacks. // watched should result in the invocation of both watch callbacks.
// 2. After one of the watches is cancelled, a redundant update from the // 2. After one of the watches is cancelled, a redundant update from the
// management server should not result in the invocation of either of the // management server should not result in the invocation of either of the
// watch callbacks. // watch callbacks.
// 3. An update from the management server containing the resource being // 3. An update from the management server containing the resource being
// watched should result in the invocation of the un-cancelled watch // watched should result in the invocation of the un-cancelled watch
// callback. // callback.
// //
// The test is run for old and new style names. // The test is run for old and new style names.
func (s) TestLDSWatch_TwoWatchesForSameResourceName(t *testing.T) { func (s) TestLDSWatch_TwoWatchesForSameResourceName(t *testing.T) {
@ -680,12 +680,12 @@ func (s) TestLDSWatch_ValidResponseCancelsExpiryTimerBehavior(t *testing.T) {
// TestLDSWatch_ResourceRemoved covers the cases where a resource being watched // TestLDSWatch_ResourceRemoved covers the cases where a resource being watched
// is removed from the management server. The test verifies the following // is removed from the management server. The test verifies the following
// scenarios: // scenarios:
// 1. Removing a resource should trigger the watch callback with a resource // 1. Removing a resource should trigger the watch callback with a resource
// removed error. It should not trigger the watch callback for an unrelated // removed error. It should not trigger the watch callback for an unrelated
// resource. // resource.
// 2. An update to another resource should result in the invocation of the watch // 2. An update to another resource should result in the invocation of the watch
// callback associated with that resource. It should not result in the // callback associated with that resource. It should not result in the
// invocation of the watch callback associated with the deleted resource. // invocation of the watch callback associated with the deleted resource.
// //
// The test is run with both old and new style names. // The test is run with both old and new style names.
func (s) TestLDSWatch_ResourceRemoved(t *testing.T) { func (s) TestLDSWatch_ResourceRemoved(t *testing.T) {

View File

@ -105,6 +105,7 @@ func (s) TestClusterWatchExpiryTimerStop(t *testing.T) {
// - an update is received after a watch() // - an update is received after a watch()
// - another update is received, with one resource removed // - another update is received, with one resource removed
// - this should trigger callback with resource removed error // - this should trigger callback with resource removed error
//
// - one more update without the removed resource // - one more update without the removed resource
// - the callback (above) shouldn't receive any update // - the callback (above) shouldn't receive any update
func (s) TestClusterResourceRemoved(t *testing.T) { func (s) TestClusterResourceRemoved(t *testing.T) {

View File

@ -57,19 +57,19 @@ func testFedTwoWatchDifferentContextParameterOrder(t *testing.T, typ xdsresource
} }
// TestLDSFedTwoWatchDifferentContextParameterOrder covers the case with new style resource name // TestLDSFedTwoWatchDifferentContextParameterOrder covers the case with new style resource name
// - Two watches with the same query string, but in different order. The two // - Two watches with the same query string, but in different order. The two
// watches should watch the same resource. // watches should watch the same resource.
// - The response has the same query string, but in different order. The watch // - The response has the same query string, but in different order. The watch
// should still be notified. // should still be notified.
func (s) TestLDSFedTwoWatchDifferentContextParameterOrder(t *testing.T) { func (s) TestLDSFedTwoWatchDifferentContextParameterOrder(t *testing.T) {
testFedTwoWatchDifferentContextParameterOrder(t, xdsresource.ListenerResource, xdsresource.ListenerUpdate{RouteConfigName: testRDSName}) testFedTwoWatchDifferentContextParameterOrder(t, xdsresource.ListenerResource, xdsresource.ListenerUpdate{RouteConfigName: testRDSName})
} }
// TestRDSFedTwoWatchDifferentContextParameterOrder covers the case with new style resource name // TestRDSFedTwoWatchDifferentContextParameterOrder covers the case with new style resource name
// - Two watches with the same query string, but in different order. The two // - Two watches with the same query string, but in different order. The two
// watches should watch the same resource. // watches should watch the same resource.
// - The response has the same query string, but in different order. The watch // - The response has the same query string, but in different order. The watch
// should still be notified. // should still be notified.
func (s) TestRDSFedTwoWatchDifferentContextParameterOrder(t *testing.T) { func (s) TestRDSFedTwoWatchDifferentContextParameterOrder(t *testing.T) {
testFedTwoWatchDifferentContextParameterOrder(t, xdsresource.RouteConfigResource, xdsresource.RouteConfigUpdate{ testFedTwoWatchDifferentContextParameterOrder(t, xdsresource.RouteConfigResource, xdsresource.RouteConfigUpdate{
VirtualHosts: []*xdsresource.VirtualHost{ VirtualHosts: []*xdsresource.VirtualHost{
@ -82,19 +82,19 @@ func (s) TestRDSFedTwoWatchDifferentContextParameterOrder(t *testing.T) {
} }
// TestClusterFedTwoWatchDifferentContextParameterOrder covers the case with new style resource name // TestClusterFedTwoWatchDifferentContextParameterOrder covers the case with new style resource name
// - Two watches with the same query string, but in different order. The two // - Two watches with the same query string, but in different order. The two
// watches should watch the same resource. // watches should watch the same resource.
// - The response has the same query string, but in different order. The watch // - The response has the same query string, but in different order. The watch
// should still be notified. // should still be notified.
func (s) TestClusterFedTwoWatchDifferentContextParameterOrder(t *testing.T) { func (s) TestClusterFedTwoWatchDifferentContextParameterOrder(t *testing.T) {
testFedTwoWatchDifferentContextParameterOrder(t, xdsresource.ClusterResource, xdsresource.ClusterUpdate{ClusterName: testEDSName}) testFedTwoWatchDifferentContextParameterOrder(t, xdsresource.ClusterResource, xdsresource.ClusterUpdate{ClusterName: testEDSName})
} }
// TestEndpointsFedTwoWatchDifferentContextParameterOrder covers the case with new style resource name // TestEndpointsFedTwoWatchDifferentContextParameterOrder covers the case with new style resource name
// - Two watches with the same query string, but in different order. The two // - Two watches with the same query string, but in different order. The two
// watches should watch the same resource. // watches should watch the same resource.
// - The response has the same query string, but in different order. The watch // - The response has the same query string, but in different order. The watch
// should still be notified. // should still be notified.
func (s) TestEndpointsFedTwoWatchDifferentContextParameterOrder(t *testing.T) { func (s) TestEndpointsFedTwoWatchDifferentContextParameterOrder(t *testing.T) {
testFedTwoWatchDifferentContextParameterOrder(t, xdsresource.EndpointsResource, xdsresource.EndpointsUpdate{Localities: []xdsresource.Locality{testLocalities[0]}}) testFedTwoWatchDifferentContextParameterOrder(t, xdsresource.EndpointsResource, xdsresource.EndpointsUpdate{Localities: []xdsresource.Locality{testLocalities[0]}})
} }

View File

@ -428,6 +428,7 @@ func testWatchAfterCache(t *testing.T, typ xdsresource.ResourceType, update inte
// - an update is received after a watch() // - an update is received after a watch()
// - another update is received, with one resource removed // - another update is received, with one resource removed
// - this should trigger callback with resource removed error // - this should trigger callback with resource removed error
//
// - one more update without the removed resource // - one more update without the removed resource
// - the callback (above) shouldn't receive any update // - the callback (above) shouldn't receive any update
func testResourceRemoved(t *testing.T, typ xdsresource.ResourceType, update1 interface{}, resourceName1 string, update2 interface{}, resourceName2 string) { func testResourceRemoved(t *testing.T, typ xdsresource.ResourceType, update1 interface{}, resourceName1 string, update2 interface{}, resourceName2 string) {

View File

@ -158,11 +158,11 @@ const (
// filter chains in a single Listener resource. It also contains the default // filter chains in a single Listener resource. It also contains the default
// filter chain specified in the Listener resource. It provides two important // filter chain specified in the Listener resource. It provides two important
// pieces of functionality: // pieces of functionality:
// 1. Validate the filter chains in an incoming Listener resource to make sure // 1. Validate the filter chains in an incoming Listener resource to make sure
// that there aren't filter chains which contain the same match criteria. // that there aren't filter chains which contain the same match criteria.
// 2. As part of performing the above validation, it builds an internal data // 2. As part of performing the above validation, it builds an internal data
// structure which will if used to look up the matching filter chain at // structure which will if used to look up the matching filter chain at
// connection time. // connection time.
// //
// The logic specified in the documentation around the xDS FilterChainMatch // The logic specified in the documentation around the xDS FilterChainMatch
// proto mentions 8 criteria to match on. // proto mentions 8 criteria to match on.

View File

@ -208,18 +208,21 @@ func match(domain, host string) (domainMatchType, bool) {
// FindBestMatchingVirtualHost returns the virtual host whose domains field best // FindBestMatchingVirtualHost returns the virtual host whose domains field best
// matches host // matches host
// //
// The domains field support 4 different matching pattern types: // The domains field support 4 different matching pattern types:
// - Exact match
// - Suffix match (e.g. “*ABC”)
// - Prefix match (e.g. “ABC*)
// - Universal match (e.g. “*”)
// //
// The best match is defined as: // - Exact match
// - A match is better if its matching pattern type is better // - Suffix match (e.g. “*ABC”)
// - Exact match > suffix match > prefix match > universal match // - Prefix match (e.g. “ABC*)
// - If two matches are of the same pattern type, the longer match is better // - Universal match (e.g. “*”)
// - This is to compare the length of the matching pattern, e.g. “*ABCDE” > //
// “*ABC” // The best match is defined as:
// - A match is better if its matching pattern type is better.
// * Exact match > suffix match > prefix match > universal match.
//
// - If two matches are of the same pattern type, the longer match is
// better.
// * This is to compare the length of the matching pattern, e.g. “*ABCDE” >
// “*ABC”
func FindBestMatchingVirtualHost(host string, vHosts []*VirtualHost) *VirtualHost { // Maybe move this crap to client func FindBestMatchingVirtualHost(host string, vHosts []*VirtualHost) *VirtualHost { // Maybe move this crap to client
var ( var (
matchVh *VirtualHost matchVh *VirtualHost

View File

@ -62,12 +62,12 @@ type ServingModeChangeArgs struct {
// to inject a bootstrap configuration used by only this server, instead of the // to inject a bootstrap configuration used by only this server, instead of the
// global configuration from the environment variables. // global configuration from the environment variables.
// //
// Testing Only // # Testing Only
// //
// This function should ONLY be used for testing and may not work with some // This function should ONLY be used for testing and may not work with some
// other features, including the CSDS service. // other features, including the CSDS service.
// //
// Experimental // # Experimental
// //
// Notice: This API is EXPERIMENTAL and may be changed or removed in a // Notice: This API is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.

View File

@ -375,12 +375,12 @@ func setupOverridesForXDSCreds(includeCertProviderCfg bool) (*testutils.Channel,
// TestServeSuccess tests the successful case of calling Serve(). // TestServeSuccess tests the successful case of calling Serve().
// The following sequence of events happen: // The following sequence of events happen:
// 1. Create a new GRPCServer and call Serve() in a goroutine. // 1. Create a new GRPCServer and call Serve() in a goroutine.
// 2. Make sure an xdsClient is created, and an LDS watch is registered. // 2. Make sure an xdsClient is created, and an LDS watch is registered.
// 3. Push an error response from the xdsClient, and make sure that Serve() does // 3. Push an error response from the xdsClient, and make sure that Serve() does
// not exit. // not exit.
// 4. Push a good response from the xdsClient, and make sure that Serve() on the // 4. Push a good response from the xdsClient, and make sure that Serve() on the
// underlying grpc.Server is called. // underlying grpc.Server is called.
func (s) TestServeSuccess(t *testing.T) { func (s) TestServeSuccess(t *testing.T) {
fs, clientCh, cleanup := setupOverrides() fs, clientCh, cleanup := setupOverrides()
defer cleanup() defer cleanup()

View File

@ -81,12 +81,12 @@ func init() {
// the supported environment variables. The resolver.Builder is meant to be // the supported environment variables. The resolver.Builder is meant to be
// used in conjunction with the grpc.WithResolvers DialOption. // used in conjunction with the grpc.WithResolvers DialOption.
// //
// Testing Only // # Testing Only
// //
// This function should ONLY be used for testing and may not work with some // This function should ONLY be used for testing and may not work with some
// other features, including the CSDS service. // other features, including the CSDS service.
// //
// Experimental // # Experimental
// //
// Notice: This API is EXPERIMENTAL and may be changed or removed in a // Notice: This API is EXPERIMENTAL and may be changed or removed in a
// later release. // later release.