mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00

This is not yet implementation, just API and tests to be filled with implementation in next CLs, tracked by: https://github.com/etcd-io/etcd/issues/12652 We propose here 3 packages: - clientv3/naming/endpoints -> That is abstraction layer over etcd that allows to write, read & watch Endpoints information. It's independent from GRPC API. It hides the storage details. - clientv3/naming/endpoints/internal -> That contains the grpc's compatible Update class to preserve the internal JSON mashalling format. - clientv3/naming/resolver -> That implements the GRPC resolver API, such that etcd can be used for connection.Dial in grpc. Please see the grpc_naming.md document changes & grpcproxy/cluster.go new integration, to see how the new abstractions work.
25 lines
525 B
Go
25 lines
525 B
Go
package resolver
|
|
|
|
import (
|
|
clientv3 "go.etcd.io/etcd/client/v3"
|
|
"google.golang.org/grpc/resolver"
|
|
)
|
|
|
|
type builder struct {
|
|
// ...
|
|
}
|
|
|
|
func (b builder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) {
|
|
// To be implemented...
|
|
// Using endpoints.NewWatcher() to subscribe for endpoints changes.
|
|
return nil, nil
|
|
}
|
|
|
|
func (b builder) Scheme() string {
|
|
return "etcd"
|
|
}
|
|
|
|
func NewBuilder(client *clientv3.Client) (resolver.Builder, error) {
|
|
return builder{}, nil
|
|
}
|