Documentation ¶
Index ¶
- func DCPrefix(datacenter, suffix string) string
- func Deregister(authority string)
- func Register(res *ServerResolverBuilder)
- type Config
- type ServerResolverBuilder
- func (s *ServerResolverBuilder) AddServer(areaID types.AreaID, server *metadata.Server)
- func (s *ServerResolverBuilder) Authority() string
- func (s *ServerResolverBuilder) Build(target resolver.Target, cc resolver.ClientConn, _ resolver.BuildOptions) (resolver.Resolver, error)
- func (s *ServerResolverBuilder) NewRebalancer(dc string) func()
- func (s *ServerResolverBuilder) RemoveServer(areaID types.AreaID, server *metadata.Server)
- func (s *ServerResolverBuilder) ServerForGlobalAddr(globalAddr string) (*metadata.Server, error)
- func (s *ServerResolverBuilder) UpdateLeaderAddr(datacenter, addr string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Deregister ¶
func Deregister(authority string)
Deregister the ServerResolverBuilder associated with the authority. Only used for testing.
func Register ¶
func Register(res *ServerResolverBuilder)
Register a ServerResolverBuilder with the global registry.
Types ¶
type Config ¶
type Config struct { // Authority used to query the server. Defaults to "". Used to support // parallel testing because gRPC registers resolvers globally. Authority string }
type ServerResolverBuilder ¶
type ServerResolverBuilder struct {
// contains filtered or unexported fields
}
ServerResolverBuilder tracks the current server list and keeps any ServerResolvers updated when changes occur.
func NewServerResolverBuilder ¶
func NewServerResolverBuilder(cfg Config) *ServerResolverBuilder
func (*ServerResolverBuilder) AddServer ¶
func (s *ServerResolverBuilder) AddServer(areaID types.AreaID, server *metadata.Server)
AddServer updates the resolvers' states to include the new server's address.
func (*ServerResolverBuilder) Authority ¶
func (s *ServerResolverBuilder) Authority() string
func (*ServerResolverBuilder) Build ¶
func (s *ServerResolverBuilder) Build(target resolver.Target, cc resolver.ClientConn, _ resolver.BuildOptions) (resolver.Resolver, error)
Build returns a new serverResolver for the given ClientConn. The resolver will keep the ClientConn's state updated based on updates from Serf.
func (*ServerResolverBuilder) NewRebalancer ¶
func (s *ServerResolverBuilder) NewRebalancer(dc string) func()
NewRebalancer returns a function which shuffles the server list for resolvers in all datacenters.
func (*ServerResolverBuilder) RemoveServer ¶
func (s *ServerResolverBuilder) RemoveServer(areaID types.AreaID, server *metadata.Server)
RemoveServer updates the resolvers' states with the given server removed.
func (*ServerResolverBuilder) ServerForGlobalAddr ¶
func (s *ServerResolverBuilder) ServerForGlobalAddr(globalAddr string) (*metadata.Server, error)
ServerForGlobalAddr returns server metadata for a server with the specified globally unique address.
func (*ServerResolverBuilder) UpdateLeaderAddr ¶
func (s *ServerResolverBuilder) UpdateLeaderAddr(datacenter, addr string)
UpdateLeaderAddr updates the leader address in the local DC's resolver.