cubefs

Форк
0
89 строк · 4.3 Кб
1
/*
2
 * Copyright 2016 gRPC authors.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 *
16
 */
17

18
// Package internal contains gRPC-internal code, to avoid polluting
19
// the godoc of the top-level grpc package.  It must not import any grpc
20
// symbols to avoid circular dependencies.
21
package internal
22

23
import (
24
	"context"
25
	"time"
26

27
	"google.golang.org/grpc/connectivity"
28
	"google.golang.org/grpc/serviceconfig"
29
)
30

31
var (
32
	// WithHealthCheckFunc is set by dialoptions.go
33
	WithHealthCheckFunc interface{} // func (HealthChecker) DialOption
34
	// HealthCheckFunc is used to provide client-side LB channel health checking
35
	HealthCheckFunc HealthChecker
36
	// BalancerUnregister is exported by package balancer to unregister a balancer.
37
	BalancerUnregister func(name string)
38
	// KeepaliveMinPingTime is the minimum ping interval.  This must be 10s by
39
	// default, but tests may wish to set it lower for convenience.
40
	KeepaliveMinPingTime = 10 * time.Second
41
	// NewRequestInfoContext creates a new context based on the argument context attaching
42
	// the passed in RequestInfo to the new context.
43
	NewRequestInfoContext interface{} // func(context.Context, credentials.RequestInfo) context.Context
44
	// NewClientHandshakeInfoContext returns a copy of the input context with
45
	// the passed in ClientHandshakeInfo struct added to it.
46
	NewClientHandshakeInfoContext interface{} // func(context.Context, credentials.ClientHandshakeInfo) context.Context
47
	// ParseServiceConfigForTesting is for creating a fake
48
	// ClientConn for resolver testing only
49
	ParseServiceConfigForTesting interface{} // func(string) *serviceconfig.ParseResult
50
	// EqualServiceConfigForTesting is for testing service config generation and
51
	// parsing. Both a and b should be returned by ParseServiceConfigForTesting.
52
	// This function compares the config without rawJSON stripped, in case the
53
	// there's difference in white space.
54
	EqualServiceConfigForTesting func(a, b serviceconfig.Config) bool
55
	// GetCertificateProviderBuilder returns the registered builder for the
56
	// given name. This is set by package certprovider for use from xDS
57
	// bootstrap code while parsing certificate provider configs in the
58
	// bootstrap file.
59
	GetCertificateProviderBuilder interface{} // func(string) certprovider.Builder
60
	// GetXDSHandshakeInfoForTesting returns a pointer to the xds.HandshakeInfo
61
	// stored in the passed in attributes. This is set by
62
	// credentials/xds/xds.go.
63
	GetXDSHandshakeInfoForTesting interface{} // func (*attributes.Attributes) *xds.HandshakeInfo
64
	// GetServerCredentials returns the transport credentials configured on a
65
	// gRPC server. An xDS-enabled server needs to know what type of credentials
66
	// is configured on the underlying gRPC server. This is set by server.go.
67
	GetServerCredentials interface{} // func (*grpc.Server) credentials.TransportCredentials
68
)
69

70
// HealthChecker defines the signature of the client-side LB channel health checking function.
71
//
72
// The implementation is expected to create a health checking RPC stream by
73
// calling newStream(), watch for the health status of serviceName, and report
74
// it's health back by calling setConnectivityState().
75
//
76
// The health checking protocol is defined at:
77
// https://github.com/grpc/grpc/blob/master/doc/health-checking.md
78
type HealthChecker func(ctx context.Context, newStream func(string) (interface{}, error), setConnectivityState func(connectivity.State, error), serviceName string) error
79

80
const (
81
	// CredsBundleModeFallback switches GoogleDefaultCreds to fallback mode.
82
	CredsBundleModeFallback = "fallback"
83
	// CredsBundleModeBalancer switches GoogleDefaultCreds to grpclb balancer
84
	// mode.
85
	CredsBundleModeBalancer = "balancer"
86
	// CredsBundleModeBackendFromBalancer switches GoogleDefaultCreds to mode
87
	// that supports backend returned by grpclb balancer.
88
	CredsBundleModeBackendFromBalancer = "backend-from-balancer"
89
)
90

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.