Mark old balancer and naming APIs as deprecated (#1951)

This commit is contained in:
Menghan Li
2018-04-05 13:12:31 -07:00
committed by GitHub
parent d0a21a3347
commit 76b07ed73d
3 changed files with 23 additions and 3 deletions

View File

@ -32,7 +32,8 @@ import (
) )
// Address represents a server the client connects to. // Address represents a server the client connects to.
// This is the EXPERIMENTAL API and may be changed or extended in the future. //
// Deprecated: please use package balancer.
type Address struct { type Address struct {
// Addr is the server address on which a connection will be established. // Addr is the server address on which a connection will be established.
Addr string Addr string
@ -42,6 +43,8 @@ type Address struct {
} }
// BalancerConfig specifies the configurations for Balancer. // BalancerConfig specifies the configurations for Balancer.
//
// Deprecated: please use package balancer.
type BalancerConfig struct { type BalancerConfig struct {
// DialCreds is the transport credential the Balancer implementation can // DialCreds is the transport credential the Balancer implementation can
// use to dial to a remote load balancer server. The Balancer implementations // use to dial to a remote load balancer server. The Balancer implementations
@ -54,7 +57,8 @@ type BalancerConfig struct {
} }
// BalancerGetOptions configures a Get call. // BalancerGetOptions configures a Get call.
// This is the EXPERIMENTAL API and may be changed or extended in the future. //
// Deprecated: please use package balancer.
type BalancerGetOptions struct { type BalancerGetOptions struct {
// BlockingWait specifies whether Get should block when there is no // BlockingWait specifies whether Get should block when there is no
// connected address. // connected address.
@ -62,7 +66,8 @@ type BalancerGetOptions struct {
} }
// Balancer chooses network addresses for RPCs. // Balancer chooses network addresses for RPCs.
// This is the EXPERIMENTAL API and may be changed or extended in the future. //
// Deprecated: please use package balancer.
type Balancer interface { type Balancer interface {
// Start does the initialization work to bootstrap a Balancer. For example, // Start does the initialization work to bootstrap a Balancer. For example,
// this function may start the name resolution and watch the updates. It will // this function may start the name resolution and watch the updates. It will
@ -135,6 +140,8 @@ func downErrorf(timeout, temporary bool, format string, a ...interface{}) downEr
// RoundRobin returns a Balancer that selects addresses round-robin. It uses r to watch // RoundRobin returns a Balancer that selects addresses round-robin. It uses r to watch
// the name resolution updates and updates the addresses available correspondingly. // the name resolution updates and updates the addresses available correspondingly.
//
// Deprecated: please use package balancer/roundrobin.
func RoundRobin(r naming.Resolver) Balancer { func RoundRobin(r naming.Resolver) Balancer {
return &roundRobin{r: r} return &roundRobin{r: r}
} }

View File

@ -18,9 +18,13 @@
// Package naming defines the naming API and related data structures for gRPC. // Package naming defines the naming API and related data structures for gRPC.
// The interface is EXPERIMENTAL and may be suject to change. // The interface is EXPERIMENTAL and may be suject to change.
//
// Deprecated: please use package resolver.
package naming package naming
// Operation defines the corresponding operations for a name resolution change. // Operation defines the corresponding operations for a name resolution change.
//
// Deprecated: please use package resolver.
type Operation uint8 type Operation uint8
const ( const (
@ -32,6 +36,8 @@ const (
// Update defines a name resolution update. Notice that it is not valid having both // Update defines a name resolution update. Notice that it is not valid having both
// empty string Addr and nil Metadata in an Update. // empty string Addr and nil Metadata in an Update.
//
// Deprecated: please use package resolver.
type Update struct { type Update struct {
// Op indicates the operation of the update. // Op indicates the operation of the update.
Op Operation Op Operation
@ -43,12 +49,16 @@ type Update struct {
} }
// Resolver creates a Watcher for a target to track its resolution changes. // Resolver creates a Watcher for a target to track its resolution changes.
//
// Deprecated: please use package resolver.
type Resolver interface { type Resolver interface {
// Resolve creates a Watcher for target. // Resolve creates a Watcher for target.
Resolve(target string) (Watcher, error) Resolve(target string) (Watcher, error)
} }
// Watcher watches for the updates on the specified target. // Watcher watches for the updates on the specified target.
//
// Deprecated: please use package resolver.
type Watcher interface { type Watcher interface {
// Next blocks until an update or error happens. It may return one or more // Next blocks until an update or error happens. It may return one or more
// updates. The first call should get the full set of the results. It should // updates. The first call should get the full set of the results. It should

3
vet.sh
View File

@ -80,5 +80,8 @@ google.golang.org/grpc/transport/transport_test.go:SA2002
google.golang.org/grpc/benchmark/benchmain/main.go:SA1019 google.golang.org/grpc/benchmark/benchmain/main.go:SA1019
google.golang.org/grpc/stats/stats_test.go:SA1019 google.golang.org/grpc/stats/stats_test.go:SA1019
google.golang.org/grpc/test/end2end_test.go:SA1019 google.golang.org/grpc/test/end2end_test.go:SA1019
google.golang.org/grpc/balancer_test.go:SA1019
google.golang.org/grpc/balancer.go:SA1019
google.golang.org/grpc/clientconn_test.go:SA1019
' ./... ' ./...
misspell -error . misspell -error .