resolver

package
v1.12.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2022 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DCPrefix

func DCPrefix(datacenter, suffix string) string

DCPrefix prefixes the given string with a datacenter for use in disambiguation.

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL