Skip to content

Commit cbf86a8

Browse files
committed
feat(client/v3/naming): add Attributes into Endpoint and deprecate Metadata
This implementation adds the new Attributes *attributes.Attributes into Endpoint and deprecate Metadata accordingly. The metadata field is still supported for backward compatibility Signed-off-by: amosehiguese <[email protected]>
1 parent 8f933a5 commit cbf86a8

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

client/v3/naming/endpoints/endpoints.go

+9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ package endpoints
1717
import (
1818
"context"
1919

20+
"google.golang.org/grpc/attributes"
21+
2022
clientv3 "go.etcd.io/etcd/client/v3"
2123
)
2224

@@ -32,7 +34,14 @@ type Endpoint struct {
3234
// Metadata is the information associated with Addr, which may be used
3335
// to make load balancing decision.
3436
// Since etcd 3.1
37+
//
38+
// Deprecated: use Attributes instead
3539
Metadata any
40+
41+
// Attributes contains arbitrary data about this address intended for
42+
// consumption by the SubConn.
43+
// Since etcd 3.5
44+
Attributes *attributes.Attributes
3645
}
3746

3847
type Operation uint8

client/v3/naming/resolver/resolver.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,9 @@ func convertToGRPCEndpoint(ups map[string]*endpoints.Update) []gresolver.Endpoin
112112
ep := gresolver.Endpoint{
113113
Addresses: []gresolver.Address{
114114
{
115-
Addr: up.Endpoint.Addr,
116-
Metadata: up.Endpoint.Metadata,
115+
Addr: up.Endpoint.Addr,
116+
Metadata: up.Endpoint.Metadata,
117+
Attributes: up.Endpoint.Attributes,
117118
},
118119
},
119120
}

0 commit comments

Comments
 (0)